[svn:parrot] r47145 - branches/gc_massacre/src/gc

bacek at svn.parrot.org bacek at svn.parrot.org
Sun May 30 11:20:24 UTC 2010


Author: bacek
Date: Sun May 30 11:20:24 2010
New Revision: 47145
URL: https://trac.parrot.org/parrot/changeset/47145

Log:
Move guts of mark_FOO_fun into gc_ms.c from api.c

Modified:
   branches/gc_massacre/src/gc/api.c
   branches/gc_massacre/src/gc/gc_ms.c

Modified: branches/gc_massacre/src/gc/api.c
==============================================================================
--- branches/gc_massacre/src/gc/api.c	Sun May 30 11:19:41 2010	(r47144)
+++ branches/gc_massacre/src/gc/api.c	Sun May 30 11:20:24 2010	(r47145)
@@ -165,25 +165,7 @@
 Parrot_gc_mark_PMC_alive_fun(PARROT_INTERP, ARGMOD_NULLOK(PMC *obj))
 {
     ASSERT_ARGS(Parrot_gc_mark_PMC_alive_fun)
-    if (!PMC_IS_NULL(obj)) {
-        PARROT_ASSERT(PObj_is_PMC_TEST(obj));
-
-        if (PObj_is_live_or_free_TESTALL(obj))
-            return;
-
-        /* mark it live */
-        PObj_live_SET(obj);
-
-        /* 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_custom_mark_TEST(obj))
-                VTABLE_mark(interp, obj);
-        }
-
-        if (PMC_metadata(obj))
-            Parrot_gc_mark_PMC_alive(interp, PMC_metadata(obj));
-    }
+    interp->gc_sys->mark_pmc_header(interp, obj);
 }
 
 /*
@@ -198,15 +180,10 @@
 
 PARROT_EXPORT
 void
-Parrot_gc_mark_STRING_alive_fun(SHIM_INTERP, ARGMOD_NULLOK(STRING *obj))
+Parrot_gc_mark_STRING_alive_fun(PARROT_INTERP, ARGMOD_NULLOK(STRING *obj))
 {
     ASSERT_ARGS(Parrot_gc_mark_STRING_alive_fun)
-    if (!STRING_IS_NULL(obj)) {
-        PARROT_ASSERT(PObj_is_string_TEST(obj));
-
-        /* mark it live */
-        PObj_live_SET(obj);
-    }
+    interp->gc_sys->mark_string_header(interp, obj);
 }
 
 /*

Modified: branches/gc_massacre/src/gc/gc_ms.c
==============================================================================
--- branches/gc_massacre/src/gc/gc_ms.c	Sun May 30 11:19:41 2010	(r47144)
+++ branches/gc_massacre/src/gc/gc_ms.c	Sun May 30 11:20:24 2010	(r47145)
@@ -154,23 +154,22 @@
 static void gc_ms_mark_and_sweep(PARROT_INTERP, UINTVAL flags)
         __attribute__nonnull__(1);
 
-static void gc_ms_mark_bufferlike_header(PARROT_INTERP, ARGMOD(Buffer *buf))
+static void gc_ms_mark_bufferlike_header(PARROT_INTERP,
+    ARGMOD_NULLOK(Buffer *buf))
         __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
         FUNC_MODIFIES(*buf);
 
-static void gc_ms_mark_pmc_header(PARROT_INTERP, ARGMOD(PMC *pmc))
+static void gc_ms_mark_pmc_header(PARROT_INTERP, ARGMOD_NULLOK(PMC *obj))
         __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*pmc);
+        FUNC_MODIFIES(*obj);
 
 static void gc_ms_mark_special(PARROT_INTERP, ARGIN(PMC *pmc))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-static void gc_ms_mark_string_header(PARROT_INTERP, ARGMOD(STRING *str))
+static void gc_ms_mark_string_header(PARROT_INTERP,
+    ARGMOD_NULLOK(STRING *str))
         __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
         FUNC_MODIFIES(*str);
 
 static void gc_ms_more_traceable_objects(PARROT_INTERP,
@@ -330,17 +329,14 @@
 #define ASSERT_ARGS_gc_ms_mark_and_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_gc_ms_mark_bufferlike_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(buf))
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_gc_ms_mark_pmc_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(pmc))
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_gc_ms_mark_special __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(pmc))
 #define ASSERT_ARGS_gc_ms_mark_string_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(str))
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_gc_ms_more_traceable_objects __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(mem_pools) \
@@ -724,8 +720,28 @@
 }
 
 static void
-gc_ms_mark_pmc_header(PARROT_INTERP, ARGMOD(PMC *pmc))
+gc_ms_mark_pmc_header(PARROT_INTERP, ARGMOD_NULLOK(PMC *obj))
 {
+    ASSERT_ARGS(gc_ms_mark_pmc_header)
+    if (!PMC_IS_NULL(obj)) {
+        PARROT_ASSERT(PObj_is_PMC_TEST(obj));
+
+        if (PObj_is_live_or_free_TESTALL(obj))
+            return;
+
+        /* mark it live */
+        PObj_live_SET(obj);
+
+        /* 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_custom_mark_TEST(obj))
+                VTABLE_mark(interp, obj);
+        }
+
+        if (PMC_metadata(obj))
+            Parrot_gc_mark_PMC_alive(interp, PMC_metadata(obj));
+    }
 }
 
 /*
@@ -776,8 +792,15 @@
 }
 
 static void
-gc_ms_mark_string_header(PARROT_INTERP, ARGMOD(STRING *str))
+gc_ms_mark_string_header(PARROT_INTERP, ARGMOD_NULLOK(STRING *str))
 {
+    ASSERT_ARGS(gc_ms_mark_string_header)
+    if (!STRING_IS_NULL(str)) {
+        PARROT_ASSERT(PObj_is_string_TEST(str));
+
+        /* mark it live */
+        PObj_live_SET(str);
+    }
 }
 
 /*
@@ -828,8 +851,12 @@
 }
 
 static void
-gc_ms_mark_bufferlike_header(PARROT_INTERP, ARGMOD(Buffer *buf))
+gc_ms_mark_bufferlike_header(PARROT_INTERP, ARGMOD_NULLOK(Buffer *buf))
 {
+    ASSERT_ARGS(gc_ms_mark_bufferlike_header)
+    if (buf)
+        /* mark it live */
+        PObj_live_SET(buf);
 }
 
 /*


More information about the parrot-commits mailing list