help-smalltalk
[Top][All Lists]
Advanced

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

[Help-smalltalk] [PATCH 3/4] jit: Fix test failures with Magritte, SUnit


From: Holger Hans Peter Freyther
Subject: [Help-smalltalk] [PATCH 3/4] jit: Fix test failures with Magritte, SUnit and other routines
Date: Thu, 27 Jun 2013 10:12:23 +0200

From: Holger Hans Peter Freyther <address@hidden>

The tests crash when returning to a previous context. In the case of the
Magritte test it is crashing on return to Delay class>>#runDelayProcess.

This appears to occur when resuming an existing image. It is because
the F_XLAT and F_XLAT_REACHABLE flags are cleared on saving of the image.
On image resume the refresh_native_ips method will re-generate the
native code and set the F_XLAT flag for active contexts. As the native
code is not executed the F_XLAT_REACHABLE will not be set. This makes it
possible for maybe_release_xlat to release the native code without
updating the context. This will eventually cause a segmentation fault
as the native code is gone.

The solution appears to be easy. Once the native_ip is updated the
F_XLAT_REACHABLE is set. This way it is guaranteed that the native code
will not be collected.

2013-06-10  Holger Hans Peter Freyther  <address@hidden>

        * interp-jit.inl: Set the F_XLAT_REACHABLE flag in refresh_native_ips.
---
 libgst/ChangeLog      |    4 ++++
 libgst/interp-jit.inl |    4 ++++
 2 files changed, 8 insertions(+)

diff --git a/libgst/ChangeLog b/libgst/ChangeLog
index 44566ea..4880a8f 100644
--- a/libgst/ChangeLog
+++ b/libgst/ChangeLog
@@ -1,3 +1,7 @@
+2013-06-10  Holger Hans Peter Freyther  <address@hidden>
+
+       * interp-jit.inl: Set the F_XLAT_REACHABLE flag in refresh_native_ips.
+
 2013-06-03  Holger Hans Peter Freyther  <address@hidden>
 
        * files.c: Make BlockClosure available before the CharacterArray.
diff --git a/libgst/interp-jit.inl b/libgst/interp-jit.inl
index 0e8fa27..78fa94c 100644
--- a/libgst/interp-jit.inl
+++ b/libgst/interp-jit.inl
@@ -353,6 +353,10 @@ refresh_native_ips (OOP contextOOP)
          virtualIP = TO_INT (context->ipOffset);
          native_ip =
            _gst_map_virtual_ip (context->method, receiverClass, virtualIP);
+         /* The above might have freshly translated the method for us
+            and the F_XLAT_REACHABLE is not set yet. Set the flag right
+            to assure we can safely return to this method. */
+         context->method->flags |= F_XLAT_REACHABLE;
 
 #ifndef OPTIMIZE
          if (!native_ip)
-- 
1.7.10.4




reply via email to

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