[svn:parrot] r35611 - branches/morph_pmc_type/src/pmc
[email protected] Thu, 15 Jan 2009 17:10:10 -0800 (PST)
Newsgroups
perl.cvs.parrot
Message-ID
<[email protected] >
Author: Whiteknight
Date: Thu Jan 15 17:10:09 2009
New Revision: 35611
Modified:
branches/morph_pmc_type/src/pmc/bigint.pmc
branches/morph_pmc_type/src/pmc/complex.pmc
branches/morph_pmc_type/src/pmc/default.pmc
branches/morph_pmc_type/src/pmc/integer.pmc
branches/morph_pmc_type/src/pmc/scalar.pmc
branches/morph_pmc_type/src/pmc/undef.pmc
Log:
[morph_pmc_type] convert files in src/pmc/* to use VTABLE_morph_string instead of VTABLE_morph
Modified: branches/morph_pmc_type/src/pmc/bigint.pmc
==============================================================================
--- branches/morph_pmc_type/src/pmc/bigint.pmc (original)
+++ branches/morph_pmc_type/src/pmc/bigint.pmc Thu Jan 15 17:10:09 2009
@@ -230,13 +230,13 @@
static void
bigint_abs(PARROT_INTERP, PMC *self, PMC *dest) {
- VTABLE_morph(interp, dest, enum_class_BigInt);
+ VTABLE_morph_string(interp, dest, CONST_STRING("BigInt"));
mpz_abs(BN(dest), BN(self));
}
static void
bigint_neg(PARROT_INTERP, PMC *self, PMC *dest) {
- VTABLE_morph(interp, dest, enum_class_BigInt);
+ VTABLE_morph_string(interp, dest, CONST_STRING("BigInt"));
mpz_neg(BN(dest), BN(self));
}
@@ -788,7 +788,7 @@
MULTI PMC *subtract(BigInt value, PMC *dest) {
if (dest)
- VTABLE_morph(interp, dest, SELF->vtable->base_type);
+ VTABLE_morph_string(interp, dest, SELF->vtable->whoami);
else
dest = pmc_new(INTERP, SELF->vtable->base_type);
@@ -798,7 +798,7 @@
MULTI PMC *subtract(Integer value, PMC *dest) {
if (dest)
- VTABLE_morph(interp, dest, SELF->vtable->base_type);
+ VTABLE_morph_string(interp, dest, SELF->vtable->whoami);
else
dest = pmc_new(INTERP, SELF->vtable->base_type);
@@ -815,7 +815,7 @@
VTABLE PMC *subtract_int(INTVAL value, PMC *dest) {
if (dest)
- VTABLE_morph(interp, dest, SELF->vtable->base_type);
+ VTABLE_morph_string(interp, dest, SELF->vtable->whoami);
else
dest = pmc_new(INTERP, SELF->vtable->base_type);
@@ -902,7 +902,7 @@
VTABLE PMC *pow_int(INTVAL value, PMC *dest) {
if (dest)
- VTABLE_morph(interp, dest, SELF->vtable->base_type);
+ VTABLE_morph_string(interp, dest, SELF->vtable->whoami);
else
dest = pmc_new(INTERP, SELF->vtable->base_type);
@@ -921,7 +921,7 @@
MULTI PMC *divide(BigInt value, PMC *dest) {
if (dest)
- VTABLE_morph(interp, dest, SELF->vtable->base_type);
+ VTABLE_morph_string(interp, dest, SELF->vtable->whoami);
else
dest = pmc_new(INTERP, SELF->vtable->base_type);
@@ -939,7 +939,7 @@
MULTI PMC *divide(Integer value, PMC *dest) {
if (dest)
- VTABLE_morph(interp, dest, SELF->vtable->base_type);
+ VTABLE_morph_string(interp, dest, SELF->vtable->whoami);
else
dest = pmc_new(INTERP, SELF->vtable->base_type);
@@ -956,7 +956,7 @@
VTABLE PMC *divide_int(INTVAL value, PMC *dest) {
if (dest)
- VTABLE_morph(interp, dest, SELF->vtable->base_type);
+ VTABLE_morph_string(interp, dest, SELF->vtable->whoami);
else
dest = pmc_new(INTERP, SELF->vtable->base_type);
@@ -1004,7 +1004,7 @@
VTABLE PMC *floor_divide_int(INTVAL value, PMC *dest) {
if (dest)
- VTABLE_morph(interp, dest, SELF->vtable->base_type);
+ VTABLE_morph_string(interp, dest, SELF->vtable->whoami);
else
dest = pmc_new(INTERP, SELF->vtable->base_type);
@@ -1033,7 +1033,7 @@
MULTI PMC *modulus(BigInt value, PMC *dest) {
if (dest)
- VTABLE_morph(interp, dest, SELF->vtable->base_type);
+ VTABLE_morph_string(interp, dest, SELF->vtable->whoami);
else
dest = pmc_new(INTERP, SELF->vtable->base_type);
@@ -1043,7 +1043,7 @@
MULTI PMC *modulus(Integer value, PMC *dest) {
if (dest)
- VTABLE_morph(interp, dest, SELF->vtable->base_type);
+ VTABLE_morph_string(interp, dest, SELF->vtable->whoami);
else
dest = pmc_new(INTERP, SELF->vtable->base_type);
@@ -1168,7 +1168,7 @@
MULTI PMC *bitwise_shl(BigInt value, PMC *dest) {
if (dest)
- VTABLE_morph(interp, dest, SELF->vtable->base_type);
+ VTABLE_morph_string(interp, dest, SELF->vtable->whoami);
else
dest = pmc_new(INTERP, SELF->vtable->base_type);
@@ -1180,7 +1180,7 @@
MULTI PMC *bitwise_shl(Integer value, PMC *dest) {
if (dest)
- VTABLE_morph(interp, dest, SELF->vtable->base_type);
+ VTABLE_morph_string(interp, dest, SELF->vtable->whoami);
else
dest = pmc_new(INTERP, SELF->vtable->base_type);
@@ -1197,7 +1197,7 @@
VTABLE PMC *bitwise_shl_int(INTVAL value, PMC *dest) {
if (dest)
- VTABLE_morph(interp, dest, SELF->vtable->base_type);
+ VTABLE_morph_string(interp, dest, SELF->vtable->whoami);
else
dest = pmc_new(INTERP, SELF->vtable->base_type);
@@ -1248,7 +1248,7 @@
MULTI PMC *bitwise_shr(BigInt value, PMC *dest) {
if (dest)
- VTABLE_morph(interp, dest, SELF->vtable->base_type);
+ VTABLE_morph_string(interp, dest, SELF->vtable->whoami);
else
dest = pmc_new(INTERP, SELF->vtable->base_type);
@@ -1260,7 +1260,7 @@
MULTI PMC *bitwise_shr(Integer value, PMC *dest) {
if (dest)
- VTABLE_morph(interp, dest, SELF->vtable->base_type);
+ VTABLE_morph_string(interp, dest, SELF->vtable->whoami);
else
dest = pmc_new(INTERP, SELF->vtable->base_type);
@@ -1278,7 +1278,7 @@
VTABLE PMC *bitwise_shr_int(INTVAL value, PMC *dest) {
if (dest)
- VTABLE_morph(interp, dest, SELF->vtable->base_type);
+ VTABLE_morph_string(interp, dest, SELF->vtable->whoami);
else
dest = pmc_new(INTERP, SELF->vtable->base_type);
Modified: branches/morph_pmc_type/src/pmc/complex.pmc
==============================================================================
--- branches/morph_pmc_type/src/pmc/complex.pmc (original)
+++ branches/morph_pmc_type/src/pmc/complex.pmc Thu Jan 15 17:10:09 2009
@@ -1221,7 +1221,7 @@
GET_ATTR_re(INTERP, SELF, re);
GET_ATTR_im(INTERP, SELF, im);
d = sqrt(re*re + im*im);
- VTABLE_morph(INTERP, SELF, enum_class_Float); /* XXX */
+ VTABLE_morph_string(INTERP, SELF, interp->vtables[enum_class_Float]->whoami);
VTABLE_set_number_native(INTERP, SELF, d);
}
Modified: branches/morph_pmc_type/src/pmc/default.pmc
==============================================================================
--- branches/morph_pmc_type/src/pmc/default.pmc (original)
+++ branches/morph_pmc_type/src/pmc/default.pmc Thu Jan 15 17:10:09 2009
@@ -111,8 +111,11 @@
/* RT #46661 warn when this fails? */
if (on && (pmc->vtable->flags & VTABLE_HAS_CONST_TOO))
pmc->vtable = interp->vtables[pmc->vtable->base_type + 1];
- else if (!on && (pmc->vtable->flags & (VTABLE_IS_CONST_FLAG)))
- VTABLE_morph(interp, pmc, pmc->vtable->base_type - 1);
+ else if (!on && (pmc->vtable->flags & (VTABLE_IS_CONST_FLAG))) {
+ /* this is a little bit of a hack. */
+ STRING * typename = interp->vtables[pmc->vtable->base_type - 1]->whoami;
+ VTABLE_morph_string(interp, pmc, typename);
+ }
else if (on && (pmc->vtable->flags & VTABLE_HAS_READONLY_FLAG))
pmc->vtable = pmc->vtable->ro_variant_vtable;
else if (!on && (pmc->vtable->flags & VTABLE_IS_READONLY_FLAG)
Modified: branches/morph_pmc_type/src/pmc/integer.pmc
==============================================================================
--- branches/morph_pmc_type/src/pmc/integer.pmc (original)
+++ branches/morph_pmc_type/src/pmc/integer.pmc Thu Jan 15 17:10:09 2009
@@ -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, enum_class_BigInt);
+ VTABLE_morph_string(interp, self, interp->vtables[enum_class_BigInt]->whoami);
VTABLE_set_integer_native(interp, self, a);
return self;
}
@@ -280,25 +280,25 @@
*/
VTABLE void set_number_native(FLOATVAL value) {
- SELF.morph(enum_class_Float);
+ SELF.morph_string(interp->vtables[enum_class_Float]->whoami);
SELF.set_number_native(value);
}
VTABLE void set_bool(INTVAL value) {
- SELF.morph(enum_class_Boolean);
+ SELF.morph_string(interp->vtables[enum_class_Boolean]->whoami);
SELF.set_bool(value);
}
VTABLE void set_bignum_int(INTVAL value) {
- SELF.morph(enum_class_BigInt);
+ SELF.morph_string(interp->vtables[enum_class_BigInt]->whoami);
SELF.set_integer_native(value);
}
VTABLE void set_string_native(STRING *value) {
- SELF.morph(enum_class_String);
+ SELF.morph_string(interp->vtables[enum_class_String]->whoami);
SELF.set_string_native(value);
}
@@ -418,7 +418,7 @@
MULTI void i_add(Complex value) {
const INTVAL a = SELF.get_integer();
- VTABLE_morph(INTERP, SELF, value->vtable->base_type);
+ VTABLE_morph_string(INTERP, SELF, value->vtable->whoami);
VTABLE_set_number_native(INTERP, SELF,
SELF.get_integer() + VTABLE_get_number(INTERP, value));
}
@@ -574,7 +574,7 @@
MULTI void i_subtract(Complex value) {
const INTVAL a = SELF.get_integer();
- VTABLE_morph(INTERP, SELF, value->vtable->base_type);
+ VTABLE_morph_string(INTERP, SELF, value->vtable->whoami);
VTABLE_set_number_native(INTERP, SELF,
(FLOATVAL)a - VTABLE_get_number_keyed_int(INTERP, value, 0));
VTABLE_set_number_keyed_int(INTERP, SELF, 1,
@@ -1237,7 +1237,7 @@
if ((c^a) >= 0 || (c^1) >= 0)
VTABLE_set_integer_native(interp, SELF, c);
else {
- VTABLE_morph(INTERP, SELF, enum_class_BigInt);
+ VTABLE_morph_string(INTERP, SELF, interp->vtables[enum_class_BigInt]->whoami);
VTABLE_set_integer_native(INTERP, SELF, a);
VTABLE_increment(interp, SELF);
}
@@ -1261,7 +1261,7 @@
if ((c^a) >= 0 || (c^~1) >= 0)
VTABLE_set_integer_native(interp, SELF, c);
else {
- VTABLE_morph(interp, SELF, enum_class_BigInt);
+ VTABLE_morph_string(interp, SELF, interp->vtables[enum_class_BigInt]->whoami);
VTABLE_set_integer_native(interp, SELF, a);
VTABLE_decrement(interp, SELF);
}
Modified: branches/morph_pmc_type/src/pmc/scalar.pmc
==============================================================================
--- branches/morph_pmc_type/src/pmc/scalar.pmc (original)
+++ branches/morph_pmc_type/src/pmc/scalar.pmc Thu Jan 15 17:10:09 2009
@@ -73,7 +73,7 @@
else {
/* Overflow; must promote dest to BigInt, and do a BigInt shift. */
if (self == dest)
- VTABLE_morph(interp, self, enum_class_BigInt);
+ VTABLE_morph_string(interp, self, interp->vtables[enum_class_BigInt]->whoami);
else
dest = pmc_new(interp, enum_class_BigInt);
@@ -252,7 +252,7 @@
MULTI void i_add(Complex value) {
const FLOATVAL a = SELF.get_number();
- VTABLE_morph(INTERP, SELF, value->vtable->base_type);
+ VTABLE_morph_string(INTERP, SELF, value->vtable->whoami);
VTABLE_set_number_native(INTERP, SELF,
a + VTABLE_get_number_keyed_int(INTERP, value, 0));
VTABLE_set_number_keyed_int(INTERP, SELF, 1,
@@ -300,7 +300,7 @@
MULTI PMC *subtract(Complex value, PMC *dest) {
const FLOATVAL a = SELF.get_number();
if (dest)
- VTABLE_morph(INTERP, dest, value->vtable->base_type);
+ VTABLE_morph_string(INTERP, dest, value->vtable->whoami);
else
dest = pmc_new(INTERP, VTABLE_type(INTERP, value));
@@ -337,7 +337,7 @@
MULTI void i_subtract(Complex value) {
const FLOATVAL a = SELF.get_number();
- VTABLE_morph(INTERP, SELF, value->vtable->base_type);
+ VTABLE_morph_string(INTERP, SELF, value->vtable->whoami);
VTABLE_set_number_native(INTERP, SELF,
a - VTABLE_get_number_keyed_int(INTERP, value, 0));
VTABLE_set_number_keyed_int(INTERP, SELF, 1,
Modified: branches/morph_pmc_type/src/pmc/undef.pmc
==============================================================================
--- branches/morph_pmc_type/src/pmc/undef.pmc (original)
+++ branches/morph_pmc_type/src/pmc/undef.pmc Thu Jan 15 17:10:09 2009
@@ -40,7 +40,7 @@
*/
VTABLE void set_pmc(PMC *other) {
- VTABLE_morph(INTERP, SELF, enum_class_Ref);
+ VTABLE_morph_string(INTERP, SELF, interp->vtables[enum_class_Ref]->whoami);
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->base_type);
+ VTABLE_morph_string(INTERP, SELF, other->vtable->whoami);
/* 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, enum_class_Integer);
+ VTABLE_morph_string(INTERP, SELF, interp->vtables[enum_class_Integer]->whoami);
VTABLE_set_integer_native(INTERP, SELF, value);
}
@@ -133,7 +133,7 @@
*/
VTABLE void set_number_native(FLOATVAL value) {
- VTABLE_morph(INTERP, SELF, enum_class_Float);
+ VTABLE_morph_string(INTERP, SELF, interp->vtables[enum_class_Float]->whoami);
VTABLE_set_number_native(INTERP, SELF, value);
}
@@ -162,7 +162,7 @@
*/
VTABLE void set_string_native(STRING *value) {
- VTABLE_morph(INTERP, SELF, UNDEF_STRING_CLASS);
+ VTABLE_morph_string(INTERP, SELF, interp->vtables[UNDEF_STRING_CLASS]->whoami);
VTABLE_set_string_native(INTERP, SELF, value);
}