Ephemeron objects are treated specially in that the objects that are only reachable from them are marked later in the GC. This however does not apply to the class object. For this reason: 1) all ephemerons are added to a buffer for later processing; 2) tail recursion is used to mark the class object.

However, the case of tail recursion is very rare because it happens only if the ephemeron class has not already been marked before -- and all classes usually are marked very early when the Smalltalk dictionary is marked. It is so rare that it was buggy. :-) In the latest master, the bug was triggered by loading the ANSI testsuite. Luckily, it's trivial to fix and the only struggling was to find that the bug was caused by an ephemeron not in the buffer.

Committed to master and stable-3.0.

Paolo
diff --git a/libgst/ChangeLog b/libgst/ChangeLog
index 7bfab36..ff87720 100644
--- a/libgst/ChangeLog
+++ b/libgst/ChangeLog
@@ -1,3 +1,9 @@
+2008-05-14  Paolo Bonzini  <[EMAIL PROTECTED]>
+
+       * libgst/oop.c: Add ephemerons to buffer before marking their class
+       (else, if the class actually has to be marked, we won't add them to the
+       buffer at all).
+
 2008-05-13  Paolo Bonzini  <[EMAIL PROTECTED]>
 
        * libgst/callin.h: Add _gst_oop_indexed_base and _gst_oop_indexed_kind.
diff --git a/libgst/oop.c b/libgst/oop.c
index 3eb1fb7..96c57cf 100644
--- a/libgst/oop.c
+++ b/libgst/oop.c
@@ -2197,14 +2197,14 @@ _gst_mark_an_oop_internal (OOP oop,
            }
          else if UNCOMMON (oop->flags & (F_EPHEMERON | F_WEAK))
            {
+             if (oop->flags & F_EPHEMERON)
+               _gst_add_buf_pointer (oop);
+
              /* In general, there will be many instances of a class,
                 but only the first time will it be unmarked.  So I'm
                 marking this as uncommon.  */
              if UNCOMMON (!IS_OOP_MARKED (objClass))
                TAIL_MARK_OOP (objClass);
-
-             if (oop->flags & F_EPHEMERON)
-               _gst_add_buf_pointer (oop);
            }
          else
            {
_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to