[svn:parrot] r47272 - in branches/gc_massacre_no_constant/src: ops pmc
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Wed Jun 2 01:07:50 UTC 2010
Author: whiteknight
Date: Wed Jun 2 01:07:49 2010
New Revision: 47272
URL: https://trac.parrot.org/parrot/changeset/47272
Log:
[gc_massacre_no_constant] Add a ->library attr to nci to keep track of the ParrotLibrary PMC that originates it. This way the library will automatically be marked by GC if any references to any NCI functions from it are reachable.
Modified:
branches/gc_massacre_no_constant/src/ops/core.ops
branches/gc_massacre_no_constant/src/pmc/nci.pmc
Modified: branches/gc_massacre_no_constant/src/ops/core.ops
==============================================================================
--- branches/gc_massacre_no_constant/src/ops/core.ops Tue Jun 1 20:59:56 2010 (r47271)
+++ branches/gc_massacre_no_constant/src/ops/core.ops Wed Jun 2 01:07:49 2010 (r47272)
@@ -1269,8 +1269,10 @@
$1 = Parrot_pmc_new(interp, enum_class_Undef);
}
else {
- $1 = Parrot_pmc_new(interp, enum_class_NCI);
- VTABLE_set_pointer_keyed_str(interp, $1, $4, F2DPTR(p));
+ PMC * const func = Parrot_pmc_new(interp, enum_class_NCI);
+ VTABLE_set_pointer_keyed_str(interp, func, $4, F2DPTR(p));
+ VTABLE_set_attr_str(INTERP, func, CONST_STRING(INTERP, "library"), $2);
+ $1 = func;
}
Parrot_str_free_cstring(name);
}
Modified: branches/gc_massacre_no_constant/src/pmc/nci.pmc
==============================================================================
--- branches/gc_massacre_no_constant/src/pmc/nci.pmc Tue Jun 1 20:59:56 2010 (r47271)
+++ branches/gc_massacre_no_constant/src/pmc/nci.pmc Wed Jun 2 01:07:49 2010 (r47272)
@@ -183,6 +183,7 @@
/* MMD fields */
ATTR STRING *long_signature; /* The full signature. */
ATTR PMC *multi_sig; /* type tuple array (?) */
+ ATTR PMC *library; /* The library that this NCI is in, if any */
/*
@@ -269,6 +270,18 @@
nci_info->signature = key;
}
+ VTABLE void set_attr_str(STRING * idx, PMC *value)
+ {
+ if (Parrot_str_equal(INTERP, idx, CONST_STRING(interp, "library")))
+ PARROT_NCI(SELF)->library = value;
+ }
+
+ VTABLE PMC * get_attr_str(STRING * idx)
+ {
+ if (Parrot_str_equal(INTERP, idx, CONST_STRING(interp, "library")))
+ return PARROT_NCI(SELF)->library;
+ }
+
/*
=item C<void mark()>
@@ -282,12 +295,13 @@
if (PARROT_NCI(SELF)) {
Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
- Parrot_gc_mark_PMC_alive(interp, nci_info->fb_info);
- 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->pcc_params_signature);
- Parrot_gc_mark_STRING_alive(interp, nci_info->long_signature);
- Parrot_gc_mark_PMC_alive(interp, nci_info->multi_sig);
+ Parrot_gc_mark_PMC_alive(INTERP, nci_info->fb_info);
+ 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->pcc_params_signature);
+ Parrot_gc_mark_STRING_alive(INTERP, nci_info->long_signature);
+ Parrot_gc_mark_PMC_alive(INTERP, nci_info->multi_sig);
+ Parrot_gc_mark_PMC_alive(INTERP, nci_info->library);
}
}
More information about the parrot-commits
mailing list