[svn:parrot] r41447 - in trunk: include/parrot src/gc src/pmc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Thu Sep 24 19:30:19 UTC 2009


Author: NotFound
Date: Thu Sep 24 19:30:17 2009
New Revision: 41447
URL: https://trac.parrot.org/parrot/changeset/41447

Log:
[gc] add new mark_... _alive functions, use it in a lot of mark vtable functions, and some cleanup related, TT #1062

Modified:
   trunk/include/parrot/gc_api.h
   trunk/src/gc/api.c
   trunk/src/pmc/arrayiterator.pmc
   trunk/src/pmc/callsignature.pmc
   trunk/src/pmc/class.pmc
   trunk/src/pmc/continuation.pmc
   trunk/src/pmc/cpointer.pmc
   trunk/src/pmc/eval.pmc
   trunk/src/pmc/eventhandler.pmc
   trunk/src/pmc/exception.pmc
   trunk/src/pmc/exceptionhandler.pmc
   trunk/src/pmc/exporter.pmc
   trunk/src/pmc/filehandle.pmc
   trunk/src/pmc/fixedpmcarray.pmc
   trunk/src/pmc/fixedstringarray.pmc
   trunk/src/pmc/hashiterator.pmc
   trunk/src/pmc/namespace.pmc
   trunk/src/pmc/nci.pmc
   trunk/src/pmc/object.pmc
   trunk/src/pmc/orderedhashiterator.pmc
   trunk/src/pmc/packfile.pmc
   trunk/src/pmc/packfileannotation.pmc
   trunk/src/pmc/packfileannotations.pmc
   trunk/src/pmc/packfileconstanttable.pmc
   trunk/src/pmc/packfiledirectory.pmc
   trunk/src/pmc/packfilefixupentry.pmc
   trunk/src/pmc/packfilefixuptable.pmc
   trunk/src/pmc/packfilerawsegment.pmc
   trunk/src/pmc/packfilesegment.pmc
   trunk/src/pmc/role.pmc
   trunk/src/pmc/scheduler.pmc
   trunk/src/pmc/schedulermessage.pmc
   trunk/src/pmc/socket.pmc
   trunk/src/pmc/string.pmc
   trunk/src/pmc/stringhandle.pmc
   trunk/src/pmc/stringiterator.pmc
   trunk/src/pmc/sub.pmc
   trunk/src/pmc/task.pmc
   trunk/src/pmc/unmanagedstruct.pmc

Modified: trunk/include/parrot/gc_api.h
==============================================================================
--- trunk/include/parrot/gc_api.h	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/include/parrot/gc_api.h	Thu Sep 24 19:30:17 2009	(r41447)
@@ -112,12 +112,23 @@
         __attribute__nonnull__(1);
 
 PARROT_EXPORT
+void Parrot_gc_mark_PMC_alive_fun(PARROT_INTERP, ARGMOD_NULLOK(PMC *obj))
+        __attribute__nonnull__(1)
+        FUNC_MODIFIES(*obj);
+
+PARROT_EXPORT
 void Parrot_gc_mark_PObj_alive(PARROT_INTERP, ARGMOD(PObj *obj))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*obj);
 
 PARROT_EXPORT
+void Parrot_gc_mark_STRING_alive_fun(PARROT_INTERP,
+    ARGMOD_NULLOK(STRING *obj))
+        __attribute__nonnull__(1)
+        FUNC_MODIFIES(*obj);
+
+PARROT_EXPORT
 unsigned int Parrot_is_blocked_GC_mark(PARROT_INTERP)
         __attribute__nonnull__(1);
 
@@ -315,9 +326,14 @@
        PARROT_ASSERT_ARG(interp)
 #define ASSERT_ARGS_Parrot_block_GC_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(interp)
+#define ASSERT_ARGS_Parrot_gc_mark_PMC_alive_fun __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+       PARROT_ASSERT_ARG(interp)
 #define ASSERT_ARGS_Parrot_gc_mark_PObj_alive __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(interp) \
     && PARROT_ASSERT_ARG(obj)
+#define ASSERT_ARGS_Parrot_gc_mark_STRING_alive_fun \
+     __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+       PARROT_ASSERT_ARG(interp)
 #define ASSERT_ARGS_Parrot_is_blocked_GC_mark __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(interp)
 #define ASSERT_ARGS_Parrot_is_blocked_GC_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = \
@@ -448,6 +464,16 @@
 
 void Parrot_gc_inf_init(PARROT_INTERP);
 
+#ifdef NDEBUG
+#  define Parrot_gc_mark_PMC_alive(interp, obj) \
+        do if (! PMC_IS_NULL(obj)) Parrot_gc_mark_PObj_alive((interp), (PObj *)(obj)); while (0)
+#  define Parrot_gc_mark_STRING_alive(interp, obj) \
+        do if (! STRING_IS_NULL(obj)) Parrot_gc_mark_PObj_alive((interp), (PObj *)(obj)); while (0)
+#else
+#  define Parrot_gc_mark_PMC_alive(interp, obj) Parrot_gc_mark_PMC_alive_fun((interp), (obj))
+#  define Parrot_gc_mark_STRING_alive(interp, obj) Parrot_gc_mark_STRING_alive_fun((interp), (obj))
+#endif
+
 #endif /* PARROT_GC_API_H_GUARD */
 
 /*

Modified: trunk/src/gc/api.c
==============================================================================
--- trunk/src/gc/api.c	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/gc/api.c	Thu Sep 24 19:30:17 2009	(r41447)
@@ -236,6 +236,48 @@
 
 /*
 
+=item C<void Parrot_gc_mark_PMC_alive_fun(PARROT_INTERP, PMC *obj)>
+
+A type safe wrapper of Parrot_gc_mark_PObj_alive for PMC.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+void
+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));
+        Parrot_gc_mark_PObj_alive(interp, (PObj *)obj);
+    }
+}
+
+/*
+
+=item C<void Parrot_gc_mark_STRING_alive_fun(PARROT_INTERP, STRING *obj)>
+
+A type safe wrapper of Parrot_gc_mark_PObj_alive for STRING.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+void
+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));
+        Parrot_gc_mark_PObj_alive(interp, (PObj *)obj);
+    }
+}
+
+/*
+
 =item C<void Parrot_gc_initialize(PARROT_INTERP, void *stacktop)>
 
 Initializes the memory allocator and the garbage collection subsystem.

Modified: trunk/src/pmc/arrayiterator.pmc
==============================================================================
--- trunk/src/pmc/arrayiterator.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/arrayiterator.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -109,8 +109,7 @@
     VTABLE void mark() {
         PMC *array;
         GET_ATTR_array(INTERP, SELF, array);
-        if (array)
-             Parrot_gc_mark_PObj_alive(INTERP, (PObj *)array);
+        Parrot_gc_mark_PMC_alive(INTERP, array);
     }
 
 /*

Modified: trunk/src/pmc/callsignature.pmc
==============================================================================
--- trunk/src/pmc/callsignature.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/callsignature.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -179,12 +179,9 @@
         Parrot_CallSignature_attributes * const attrs = PARROT_CALLSIGNATURE(SELF);
 
         if (attrs) {
-            if (attrs->returns)
-                Parrot_gc_mark_PObj_alive(interp, (PObj*)attrs->returns);
-            if (attrs->type_tuple)
-                Parrot_gc_mark_PObj_alive(interp, (PObj*)attrs->type_tuple);
-            if (attrs->short_sig)
-                Parrot_gc_mark_PObj_alive(interp, (PObj*)attrs->short_sig);
+            Parrot_gc_mark_PMC_alive(interp, attrs->returns);
+            Parrot_gc_mark_PMC_alive(interp, attrs->type_tuple);
+            Parrot_gc_mark_STRING_alive(interp, attrs->short_sig);
         }
         SUPER();
     }

Modified: trunk/src/pmc/class.pmc
==============================================================================
--- trunk/src/pmc/class.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/class.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -589,32 +589,19 @@
 
     VTABLE void mark() {
         Parrot_Class_attributes * const _class = PARROT_CLASS(SELF);
-        if (_class->name)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)_class->name);
-        if (_class->fullname)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)_class->fullname);
-        if (_class->_namespace)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)_class->_namespace);
-        if (_class->parents)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)_class->parents);
-        if (_class->all_parents)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)_class->all_parents);
-        if (_class->roles)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)_class->roles);
-        if (_class->methods)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)_class->methods);
-        if (_class->vtable_overrides)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)_class->vtable_overrides);
-        if (_class->parent_overrides)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)_class->parent_overrides);
-        if (_class->attrib_metadata)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)_class->attrib_metadata);
-        if (_class->attrib_index)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)_class->attrib_index);
-        if (_class->attrib_cache)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)_class->attrib_cache);
-        if (_class->resolve_method)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)_class->resolve_method);
+        Parrot_gc_mark_STRING_alive(interp, _class->name);
+        Parrot_gc_mark_STRING_alive(interp, _class->fullname);
+        Parrot_gc_mark_PMC_alive(interp, _class->_namespace);
+        Parrot_gc_mark_PMC_alive(interp, _class->parents);
+        Parrot_gc_mark_PMC_alive(interp, _class->all_parents);
+        Parrot_gc_mark_PMC_alive(interp, _class->roles);
+        Parrot_gc_mark_PMC_alive(interp, _class->methods);
+        Parrot_gc_mark_PMC_alive(interp, _class->vtable_overrides);
+        Parrot_gc_mark_PMC_alive(interp, _class->parent_overrides);
+        Parrot_gc_mark_PMC_alive(interp, _class->attrib_metadata);
+        Parrot_gc_mark_PMC_alive(interp, _class->attrib_index);
+        Parrot_gc_mark_PMC_alive(interp, _class->attrib_cache);
+        Parrot_gc_mark_PMC_alive(interp, _class->resolve_method);
     }
 
 

Modified: trunk/src/pmc/continuation.pmc
==============================================================================
--- trunk/src/pmc/continuation.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/continuation.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -131,10 +131,8 @@
         if (!cc)
             return;
 
-        if (cc->to_ctx)
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *) cc->to_ctx);
-        if (cc->from_ctx)
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *) cc->from_ctx);
+        Parrot_gc_mark_PMC_alive(INTERP, cc->to_ctx);
+        Parrot_gc_mark_PMC_alive(INTERP, cc->from_ctx);
     }
 
 /*

Modified: trunk/src/pmc/cpointer.pmc
==============================================================================
--- trunk/src/pmc/cpointer.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/cpointer.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -84,18 +84,18 @@
         if (sig) {
             void *pointer;
             GET_ATTR_pointer(INTERP, SELF, pointer);
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)sig);
+            Parrot_gc_mark_STRING_alive(interp, sig);
 
             if (pointer) {
                 if (Parrot_str_equal(interp, sig, CONST_STRING(interp, "P"))) {
                     PMC ** const pmc_pointer = (PMC **) pointer;
                     PARROT_ASSERT(*pmc_pointer);
-                    Parrot_gc_mark_PObj_alive(interp, (PObj *) *pmc_pointer);
+                    Parrot_gc_mark_PMC_alive(interp, *pmc_pointer);
                 }
                 else if (Parrot_str_equal(interp, sig, CONST_STRING(interp, "S"))) {
                     STRING ** const str_pointer = (STRING **) pointer;
                     PARROT_ASSERT(*str_pointer);
-                    Parrot_gc_mark_PObj_alive(interp, (PObj *) *str_pointer);
+                    Parrot_gc_mark_STRING_alive(interp, *str_pointer);
                 }
             }
         }

Modified: trunk/src/pmc/eval.pmc
==============================================================================
--- trunk/src/pmc/eval.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/eval.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -119,8 +119,7 @@
             opcode_t  ci  = e->offset;
             PMC      *sub = ct->constants[ci]->u.key;
 
-            if (!PMC_IS_NULL(sub))
-                Parrot_gc_mark_PObj_alive(interp, (PObj *)sub);
+            Parrot_gc_mark_PMC_alive(interp, sub);
         }
     }
 }

Modified: trunk/src/pmc/eventhandler.pmc
==============================================================================
--- trunk/src/pmc/eventhandler.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/eventhandler.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -123,14 +123,9 @@
         Parrot_EventHandler_attributes * const e = PARROT_EVENTHANDLER(SELF);
 
         if (e) {
-            if (e->type)
-                Parrot_gc_mark_PObj_alive(INTERP, (PObj *)e->type);
-
-            if (! PMC_IS_NULL(e->interp))
-                Parrot_gc_mark_PObj_alive(INTERP, (PObj *)e->interp);
-
-            if (! PMC_IS_NULL(e->code))
-                Parrot_gc_mark_PObj_alive(INTERP, (PObj *)e->code);
+            Parrot_gc_mark_STRING_alive(INTERP, e->type);
+            Parrot_gc_mark_PMC_alive(INTERP, e->interp);
+            Parrot_gc_mark_PMC_alive(INTERP, e->code);
 
             SUPER();
         }

Modified: trunk/src/pmc/exception.pmc
==============================================================================
--- trunk/src/pmc/exception.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/exception.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -149,20 +149,13 @@
 
     VTABLE void mark() {
         Parrot_Exception_attributes * const core_struct = PARROT_EXCEPTION(SELF);
-        if (core_struct->message)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)core_struct->message);
-        if (core_struct->payload)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)core_struct->payload);
-        if (core_struct->resume)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)core_struct->resume);
-        if (core_struct->backtrace)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)core_struct->backtrace);
-        if (core_struct->handler_iter)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)core_struct->handler_iter);
-        if (core_struct->handler_ctx)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)core_struct->handler_ctx);
-        if (core_struct->thrower)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)core_struct->thrower);
+        Parrot_gc_mark_STRING_alive(interp, core_struct->message);
+        Parrot_gc_mark_PMC_alive(interp, core_struct->payload);
+        Parrot_gc_mark_PMC_alive(interp, core_struct->resume);
+        Parrot_gc_mark_PMC_alive(interp, core_struct->backtrace);
+        Parrot_gc_mark_PMC_alive(interp, core_struct->handler_iter);
+        Parrot_gc_mark_PMC_alive(interp, core_struct->handler_ctx);
+        Parrot_gc_mark_PMC_alive(interp, core_struct->thrower);
     }
 
 /*

Modified: trunk/src/pmc/exceptionhandler.pmc
==============================================================================
--- trunk/src/pmc/exceptionhandler.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/exceptionhandler.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -68,10 +68,8 @@
     VTABLE void mark() {
         Parrot_ExceptionHandler_attributes * const attrs =
             PARROT_EXCEPTIONHANDLER(SELF);
-        if (attrs->handled_types)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)attrs->handled_types);
-        if (attrs->handled_types_except)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)attrs->handled_types_except);
+        Parrot_gc_mark_PMC_alive(interp, attrs->handled_types);
+        Parrot_gc_mark_PMC_alive(interp, attrs->handled_types_except);
         SUPER();
     }
 

Modified: trunk/src/pmc/exporter.pmc
==============================================================================
--- trunk/src/pmc/exporter.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/exporter.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -134,12 +134,9 @@
         GET_ATTR_ns_dest(INTERP, SELF, ns_dest);
         GET_ATTR_globals(INTERP, SELF, globals);
 
-        if (ns_src)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)ns_src);
-        if (ns_dest)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)ns_dest);
-        if (globals)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)globals);
+        Parrot_gc_mark_PMC_alive(interp, ns_src);
+        Parrot_gc_mark_PMC_alive(interp, ns_dest);
+        Parrot_gc_mark_PMC_alive(interp, globals);
     }
 
 

Modified: trunk/src/pmc/filehandle.pmc
==============================================================================
--- trunk/src/pmc/filehandle.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/filehandle.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -119,12 +119,9 @@
 
     VTABLE void mark() {
         Parrot_FileHandle_attributes * const data_struct = PARROT_FILEHANDLE(SELF);
-        if (data_struct->mode)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)data_struct->mode);
-        if (data_struct->filename)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)data_struct->filename);
-        if (data_struct->encoding)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)data_struct->encoding);
+        Parrot_gc_mark_STRING_alive(interp, data_struct->mode);
+        Parrot_gc_mark_STRING_alive(interp, data_struct->filename);
+        Parrot_gc_mark_STRING_alive(interp, data_struct->encoding);
     }
 
 /*

Modified: trunk/src/pmc/fixedpmcarray.pmc
==============================================================================
--- trunk/src/pmc/fixedpmcarray.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/fixedpmcarray.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -787,8 +787,7 @@
             return;
 
         for (i = PMC_size(SELF) - 1; i >= 0; --i)
-            if (data[i])
-                Parrot_gc_mark_PObj_alive(interp, (PObj *)data[i]);
+            Parrot_gc_mark_PMC_alive(interp, data[i]);
     }
 
 

Modified: trunk/src/pmc/fixedstringarray.pmc
==============================================================================
--- trunk/src/pmc/fixedstringarray.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/fixedstringarray.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -118,8 +118,7 @@
             GET_ATTR_size(INTERP, SELF, size);
 
             for (i = 0; i < size; i++) {
-                if (str_array[i])
-                    Parrot_gc_mark_PObj_alive(INTERP, (PObj *) str_array[i]);
+                Parrot_gc_mark_STRING_alive(INTERP, str_array[i]);
             }
         }
     }

Modified: trunk/src/pmc/hashiterator.pmc
==============================================================================
--- trunk/src/pmc/hashiterator.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/hashiterator.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -126,8 +126,7 @@
 
     VTABLE void mark() {
         PMC *hash = PARROT_HASHITERATOR(SELF)->pmc_hash;
-        if (hash)
-             Parrot_gc_mark_PObj_alive(INTERP, (PObj *)hash);
+        Parrot_gc_mark_PMC_alive(INTERP, hash);
         /* We don't mark underlying parrot_hash. Hash PMC will mark it */
     }
 

Modified: trunk/src/pmc/namespace.pmc
==============================================================================
--- trunk/src/pmc/namespace.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/namespace.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -162,16 +162,11 @@
     VTABLE void mark() {
         Parrot_NameSpace_attributes * const nsinfo = PARROT_NAMESPACE(SELF);
         SUPER();
-        if (nsinfo->parent)
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *)nsinfo->parent);
-        if (nsinfo->name)
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *)nsinfo->name);
-        if (nsinfo->_class)
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *)nsinfo->_class);
-        if (nsinfo->vtable)
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *)nsinfo->vtable);
-        if (nsinfo->methods)
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *)nsinfo->methods);
+        Parrot_gc_mark_PMC_alive(INTERP, nsinfo->parent);
+        Parrot_gc_mark_STRING_alive(INTERP, nsinfo->name);
+        Parrot_gc_mark_PMC_alive(INTERP, nsinfo->_class);
+        Parrot_gc_mark_PMC_alive(INTERP, nsinfo->vtable);
+        Parrot_gc_mark_PMC_alive(INTERP, nsinfo->methods);
     }
 
 /*

Modified: trunk/src/pmc/nci.pmc
==============================================================================
--- trunk/src/pmc/nci.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/nci.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -232,14 +232,10 @@
         if (PARROT_NCI(SELF)) {
             Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
 
-            if (nci_info->signature)
-                Parrot_gc_mark_PObj_alive(interp, (PObj*)nci_info->signature);
-            if (nci_info->pcc_params_signature)
-                Parrot_gc_mark_PObj_alive(interp, (PObj*)nci_info->pcc_params_signature);
-            if (nci_info->long_signature)
-                Parrot_gc_mark_PObj_alive(interp, (PObj*)nci_info->long_signature);
-            if (nci_info->multi_sig)
-                Parrot_gc_mark_PObj_alive(interp, (PObj*)nci_info->multi_sig);
+            Parrot_gc_mark_STRING_alive(interp, nci_info->signature);
+            Parrot_gc_mark_STRING_alive(interp, nci_info->pcc_params_signature);
+            Parrot_gc_mark_STRING_alive(interp, nci_info->long_signature);
+            Parrot_gc_mark_PMC_alive(interp, nci_info->multi_sig);
         }
     }
 

Modified: trunk/src/pmc/object.pmc
==============================================================================
--- trunk/src/pmc/object.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/object.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -190,10 +190,8 @@
         if (PARROT_OBJECT(SELF)) {
             Parrot_Object_attributes * const obj = PARROT_OBJECT(SELF);
 
-            if (obj->_class)
-                Parrot_gc_mark_PObj_alive(interp, (PObj*)obj->_class);
-            if (obj->attrib_store)
-                Parrot_gc_mark_PObj_alive(interp, (PObj*)obj->attrib_store);
+            Parrot_gc_mark_PMC_alive(interp, obj->_class);
+            Parrot_gc_mark_PMC_alive(interp, obj->attrib_store);
         }
     }
 

Modified: trunk/src/pmc/orderedhashiterator.pmc
==============================================================================
--- trunk/src/pmc/orderedhashiterator.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/orderedhashiterator.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -65,8 +65,7 @@
 
     VTABLE void mark() {
         PMC * const hash = PARROT_ORDEREDHASHITERATOR(SELF)->pmc_hash;
-        if (hash)
-             Parrot_gc_mark_PObj_alive(INTERP, (PObj *)hash);
+        Parrot_gc_mark_PMC_alive(INTERP, hash);
     }
 
 /*

Modified: trunk/src/pmc/packfile.pmc
==============================================================================
--- trunk/src/pmc/packfile.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/packfile.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -95,10 +95,8 @@
     VTABLE void mark() {
         Parrot_Packfile_attributes * attrs = PARROT_PACKFILE(SELF);
 
-        if (attrs->uuid)
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *)attrs->uuid);
-        if (!PMC_IS_NULL(attrs->directory))
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *)attrs->directory);
+        Parrot_gc_mark_STRING_alive(INTERP, attrs->uuid);
+        Parrot_gc_mark_PMC_alive(INTERP, attrs->directory);
     }
 /*
 

Modified: trunk/src/pmc/packfileannotation.pmc
==============================================================================
--- trunk/src/pmc/packfileannotation.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/packfileannotation.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -60,10 +60,8 @@
         Parrot_PackfileAnnotation_attributes * attrs =
                 PARROT_PACKFILEANNOTATION(SELF);
 
-        if (attrs->name)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)attrs->name);
-        if ((attrs->value_type == PF_ANNOTATION_KEY_TYPE_STR) && attrs->str_value)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)attrs->str_value);
+        Parrot_gc_mark_STRING_alive(interp, attrs->name);
+        Parrot_gc_mark_STRING_alive(interp, attrs->str_value);
     }
 
 

Modified: trunk/src/pmc/packfileannotations.pmc
==============================================================================
--- trunk/src/pmc/packfileannotations.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/packfileannotations.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -72,11 +72,8 @@
         Parrot_PackfileAnnotations_attributes * attrs =
                 PARROT_PACKFILEANNOTATIONS(SELF);
 
-        if (!PMC_IS_NULL(attrs->const_table))
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)attrs->const_table);
-
-        if (!PMC_IS_NULL(attrs->annotations))
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)attrs->annotations);
+        Parrot_gc_mark_PMC_alive(interp, attrs->const_table);
+        Parrot_gc_mark_PMC_alive(interp, attrs->annotations);
 
         SUPER();
     }

Modified: trunk/src/pmc/packfileconstanttable.pmc
==============================================================================
--- trunk/src/pmc/packfileconstanttable.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/packfileconstanttable.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -66,10 +66,8 @@
         Parrot_PackfileConstantTable_attributes * attrs =
                 PARROT_PACKFILECONSTANTTABLE(SELF);
 
-        if (!PMC_IS_NULL(attrs->constants))
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)attrs->constants);
-        if (!PMC_IS_NULL(attrs->types))
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)attrs->types);
+        Parrot_gc_mark_PMC_alive(interp, attrs->constants);
+        Parrot_gc_mark_PMC_alive(interp, attrs->types);
 
         SUPER();
     }

Modified: trunk/src/pmc/packfiledirectory.pmc
==============================================================================
--- trunk/src/pmc/packfiledirectory.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/packfiledirectory.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -61,8 +61,7 @@
         Parrot_PackfileDirectory_attributes * attrs =
                 PARROT_PACKFILEDIRECTORY(SELF);
 
-        if (!PMC_IS_NULL(attrs->hash))
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)attrs->hash);
+        Parrot_gc_mark_PMC_alive(interp, attrs->hash);
 
         SUPER();
     }

Modified: trunk/src/pmc/packfilefixupentry.pmc
==============================================================================
--- trunk/src/pmc/packfilefixupentry.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/packfilefixupentry.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -57,8 +57,7 @@
         Parrot_PackfileFixupEntry_attributes * attrs =
                 PARROT_PACKFILEFIXUPENTRY(SELF);
 
-        if (attrs->name)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)attrs->name);
+        Parrot_gc_mark_STRING_alive(interp, attrs->name);
     }
 
 /*

Modified: trunk/src/pmc/packfilefixuptable.pmc
==============================================================================
--- trunk/src/pmc/packfilefixuptable.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/packfilefixuptable.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -61,8 +61,7 @@
         Parrot_PackfileFixupTable_attributes * attrs =
                 PARROT_PACKFILEFIXUPTABLE(SELF);
 
-        if (!PMC_IS_NULL(attrs->entries))
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)attrs->entries);
+        Parrot_gc_mark_PMC_alive(interp, attrs->entries);
 
         SUPER();
     }

Modified: trunk/src/pmc/packfilerawsegment.pmc
==============================================================================
--- trunk/src/pmc/packfilerawsegment.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/packfilerawsegment.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -64,8 +64,7 @@
         Parrot_PackfileRawSegment_attributes * attrs =
                 PARROT_PACKFILERAWSEGMENT(SELF);
 
-        if (!PMC_IS_NULL(attrs->opcodes))
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)attrs->opcodes);
+        Parrot_gc_mark_PMC_alive(interp, attrs->opcodes);
 
         SUPER();
     }

Modified: trunk/src/pmc/packfilesegment.pmc
==============================================================================
--- trunk/src/pmc/packfilesegment.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/packfilesegment.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -63,8 +63,7 @@
         Parrot_PackfileSegment_attributes * attrs =
                 PARROT_PACKFILESEGMENT(SELF);
 
-        if (!PMC_IS_NULL(attrs->directory))
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)attrs->directory);
+        Parrot_gc_mark_PMC_alive(interp, attrs->directory);
     }
 
 /*

Modified: trunk/src/pmc/role.pmc
==============================================================================
--- trunk/src/pmc/role.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/role.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -256,16 +256,11 @@
     VTABLE void mark() {
         Parrot_Role_attributes * const role = PARROT_ROLE(SELF);
 
-        if (role->name)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)role->name);
-        if (role->_namespace)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)role->_namespace);
-        if (role->roles)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)role->roles);
-        if (role->methods)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)role->methods);
-        if (role->attrib_metadata)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)role->attrib_metadata);
+        Parrot_gc_mark_STRING_alive(interp, role->name);
+        Parrot_gc_mark_PMC_alive(interp, role->_namespace);
+        Parrot_gc_mark_PMC_alive(interp, role->roles);
+        Parrot_gc_mark_PMC_alive(interp, role->methods);
+        Parrot_gc_mark_PMC_alive(interp, role->attrib_metadata);
     }
 
 /*

Modified: trunk/src/pmc/scheduler.pmc
==============================================================================
--- trunk/src/pmc/scheduler.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/scheduler.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -266,16 +266,11 @@
         if (PARROT_SCHEDULER(SELF)) {
             Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
 
-            if (core_struct->task_list)
-                Parrot_gc_mark_PObj_alive(interp, (PObj *)core_struct->task_list);
-            if (core_struct->task_index)
-                Parrot_gc_mark_PObj_alive(interp, (PObj *)core_struct->task_index);
-            if (core_struct->wait_index)
-                Parrot_gc_mark_PObj_alive(interp, (PObj *)core_struct->wait_index);
-            if (core_struct->handlers)
-                Parrot_gc_mark_PObj_alive(interp, (PObj *)core_struct->handlers);
-            if (core_struct->messages)
-                Parrot_gc_mark_PObj_alive(interp, (PObj *)core_struct->messages);
+            Parrot_gc_mark_PMC_alive(interp, core_struct->task_list);
+            Parrot_gc_mark_PMC_alive(interp, core_struct->task_index);
+            Parrot_gc_mark_PMC_alive(interp, core_struct->wait_index);
+            Parrot_gc_mark_PMC_alive(interp, core_struct->handlers);
+            Parrot_gc_mark_PMC_alive(interp, core_struct->messages);
         }
     }
 

Modified: trunk/src/pmc/schedulermessage.pmc
==============================================================================
--- trunk/src/pmc/schedulermessage.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/schedulermessage.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -199,8 +199,8 @@
             Parrot_SchedulerMessage_attributes * const core_struct =
                 PARROT_SCHEDULERMESSAGE(SELF);
 
-            if (core_struct->data)
-                Parrot_gc_mark_PObj_alive(interp, (PObj*)core_struct->data);
+            Parrot_gc_mark_STRING_alive(interp, core_struct->type);
+            Parrot_gc_mark_PMC_alive(interp, core_struct->data);
         }
     }
 

Modified: trunk/src/pmc/socket.pmc
==============================================================================
--- trunk/src/pmc/socket.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/socket.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -94,11 +94,8 @@
         Parrot_Socket_attributes * const data = PARROT_SOCKET(SELF);
 
         if (data) {
-            if (data->local)
-                Parrot_gc_mark_PObj_alive(interp, (PObj *)data->local);
-
-            if (data->remote)
-                Parrot_gc_mark_PObj_alive(interp, (PObj *)data->remote);
+            Parrot_gc_mark_PMC_alive(interp, data->local);
+            Parrot_gc_mark_PMC_alive(interp, data->remote);
         }
     }
 /*

Modified: trunk/src/pmc/string.pmc
==============================================================================
--- trunk/src/pmc/string.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/string.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -75,9 +75,7 @@
     VTABLE void mark() {
         STRING *str_val;
         GET_ATTR_str_val(INTERP, SELF, str_val);
-
-        if (str_val)
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *)str_val);
+        Parrot_gc_mark_STRING_alive(INTERP, str_val);
     }
 
 /*

Modified: trunk/src/pmc/stringhandle.pmc
==============================================================================
--- trunk/src/pmc/stringhandle.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/stringhandle.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -120,14 +120,10 @@
 
     VTABLE void mark() {
         Parrot_StringHandle_attributes * const data_struct = PARROT_STRINGHANDLE(SELF);
-        if (data_struct->stringhandle)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)data_struct->stringhandle);
-        if (data_struct->mode)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)data_struct->mode);
-        if (data_struct->encoding)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)data_struct->encoding);
-        if (data_struct->filename)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)data_struct->filename);
+        Parrot_gc_mark_STRING_alive(interp, data_struct->stringhandle);
+        Parrot_gc_mark_STRING_alive(interp, data_struct->mode);
+        Parrot_gc_mark_STRING_alive(interp, data_struct->encoding);
+        Parrot_gc_mark_STRING_alive(interp, data_struct->filename);
     }
 
 /*

Modified: trunk/src/pmc/stringiterator.pmc
==============================================================================
--- trunk/src/pmc/stringiterator.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/stringiterator.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -59,8 +59,7 @@
     VTABLE void mark() {
         PMC *string;
         GET_ATTR_string(INTERP, SELF, string);
-        if (string)
-             Parrot_gc_mark_PObj_alive(INTERP, (PObj *)string);
+        Parrot_gc_mark_PMC_alive(INTERP, string);
     }
 
 /*

Modified: trunk/src/pmc/sub.pmc
==============================================================================
--- trunk/src/pmc/sub.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/sub.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -571,30 +571,18 @@
         if (!sub)
             return;
 
-        if (sub->name)
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *) sub->name);
-        if (sub->method_name)
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *) sub->method_name);
-        if (sub->ns_entry_name)
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *) sub->ns_entry_name);
-        if (!PMC_IS_NULL(sub->namespace_name))
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *) sub->namespace_name);
-        if (!PMC_IS_NULL(sub->namespace_stash))
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *) sub->namespace_stash);
-        if (!PMC_IS_NULL(sub->multi_signature))
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *) sub->multi_signature);
-        if (!PMC_IS_NULL(sub->lex_info))
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *) sub->lex_info);
-        if (!PMC_IS_NULL(sub->outer_sub))
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *) sub->outer_sub);
-        if (!PMC_IS_NULL(sub->eval_pmc))
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *) sub->eval_pmc);
-        if (sub->subid)
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *) sub->subid);
-        if (sub->ctx)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *) sub->ctx);
-        if (sub->outer_ctx)
-            Parrot_gc_mark_PObj_alive(interp, (PObj *) sub->outer_ctx);
+        Parrot_gc_mark_STRING_alive(INTERP, sub->name);
+        Parrot_gc_mark_STRING_alive(INTERP, sub->method_name);
+        Parrot_gc_mark_STRING_alive(INTERP, sub->ns_entry_name);
+        Parrot_gc_mark_PMC_alive(INTERP, sub->namespace_name);
+        Parrot_gc_mark_PMC_alive(INTERP, sub->namespace_stash);
+        Parrot_gc_mark_PMC_alive(INTERP, sub->multi_signature);
+        Parrot_gc_mark_PMC_alive(INTERP, sub->lex_info);
+        Parrot_gc_mark_PMC_alive(INTERP, sub->outer_sub);
+        Parrot_gc_mark_PMC_alive(INTERP, sub->eval_pmc);
+        Parrot_gc_mark_STRING_alive(INTERP, sub->subid);
+        Parrot_gc_mark_PMC_alive(interp, sub->ctx);
+        Parrot_gc_mark_PMC_alive(interp, sub->outer_ctx);
     }
 
 /*

Modified: trunk/src/pmc/task.pmc
==============================================================================
--- trunk/src/pmc/task.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/task.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -375,10 +375,11 @@
         if (PARROT_TASK(SELF)) {
             Parrot_Task_attributes * const core_struct = PARROT_TASK(SELF);
 
-            if (core_struct->codeblock)
-                Parrot_gc_mark_PObj_alive(interp, (PObj*)core_struct->codeblock);
-            if (core_struct->data)
-                Parrot_gc_mark_PObj_alive(interp, (PObj*)core_struct->data);
+            Parrot_gc_mark_STRING_alive(interp, core_struct->type);
+            Parrot_gc_mark_STRING_alive(interp, core_struct->subtype);
+            Parrot_gc_mark_STRING_alive(interp, core_struct->status);
+            Parrot_gc_mark_PMC_alive(interp, core_struct->codeblock);
+            Parrot_gc_mark_PMC_alive(interp, core_struct->data);
         }
     }
 

Modified: trunk/src/pmc/unmanagedstruct.pmc
==============================================================================
--- trunk/src/pmc/unmanagedstruct.pmc	Thu Sep 24 18:00:22 2009	(r41446)
+++ trunk/src/pmc/unmanagedstruct.pmc	Thu Sep 24 19:30:17 2009	(r41447)
@@ -739,8 +739,8 @@
 */
 
     VTABLE void mark() {
-        if (PARROT_UNMANAGEDSTRUCT(SELF)->init)
-            Parrot_gc_mark_PObj_alive(INTERP, (PObj *)PARROT_UNMANAGEDSTRUCT(SELF)->init);
+        PMC *init = PARROT_UNMANAGEDSTRUCT(SELF)->init;
+        Parrot_gc_mark_PMC_alive(INTERP, init);
     }
 
 /*


More information about the parrot-commits mailing list