Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[gc] add new mark_... _alive functions, use it in a lot of mark vtabl…

…e functions, and some cleanup related, TT #1062

git-svn-id: https://svn.parrot.org/parrot/trunk@41447 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
commit 18dd1479df37d6deff408de02cb699d67dad364c 1 parent 8c03a5e
@NotFound NotFound authored
Showing with 176 additions and 208 deletions.
  1. +26 −0 include/parrot/gc_api.h
  2. +42 −0 src/gc/api.c
  3. +1 −2  src/pmc/arrayiterator.pmc
  4. +3 −6 src/pmc/callsignature.pmc
  5. +13 −26 src/pmc/class.pmc
  6. +2 −4 src/pmc/continuation.pmc
  7. +3 −3 src/pmc/cpointer.pmc
  8. +1 −2  src/pmc/eval.pmc
  9. +3 −8 src/pmc/eventhandler.pmc
  10. +7 −14 src/pmc/exception.pmc
  11. +2 −4 src/pmc/exceptionhandler.pmc
  12. +3 −6 src/pmc/exporter.pmc
  13. +3 −6 src/pmc/filehandle.pmc
  14. +1 −2  src/pmc/fixedpmcarray.pmc
  15. +1 −2  src/pmc/fixedstringarray.pmc
  16. +1 −2  src/pmc/hashiterator.pmc
  17. +5 −10 src/pmc/namespace.pmc
  18. +4 −8 src/pmc/nci.pmc
  19. +2 −4 src/pmc/object.pmc
  20. +1 −2  src/pmc/orderedhashiterator.pmc
  21. +2 −4 src/pmc/packfile.pmc
  22. +2 −4 src/pmc/packfileannotation.pmc
  23. +2 −5 src/pmc/packfileannotations.pmc
  24. +2 −4 src/pmc/packfileconstanttable.pmc
  25. +1 −2  src/pmc/packfiledirectory.pmc
  26. +1 −2  src/pmc/packfilefixupentry.pmc
  27. +1 −2  src/pmc/packfilefixuptable.pmc
  28. +1 −2  src/pmc/packfilerawsegment.pmc
  29. +1 −2  src/pmc/packfilesegment.pmc
  30. +5 −10 src/pmc/role.pmc
  31. +5 −10 src/pmc/scheduler.pmc
  32. +2 −2 src/pmc/schedulermessage.pmc
  33. +2 −5 src/pmc/socket.pmc
  34. +1 −3 src/pmc/string.pmc
  35. +4 −8 src/pmc/stringhandle.pmc
  36. +1 −2  src/pmc/stringiterator.pmc
  37. +12 −24 src/pmc/sub.pmc
  38. +5 −4 src/pmc/task.pmc
  39. +2 −2 src/pmc/unmanagedstruct.pmc
View
26 include/parrot/gc_api.h
@@ -112,12 +112,23 @@ void Parrot_block_GC_sweep(PARROT_INTERP)
__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 @@ int Parrot_gc_total_sized_buffers(PARROT_INTERP)
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 @@ int Parrot_gc_total_sized_buffers(PARROT_INTERP)
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 */
/*
View
42 src/gc/api.c
@@ -236,6 +236,48 @@ Parrot_gc_mark_PObj_alive(PARROT_INTERP, ARGMOD(PObj *obj))
/*
+=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.
View
3  src/pmc/arrayiterator.pmc
@@ -109,8 +109,7 @@ Marks the current idx/key and the aggregate as live.
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);
}
/*
View
9 src/pmc/callsignature.pmc
@@ -179,12 +179,9 @@ Mark any referenced strings and PMCs.
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();
}
View
39 src/pmc/class.pmc
@@ -589,32 +589,19 @@ Marks any referenced strings and PMCs in the structure as live.
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);
}
View
6 src/pmc/continuation.pmc
@@ -131,10 +131,8 @@ Marks the continuation as live.
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);
}
/*
View
6 src/pmc/cpointer.pmc
@@ -84,18 +84,18 @@ pointer.
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);
}
}
}
View
3  src/pmc/eval.pmc
@@ -119,8 +119,7 @@ mark_subs(PARROT_INTERP, PMC *self)
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);
}
}
}
View
11 src/pmc/eventhandler.pmc
@@ -123,14 +123,9 @@ Marks this PMC and any of its contents as live.
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();
}
View
21 src/pmc/exception.pmc
@@ -149,20 +149,13 @@ Mark any active exception data as live.
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);
}
/*
View
6 src/pmc/exceptionhandler.pmc
@@ -68,10 +68,8 @@ Mark any active exception handler data as live.
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();
}
View
9 src/pmc/exporter.pmc
@@ -134,12 +134,9 @@ Mark referenced strings and PMCs in the structure as live.
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);
}
View
9 src/pmc/filehandle.pmc
@@ -119,12 +119,9 @@ Mark active filehandle data as live.
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);
}
/*
View
3  src/pmc/fixedpmcarray.pmc
@@ -787,8 +787,7 @@ Mark the array.
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]);
}
View
3  src/pmc/fixedstringarray.pmc
@@ -118,8 +118,7 @@ Marks the array as live.
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]);
}
}
}
View
3  src/pmc/hashiterator.pmc
@@ -126,8 +126,7 @@ Marks the hash as live.
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 */
}
View
15 src/pmc/namespace.pmc
@@ -162,16 +162,11 @@ Marks the namespace as live.
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);
}
/*
View
12 src/pmc/nci.pmc
@@ -232,14 +232,10 @@ Mark any referenced strings and PMCs.
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);
}
}
View
6 src/pmc/object.pmc
@@ -190,10 +190,8 @@ Mark any referenced strings and PMCs.
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);
}
}
View
3  src/pmc/orderedhashiterator.pmc
@@ -65,8 +65,7 @@ Marks the hash as live.
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);
}
/*
View
6 src/pmc/packfile.pmc
@@ -95,10 +95,8 @@ Marks the Packfile as alive.
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);
}
/*
View
6 src/pmc/packfileannotation.pmc
@@ -60,10 +60,8 @@ Marks the object as live.
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);
}
View
7 src/pmc/packfileannotations.pmc
@@ -72,11 +72,8 @@ Marks the object as live.
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();
}
View
6 src/pmc/packfileconstanttable.pmc
@@ -66,10 +66,8 @@ Marks the object as live.
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();
}
View
3  src/pmc/packfiledirectory.pmc
@@ -61,8 +61,7 @@ Marks the object as live.
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();
}
View
3  src/pmc/packfilefixupentry.pmc
@@ -57,8 +57,7 @@ Marks the object as live.
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);
}
/*
View
3  src/pmc/packfilefixuptable.pmc
@@ -61,8 +61,7 @@ Marks the object as live.
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();
}
View
3  src/pmc/packfilerawsegment.pmc
@@ -64,8 +64,7 @@ Marks the object as live.
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();
}
View
3  src/pmc/packfilesegment.pmc
@@ -63,8 +63,7 @@ Marks the object as live.
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);
}
/*
View
15 src/pmc/role.pmc
@@ -256,16 +256,11 @@ Mark referenced strings and PMCs in the structure as live.
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);
}
/*
View
15 src/pmc/scheduler.pmc
@@ -266,16 +266,11 @@ Marks any referenced strings and PMCs as live.
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);
}
}
View
4 src/pmc/schedulermessage.pmc
@@ -199,8 +199,8 @@ Mark any referenced strings and PMCs.
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);
}
}
View
7 src/pmc/socket.pmc
@@ -94,11 +94,8 @@ Mark active socket handle data as live.
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);
}
}
/*
View
4 src/pmc/string.pmc
@@ -75,9 +75,7 @@ Marks the string as live.
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);
}
/*
View
12 src/pmc/stringhandle.pmc
@@ -120,14 +120,10 @@ Mark active stringhandle data as live.
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);
}
/*
View
3  src/pmc/stringiterator.pmc
@@ -59,8 +59,7 @@ Marks the current idx/key and the aggregate as live.
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);
}
/*
View
36 src/pmc/sub.pmc
@@ -571,30 +571,18 @@ Marks the sub as live.
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);
}
/*
View
9 src/pmc/task.pmc
@@ -375,10 +375,11 @@ Mark any referenced strings and PMCs.
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);
}
}
View
4 src/pmc/unmanagedstruct.pmc
@@ -739,8 +739,8 @@ Marks the C<struct> as live.
*/
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);
}
/*
Please sign in to comment.
Something went wrong with that request. Please try again.