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

bacek at svn.parrot.org bacek at svn.parrot.org
Sun May 30 11:21:33 UTC 2010


Author: bacek
Date: Sun May 30 11:21:33 2010
New Revision: 47147
URL: https://trac.parrot.org/parrot/changeset/47147

Log:
Remove GC_Subsytem.mark_string_alive. Use mark_pobj_alive instead

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

Modified: branches/gc_massacre/src/gc/api.c
==============================================================================
--- branches/gc_massacre/src/gc/api.c	Sun May 30 11:21:06 2010	(r47146)
+++ branches/gc_massacre/src/gc/api.c	Sun May 30 11:21:33 2010	(r47147)
@@ -126,27 +126,16 @@
 Parrot_gc_mark_PObj_alive(PARROT_INTERP, ARGMOD(PObj *obj))
 {
     ASSERT_ARGS(Parrot_gc_mark_PObj_alive)
-    /* TODO: Have each core register a ->pobject_lives function pointer in the
-       Memory_Pools struct, and call that pointer directly instead of having a messy
-       set of #if preparser conditions. */
 
     /* if object is live or on free list return */
     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_PMC_TEST(obj)) {
-        PMC * const p = (PMC *)obj;
-
-        if (PObj_is_special_PMC_TEST(obj))
-            interp->gc_sys->mark_special(interp, p);
-
-        else if (PMC_metadata(p))
-            Parrot_gc_mark_PMC_alive(interp, PMC_metadata(p));
+        interp->gc_sys->mark_pmc_header(interp, (PMC*) obj);
+    }
+    else {
+        interp->gc_sys->mark_pobj_header(interp, obj);
     }
 }
 
@@ -183,7 +172,7 @@
 Parrot_gc_mark_STRING_alive_fun(PARROT_INTERP, ARGMOD_NULLOK(STRING *obj))
 {
     ASSERT_ARGS(Parrot_gc_mark_STRING_alive_fun)
-    interp->gc_sys->mark_string_header(interp, obj);
+    interp->gc_sys->mark_pobj_header(interp, (PObj*)obj);
 }
 
 /*

Modified: branches/gc_massacre/src/gc/gc_ms.c
==============================================================================
--- branches/gc_massacre/src/gc/gc_ms.c	Sun May 30 11:21:06 2010	(r47146)
+++ branches/gc_massacre/src/gc/gc_ms.c	Sun May 30 11:21:33 2010	(r47147)
@@ -154,12 +154,11 @@
 static void gc_ms_mark_and_sweep(PARROT_INTERP, UINTVAL flags)
         __attribute__nonnull__(1);
 
-static void gc_ms_mark_bufferlike_header(PARROT_INTERP,
-    ARGMOD_NULLOK(Buffer *buf))
+static void gc_ms_mark_pmc_header(PARROT_INTERP, ARGMOD_NULLOK(PMC *obj))
         __attribute__nonnull__(1)
-        FUNC_MODIFIES(*buf);
+        FUNC_MODIFIES(*obj);
 
-static void gc_ms_mark_pmc_header(PARROT_INTERP, ARGMOD_NULLOK(PMC *obj))
+static void gc_ms_mark_pobj_header(PARROT_INTERP, ARGMOD_NULLOK(PObj *obj))
         __attribute__nonnull__(1)
         FUNC_MODIFIES(*obj);
 
@@ -167,11 +166,6 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-static void gc_ms_mark_string_header(PARROT_INTERP,
-    ARGMOD_NULLOK(STRING *str))
-        __attribute__nonnull__(1)
-        FUNC_MODIFIES(*str);
-
 static void gc_ms_more_traceable_objects(PARROT_INTERP,
     ARGIN(Memory_Pools *mem_pools),
     ARGMOD(Fixed_Size_Pool *pool))
@@ -328,15 +322,13 @@
        PARROT_ASSERT_ARG(interp))
 #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))
 #define ASSERT_ARGS_gc_ms_mark_pmc_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms_mark_pobj_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       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))
 #define ASSERT_ARGS_gc_ms_more_traceable_objects __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(mem_pools) \
@@ -423,15 +415,15 @@
 
     interp->gc_sys->allocate_pmc_header     = gc_ms_allocate_pmc_header;
     interp->gc_sys->free_pmc_header         = gc_ms_free_pmc_header;
-    interp->gc_sys->mark_pmc_header         = gc_ms_mark_pmc_header;
 
     interp->gc_sys->allocate_string_header  = gc_ms_allocate_string_header;
     interp->gc_sys->free_string_header      = gc_ms_free_string_header;
-    interp->gc_sys->mark_string_header      = gc_ms_mark_string_header;
 
     interp->gc_sys->allocate_bufferlike_header  = gc_ms_allocate_bufferlike_header;
     interp->gc_sys->free_bufferlike_header      = gc_ms_free_bufferlike_header;
-    interp->gc_sys->mark_bufferlike_header      = gc_ms_mark_bufferlike_header;
+
+    interp->gc_sys->mark_pmc_header         = gc_ms_mark_pmc_header;
+    interp->gc_sys->mark_pobj_header        = gc_ms_mark_pobj_header;
 
     interp->gc_sys->allocate_pmc_attributes = gc_ms_allocate_pmc_attributes;
     interp->gc_sys->free_pmc_attributes     = gc_ms_free_pmc_attributes;
@@ -792,14 +784,12 @@
 }
 
 static void
-gc_ms_mark_string_header(PARROT_INTERP, ARGMOD_NULLOK(STRING *str))
+gc_ms_mark_pobj_header(PARROT_INTERP, ARGMOD_NULLOK(PObj *obj))
 {
-    ASSERT_ARGS(gc_ms_mark_string_header)
-    if (!STRING_IS_NULL(str)) {
-        PARROT_ASSERT(PObj_is_string_TEST(str));
-
+    ASSERT_ARGS(gc_ms_mark_pobj_header)
+    if (obj) {
         /* mark it live */
-        PObj_live_SET(str);
+        PObj_live_SET(obj);
     }
 }
 
@@ -850,15 +840,6 @@
     pool->add_free_object(interp, interp->mem_pools, pool, obj);
 }
 
-static void
-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);
-}
-
 /*
 
 =over 4

Modified: branches/gc_massacre/src/gc/gc_private.h
==============================================================================
--- branches/gc_massacre/src/gc/gc_private.h	Sun May 30 11:21:06 2010	(r47146)
+++ branches/gc_massacre/src/gc/gc_private.h	Sun May 30 11:21:33 2010	(r47147)
@@ -115,15 +115,15 @@
 
     PMC* (*allocate_pmc_header)(PARROT_INTERP, UINTVAL flags);
     void (*free_pmc_header)(PARROT_INTERP, PMC *);
-    void (*mark_pmc_header)(PARROT_INTERP, PMC *);
 
     STRING* (*allocate_string_header)(PARROT_INTERP, UINTVAL flags);
     void    (*free_string_header)(PARROT_INTERP, STRING*);
-    void    (*mark_string_header)(PARROT_INTERP, STRING*);
 
     Buffer* (*allocate_bufferlike_header)(PARROT_INTERP, size_t size);
     void    (*free_bufferlike_header)(PARROT_INTERP, Buffer*, size_t size);
-    void    (*mark_bufferlike_header)(PARROT_INTERP, Buffer*);
+
+    void (*mark_pobj_header)(PARROT_INTERP, PObj*);
+    void (*mark_pmc_header)(PARROT_INTERP, PMC *);
 
     void* (*allocate_pmc_attributes)(PARROT_INTERP, PMC *);
     void (*free_pmc_attributes)(PARROT_INTERP, PMC *);


More information about the parrot-commits mailing list