[svn:parrot] r39481 - in branches/pmc_i_ops: src/pmc t/native_pbc

bacek at svn.parrot.org bacek at svn.parrot.org
Tue Jun 9 22:15:56 UTC 2009


Author: bacek
Date: Tue Jun  9 22:15:55 2009
New Revision: 39481
URL: https://trac.parrot.org/parrot/changeset/39481

Log:
[pmc] Replace SELF.clone with pmc_new/set combo

Modified:
   branches/pmc_i_ops/src/pmc/bigint.pmc
   branches/pmc_i_ops/src/pmc/integer.pmc
   branches/pmc_i_ops/src/pmc/scalar.pmc
   branches/pmc_i_ops/t/native_pbc/annotations.pbc
   branches/pmc_i_ops/t/native_pbc/integer_1.pbc
   branches/pmc_i_ops/t/native_pbc/number_1.pbc
   branches/pmc_i_ops/t/native_pbc/string_1.pbc

Modified: branches/pmc_i_ops/src/pmc/bigint.pmc
==============================================================================
--- branches/pmc_i_ops/src/pmc/bigint.pmc	Tue Jun  9 21:52:47 2009	(r39480)
+++ branches/pmc_i_ops/src/pmc/bigint.pmc	Tue Jun  9 22:15:55 2009	(r39481)
@@ -835,7 +835,8 @@
     }
 
     MULTI PMC *add(DEFAULT value, PMC *dest) {
-        dest = SELF.clone();
+        dest = pmc_new(INTERP, SELF.type());
+        bigint_set(INTERP, dest, SELF);
         VTABLE_i_add(INTERP, dest, value);
         return dest;
     }
@@ -875,7 +876,8 @@
 
 
     MULTI PMC *subtract(DEFAULT value, PMC *dest) {
-        dest = SELF.clone();
+        dest = pmc_new(INTERP, SELF.type());
+        bigint_set(INTERP, dest, SELF);
         VTABLE_i_subtract(INTERP, dest, value);
         return dest;
     }
@@ -915,7 +917,8 @@
 
 
     MULTI PMC *multiply(DEFAULT value, PMC *dest) {
-        dest = SELF.clone();
+        dest = pmc_new(INTERP, SELF.type());
+        bigint_set(INTERP, dest, SELF);
         VTABLE_i_multiply(INTERP, dest, value);
         return dest;
     }
@@ -987,7 +990,8 @@
     }
 
     MULTI PMC *divide(DEFAULT value, PMC *dest) {
-        dest = SELF.clone();
+        dest = pmc_new(INTERP, SELF.type());
+        bigint_set(INTERP, dest, SELF);
         VTABLE_i_divide(INTERP, dest, value);
         return dest;
     }
@@ -1019,7 +1023,8 @@
     }
 
     MULTI PMC *floor_divide(DEFAULT value, PMC *dest) {
-        dest = SELF.clone();
+        dest = pmc_new(INTERP, SELF.type());
+        bigint_set(INTERP, dest, SELF);
         VTABLE_i_floor_divide(INTERP, dest, value);
         return dest;
     }
@@ -1051,7 +1056,8 @@
     }
 
     MULTI PMC *modulus(DEFAULT value, PMC *dest) {
-        dest = SELF.clone();
+        dest = pmc_new(INTERP, SELF.type());
+        bigint_set(INTERP, dest, SELF);
         VTABLE_i_modulus(INTERP, dest, value);
         return dest;
     }
@@ -1167,7 +1173,8 @@
 */
 
     MULTI PMC *bitwise_shl(DEFAULT value, PMC *dest) {
-        dest = SELF.clone();
+        dest = pmc_new(INTERP, SELF.type());
+        bigint_set(INTERP, dest, SELF);
         VTABLE_i_bitwise_shl(INTERP, dest, value);
         return dest;
     }
@@ -1222,7 +1229,8 @@
 */
 
     MULTI PMC *bitwise_shr(DEFAULT value, PMC *dest) {
-        dest = SELF.clone();
+        dest = pmc_new(INTERP, SELF.type());
+        bigint_set(INTERP, dest, SELF);
         VTABLE_i_bitwise_shr(INTERP, dest, value);
         return dest;
     }

Modified: branches/pmc_i_ops/src/pmc/integer.pmc
==============================================================================
--- branches/pmc_i_ops/src/pmc/integer.pmc	Tue Jun  9 21:52:47 2009	(r39480)
+++ branches/pmc_i_ops/src/pmc/integer.pmc	Tue Jun  9 22:15:55 2009	(r39481)
@@ -357,13 +357,15 @@
 
 */
     MULTI PMC *add(DEFAULT value, PMC *dest) {
-        dest = VTABLE_clone(INTERP, SELF);
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_integer_native(INTERP, dest, SELF.get_integer());
         VTABLE_i_add(INTERP, dest, value);
         return dest;
     }
 
     VTABLE PMC *add_int(INTVAL value, PMC *dest) {
-        dest = VTABLE_clone(INTERP, SELF);
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_integer_native(INTERP, dest, SELF.get_integer());
         Integer.dest.i_add_int(value);
         return dest;
     }
@@ -435,7 +437,8 @@
 */
 
     MULTI PMC *subtract(DEFAULT value, PMC *dest) {
-        dest = VTABLE_clone(INTERP, SELF);
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_integer_native(INTERP, dest, SELF.get_integer());
         VTABLE_i_subtract(INTERP, dest, value);
         return dest;
     }
@@ -451,7 +454,8 @@
 */
 
     VTABLE PMC *subtract_int(INTVAL b, PMC *dest) {
-        dest = VTABLE_clone(INTERP, SELF);
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_integer_native(INTERP, dest, SELF.get_integer());
         Integer.dest.i_subtract_int(b);
         return dest;
     }
@@ -523,14 +527,16 @@
 */
 
     MULTI PMC *multiply(PMC *value, PMC *dest) {
-        dest = VTABLE_clone(INTERP, SELF);
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_integer_native(INTERP, dest, SELF.get_integer());
         VTABLE_i_multiply(INTERP, dest, value);
         return dest;
     }
 
 
     VTABLE PMC *multiply_int(INTVAL b, PMC *dest) {
-        dest = VTABLE_clone(INTERP, SELF);
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_integer_native(INTERP, dest, SELF.get_integer());
         Integer.dest.i_multiply_int(b);
         return dest;
     }
@@ -614,7 +620,8 @@
 */
 
     MULTI PMC *divide(DEFAULT value, PMC *dest) {
-        dest = VTABLE_clone(INTERP, SELF);
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_integer_native(INTERP, dest, SELF.get_integer());
         VTABLE_i_divide(INTERP, dest, value);
         return dest;
     }
@@ -659,19 +666,22 @@
 */
 
     MULTI PMC *floor_divide(DEFAULT value, PMC *dest) {
-        dest = VTABLE_clone(INTERP, SELF);
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_integer_native(INTERP, dest, SELF.get_integer());
         VTABLE_i_floor_divide(INTERP, dest, value);
         return dest;
     }
 
     VTABLE PMC *floor_divide_int(INTVAL value, PMC *dest) {
-        dest = VTABLE_clone(INTERP, SELF);
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_integer_native(INTERP, dest, SELF.get_integer());
         VTABLE_i_floor_divide_int(INTERP, dest, value);
         return dest;
     }
 
     VTABLE PMC *floor_divide_float(FLOATVAL value, PMC *dest) {
-        dest = VTABLE_clone(INTERP, SELF);
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_integer_native(INTERP, dest, SELF.get_integer());
         VTABLE_i_floor_divide_float(INTERP, dest, value);
         return dest;
     }
@@ -744,21 +754,24 @@
 
 
     MULTI PMC *modulus(DEFAULT value, PMC *dest) {
-        dest = VTABLE_clone(INTERP, SELF);
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_integer_native(INTERP, dest, SELF.get_integer());
         VTABLE_i_modulus(INTERP, dest, value);
         return dest;
     }
 
 
     VTABLE PMC *modulus_int(INTVAL value, PMC *dest) {
-        dest = VTABLE_clone(INTERP, SELF);
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_integer_native(INTERP, dest, SELF.get_integer());
         STATICSELF.i_modulus_int(value);
         return dest;
     }
 
 
     VTABLE PMC *modulus_float(FLOATVAL value, PMC *dest) {
-        dest = VTABLE_clone(INTERP, SELF);
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_integer_native(INTERP, dest, SELF.get_integer());
         STATICSELF.i_modulus_float(value);
         return dest;
     }

Modified: branches/pmc_i_ops/src/pmc/scalar.pmc
==============================================================================
--- branches/pmc_i_ops/src/pmc/scalar.pmc	Tue Jun  9 21:52:47 2009	(r39480)
+++ branches/pmc_i_ops/src/pmc/scalar.pmc	Tue Jun  9 22:15:55 2009	(r39481)
@@ -172,7 +172,8 @@
 */
 
     MULTI PMC *add(DEFAULT value, PMC *dest) {
-        dest = SELF.clone();
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_number_native(INTERP, dest, SELF.get_number());
         VTABLE_i_add(INTERP, dest, value);
         return dest;
     }
@@ -242,7 +243,8 @@
 */
 
     MULTI PMC *subtract(DEFAULT value, PMC *dest) {
-        dest = SELF.clone();
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_number_native(INTERP, dest, SELF.get_number());
         VTABLE_i_subtract(INTERP, dest, value);
         return dest;
     }
@@ -303,7 +305,8 @@
 */
 
     MULTI PMC *multiply(DEFAULT value, PMC *dest) {
-        dest = SELF.clone();
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_number_native(INTERP, dest, SELF.get_number());
         VTABLE_i_multiply(INTERP, dest, value);
         return dest;
     }
@@ -367,7 +370,8 @@
 */
 
     MULTI PMC *divide(DEFAULT value, PMC *dest) {
-        dest = SELF.clone();
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_number_native(INTERP, dest, SELF.get_number());
         VTABLE_i_divide(INTERP, dest, value);
         return dest;
     }
@@ -443,7 +447,8 @@
 */
 
     MULTI PMC *floor_divide(DEFAULT value, PMC *dest) {
-        dest = SELF.clone();
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_number_native(INTERP, dest, SELF.get_number());
         VTABLE_i_floor_divide(INTERP, dest, value);
         return dest;
     }
@@ -525,7 +530,8 @@
 */
 
     MULTI PMC *modulus(DEFAULT value, PMC *dest) {
-        dest = SELF.clone();
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_number_native(INTERP, dest, SELF.get_number());
         VTABLE_i_modulus(INTERP, dest, value);
         return dest;
     }
@@ -607,7 +613,8 @@
 */
 
     MULTI PMC *pow(DEFAULT value, PMC *dest) {
-        dest = SELF.clone();
+        dest = pmc_new(INTERP, SELF.type());
+        VTABLE_set_number_native(INTERP, dest, SELF.get_number());
         VTABLE_i_pow(INTERP, dest, value);
         return dest;
     }

Modified: branches/pmc_i_ops/t/native_pbc/annotations.pbc
==============================================================================
Binary file (source and/or target). No diff available.

Modified: branches/pmc_i_ops/t/native_pbc/integer_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.

Modified: branches/pmc_i_ops/t/native_pbc/number_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.

Modified: branches/pmc_i_ops/t/native_pbc/string_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.


More information about the parrot-commits mailing list