help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] [PATCH 6/6] jit: Fix the alignment of the function now


From: Holger Hans Peter Freyther
Subject: [Help-smalltalk] [PATCH 6/6] jit: Fix the alignment of the function now that I understand it
Date: Thu, 9 Jan 2014 19:09:04 +0100

For the pointer we return it needs to look like a valid OOP. The
trick that was used to align the code to make that true. Otherwise
empty_context_stack will set a DUMMY_NATIVE_IP and we will resume
at the ipOffset (e.g. the beginning of a loop) and not after the
interrupt check.

This fixes something like this:

 a := nil. p := [a := 3] newProcess.
 [p isTerminated] whileFalse: [p singleStep; suspend]

2014-01-09  Holger Hans Peter Freyther  <address@hidden>

        * xlat.c: Align the label correctly.
---
 libgst/ChangeLog | 4 ++++
 libgst/xlat.c    | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libgst/ChangeLog b/libgst/ChangeLog
index 05bc54b..528b6ae 100644
--- a/libgst/ChangeLog
+++ b/libgst/ChangeLog
@@ -1,3 +1,7 @@
+2014-01-09  Holger Hans Peter Freyther  <address@hidden>
+
+       * xlat.c: Align the label correctly.
+
 2013-12-23  Holger Hans Peter Freyther  <address@hidden>
 
        * xlat.c: Change emitted code in emit_interrupt_check.
diff --git a/libgst/xlat.c b/libgst/xlat.c
index 9f45b33..260c7f6 100644
--- a/libgst/xlat.c
+++ b/libgst/xlat.c
@@ -2502,8 +2502,6 @@ emit_interrupt_check (int restartReg, int ipOffset)
 {
   jit_insn *jmp, *restart = NULL;
 
-  jit_align (2);
-
   jit_ldi_i (JIT_R2, &_gst_except_flag);
   jmp = jit_beqi_i (jit_forward (), JIT_R2, 0);
 
@@ -2514,6 +2512,8 @@ emit_interrupt_check (int restartReg, int ipOffset)
       jit_sti_ul (&ip, JIT_R2);
     }
 
+  jit_align (2);
+
   /* Where to restart?*/
   if (restartReg == JIT_NOREG)
     restart = jit_movi_p (JIT_RET, jit_forward());
-- 
1.8.5.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]