[svn:parrot] r36514 - in branches/vtable_morph_change: src/pmc t/oo t/pmc
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Tue Feb 10 01:33:19 UTC 2009
Author: whiteknight
Date: Tue Feb 10 01:33:16 2009
New Revision: 36514
URL: https://trac.parrot.org/parrot/changeset/36514
Log:
fix a bunch of VTABLE_morph calls to redirect to pmc_reuse, and fix a few tests to use the new opcode
Modified:
branches/vtable_morph_change/src/pmc/float.pmc
branches/vtable_morph_change/src/pmc/integer.pmc
branches/vtable_morph_change/src/pmc/scalar.pmc
branches/vtable_morph_change/src/pmc/undef.pmc
branches/vtable_morph_change/t/oo/vtableoverride.t
branches/vtable_morph_change/t/pmc/undef.t
Modified: branches/vtable_morph_change/src/pmc/float.pmc
==============================================================================
--- branches/vtable_morph_change/src/pmc/float.pmc Tue Feb 10 00:34:19 2009 (r36513)
+++ branches/vtable_morph_change/src/pmc/float.pmc Tue Feb 10 01:33:16 2009 (r36514)
@@ -170,12 +170,12 @@
*/
VTABLE void set_integer_native(INTVAL value) {
- SELF.morph(enum_class_Integer);
+ pmc_reuse(INTERP, SELF, enum_class_Integer, 0);
SELF.set_integer_native(value);
}
VTABLE void set_bool(INTVAL value) {
- SELF.morph(enum_class_Boolean);
+ pmc_reuse(INTERP, SELF, enum_class_Boolean, 0);
SELF.set_bool(value);
}
@@ -222,7 +222,7 @@
*/
VTABLE void set_string_native(STRING *value) {
- SELF.morph(enum_class_String);
+ pmc_reuse(INTERP, SELF, enum_class_String, 0);
SELF.set_string_native(value);
}
Modified: branches/vtable_morph_change/src/pmc/integer.pmc
==============================================================================
--- branches/vtable_morph_change/src/pmc/integer.pmc Tue Feb 10 00:34:19 2009 (r36513)
+++ branches/vtable_morph_change/src/pmc/integer.pmc Tue Feb 10 01:33:16 2009 (r36514)
@@ -46,7 +46,7 @@
/* Do an in-place upgrade to a Bignum of SELF and return a pointer
to it (which is probably redundant, but whatever). */
const INTVAL a = VTABLE_get_integer(interp, self);
- VTABLE_morph(interp, self, interp->vtables[enum_class_BigInt]->pmc_class);
+ pmc_reuse(interp, self, enum_class_BigInt, 0);
VTABLE_set_integer_native(interp, self, a);
return self;
}
@@ -313,25 +313,25 @@
*/
VTABLE void set_number_native(FLOATVAL value) {
- SELF.morph(enum_class_Float);
+ pmc_reuse(INTERP, SELF, enum_class_Float, 0);
SELF.set_number_native(value);
}
VTABLE void set_bool(INTVAL value) {
- SELF.morph(enum_class_Boolean);
+ pmc_reuse(INTERP, SELF, enum_class_Boolean, 0);
SELF.set_bool(value);
}
VTABLE void set_bignum_int(INTVAL value) {
- SELF.morph(enum_class_BigInt);
+ pmc_reuse(INTERP, SELF, enum_class_BigInt, 0);
SELF.set_integer_native(value);
}
VTABLE void set_string_native(STRING *value) {
- SELF.morph(enum_class_String);
+ pmc_reuse(INTERP, SELF, enum_class_String, 0);
SELF.set_string_native(value);
}
@@ -451,7 +451,7 @@
MULTI void i_add(Complex value) {
const INTVAL a = SELF.get_integer();
- VTABLE_morph(INTERP, SELF, value->vtable->pmc_class);
+ pmc_reuse(INTERP, SELF, enum_class_Complex, 0);
VTABLE_set_number_native(INTERP, SELF,
SELF.get_integer() + VTABLE_get_number(INTERP, value));
}
@@ -609,7 +609,7 @@
MULTI void i_subtract(Complex value) {
const INTVAL a = SELF.get_integer();
- VTABLE_morph(INTERP, SELF, value->vtable->pmc_class);
+ pmc_reuse(INTERP, SELF, enum_class_Complex, 0);
VTABLE_set_number_native(INTERP, SELF,
(FLOATVAL)a - VTABLE_get_number_keyed_int(INTERP, value, 0));
VTABLE_set_number_keyed_int(INTERP, SELF, 1,
@@ -1272,7 +1272,7 @@
if ((c^a) >= 0 || (c^1) >= 0)
VTABLE_set_integer_native(interp, SELF, c);
else {
- VTABLE_morph(INTERP, SELF, interp->vtables[enum_class_BigInt]->pmc_class);
+ pmc_reuse(INTERP, SELF, enum_class_BigInt, 0);
VTABLE_set_integer_native(INTERP, SELF, a);
VTABLE_increment(interp, SELF);
}
@@ -1296,7 +1296,7 @@
if ((c^a) >= 0 || (c^~1) >= 0)
VTABLE_set_integer_native(interp, SELF, c);
else {
- VTABLE_morph(interp, SELF, interp->vtables[enum_class_BigInt]->pmc_class);
+ pmc_reuse(INTERP, SELF, enum_class_BigInt, 0);
VTABLE_set_integer_native(interp, SELF, a);
VTABLE_decrement(interp, SELF);
}
Modified: branches/vtable_morph_change/src/pmc/scalar.pmc
==============================================================================
--- branches/vtable_morph_change/src/pmc/scalar.pmc Tue Feb 10 00:34:19 2009 (r36513)
+++ branches/vtable_morph_change/src/pmc/scalar.pmc Tue Feb 10 01:33:16 2009 (r36514)
@@ -88,7 +88,7 @@
/*
-=item C<void morph(INTVAL type)>
+=item C<void morph(PMC* type)>
Morphs the scalar to the specified type.
Modified: branches/vtable_morph_change/src/pmc/undef.pmc
==============================================================================
--- branches/vtable_morph_change/src/pmc/undef.pmc Tue Feb 10 00:34:19 2009 (r36513)
+++ branches/vtable_morph_change/src/pmc/undef.pmc Tue Feb 10 01:33:16 2009 (r36514)
@@ -40,7 +40,7 @@
*/
VTABLE void set_pmc(PMC *other) {
- VTABLE_morph(INTERP, SELF, interp->vtables[enum_class_Ref]->pmc_class);
+ pmc_reuse(INTERP, SELF, enum_class_Ref, 0);
VTABLE_set_pmc(INTERP, SELF, other);
}
@@ -57,7 +57,7 @@
VTABLE void assign_pmc(PMC *other) {
if (!PObj_is_object_TEST(other))
- VTABLE_morph(INTERP, SELF, other->vtable->pmc_class);
+ pmc_reuse(INTERP, SELF, other->vtable->type, 0);
/* don't want to call set_pmc if we're assigning an Undef to an Undef */
if (other->vtable->base_type != enum_class_Undef)
@@ -104,7 +104,7 @@
*/
VTABLE void set_integer_native(INTVAL value) {
- VTABLE_morph(INTERP, SELF, interp->vtables[enum_class_Integer]->pmc_class);
+ pmc_reuse(INTERP, SELF, enum_class_Integer, 0);
VTABLE_set_integer_native(INTERP, SELF, value);
}
@@ -133,7 +133,7 @@
*/
VTABLE void set_number_native(FLOATVAL value) {
- VTABLE_morph(INTERP, SELF, interp->vtables[enum_class_Float]->pmc_class);
+ pmc_reuse(INTERP, SELF, enum_class_Float, 0);
VTABLE_set_number_native(INTERP, SELF, value);
}
@@ -165,7 +165,7 @@
*/
VTABLE void set_string_native(STRING *value) {
- VTABLE_morph(INTERP, SELF, interp->vtables[enum_class_String]->pmc_class);
+ pmc_reuse(interp, SELF, enum_class_String, 0);
VTABLE_set_string_native(INTERP, SELF, value);
}
Modified: branches/vtable_morph_change/t/oo/vtableoverride.t
==============================================================================
--- branches/vtable_morph_change/t/oo/vtableoverride.t Tue Feb 10 00:34:19 2009 (r36513)
+++ branches/vtable_morph_change/t/oo/vtableoverride.t Tue Feb 10 01:33:16 2009 (r36514)
@@ -44,21 +44,23 @@
is ($I0, 0, "no it doesn't")
# Test morph (doesn't actually perform a morph)
- morph $P1, "String"
+ $P2 = get_class 'String'
+ morph $P1, $P2
$P0 = getattribute $P1, "message"
$S0 = $P0
is($S0, "Morphing [MyObject] to type String", "Morph VTABLE override 1")
- morph $P1, "Integer"
+ $P2 = get_class 'Integer'
+ morph $P1, $P2
$P0 = getattribute $P1, "message"
$S0 = $P0
is($S0, "Morphing [MyObject] to type Integer", "Morph VTABLE override 1")
-
+
# Test invoke. Doesn't currently work so we need to fix that.
#$P0 = $P1("invoked!")
#$S0 = $P0
#is($S0, "invoked!", "Invoke VTABLE override return value")
-
+
#$P0 = getattribute $P1, "message"
#$S0 = $P0
#is($S0, "invoked!", "Invoke VTABLE override sideeffects")
Modified: branches/vtable_morph_change/t/pmc/undef.t
==============================================================================
--- branches/vtable_morph_change/t/pmc/undef.t Tue Feb 10 00:34:19 2009 (r36513)
+++ branches/vtable_morph_change/t/pmc/undef.t Tue Feb 10 01:33:16 2009 (r36514)
@@ -99,7 +99,8 @@
.sub string_pmc_morph_to_undef
.local pmc pmc1
pmc1 = new ['String']
- morph pmc1, 'Undef'
+ $P0 = get_class 'Undef'
+ morph pmc1, $P0
$S1 = typeof pmc1
is( $S1, 'Undef', 'PMC String morph to undef' )
.end
More information about the parrot-commits
mailing list