[svn:parrot] r36585 - trunk/src/pmc

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


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

Log:
Apply r36562 from vtable_morph_change branch.

Modified:
   trunk/src/pmc/complex.pmc
   trunk/src/pmc/pointer.pmc
   trunk/src/pmc/ref.pmc
   trunk/src/pmc/scalar.pmc

Modified: trunk/src/pmc/complex.pmc
==============================================================================
--- trunk/src/pmc/complex.pmc	Wed Feb 11 17:57:31 2009	(r36584)
+++ trunk/src/pmc/complex.pmc	Wed Feb 11 17:57:35 2009	(r36585)
@@ -1248,7 +1248,7 @@
         GET_ATTR_re(INTERP, SELF, re);
         GET_ATTR_im(INTERP, SELF, im);
         d = sqrt(re*re + im*im);
-        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, d);
     }
 

Modified: trunk/src/pmc/pointer.pmc
==============================================================================
--- trunk/src/pmc/pointer.pmc	Wed Feb 11 17:57:31 2009	(r36584)
+++ trunk/src/pmc/pointer.pmc	Wed Feb 11 17:57:35 2009	(r36585)
@@ -40,19 +40,6 @@
 
 /*
 
-=item C<void morph(INTVAL type)>
-
-Does nothing.
-
-=cut
-
-*/
-
-    VTABLE void morph(PMC* type) {
-    }
-
-/*
-
 =item C<void mark()>
 
 Marks the pointer as live.

Modified: trunk/src/pmc/ref.pmc
==============================================================================
--- trunk/src/pmc/ref.pmc	Wed Feb 11 17:57:31 2009	(r36584)
+++ trunk/src/pmc/ref.pmc	Wed Feb 11 17:57:35 2009	(r36585)
@@ -140,19 +140,6 @@
         return SUPER();
     }
 
-/*
-
-=item C<void morph(PMC* type)>
-
-Changes the PMC to a PMC of a new type.
-
-=cut
-
-*/
-    VTABLE void morph(PMC* type) {
-        SUPER(type);
-    }
-
 }
 
 /*

Modified: trunk/src/pmc/scalar.pmc
==============================================================================
--- trunk/src/pmc/scalar.pmc	Wed Feb 11 17:57:31 2009	(r36584)
+++ trunk/src/pmc/scalar.pmc	Wed Feb 11 17:57:35 2009	(r36585)
@@ -73,7 +73,7 @@
     else {
         /* Overflow; must promote dest to BigInt, and do a BigInt shift. */
         if (self == dest)
-            VTABLE_morph(interp, self, interp->vtables[enum_class_BigInt]->pmc_class);
+            pmc_reuse(interp, self, enum_class_BigInt, 0);
         else
             dest = pmc_new(interp, enum_class_BigInt);
 
@@ -88,22 +88,6 @@
 
 /*
 
-=item C<void morph(PMC* type)>
-
-Morphs the scalar to the specified type.
-
-=cut
-
-*/
-
-    VTABLE void morph(PMC* type) {
-        INTVAL type_id = VTABLE_get_integer(interp, type);
-        if (SELF->vtable->base_type == type_id)
-            return;
-        pmc_reuse(INTERP, SELF, type_id, 0);
-    }
-/*
-
 =item C<void assign_pmc(PMC *value)>
 
 Sets the PMC C<*value>, calling the appropriate C<set_*> method
@@ -118,13 +102,12 @@
         STRING        *s_num;
         STRING        *s_str;
 
-        if (SELF->vtable->base_type == enum_class_Boolean) {
+        if (SELF->vtable->base_type == enum_class_Boolean)
             /* doesn't morph */
-            SELF.morph(value->vtable->pmc_class);
-        }
+            pmc_reuse(INTERP, SELF, value->vtable->base_type, 0);
 
         if (value->vtable->base_type == enum_class_Undef) {
-            SELF.morph(value->vtable->pmc_class);
+            pmc_reuse(INTERP, SELF, value->vtable->base_type, 0);
             return;
         }
 
@@ -149,7 +132,7 @@
             SELF.set_string_native(v);
             return;
         }
-        SELF.morph(interp->vtables[enum_class_Ref]->pmc_class);
+        pmc_reuse(INTERP, SELF, enum_class_Ref, 0);
         SELF.set_pmc(value);
     }
 
@@ -246,7 +229,7 @@
     MULTI void i_add(Complex value) {
         const FLOATVAL a = SELF.get_number();
 
-        VTABLE_morph(INTERP, SELF, value->vtable->pmc_class);
+        pmc_reuse(INTERP, SELF, enum_class_Complex, 0);
         VTABLE_set_number_native(INTERP, SELF,
                 a + VTABLE_get_number_keyed_int(INTERP, value, 0));
         VTABLE_set_number_keyed_int(INTERP, SELF, 1,
@@ -294,7 +277,7 @@
     MULTI PMC *subtract(Complex value, PMC *dest) {
         const FLOATVAL a = SELF.get_number();
         if (dest)
-            VTABLE_morph(INTERP, dest, value->vtable->pmc_class);
+            pmc_reuse(INTERP, dest, value->vtable->base_type, 0);
         else
             dest = pmc_new(INTERP, VTABLE_type(INTERP, value));
 
@@ -331,7 +314,7 @@
     MULTI void i_subtract(Complex value) {
         const FLOATVAL a = SELF.get_number();
 
-        VTABLE_morph(INTERP, SELF, value->vtable->pmc_class);
+        pmc_reuse(INTERP, SELF, enum_class_Complex, 0);
         VTABLE_set_number_native(INTERP, SELF,
                 a - VTABLE_get_number_keyed_int(INTERP, value, 0));
         VTABLE_set_number_keyed_int(INTERP, SELF, 1,


More information about the parrot-commits mailing list