[svn:parrot] r36582 - in trunk: src/pmc t/oo t/pmc

Infinoid at svn.parrot.org Infinoid at svn.parrot.org
Wed Feb 11 17:57:24 UTC 2009


Author: Infinoid
Date: Wed Feb 11 17:57:23 2009
New Revision: 36582
URL: https://trac.parrot.org/parrot/changeset/36582

Log:
Apply r36514 from vtable_morph_change branch.

Modified:
   trunk/src/pmc/float.pmc
   trunk/src/pmc/integer.pmc
   trunk/src/pmc/scalar.pmc
   trunk/src/pmc/undef.pmc
   trunk/t/oo/vtableoverride.t
   trunk/t/pmc/undef.t

Modified: trunk/src/pmc/float.pmc
==============================================================================
--- trunk/src/pmc/float.pmc	Wed Feb 11 17:57:16 2009	(r36581)
+++ trunk/src/pmc/float.pmc	Wed Feb 11 17:57:23 2009	(r36582)
@@ -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: trunk/src/pmc/integer.pmc
==============================================================================
--- trunk/src/pmc/integer.pmc	Wed Feb 11 17:57:16 2009	(r36581)
+++ trunk/src/pmc/integer.pmc	Wed Feb 11 17:57:23 2009	(r36582)
@@ -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: trunk/src/pmc/scalar.pmc
==============================================================================
--- trunk/src/pmc/scalar.pmc	Wed Feb 11 17:57:16 2009	(r36581)
+++ trunk/src/pmc/scalar.pmc	Wed Feb 11 17:57:23 2009	(r36582)
@@ -88,7 +88,7 @@
 
 /*
 
-=item C<void morph(INTVAL type)>
+=item C<void morph(PMC* type)>
 
 Morphs the scalar to the specified type.
 

Modified: trunk/src/pmc/undef.pmc
==============================================================================
--- trunk/src/pmc/undef.pmc	Wed Feb 11 17:57:16 2009	(r36581)
+++ trunk/src/pmc/undef.pmc	Wed Feb 11 17:57:23 2009	(r36582)
@@ -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: trunk/t/oo/vtableoverride.t
==============================================================================
--- trunk/t/oo/vtableoverride.t	Wed Feb 11 17:57:16 2009	(r36581)
+++ trunk/t/oo/vtableoverride.t	Wed Feb 11 17:57:23 2009	(r36582)
@@ -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: trunk/t/pmc/undef.t
==============================================================================
--- trunk/t/pmc/undef.t	Wed Feb 11 17:57:16 2009	(r36581)
+++ trunk/t/pmc/undef.t	Wed Feb 11 17:57:23 2009	(r36582)
@@ -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