Index: src/pmc/role.pmc =================================================================== --- src/pmc/role.pmc (revision 41445) +++ src/pmc/role.pmc (working copy) @@ -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); } /* Index: src/pmc/packfilesegment.pmc =================================================================== --- src/pmc/packfilesegment.pmc (revision 41445) +++ src/pmc/packfilesegment.pmc (working copy) @@ -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); } /* Index: src/pmc/packfilefixuptable.pmc =================================================================== --- src/pmc/packfilefixuptable.pmc (revision 41445) +++ src/pmc/packfilefixuptable.pmc (working copy) @@ -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(); } Index: src/pmc/class.pmc =================================================================== --- src/pmc/class.pmc (revision 41445) +++ src/pmc/class.pmc (working copy) @@ -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); } Index: src/pmc/string.pmc =================================================================== --- src/pmc/string.pmc (revision 41445) +++ src/pmc/string.pmc (working copy) @@ -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); } /* Index: src/pmc/object.pmc =================================================================== --- src/pmc/object.pmc (revision 41445) +++ src/pmc/object.pmc (working copy) @@ -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); } } Index: src/pmc/exporter.pmc =================================================================== --- src/pmc/exporter.pmc (revision 41445) +++ src/pmc/exporter.pmc (working copy) @@ -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); } Index: src/pmc/eventhandler.pmc =================================================================== --- src/pmc/eventhandler.pmc (revision 41445) +++ src/pmc/eventhandler.pmc (working copy) @@ -123,15 +123,10 @@ Parrot_EventHandler_attributes * const e = PARROT_EVENTHANDLER(SELF); if (e) { - if (e->type) - Parrot_gc_mark_PObj_alive(INTERP, (PObj *)e->type); + Parrot_gc_mark_STRING_alive(INTERP, e->type); + Parrot_gc_mark_PMC_alive(INTERP, e->interp); + Parrot_gc_mark_PMC_alive(INTERP, e->code); - 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); - SUPER(); } } Index: src/pmc/cpointer.pmc =================================================================== --- src/pmc/cpointer.pmc (revision 41445) +++ src/pmc/cpointer.pmc (working copy) @@ -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); } } } Index: src/pmc/filehandle.pmc =================================================================== --- src/pmc/filehandle.pmc (revision 41445) +++ src/pmc/filehandle.pmc (working copy) @@ -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); } /* Index: src/pmc/packfileannotations.pmc =================================================================== --- src/pmc/packfileannotations.pmc (revision 41445) +++ src/pmc/packfileannotations.pmc (working copy) @@ -72,12 +72,9 @@ Parrot_PackfileAnnotations_attributes * attrs = PARROT_PACKFILEANNOTATIONS(SELF); - if (!PMC_IS_NULL(attrs->const_table)) - Parrot_gc_mark_PObj_alive(interp, (PObj *)attrs->const_table); + Parrot_gc_mark_PMC_alive(interp, attrs->const_table); + Parrot_gc_mark_PMC_alive(interp, attrs->annotations); - if (!PMC_IS_NULL(attrs->annotations)) - Parrot_gc_mark_PObj_alive(interp, (PObj *)attrs->annotations); - SUPER(); } Index: src/pmc/exception.pmc =================================================================== --- src/pmc/exception.pmc (revision 41445) +++ src/pmc/exception.pmc (working copy) @@ -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); } /* Index: src/pmc/task.pmc =================================================================== --- src/pmc/task.pmc (revision 41445) +++ src/pmc/task.pmc (working copy) @@ -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); } } Index: src/pmc/orderedhashiterator.pmc =================================================================== --- src/pmc/orderedhashiterator.pmc (revision 41445) +++ src/pmc/orderedhashiterator.pmc (working copy) @@ -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); } /* Index: src/pmc/continuation.pmc =================================================================== --- src/pmc/continuation.pmc (revision 41445) +++ src/pmc/continuation.pmc (working copy) @@ -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); } /* Index: src/pmc/packfile.pmc =================================================================== --- src/pmc/packfile.pmc (revision 41445) +++ src/pmc/packfile.pmc (working copy) @@ -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); } /* Index: src/pmc/stringiterator.pmc =================================================================== --- src/pmc/stringiterator.pmc (revision 41445) +++ src/pmc/stringiterator.pmc (working copy) @@ -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); } /* Index: src/pmc/socket.pmc =================================================================== --- src/pmc/socket.pmc (revision 41445) +++ src/pmc/socket.pmc (working copy) @@ -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); } } /* Index: src/pmc/hashiterator.pmc =================================================================== --- src/pmc/hashiterator.pmc (revision 41445) +++ src/pmc/hashiterator.pmc (working copy) @@ -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 */ } Index: src/pmc/fixedpmcarray.pmc =================================================================== --- src/pmc/fixedpmcarray.pmc (revision 41445) +++ src/pmc/fixedpmcarray.pmc (working copy) @@ -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]); } Index: src/pmc/packfileconstanttable.pmc =================================================================== --- src/pmc/packfileconstanttable.pmc (revision 41445) +++ src/pmc/packfileconstanttable.pmc (working copy) @@ -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(); } Index: src/pmc/unmanagedstruct.pmc =================================================================== --- src/pmc/unmanagedstruct.pmc (revision 41445) +++ src/pmc/unmanagedstruct.pmc (working copy) @@ -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); } /* Index: src/pmc/packfilerawsegment.pmc =================================================================== --- src/pmc/packfilerawsegment.pmc (revision 41445) +++ src/pmc/packfilerawsegment.pmc (working copy) @@ -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(); } Index: src/pmc/packfilefixupentry.pmc =================================================================== --- src/pmc/packfilefixupentry.pmc (revision 41445) +++ src/pmc/packfilefixupentry.pmc (working copy) @@ -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); } /* Index: src/pmc/scheduler.pmc =================================================================== --- src/pmc/scheduler.pmc (revision 41445) +++ src/pmc/scheduler.pmc (working copy) @@ -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); } } Index: src/pmc/exceptionhandler.pmc =================================================================== --- src/pmc/exceptionhandler.pmc (revision 41445) +++ src/pmc/exceptionhandler.pmc (working copy) @@ -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(); } Index: src/pmc/namespace.pmc =================================================================== --- src/pmc/namespace.pmc (revision 41445) +++ src/pmc/namespace.pmc (working copy) @@ -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); } /* Index: src/pmc/packfiledirectory.pmc =================================================================== --- src/pmc/packfiledirectory.pmc (revision 41445) +++ src/pmc/packfiledirectory.pmc (working copy) @@ -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(); } Index: src/pmc/nci.pmc =================================================================== --- src/pmc/nci.pmc (revision 41445) +++ src/pmc/nci.pmc (working copy) @@ -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); } } Index: src/pmc/packfileannotation.pmc =================================================================== --- src/pmc/packfileannotation.pmc (revision 41445) +++ src/pmc/packfileannotation.pmc (working copy) @@ -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); } Index: src/pmc/stringhandle.pmc =================================================================== --- src/pmc/stringhandle.pmc (revision 41445) +++ src/pmc/stringhandle.pmc (working copy) @@ -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); } /* Index: src/pmc/schedulermessage.pmc =================================================================== --- src/pmc/schedulermessage.pmc (revision 41445) +++ src/pmc/schedulermessage.pmc (working copy) @@ -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); } } Index: src/pmc/fixedstringarray.pmc =================================================================== --- src/pmc/fixedstringarray.pmc (revision 41445) +++ src/pmc/fixedstringarray.pmc (working copy) @@ -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]); } } } Index: src/pmc/eval.pmc =================================================================== --- src/pmc/eval.pmc (revision 41445) +++ src/pmc/eval.pmc (working copy) @@ -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); } } } Index: src/pmc/arrayiterator.pmc =================================================================== --- src/pmc/arrayiterator.pmc (revision 41445) +++ src/pmc/arrayiterator.pmc (working copy) @@ -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); } /* Index: src/pmc/sub.pmc =================================================================== --- src/pmc/sub.pmc (revision 41445) +++ src/pmc/sub.pmc (working copy) @@ -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); } /* Index: src/pmc/callsignature.pmc =================================================================== --- src/pmc/callsignature.pmc (revision 41445) +++ src/pmc/callsignature.pmc (working copy) @@ -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(); } Index: src/gc/api.c =================================================================== --- src/gc/api.c (revision 41445) +++ src/gc/api.c (working copy) @@ -236,6 +236,48 @@ /* +=item C + +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 + +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 Initializes the memory allocator and the garbage collection subsystem. Index: include/parrot/gc_api.h =================================================================== --- include/parrot/gc_api.h (revision 41445) +++ include/parrot/gc_api.h (working copy) @@ -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 */ /*