[svn:parrot] r44985 - in branches/tt389_fix: lib/Parrot/Pmc2c src/interp
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Wed Mar 17 17:55:53 UTC 2010
Author: whiteknight
Date: Wed Mar 17 17:55:50 2010
New Revision: 44985
URL: https://trac.parrot.org/parrot/changeset/44985
Log:
share pmc_class between a vtable and the ->ro_variant_vtable. Fixes 6 tests in t/dynpmc/rotest.t
Modified:
branches/tt389_fix/lib/Parrot/Pmc2c/PMCEmitter.pm
branches/tt389_fix/src/interp/inter_misc.c
Modified: branches/tt389_fix/lib/Parrot/Pmc2c/PMCEmitter.pm
==============================================================================
--- branches/tt389_fix/lib/Parrot/Pmc2c/PMCEmitter.pm Wed Mar 17 17:09:04 2010 (r44984)
+++ branches/tt389_fix/lib/Parrot/Pmc2c/PMCEmitter.pm Wed Mar 17 17:55:50 2010 (r44985)
@@ -623,18 +623,15 @@
my $k_flags = $self->$k->vtable_flags;
$cout .= <<"EOC";
{
- VTABLE *vt_$k;
- vt_${k} = Parrot_${classname}_${k}_get_vtable(interp);
- vt_${k}->base_type = $enum_name;
- vt_${k}->flags = $k_flags;
-
- vt_${k}->attribute_defs = attr_defs;
-
+ VTABLE *vt_$k;
+ vt_${k} = Parrot_${classname}_${k}_get_vtable(interp);
+ vt_${k}->flags = $k_flags;
+ vt_${k}->attribute_defs = attr_defs;
vt_${k}->base_type = entry;
vt_${k}->whoami = vt->whoami;
vt_${k}->provides_str = vt->provides_str;
vt->${k}_variant_vtable = vt_${k};
- vt_${k}->${k}_variant_vtable = vt;
+ vt_${k}->${k}_variant_vtable = vt;
vt_${k}->isa_hash = vt->isa_hash;
}
@@ -669,17 +666,15 @@
}
$cout .= <<"EOC";
- {
- VTABLE * const vt = interp->vtables[entry];
-
- vt->mro = Parrot_${classname}_get_mro(interp, PMCNULL);
+ VTABLE * const vt = interp->vtables[entry];
- if (vt->ro_variant_vtable)
- vt->ro_variant_vtable->mro = vt->mro;
- }
-
- /* set up MRO and _namespace */
+ /* set up MRO, _class and _namespace */
+ vt->mro = Parrot_${classname}_get_mro(interp, PMCNULL);
Parrot_create_mro(interp, entry);
+ if (vt->ro_variant_vtable) {
+ vt->ro_variant_vtable->mro = vt->mro;
+ vt->ro_variant_vtable->pmc_class = vt->pmc_class;
+ }
EOC
$cout .= $self->write_nci_methods();
Modified: branches/tt389_fix/src/interp/inter_misc.c
==============================================================================
--- branches/tt389_fix/src/interp/inter_misc.c Wed Mar 17 17:09:04 2010 (r44984)
+++ branches/tt389_fix/src/interp/inter_misc.c Wed Mar 17 17:55:50 2010 (r44985)
@@ -24,6 +24,7 @@
#include "../compilers/imcc/imc.h"
#include "parrot/runcore_api.h"
#include "pmc/pmc_callcontext.h"
+#include "pmc/pmc_class.h"
#include "parrot/has_header.h"
@@ -116,8 +117,9 @@
ASSERT_ARGS(Parrot_mark_method_writes)
STRING *const str_name = Parrot_str_new_constant(interp, name);
PMC *const pmc_true = pmc_new(interp, enum_class_Integer);
- PMC *const method = VTABLE_get_pmc_keyed_str(
- interp, interp->vtables[type]->_namespace, str_name);
+ PMC * const pmc_class = interp->vtables[type]->pmc_class;
+ Parrot_Class_attributes * const class_info = PARROT_CLASS(pmc_class);
+ PMC *const method = VTABLE_get_pmc_keyed_str(interp, class_info->methods, str_name);
VTABLE_set_integer_native(interp, pmc_true, 1);
VTABLE_setprop(interp, method, CONST_STRING(interp, "write"), pmc_true);
}
More information about the parrot-commits
mailing list