Author: chromatic
Date: Sun Feb 24 15:59:28 2008
New Revision: 26053

Modified:
   trunk/src/gc/dod.c
   trunk/src/pmc/string.pmc

Log:
[gc] Constant PMCs with custom mark() entries now always get called during the
mark phase of GC, even if their live flag is set.  (Nothing clears their live
flag during sweep, so any of their contained PObjs might not get marked during
the next mark phase.)

This seems to allow me to remove the hack in the String PMC that copied a
string to a constant string if the String PMC was constant.

Four more Tcl tests pass without this than did before, and Pheme, Perl 6, and
Cardinal are all happy with it

Modified: trunk/src/gc/dod.c
==============================================================================
--- trunk/src/gc/dod.c  (original)
+++ trunk/src/gc/dod.c  Sun Feb 24 15:59:28 2008
@@ -185,6 +185,10 @@
             parrot_gc_gms_pobject_lives(interp, obj); \
     } while (0);
 #else /* not PARROT_GC_GMS */
+
+    if (PObj_constant_TEST(obj) && PObj_custom_mark_TEST(obj))
+        VTABLE_mark(interp, (PMC *)obj);
+
     /* if object is live or on free list return */
     if (PObj_is_live_or_free_TESTALL(obj))
         return;
@@ -212,7 +216,7 @@
     /* if object is a PMC and contains buffers or PMCs, then attach
      * the PMC to the chained mark list.
      */
-    if (PObj_is_special_PMC_TEST(obj)) {
+    if (PObj_is_special_PMC_TEST(obj) && !PObj_constant_TEST(obj)) {
         mark_special(interp, (PMC*) obj);
     }
 #  ifndef NDEBUG

Modified: trunk/src/pmc/string.pmc
==============================================================================
--- trunk/src/pmc/string.pmc    (original)
+++ trunk/src/pmc/string.pmc    Sun Feb 24 15:59:28 2008
@@ -216,12 +216,6 @@
 */
 
     void set_string_native(STRING *value) {
-        /* Only allow constant PMCs to embed constant strings */
-        if (PObj_constant_TEST(SELF) && !PObj_constant_TEST(value)) {
-            const char *copy = string_to_cstring(INTERP, value);
-            value            = const_string(INTERP, copy);
-        }
-
         PMC_str_val(SELF) = value;
     }
 

Reply via email to