Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[pmc]: set pmc flags after anchoring to prevent accidental collection…

… during init

git-svn-id: https://svn.parrot.org/parrot/trunk@20041 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
commit 366638e3229aa3c75ac40d153421743388bdd32a 1 parent d64123b
@particle particle authored
View
14 src/pmc/class.pmc
@@ -389,13 +389,6 @@ arguments. The class is attatched to the current namespace.
void init() {
Parrot_Class *_class = NULL;
- /* Set flags for custom DOD mark and destroy. */
- PObj_custom_mark_SET(SELF);
- PObj_active_destroy_SET(SELF);
-
- /* We are a class. */
- PObj_is_class_SET(SELF);
-
/* Set up the object. */
_class = mem_allocate_zeroed_typed(Parrot_Class);
_class->name = CONST_STRING(interp, "");
@@ -415,6 +408,13 @@ arguments. The class is attatched to the current namespace.
VTABLE_push_pmc(interp, _class->all_parents, SELF);
PMC_data(SELF) = _class;
+
+ /* We are a class. */
+ PObj_is_class_SET(SELF);
+
+ /* Set flags for custom DOD mark and destroy. */
+ PObj_custom_mark_SET(SELF);
+ PObj_active_destroy_SET(SELF);
}
void init_pmc(PMC* init_data) {
View
8 src/pmc/exporter.pmc
@@ -97,16 +97,16 @@ Initializes an Exporter PMC.
void init() {
Parrot_Exporter *exp = NULL;
- /* Set flags for custom DOD mark and destroy. */
- PObj_custom_mark_SET(SELF);
- PObj_active_destroy_SET(SELF);
-
/* Set up the object. */
exp = mem_allocate_zeroed_typed(Parrot_Exporter);
exp->ns_src = PMCNULL;
exp->ns_dest = CONTEXT(interp->ctx)->current_namespace;
exp->globals = PMCNULL;
PMC_data(SELF) = exp;
+
+ /* Set flags for custom DOD mark and destroy. */
+ PObj_custom_mark_SET(SELF);
+ PObj_active_destroy_SET(SELF);
}
View
14 src/pmc/pmcproxy.pmc
@@ -77,13 +77,6 @@ Initializes a PMCProxy PMC.
void init() {
Parrot_PMCProxy *_pmc = NULL;
- /* Set flags for custom DOD mark and destroy. */
- PObj_custom_mark_SET(SELF);
- PObj_active_destroy_SET(SELF);
-
- /* We are a class. */
- PObj_is_class_SET(SELF);
-
/* Set up the object. */
_pmc = mem_allocate_zeroed_typed(Parrot_PMCProxy);
_pmc->id = 0;
@@ -97,6 +90,13 @@ Initializes a PMCProxy PMC.
VTABLE_push_pmc(interp, _pmc->all_parents, SELF);
PMC_data(SELF) = _pmc;
+
+ /* We are a class. */
+ PObj_is_class_SET(SELF);
+
+ /* Set flags for custom DOD mark and destroy. */
+ PObj_custom_mark_SET(SELF);
+ PObj_active_destroy_SET(SELF);
}
/*
View
8 src/pmc/role.pmc
@@ -227,10 +227,6 @@ C<init_data>.
void init() {
Parrot_Role *role = NULL;
- /* Set flags for custom DOD mark and destroy. */
- PObj_custom_mark_SET(SELF);
- PObj_active_destroy_SET(SELF);
-
/* Set up the object. */
role = mem_allocate_zeroed_typed(Parrot_Role);
role->name = CONST_STRING(interp, "");
@@ -239,6 +235,10 @@ C<init_data>.
role->methods = pmc_new(interp, enum_class_Hash);
role->attrib_metadata = pmc_new(interp, enum_class_Hash);
PMC_data(SELF) = role;
+
+ /* Set flags for custom DOD mark and destroy. */
+ PObj_custom_mark_SET(SELF);
+ PObj_active_destroy_SET(SELF);
}
void init_pmc(PMC* init_data) {
Please sign in to comment.
Something went wrong with that request. Please try again.