Skip to content
Browse files

#25266

PMC accessor macros come in a bewildering variety of forms, depend upon
one another, are scattered throughout pobj.h, are generally difficult to
decipher...

This patch defines yet another set of accessor macros, but these have a
consistent naming strategy, qualified names, are declared together, and
don't depend on one another. They make the layout of a PMC much clearer
to the casual reader, and allow experimentation with PMC layout. Idea is
for subsequent patches to remove other "direct" accesses which make use
of the old macros.

Courtesy of Gordon Henriksen


git-svn-id: https://svn.parrot.org/parrot/trunk@5150 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent a05c30f commit 8d6d5d36df1ab6717bda3b6d0ce3dd0d0f14d94c Leopold Toetsch committed
View
16 classes/array.pmc
@@ -512,22 +512,22 @@ pmclass Array need_ext does array {
PObj_get_FLAGS(ret) |= KEY_integer_FLAG;
switch (what) {
case ITERATE_FROM_START: /* reset key */
- ret->cache.int_val = 0;
+ PMC_int_val(ret) = 0;
if (!n)
- ret->cache.int_val = -1;
+ PMC_int_val(ret) = -1;
break;
case ITERATE_GET_NEXT:
- if (ret->cache.int_val < n - 1)
- ++ret->cache.int_val;
+ if (PMC_int_val(ret) < n - 1)
+ ++PMC_int_val(ret);
else
- ret->cache.int_val = -1;
+ PMC_int_val(ret) = -1;
break;
case ITERATE_GET_PREV:
- if (ret->cache.int_val >= 0)
- --ret->cache.int_val;
+ if (PMC_int_val(ret) >= 0)
+ --PMC_int_val(ret);
break;
case ITERATE_FROM_END:
- ret->cache.int_val = n - 1;
+ PMC_int_val(ret) = n - 1;
break;
}
return ret;
View
16 classes/boolean.pmc
@@ -19,41 +19,41 @@ pmclass Boolean extends PerlInt {
void set_integer_native (INTVAL value) {
- SELF->cache.int_val = (value != 0);
+ PMC_int_val(SELF) = (value != 0);
}
void set_number_native (FLOATVAL value) {
- SELF->cache.int_val = (value!=0);
+ PMC_int_val(SELF) = (value!=0);
}
void set_string_native (STRING* value) {
- SELF->cache.int_val = string_bool(value);
+ PMC_int_val(SELF) = string_bool(value);
}
void neg (PMC* dest) {
if (!dest)
- SELF->cache.int_val = -SELF->cache.int_val;
+ PMC_int_val(SELF) = -PMC_int_val(SELF);
else
- VTABLE_set_integer_native(INTERP, dest, -SELF->cache.int_val);
+ VTABLE_set_integer_native(INTERP, dest, -PMC_int_val(SELF));
}
void logical_or (PMC* value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- SELF->cache.int_val ||
+ PMC_int_val(SELF) ||
VTABLE_get_bool(INTERP, value)
);
}
void logical_and (PMC* value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- SELF->cache.int_val &&
+ PMC_int_val(SELF) &&
VTABLE_get_bool(INTERP, value)
);
}
void logical_xor (PMC* value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- ( SELF->cache.int_val ? 1 : 0 ) ^
+ ( PMC_int_val(SELF) ? 1 : 0 ) ^
VTABLE_get_bool(INTERP, value)
);
}
View
6 classes/closure.pmc
@@ -19,7 +19,7 @@ pmclass Closure extends Sub {
void init () {
PMC_sub(SELF) = new_closure(INTERP);
- SELF->cache.struct_val = NULL;
+ PMC_struct_val(SELF) = NULL;
PObj_custom_mark_destroy_SETALL(SELF);
if (Interp_flags_TEST(interpreter, PARROT_DEBUG_FLAG))
printf("Address of base segment is %p\n", ((struct Parrot_Sub *)PMC_sub(SELF))->seg->base.pf->byte_code);
@@ -49,12 +49,12 @@ pmclass Closure extends Sub {
void set_same (PMC* value) {
PMC_sub(SELF) = PMC_sub(value);
- SELF->cache.struct_val = value->cache.struct_val;
+ PMC_struct_val(SELF) = PMC_struct_val(value);
}
INTVAL is_equal (PMC* value) {
return (SELF->vtable == value->vtable &&
- SELF->cache.struct_val == value->cache.struct_val &&
+ PMC_struct_val(SELF) == PMC_struct_val(value) &&
memcmp(PMC_sub(value), PMC_sub(SELF),
sizeof(struct Parrot_Sub)) == 0);
}
View
2 classes/continuation.pmc
@@ -18,7 +18,7 @@ pmclass Continuation extends Closure {
void init () {
PMC_sub(SELF) = new_continuation(INTERP);
- SELF->cache.struct_val = NULL;
+ PMC_struct_val(SELF) = NULL;
PObj_custom_mark_destroy_SETALL(SELF);
}
View
6 classes/coroutine.pmc
@@ -18,15 +18,15 @@ pmclass Coroutine extends Continuation {
void init () {
PMC_sub(SELF) = new_coroutine(INTERP);
- SELF->cache.struct_val = NULL;
+ PMC_struct_val(SELF) = NULL;
PObj_custom_mark_destroy_SETALL(SELF);
PObj_get_FLAGS(SELF) &= ~PObj_private0_FLAG;
}
void* invoke (void* next) {
- void * dest = SELF->cache.struct_val;
- SELF->cache.struct_val = next;
+ void * dest = PMC_struct_val(SELF);
+ PMC_struct_val(SELF) = next;
swap_context(interpreter, SELF);
return dest;
View
10 classes/csub.pmc
@@ -18,7 +18,7 @@ pmclass CSub {
PMC* clone () {
PMC* dest = pmc_new_noinit(INTERP, SELF->vtable->base_type);
- dest->cache.struct_val = SELF->cache.struct_val;
+ PMC_struct_val(dest) = PMC_struct_val(SELF);
return dest;
}
@@ -31,21 +31,21 @@ pmclass CSub {
}
void set_same (PMC* value) {
- SELF->cache.struct_val = value->cache.struct_val;
+ PMC_struct_val(SELF) = PMC_struct_val(value);
}
INTVAL is_equal (PMC* value) {
return (SELF->vtable == value->vtable
- && SELF->cache.struct_val == value->cache.struct_val);
+ && PMC_struct_val(SELF) == PMC_struct_val(value));
}
INTVAL defined () {
- return SELF->cache.struct_val != NULL;
+ return PMC_struct_val(SELF) != NULL;
}
void* invoke (void * next) {
Parrot_csub_t func =
- (Parrot_csub_t)D2FPTR(SELF->cache.struct_val);
+ (Parrot_csub_t)D2FPTR(PMC_struct_val(SELF));
func(INTERP, SELF);
return next;
}
View
2 classes/default.pmc
@@ -253,7 +253,7 @@ pmclass default abstract noinit {
INTVAL is_equal (PMC* value) {
return (SELF->vtable == value->vtable
- && SELF->cache.struct_val == value->cache.struct_val
+ && PMC_struct_val(SELF) == PMC_struct_val(value)
&& PMC_data(SELF) == PMC_data(value));
}
View
4 classes/eval.pmc
@@ -64,7 +64,7 @@ pmclass Eval extends Closure {
}
INTVAL get_integer_keyed (PMC* key) {
- opcode_t *code = ((struct PackFile *)SELF->cache.struct_val)->byte_code;
+ opcode_t *code = ((struct PackFile *)PMC_struct_val(SELF))->byte_code;
/* int i = 0;
for (i=0; i < 16; i++) {
printf("At %p there is an %i\n", code+i, *(code+i));
@@ -76,7 +76,7 @@ pmclass Eval extends Closure {
size_t size;
opcode_t *packed;
- struct PackFile *pf = (struct PackFile *) SELF->cache.struct_val;
+ struct PackFile *pf = (struct PackFile *) PMC_struct_val(SELF);
STRING *s;
size = PackFile_pack_size(pf) * sizeof(opcode_t);
View
14 classes/float.pmc
@@ -20,30 +20,30 @@ pmclass Float extends mmd_default {
}
void set_integer_native(INTVAL value) {
- SELF->cache.num_val = value;
+ PMC_num_val(SELF) = value;
}
void set_number_native(FLOATVAL value) {
- SELF->cache.num_val = value;
+ PMC_num_val(SELF) = value;
}
void set_string_native(STRING* value) {
- SELF->cache.num_val = string_to_num(value);
+ PMC_num_val(SELF) = string_to_num(value);
}
void set_pmc(PMC *value) {
- SELF->cache.num_val = VTABLE_get_number(INTERP, value);
+ PMC_num_val(SELF) = VTABLE_get_number(INTERP, value);
}
FLOATVAL get_number() {
- return SELF->cache.num_val;
+ return PMC_num_val(SELF);
}
INTVAL get_integer() {
- return (INTVAL)SELF->cache.num_val;
+ return (INTVAL) PMC_num_val(SELF);
}
STRING* get_string() {
- return string_from_num(INTERP, SELF->cache.num_val);
+ return string_from_num(INTERP, PMC_num_val(SELF));
}
}
View
20 classes/integer.pmc
@@ -36,41 +36,41 @@ pmclass Integer extends mmd_default {
}
void set_integer_native(INTVAL value) {
- SELF->cache.int_val = value;
+ PMC_int_val(SELF) = value;
}
void set_number_native(FLOATVAL value) {
- SELF->cache.int_val = value;
+ PMC_int_val(SELF) = value;
}
void set_string_native(STRING* value) {
- SELF->cache.int_val = string_to_num(value);
+ PMC_int_val(SELF) = string_to_num(value);
}
void set_pmc(PMC *value) {
- SELF->cache.int_val = VTABLE_get_integer(INTERP, value);
+ PMC_int_val(SELF) = VTABLE_get_integer(INTERP, value);
}
FLOATVAL get_number() {
- return SELF->cache.int_val;
+ return PMC_int_val(SELF);
}
INTVAL get_integer() {
- return (INTVAL)SELF->cache.int_val;
+ return (INTVAL)PMC_int_val(SELF);
}
INTVAL get_bool() {
- return(SELF->cache.int_val != 0);
+ return(PMC_int_val(SELF) != 0);
}
STRING* get_string() {
- return string_from_num(INTERP, SELF->cache.int_val);
+ return string_from_num(INTERP, PMC_int_val(SELF));
}
void increment() {
- SELF->cache.int_val++;
+ PMC_int_val(SELF)++;
}
void decrement() {
- SELF->cache.int_val--;
+ PMC_int_val(SELF)--;
}
}
View
2 classes/intlist.pmc
@@ -25,7 +25,7 @@ pmclass IntList need_ext {
void init () {
PMC_data(SELF) = intlist_new(INTERP);
- SELF->cache.int_val = 0;
+ PMC_int_val(SELF) = 0;
PObj_custom_mark_SET(SELF);
}
View
122 classes/iterator.pmc
@@ -19,16 +19,16 @@ pmclass Iterator {
}
void init_pmc (PMC* initializer) {
- PMC_ptr2p(SELF) = initializer; /* the aggregate itself */
- SELF->cache.struct_val = NULL;
+ PMC_pmc_val(SELF) = initializer; /* the aggregate itself */
+ PMC_struct_val(SELF) = NULL;
PObj_custom_mark_SET(SELF);
}
void mark () {
- if (SELF->cache.struct_val) /* the KEY */
- pobject_lives(INTERP, (PObj *) SELF->cache.struct_val);
- if (PMC_ptr2p(SELF)) /* the aggregate */
- pobject_lives(INTERP, (PObj *) PMC_ptr2p(SELF));
+ if (PMC_struct_val(SELF)) /* the KEY */
+ pobject_lives(INTERP, (PObj *) PMC_struct_val(SELF));
+ if (PMC_pmc_val(SELF)) /* the aggregate */
+ pobject_lives(INTERP, (PObj *) PMC_pmc_val(SELF));
}
PMC* clone () {
@@ -37,58 +37,58 @@ pmclass Iterator {
}
INTVAL get_integer () {
- return VTABLE_get_integer(INTERP, (PMC *)PMC_ptr2p(SELF));
+ return VTABLE_get_integer(INTERP, (PMC *)PMC_pmc_val(SELF));
}
INTVAL get_integer_keyed (PMC* key) {
- return VTABLE_get_integer_keyed(INTERP, (PMC *)PMC_ptr2p(SELF), key);
+ return VTABLE_get_integer_keyed(INTERP, (PMC *)PMC_pmc_val(SELF), key);
}
INTVAL get_integer_keyed_int (INTVAL key) {
/* XXX adjust index */
- return VTABLE_get_integer_keyed_int(INTERP, (PMC *)PMC_ptr2p(SELF), key);
+ return VTABLE_get_integer_keyed_int(INTERP, (PMC *)PMC_pmc_val(SELF), key);
}
FLOATVAL get_number_keyed (PMC* key) {
- return VTABLE_get_number_keyed(INTERP, (PMC *)PMC_ptr2p(SELF), key);
+ return VTABLE_get_number_keyed(INTERP, (PMC *)PMC_pmc_val(SELF), key);
}
FLOATVAL get_number_keyed_int (INTVAL key) {
/* XXX adjust index */
- return VTABLE_get_number_keyed_int(INTERP, (PMC *)PMC_ptr2p(SELF), key);
+ return VTABLE_get_number_keyed_int(INTERP, (PMC *)PMC_pmc_val(SELF), key);
}
BIGNUM* get_bignum_keyed (PMC* key) {
- return VTABLE_get_bignum_keyed(INTERP, (PMC *)PMC_ptr2p(SELF), key);
+ return VTABLE_get_bignum_keyed(INTERP, (PMC *)PMC_pmc_val(SELF), key);
}
BIGNUM* get_bignum_keyed_int (INTVAL key) {
- return VTABLE_get_bignum_keyed_int(INTERP, (PMC *)PMC_ptr2p(SELF), key);
+ return VTABLE_get_bignum_keyed_int(INTERP, (PMC *)PMC_pmc_val(SELF), key);
}
STRING* get_string_keyed (PMC* key) {
- return VTABLE_get_string_keyed(INTERP, (PMC *)PMC_ptr2p(SELF), key);
+ return VTABLE_get_string_keyed(INTERP, (PMC *)PMC_pmc_val(SELF), key);
}
STRING* get_string_keyed_int (INTVAL key) {
- return VTABLE_get_string_keyed_int(INTERP, (PMC *)PMC_ptr2p(SELF), key);
+ return VTABLE_get_string_keyed_int(INTERP, (PMC *)PMC_pmc_val(SELF), key);
}
INTVAL get_bool () {
- PMC *key = SELF->cache.struct_val;
- return key && key->cache.int_val != -1;
+ PMC *key = PMC_struct_val(SELF);
+ return key && PMC_int_val(key) != -1;
}
INTVAL elements () {
- return VTABLE_elements(INTERP, (PMC *)PMC_ptr2p(SELF));
+ return VTABLE_elements(INTERP, (PMC *)PMC_pmc_val(SELF));
}
PMC* get_pmc_keyed (PMC* key) {
- return VTABLE_get_pmc_keyed(INTERP, (PMC *)PMC_ptr2p(SELF), key);
+ return VTABLE_get_pmc_keyed(INTERP, (PMC *)PMC_pmc_val(SELF), key);
}
PMC* get_pmc_keyed_int (INTVAL key) {
- return VTABLE_get_pmc_keyed_int(INTERP, (PMC *)PMC_ptr2p(SELF), key);
+ return VTABLE_get_pmc_keyed_int(INTERP, (PMC *)PMC_pmc_val(SELF), key);
}
void set_integer_native (INTVAL value) {
@@ -96,126 +96,126 @@ pmclass Iterator {
if (value < ITERATE_FROM_START || value > ITERATE_FROM_END)
internal_exception(1, "Illegal set_integer on iterator\n");
/* reset iterator on aggregate */
- if (!SELF->cache.struct_val) {
- SELF->cache.struct_val = key_new(INTERP);
+ if (!PMC_struct_val(SELF)) {
+ PMC_struct_val(SELF) = key_new(INTERP);
}
- key = SELF->cache.struct_val;
- SELF->cache.struct_val =
- VTABLE_nextkey_keyed(INTERP, (PMC*) PMC_ptr2p(SELF), key, value);
+ key = PMC_struct_val(SELF);
+ PMC_struct_val(SELF) =
+ VTABLE_nextkey_keyed(INTERP, (PMC*) PMC_pmc_val(SELF), key, value);
}
INTVAL pop_integer () {
- PMC *key = SELF->cache.struct_val;
- PMC *agg = PMC_ptr2p(SELF);
+ PMC *key = PMC_struct_val(SELF);
+ PMC *agg = PMC_pmc_val(SELF);
INTVAL ret = VTABLE_get_integer_keyed(INTERP, agg, key);
- SELF->cache.struct_val =
+ PMC_struct_val(SELF) =
VTABLE_nextkey_keyed(INTERP, agg, key, ITERATE_GET_PREV);
return ret;
}
FLOATVAL pop_float () {
- PMC *key = SELF->cache.struct_val;
- PMC *agg = PMC_ptr2p(SELF);
+ PMC *key = PMC_struct_val(SELF);
+ PMC *agg = PMC_pmc_val(SELF);
FLOATVAL ret = VTABLE_get_number_keyed(INTERP, agg, key);
- SELF->cache.struct_val =
+ PMC_struct_val(SELF) =
VTABLE_nextkey_keyed(INTERP, agg, key, ITERATE_GET_PREV);
return ret;
}
BIGNUM* pop_bignum () {
- PMC *key = SELF->cache.struct_val;
- PMC *agg = PMC_ptr2p(SELF);
+ PMC *key = PMC_struct_val(SELF);
+ PMC *agg = PMC_pmc_val(SELF);
BIGNUM *ret = VTABLE_get_bignum_keyed(INTERP, agg, key);
- SELF->cache.struct_val =
+ PMC_struct_val(SELF) =
VTABLE_nextkey_keyed(INTERP, agg, key, ITERATE_GET_PREV);
return ret;
}
STRING* pop_string () {
- PMC *key = SELF->cache.struct_val;
- PMC *agg = PMC_ptr2p(SELF);
+ PMC *key = PMC_struct_val(SELF);
+ PMC *agg = PMC_pmc_val(SELF);
STRING *ret = VTABLE_get_string_keyed(INTERP, agg, key);
- SELF->cache.struct_val =
+ PMC_struct_val(SELF) =
VTABLE_nextkey_keyed(INTERP, agg, key, ITERATE_GET_PREV);
return ret;
}
PMC* pop_pmc () {
- PMC *key = SELF->cache.struct_val;
- PMC *agg = PMC_ptr2p(SELF);
+ PMC *key = PMC_struct_val(SELF);
+ PMC *agg = PMC_pmc_val(SELF);
PMC *ret = VTABLE_get_pmc_keyed(INTERP, agg, key);
- SELF->cache.struct_val =
+ PMC_struct_val(SELF) =
VTABLE_nextkey_keyed(INTERP, agg, key, ITERATE_GET_PREV);
return ret;
}
INTVAL shift_integer () {
- PMC *key = SELF->cache.struct_val;
- PMC *agg = PMC_ptr2p(SELF);
+ PMC *key = PMC_struct_val(SELF);
+ PMC *agg = PMC_pmc_val(SELF);
INTVAL ret = VTABLE_get_integer_keyed(INTERP, agg, key);
- SELF->cache.struct_val =
+ PMC_struct_val(SELF) =
VTABLE_nextkey_keyed(INTERP, agg, key, ITERATE_GET_NEXT);
return ret;
}
FLOATVAL shift_float () {
- PMC *key = SELF->cache.struct_val;
- PMC *agg = PMC_ptr2p(SELF);
+ PMC *key = PMC_struct_val(SELF);
+ PMC *agg = PMC_pmc_val(SELF);
FLOATVAL ret = VTABLE_get_number_keyed(INTERP, agg, key);
- SELF->cache.struct_val =
+ PMC_struct_val(SELF) =
VTABLE_nextkey_keyed(INTERP, agg, key, ITERATE_GET_NEXT);
return ret;
}
BIGNUM* shift_bignum () {
- PMC *key = SELF->cache.struct_val;
- PMC *agg = PMC_ptr2p(SELF);
+ PMC *key = PMC_struct_val(SELF);
+ PMC *agg = PMC_pmc_val(SELF);
BIGNUM *ret = VTABLE_get_bignum_keyed(INTERP, agg, key);
- SELF->cache.struct_val =
+ PMC_struct_val(SELF) =
VTABLE_nextkey_keyed(INTERP, agg, key, ITERATE_GET_NEXT);
return ret;
}
STRING* shift_string () {
- PMC *key = SELF->cache.struct_val;
- PMC *agg = PMC_ptr2p(SELF);
+ PMC *key = PMC_struct_val(SELF);
+ PMC *agg = PMC_pmc_val(SELF);
STRING * ret = VTABLE_get_string_keyed(INTERP, agg, key);
- SELF->cache.struct_val =
+ PMC_struct_val(SELF) =
VTABLE_nextkey_keyed(INTERP, agg, key, ITERATE_GET_NEXT);
return ret;
}
PMC* shift_pmc () {
- PMC *key = SELF->cache.struct_val;
- PMC *agg = PMC_ptr2p(SELF);
+ PMC *key = PMC_struct_val(SELF);
+ PMC *agg = PMC_pmc_val(SELF);
PMC *ret = VTABLE_get_pmc_keyed(INTERP, agg, key);
- SELF->cache.struct_val =
+ PMC_struct_val(SELF) =
VTABLE_nextkey_keyed(INTERP, agg, key, ITERATE_GET_NEXT);
return ret;
}
INTVAL exists_keyed (PMC* key) {
- return VTABLE_exists_keyed(INTERP, (PMC *)PMC_ptr2p(SELF), key);
+ return VTABLE_exists_keyed(INTERP, (PMC *)PMC_pmc_val(SELF), key);
}
INTVAL exists_keyed_int (INTVAL key) {
- return VTABLE_exists_keyed_int(INTERP, (PMC *)PMC_ptr2p(SELF), key);
+ return VTABLE_exists_keyed_int(INTERP, (PMC *)PMC_pmc_val(SELF), key);
}
INTVAL defined () {
- return (INTVAL) (PMC_ptr2p(SELF) != 0);
+ return (INTVAL) (PMC_pmc_val(SELF) != 0);
}
INTVAL defined_keyed (PMC* key) {
- return VTABLE_defined_keyed(INTERP, (PMC *)PMC_ptr2p(SELF), key);
+ return VTABLE_defined_keyed(INTERP, (PMC *)PMC_pmc_val(SELF), key);
}
INTVAL defined_keyed_int (INTVAL key) {
- return VTABLE_defined_keyed_int(INTERP, (PMC *)PMC_ptr2p(SELF), key);
+ return VTABLE_defined_keyed_int(INTERP, (PMC *)PMC_pmc_val(SELF), key);
}
INTVAL type_keyed (PMC* key) {
- return VTABLE_type_keyed(INTERP, (PMC *)PMC_ptr2p(SELF), key);
+ return VTABLE_type_keyed(INTERP, (PMC *)PMC_pmc_val(SELF), key);
}
}
View
2 classes/key.pmc
@@ -118,7 +118,7 @@ pmclass Key need_ext {
if (PMC_data(key))
ret = key_next(interpreter, key);
else
- ret->cache.int_val = -1;
+ PMC_int_val(ret) = -1;
break;
default:
internal_exception(1, "Key can't iterate backwards");
View
18 classes/managedstruct.pmc
@@ -19,7 +19,7 @@ pmclass ManagedStruct extends UnManagedStruct need_ext {
void init () {
SUPER();
PObj_active_destroy_SET(SELF);
- SELF->cache.int_val = 0;
+ PMC_int_val(SELF) = 0;
}
void init_pmc (PMC* value) {
@@ -41,14 +41,14 @@ pmclass ManagedStruct extends UnManagedStruct need_ext {
if (!key)
return -1;
ix = key_integer(INTERP, key);
- if (!PMC_ptr2p(SELF) && (ix < 0 || ix >= SELF->cache.int_val))
+ if (!PMC_pmc_val(SELF) && (ix < 0 || ix >= PMC_int_val(SELF)))
return -1;
return SUPER(key);
}
INTVAL get_integer_keyed_int(INTVAL ix) {
- if (!PMC_ptr2p(SELF) && (ix < 0 || ix >= SELF->cache.int_val))
+ if (!PMC_pmc_val(SELF) && (ix < 0 || ix >= PMC_int_val(SELF)))
return -1;
return SUPER(ix);
}
@@ -60,34 +60,34 @@ pmclass ManagedStruct extends UnManagedStruct need_ext {
if (!key)
return;
ix = key_integer(INTERP, key);
- if (!PMC_ptr2p(SELF) && (ix < 0 || ix >= SELF->cache.int_val))
+ if (!PMC_pmc_val(SELF) && (ix < 0 || ix >= PMC_int_val(SELF)))
return;
SUPER(key, value);
}
void set_integer_keyed_int (INTVAL ix, INTVAL value) {
- if (!PMC_ptr2p(SELF) && (ix < 0 || ix >= SELF->cache.int_val))
+ if (!PMC_pmc_val(SELF) && (ix < 0 || ix >= PMC_int_val(SELF)))
return;
SUPER(ix, value);
}
INTVAL get_integer () {
- return(SELF->cache.int_val);
+ return(PMC_int_val(SELF));
}
void set_integer_native (INTVAL value) {
if (PMC_data(SELF) && (! value)) {
mem_sys_free(PMC_data(SELF));
PMC_data(SELF) = NULL;
- SELF->cache.int_val = 0;
+ PMC_int_val(SELF) = 0;
}
else if (value && (! PMC_data(SELF))) {
PMC_data(SELF) = mem_sys_allocate_zeroed(value);
- SELF->cache.int_val = value;
+ PMC_int_val(SELF) = value;
}
else if (value && PMC_data(SELF)) {
PMC_data(SELF) = mem_sys_realloc(PMC_data(SELF), value);
- SELF->cache.int_val = value;
+ PMC_int_val(SELF) = value;
}
return;
}
View
2 classes/mmd_default.pmc
@@ -16,7 +16,7 @@
pmclass mmd_default extends default {
void init() {
- SELF->cache.num_val = 0.0;
+ PMC_num_val(SELF) = 0.0;
}
void add(PMC* value, PMC* dest) {
View
6 classes/nci.pmc
@@ -20,12 +20,12 @@
pmclass NCI need_ext {
void init() {
- SELF->cache.struct_val = NULL;
+ PMC_struct_val(SELF) = NULL;
}
void set_string_keyed (PMC* func, STRING* value) {
/* key = func_ptr, value = signature */
- SELF->cache.struct_val = (DPOINTER *)func;
+ PMC_struct_val(SELF) = (DPOINTER *)func;
PMC_data(SELF) = build_call_func(INTERP, SELF, value);
}
@@ -36,7 +36,7 @@ pmclass NCI need_ext {
PMC* clone () {
PMC* ret = pmc_new_noinit(INTERP, SELF->vtable->base_type);
- ret->cache.struct_val = SELF->cache.struct_val;
+ PMC_struct_val(ret) = PMC_struct_val(SELF);
/* FIXME if data is malloced (JIT/i386!) then we need
* the length of data here, to memcpy it
* ManagedStruct or Buffer?
View
4 classes/orderedhash.pmc
@@ -31,7 +31,7 @@
pmclass OrderedHash extends PerlArray need_ext does array does hash {
void init () {
/* clear the Hash ptr - its not yet existing */
- PMC_ptr1v(SELF) = NULL;
+ PMC_struct_val(SELF) = NULL;
SUPER();
PerlHash.SUPER();
}
@@ -43,7 +43,7 @@ pmclass OrderedHash extends PerlArray need_ext does array does hash {
PMC* clone () {
PMC* dest = SUPER();
- hash_clone(INTERP, (Hash *)PMC_ptr1v(SELF), (Hash**)&PMC_ptr1v(dest));
+ hash_clone(INTERP, (Hash *)PMC_struct_val(SELF), (Hash**)&PMC_struct_val(dest));
return dest;
}
View
2 classes/parrotclass.pmc
@@ -31,7 +31,7 @@ pmclass ParrotClass need_ext {
void init () {
/* No attributes to start with */
- SELF->cache.int_val = 0;
+ PMC_int_val(SELF) = 0;
/* But we are a class, really */
PObj_is_class_SET(SELF);
/* And, coincidentally, data points to a PMC. Fancy that... */
View
10 classes/parrotinterpreter.pmc
@@ -208,7 +208,7 @@ pmclass ParrotInterpreter need_ext {
if (!PMC_data(SELF)) {
create_interp(SELF, INTERP);
}
- SELF->cache.struct_val = NULL;
+ PMC_struct_val(SELF) = NULL;
}
void init_pmc (PMC *parent) {
@@ -217,15 +217,15 @@ pmclass ParrotInterpreter need_ext {
if (!PMC_data(SELF)) {
create_interp(SELF, p);
}
- SELF->cache.struct_val = NULL;
+ PMC_struct_val(SELF) = NULL;
}
void set_pointer (void* value) {
- SELF->cache.struct_val = value;
+ PMC_struct_val(SELF) = value;
}
void* get_pointer () {
- return SELF->cache.struct_val;
+ return PMC_struct_val(SELF);
}
INTVAL get_integer () {
@@ -241,7 +241,7 @@ pmclass ParrotInterpreter need_ext {
*/
pt_thread_prepare_for_run(new_interp, interpreter);
/* calculate offset and run */
- runops(new_interp, (opcode_t *)SELF->cache.struct_val -
+ runops(new_interp, (opcode_t *)PMC_struct_val(SELF) -
(opcode_t *)interpreter->code->byte_code);
return next;
}
View
2 classes/parrotio.pmc
@@ -73,7 +73,7 @@ pmclass ParrotIO need_ext {
* If we have different IO layers, we might copy these structures
*/
PMC_data(dest) = PMC_data(SELF);
- dest->cache.struct_val = SELF->cache.struct_val;
+ PMC_struct_val(dest) = PMC_struct_val(SELF);
return dest;
}
View
8 classes/parrotlibrary.pmc
@@ -7,8 +7,8 @@
* Data Structure and Algorithms:
*
* PMC data
- * SELF->cache.struct_val oplib init function
- * PMC_data(SELF) DLL handle
+ * PMC_struct_val(SELF) oplib init function
+ * PMC_data(SELF) DLL handle
*
* Properties:
* _filename full path/file of lib
@@ -32,7 +32,7 @@
pmclass ParrotLibrary need_ext does library const_too {
void init() {
- SELF->cache.struct_val = NULL;
+ PMC_struct_val(SELF) = NULL;
}
void morph(INTVAL type) {
@@ -41,7 +41,7 @@ pmclass ParrotLibrary need_ext does library const_too {
PMC* clone() {
PMC* dest = pmc_new_noinit(INTERP, SELF->vtable->base_type);
- dest->cache.struct_val = SELF->cache.struct_val;
+ PMC_struct_val(dest) = PMC_struct_val(SELF);
PMC_data(dest) = PMC_data(SELF);
if (SELF->metadata) {
dest->metadata = VTABLE_clone(INTERP, SELF->metadata);
View
18 classes/parrotobject.pmc
@@ -59,7 +59,7 @@ pmclass ParrotObject extends ParrotClass need_ext {
*/
INTVAL elements() {
PMC* data_array = (PMC*) PMC_data(SELF);
- return VTABLE_elements(interpreter, data_array) - SELF->cache.int_val;
+ return VTABLE_elements(interpreter, data_array) - PMC_int_val(SELF);
}
INTVAL get_integer() {
@@ -73,7 +73,7 @@ pmclass ParrotObject extends ParrotClass need_ext {
INTVAL get_integer_keyed_int (INTVAL idx) {
PMC* data_array = (PMC*) PMC_data(SELF);
return VTABLE_get_integer_keyed_int(interpreter, data_array,
- idx + SELF->cache.int_val);
+ idx + PMC_int_val(SELF));
}
INTVAL get_integer_keyed_str (STRING* attr) {
@@ -104,7 +104,7 @@ pmclass ParrotObject extends ParrotClass need_ext {
void set_integer_keyed_int (INTVAL idx, INTVAL value) {
PMC* data_array = (PMC*) PMC_data(SELF);
VTABLE_set_integer_keyed_int(interpreter, data_array,
- idx + SELF->cache.int_val, value);
+ idx + PMC_int_val(SELF), value);
}
void set_integer_keyed_str (STRING* attr, INTVAL value) {
@@ -130,7 +130,7 @@ pmclass ParrotObject extends ParrotClass need_ext {
FLOATVAL get_number_keyed_int (INTVAL idx) {
PMC* data_array = (PMC*) PMC_data(SELF);
return VTABLE_get_number_keyed_int(interpreter, data_array,
- idx + SELF->cache.int_val);
+ idx + PMC_int_val(SELF));
}
FLOATVAL get_number_keyed_str (STRING* attr) {
@@ -156,7 +156,7 @@ pmclass ParrotObject extends ParrotClass need_ext {
void set_number_keyed_int (INTVAL idx, FLOATVAL value) {
PMC* data_array = (PMC*) PMC_data(SELF);
VTABLE_set_number_keyed_int(interpreter, data_array,
- idx + SELF->cache.int_val, value);
+ idx + PMC_int_val(SELF), value);
}
void set_number_keyed_str (STRING* attr, FLOATVAL value) {
@@ -183,7 +183,7 @@ pmclass ParrotObject extends ParrotClass need_ext {
STRING* get_string_keyed_int (INTVAL idx) {
PMC* data_array = (PMC*) PMC_data(SELF);
return VTABLE_get_string_keyed_int(interpreter, data_array,
- idx + SELF->cache.int_val);
+ idx + PMC_int_val(SELF));
}
STRING* get_string_keyed_str (STRING* attr) {
@@ -208,7 +208,7 @@ pmclass ParrotObject extends ParrotClass need_ext {
void set_string_keyed_int (INTVAL idx, STRING* value) {
PMC* data_array = (PMC*) PMC_data(SELF);
VTABLE_set_string_keyed_int(interpreter, data_array,
- idx + SELF->cache.int_val, value);
+ idx + PMC_int_val(SELF), value);
}
void set_string_keyed_str (STRING* attr, STRING* value) {
@@ -234,7 +234,7 @@ pmclass ParrotObject extends ParrotClass need_ext {
PMC* get_pmc_keyed_int (INTVAL idx) {
PMC* data_array = (PMC*) PMC_data(SELF);
return VTABLE_get_pmc_keyed_int(interpreter, data_array,
- idx + SELF->cache.int_val);
+ idx + PMC_int_val(SELF));
}
PMC* get_pmc_keyed_str (STRING* attr) {
@@ -260,7 +260,7 @@ pmclass ParrotObject extends ParrotClass need_ext {
void set_pmc_keyed_int (INTVAL idx, PMC* value) {
PMC* data_array = (PMC*) PMC_data(SELF);
VTABLE_set_pmc_keyed_int(interpreter, data_array,
- idx + SELF->cache.int_val, value);
+ idx + PMC_int_val(SELF), value);
}
void set_pmc_keyed_str (STRING* attr, PMC* value) {
View
2 classes/perlarray.pmc
@@ -40,7 +40,7 @@ pmclass PerlArray extends Array need_ext does array {
void set_integer_keyed_int (INTVAL key, INTVAL value) {
PMC *src = pmc_new_noinit(INTERP, enum_class_PerlInt);
- src->cache.int_val = value;
+ PMC_int_val(src) = value;
list_assign(INTERP, (List *) PMC_data(SELF), key, src, enum_type_PMC);
}
View
82 classes/perlhash.pmc
@@ -43,16 +43,16 @@ pmclass PerlHash need_ext does hash {
VTABLE_init(INTERP, undef);
}
PObj_custom_mark_SET(SELF);
- new_hash(INTERP, (Hash**)&PMC_ptr1v(SELF));
+ new_hash(INTERP, (Hash**)&PMC_struct_val(SELF));
}
void mark () {
- if (PMC_ptr1v(SELF))
- mark_hash(INTERP, PMC_ptr1v(SELF));
+ if (PMC_struct_val(SELF))
+ mark_hash(INTERP, PMC_struct_val(SELF));
}
INTVAL type_keyed_str (STRING* key) {
- HashBucket* b = hash_get_bucket(INTERP, (Hash*) PMC_ptr1v(SELF), key);
+ HashBucket* b = hash_get_bucket(INTERP, (Hash*) PMC_struct_val(SELF), key);
if (!b)
return enum_hash_undef;
return VTABLE_type(INTERP, (PMC*) b->value);
@@ -62,7 +62,7 @@ pmclass PerlHash need_ext does hash {
PMC* valpmc;
PMC* nextkey;
STRING* keystr = make_hash_key(INTERP, key);
- HashBucket* b = hash_get_bucket(INTERP, (Hash*) PMC_ptr1v(SELF),
+ HashBucket* b = hash_get_bucket(INTERP, (Hash*) PMC_struct_val(SELF),
keystr);
if (b == NULL) {
return enum_hash_undef;
@@ -77,16 +77,16 @@ pmclass PerlHash need_ext does hash {
PMC* clone () {
PMC* dest = pmc_new_noinit(INTERP, SELF->vtable->base_type);
PObj_custom_mark_SET(dest);
- hash_clone(INTERP, (Hash *)PMC_ptr1v(SELF), (Hash**)&PMC_ptr1v(dest));
+ hash_clone(INTERP, (Hash *)PMC_struct_val(SELF), (Hash**)&PMC_struct_val(dest));
return dest;
}
INTVAL get_integer () {
- return hash_size(INTERP, PMC_ptr1v(SELF));
+ return hash_size(INTERP, PMC_struct_val(SELF));
}
INTVAL get_integer_keyed_str (STRING* key) {
- HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_ptr1v(SELF), key);
+ HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_struct_val(SELF), key);
if (b == NULL) {
/* XXX Warning: use of uninitialized value */
return VTABLE_get_integer(INTERP, undef);
@@ -97,7 +97,7 @@ pmclass PerlHash need_ext does hash {
INTVAL get_integer_keyed (PMC* key) {
PMC* valpmc;
STRING* keystr = make_hash_key(INTERP, key);
- HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_ptr1v(SELF),
+ HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_struct_val(SELF),
keystr);
PMC* nextkey;
if (b == NULL) {
@@ -113,7 +113,7 @@ pmclass PerlHash need_ext does hash {
}
FLOATVAL get_number_keyed_str (STRING* key) {
- HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_ptr1v(SELF), key);
+ HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_struct_val(SELF), key);
if (b == NULL) {
/* XXX Warning: Use of uninitialized value */
return VTABLE_get_number(INTERP, undef);
@@ -124,7 +124,7 @@ pmclass PerlHash need_ext does hash {
FLOATVAL get_number_keyed (PMC* key) {
PMC* valpmc;
STRING* keystr = make_hash_key(INTERP, key);
- HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_ptr1v(SELF),
+ HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_struct_val(SELF),
keystr);
PMC* nextkey;
if (b == NULL) {
@@ -139,7 +139,7 @@ pmclass PerlHash need_ext does hash {
}
BIGNUM* get_bignum_keyed_str (STRING* key) {
- HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_ptr1v(SELF), key);
+ HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_struct_val(SELF), key);
if (b == NULL) {
/* XXX Warning: Use of uninitialized value */
return VTABLE_get_bignum(INTERP, undef);
@@ -150,7 +150,7 @@ pmclass PerlHash need_ext does hash {
BIGNUM* get_bignum_keyed (PMC* key) {
PMC* valpmc;
STRING* keystr = make_hash_key(INTERP, key);
- HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_ptr1v(SELF),
+ HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_struct_val(SELF),
keystr);
PMC* nextkey;
if (b == NULL) {
@@ -169,7 +169,7 @@ pmclass PerlHash need_ext does hash {
}
STRING* get_string_keyed_str (STRING* key) {
- HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_ptr1v(SELF), key);
+ HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_struct_val(SELF), key);
if (b == NULL) {
/* XXX Warning: use of uninitialized value */
return VTABLE_get_string(INTERP, undef);
@@ -186,11 +186,11 @@ pmclass PerlHash need_ext does hash {
switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
case KEY_integer_FLAG:
/* called from iterator with an integer idx in key */
- return hash_get_idx(INTERP, (Hash*) PMC_ptr1v(SELF), key);
+ return hash_get_idx(INTERP, (Hash*) PMC_struct_val(SELF), key);
default:
keystr = make_hash_key(INTERP, key);
}
- b = hash_get_bucket(INTERP, (Hash*) PMC_ptr1v(SELF), keystr);
+ b = hash_get_bucket(INTERP, (Hash*) PMC_struct_val(SELF), keystr);
if (b == NULL) {
/* XXX Warning: use of uninitialized value */
return VTABLE_get_string(INTERP, undef);
@@ -203,15 +203,15 @@ pmclass PerlHash need_ext does hash {
}
INTVAL get_bool () {
- return hash_size(INTERP, PMC_ptr1v(SELF)) != 0;
+ return hash_size(INTERP, PMC_struct_val(SELF)) != 0;
}
INTVAL elements () {
- return hash_size(INTERP, PMC_ptr1v(SELF));
+ return hash_size(INTERP, PMC_struct_val(SELF));
}
PMC* get_pmc_keyed_str (STRING* key) {
- HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_ptr1v(SELF), key);
+ HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_struct_val(SELF), key);
if (b == NULL) {
/* XXX should store the undef for consisteny */
PMC *new_undef = pmc_new(INTERP, enum_class_PerlUndef);
@@ -222,7 +222,7 @@ pmclass PerlHash need_ext does hash {
PMC* get_pmc_keyed (PMC* key) {
STRING* keystr = make_hash_key(INTERP, key);
- HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_ptr1v(SELF),
+ HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_struct_val(SELF),
keystr);
PMC* nextkey;
if (b == NULL) {
@@ -238,34 +238,34 @@ pmclass PerlHash need_ext does hash {
INTVAL is_same (PMC* other) {
return (INTVAL)( other->vtable == SELF->vtable &&
- PMC_ptr1v(other) == PMC_ptr1v(SELF));
+ PMC_struct_val(other) == PMC_struct_val(SELF));
}
void set_integer_keyed (PMC* key, INTVAL value) {
STRING* keystr = make_hash_key(INTERP, key);
PMC *val = pmc_new(interpreter, enum_class_PerlInt);
VTABLE_set_integer_native(INTERP, val, value);
- hash_put(INTERP, PMC_ptr1v(SELF), keystr, val);
+ hash_put(INTERP, PMC_struct_val(SELF), keystr, val);
}
void set_integer_keyed_str (STRING* key, INTVAL value) {
PMC *val = pmc_new(interpreter, enum_class_PerlInt);
- val->cache.int_val = value;
- hash_put(INTERP, PMC_ptr1v(SELF), key, val);
+ PMC_int_val(val) = value;
+ hash_put(INTERP, PMC_struct_val(SELF), key, val);
}
void set_number_keyed (PMC* key, FLOATVAL value) {
STRING* keystr = make_hash_key(INTERP, key);
PMC *val = pmc_new(interpreter, enum_class_PerlNum);
- val->cache.num_val = value;
- hash_put(INTERP, PMC_ptr1v(SELF), keystr, val);
+ PMC_num_val(val) = value;
+ hash_put(INTERP, PMC_struct_val(SELF), keystr, val);
}
void set_number_keyed_str (STRING* key, FLOATVAL value) {
PMC *val = pmc_new(interpreter, enum_class_PerlNum);
- val->cache.num_val = value;
- hash_put(INTERP, PMC_ptr1v(SELF), key, val);
+ PMC_num_val(val) = value;
+ hash_put(INTERP, PMC_struct_val(SELF), key, val);
}
@@ -281,22 +281,22 @@ pmclass PerlHash need_ext does hash {
STRING* keystr = make_hash_key(INTERP, key);
PMC *val = pmc_new(interpreter, enum_class_PerlString);
VTABLE_set_string_native(INTERP, val, value);
- hash_put(INTERP, PMC_ptr1v(SELF), keystr, val);
+ hash_put(INTERP, PMC_struct_val(SELF), keystr, val);
}
void set_string_keyed_str (STRING* key, STRING* value) {
PMC *val = pmc_new(interpreter, enum_class_PerlString);
VTABLE_set_string_native(INTERP, val, value);
- hash_put(INTERP, PMC_ptr1v(SELF), key, val);
+ hash_put(INTERP, PMC_struct_val(SELF), key, val);
}
void set_pmc_keyed (PMC* dest_key, PMC* value) {
STRING* keystr = make_hash_key(INTERP, dest_key);
- hash_put(INTERP, PMC_ptr1v(SELF), keystr, value);
+ hash_put(INTERP, PMC_struct_val(SELF), keystr, value);
}
void set_pmc_keyed_str (STRING* key, PMC* value) {
- hash_put(INTERP, PMC_ptr1v(SELF), key, value);
+ hash_put(INTERP, PMC_struct_val(SELF), key, value);
}
@@ -306,13 +306,13 @@ pmclass PerlHash need_ext does hash {
}
INTVAL exists_keyed_str(STRING* key) {
- HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_ptr1v(SELF), key);
+ HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_struct_val(SELF), key);
return b != NULL;
}
INTVAL exists_keyed(PMC* key) {
STRING * sx;
- Hash * h = (Hash *)PMC_ptr1v(SELF);
+ Hash * h = (Hash *)PMC_struct_val(SELF);
HashBucket *b;
sx = key_string(INTERP, key);
key = key_next(INTERP, key);
@@ -325,7 +325,7 @@ pmclass PerlHash need_ext does hash {
}
INTVAL defined_keyed_str(STRING* key) {
- HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_ptr1v(SELF), key);
+ HashBucket *b = hash_get_bucket(INTERP, (Hash*) PMC_struct_val(SELF), key);
if (b == NULL)
return 0; /* no such key */
return VTABLE_defined(INTERP, (PMC*)b->value);
@@ -333,7 +333,7 @@ pmclass PerlHash need_ext does hash {
INTVAL defined_keyed(PMC* key) {
STRING * sx;
- Hash * h = (Hash *)PMC_ptr1v(SELF);
+ Hash * h = (Hash *)PMC_struct_val(SELF);
HashBucket *b;
sx = key_string(INTERP, key);
key = key_next(INTERP, key);
@@ -347,12 +347,12 @@ pmclass PerlHash need_ext does hash {
}
void delete_keyed_str(STRING* key) {
- hash_delete(INTERP, (Hash *)PMC_ptr1v(SELF), key);
+ hash_delete(INTERP, (Hash *)PMC_struct_val(SELF), key);
}
void delete_keyed(PMC* key) {
STRING * sx;
- Hash * h = (Hash *)PMC_ptr1v(SELF);
+ Hash * h = (Hash *)PMC_struct_val(SELF);
HashBucket *b;
sx = key_string(INTERP, key);
key = key_next(INTERP, key);
@@ -374,9 +374,9 @@ pmclass PerlHash need_ext does hash {
switch (what) {
case ITERATE_FROM_START: /* reset key */
case ITERATE_FROM_START_KEYS:
- ret->cache.int_val = 0;
+ PMC_int_val(ret) = 0;
if (!n)
- ret->cache.int_val = -1;
+ PMC_int_val(ret) = -1;
PMC_data(ret) = (void *)INITBucketIndex;
break;
case ITERATE_GET_NEXT:
@@ -390,7 +390,7 @@ pmclass PerlHash need_ext does hash {
}
void visit(visit_info *info) {
- hash_visit(INTERP, (Hash*)PMC_ptr1v(SELF), info);
+ hash_visit(INTERP, (Hash*)PMC_struct_val(SELF), info);
SUPER(info);
}
View
88 classes/perlint.pmc
@@ -17,7 +17,7 @@
pmclass PerlInt extends perlscalar {
void init () {
- SELF->cache.int_val = 0;
+ PMC_int_val(SELF) = 0;
}
void share () {
@@ -29,7 +29,7 @@ pmclass PerlInt extends perlscalar {
}
FLOATVAL get_number () {
- return (FLOATVAL)SELF->cache.int_val;
+ return (FLOATVAL)PMC_int_val(SELF);
}
BIGNUM* get_bignum () {
@@ -38,12 +38,12 @@ pmclass PerlInt extends perlscalar {
}
STRING* get_string () {
- return string_from_int(INTERP, SELF->cache.int_val);
+ return string_from_int(INTERP, PMC_int_val(SELF));
}
void set_integer_same (PMC * value) {
- SELF->cache.int_val = value->cache.int_val;
+ PMC_int_val(SELF) = PMC_int_val(value);
}
void set_number (PMC* value) {
@@ -58,13 +58,13 @@ pmclass PerlInt extends perlscalar {
void set_bignum (PMC* value) {
/* XXX not sure if this can be optimized further safely */
- SELF->cache.struct_val = (DPOINTER*)VTABLE_get_bignum(INTERP, value);
+ PMC_struct_val(SELF) = (DPOINTER*)VTABLE_get_bignum(INTERP, value);
/* SELF->vtable = Parrot_base_vtables[enum_class_PerlBigNum]; */
}
void set_bignum_native (BIGNUM* value) {
/* XXX Some of this bignum stuff is starting to look pretty redundant -DML */
- SELF->cache.struct_val = value; /* Maybe we need a copy */
+ PMC_struct_val(SELF) = value; /* Maybe we need a copy */
/* SELF->vtable = Parrot_base_vtables[enum_class_PerlBignum]; */
}
@@ -84,7 +84,7 @@ pmclass PerlInt extends perlscalar {
FLOATVAL valf;
FLOATVAL sumf;
- pmci = SELF->cache.int_val;
+ pmci = PMC_int_val(SELF);
if (vtype == enum_class_PerlUndef) {
VTABLE_set_integer_native(INTERP, dest, pmci);
return;
@@ -116,7 +116,7 @@ pmclass PerlInt extends perlscalar {
FLOATVAL valf;
FLOATVAL diff;
- pmci = SELF->cache.int_val;
+ pmci = PMC_int_val(SELF);
if (vtype == enum_class_PerlUndef) {
VTABLE_set_integer_native(INTERP, dest, pmci);
return;
@@ -144,7 +144,7 @@ pmclass PerlInt extends perlscalar {
void subtract_int (INTVAL value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- SELF->cache.int_val - value
+ PMC_int_val(SELF) - value
);
}
@@ -154,7 +154,7 @@ pmclass PerlInt extends perlscalar {
FLOATVAL valf;
FLOATVAL mulf;
- pmci = SELF->cache.int_val;
+ pmci = PMC_int_val(SELF);
if (vtype == enum_class_PerlUndef) {
VTABLE_set_integer_native(INTERP, dest, 0);
return;
@@ -182,7 +182,7 @@ pmclass PerlInt extends perlscalar {
void multiply_int (INTVAL value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- SELF->cache.int_val * value
+ PMC_int_val(SELF) * value
);
}
@@ -194,7 +194,7 @@ pmclass PerlInt extends perlscalar {
/* TODO: Is this the appropriate way to throw the exception? */
- pmci = SELF->cache.int_val;
+ pmci = PMC_int_val(SELF);
if (vtype == enum_class_PerlUndef) {
internal_exception(DIV_BY_ZERO, "division by zero!\n");
return;
@@ -230,7 +230,7 @@ pmclass PerlInt extends perlscalar {
INTVAL pmci, divi;
FLOATVAL valf, divf;
- pmci = SELF->cache.int_val;
+ pmci = PMC_int_val(SELF);
/* TODO exception */
divf = (FLOATVAL)pmci / value;
divi = pmci / value;
@@ -244,114 +244,114 @@ pmclass PerlInt extends perlscalar {
void cmodulus (PMC* value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- SELF->cache.int_val %
+ PMC_int_val(SELF) %
VTABLE_get_integer(INTERP, value));
}
void cmodulus_int (INTVAL value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- SELF->cache.int_val % value);
+ PMC_int_val(SELF) % value);
}
void modulus (PMC* value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- intval_mod(SELF->cache.int_val,
+ intval_mod(PMC_int_val(SELF),
VTABLE_get_integer(INTERP, value)));
}
void modulus_int (INTVAL value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- intval_mod(SELF->cache.int_val, value));
+ intval_mod(PMC_int_val(SELF), value));
}
void neg (PMC* dest) {
if (!dest)
- SELF->cache.int_val = -SELF->cache.int_val;
+ PMC_int_val(SELF) = -PMC_int_val(SELF);
else
- VTABLE_set_integer_native(INTERP, dest, -SELF->cache.int_val);
+ VTABLE_set_integer_native(INTERP, dest, -PMC_int_val(SELF));
}
void bitwise_or (PMC* value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- SELF->cache.int_val |
+ PMC_int_val(SELF) |
VTABLE_get_integer(INTERP, value)
);
}
void bitwise_or_int (INTVAL value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- SELF->cache.int_val | value
+ PMC_int_val(SELF) | value
);
}
void bitwise_and (PMC* value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- SELF->cache.int_val &
+ PMC_int_val(SELF) &
VTABLE_get_integer(INTERP, value)
);
}
void bitwise_and_int (INTVAL value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- SELF->cache.int_val & value
+ PMC_int_val(SELF) & value
);
}
void bitwise_xor (PMC* value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- SELF->cache.int_val ^
+ PMC_int_val(SELF) ^
VTABLE_get_integer(INTERP, value)
);
}
void bitwise_xor_int (INTVAL value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- SELF->cache.int_val ^ value
+ PMC_int_val(SELF) ^ value
);
}
void bitwise_not (PMC* dest) {
- VTABLE_set_integer_native(INTERP, dest, ~SELF->cache.int_val);
+ VTABLE_set_integer_native(INTERP, dest, ~PMC_int_val(SELF));
}
void bitwise_shr (PMC* value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- SELF->cache.int_val >>
+ PMC_int_val(SELF) >>
VTABLE_get_integer(INTERP, value)
);
}
void bitwise_shr_int (INTVAL value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- SELF->cache.int_val >> value
+ PMC_int_val(SELF) >> value
);
}
void bitwise_shl (PMC* value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- SELF->cache.int_val <<
+ PMC_int_val(SELF) <<
VTABLE_get_integer(INTERP, value)
);
}
void bitwise_shl_int (INTVAL value, PMC* dest) {
VTABLE_set_integer_native(INTERP, dest,
- SELF->cache.int_val << value
+ PMC_int_val(SELF) << value
);
}
/* == operation */
INTVAL is_equal (PMC* value) {
- return (INTVAL)(SELF->cache.int_val ==
+ return (INTVAL)(PMC_int_val(SELF) ==
VTABLE_get_integer(INTERP, value));
}
INTVAL cmp(PMC* value) {
if (value->vtable == Parrot_base_vtables[enum_class_PerlString]) {
- FLOATVAL fdiff = SELF->cache.int_val
+ FLOATVAL fdiff = PMC_int_val(SELF)
- VTABLE_get_number(INTERP, value);
if (fdiff == 0) {
- INTVAL idiff = SELF->cache.int_val
+ INTVAL idiff = PMC_int_val(SELF)
- VTABLE_get_integer(INTERP, value);
return idiff > 0 ? 1 : idiff < 0 ? -1 : 0;
} else {
@@ -360,13 +360,13 @@ pmclass PerlInt extends perlscalar {
}
else if (value->vtable == Parrot_base_vtables[enum_class_PerlNum]) {
FLOATVAL diff;
- diff = (FLOATVAL)SELF->cache.int_val
+ diff = (FLOATVAL)PMC_int_val(SELF)
- VTABLE_get_number(INTERP, value);
return diff > 0 ? 1 : diff < 0 ? -1 : 0;
}
else {
/* int or undef */
- INTVAL diff = SELF->cache.int_val
+ INTVAL diff = PMC_int_val(SELF)
- VTABLE_get_integer(INTERP, value);
return diff > 0 ? 1 : diff < 0 ? -1 : 0;
}
@@ -374,10 +374,10 @@ pmclass PerlInt extends perlscalar {
INTVAL cmp_num(PMC* value) {
if (value->vtable == Parrot_base_vtables[enum_class_PerlString]) {
- FLOATVAL fdiff = SELF->cache.int_val
+ FLOATVAL fdiff = PMC_int_val(SELF)
- VTABLE_get_number(INTERP, value);
if (fdiff == 0) {
- INTVAL idiff = SELF->cache.int_val
+ INTVAL idiff = PMC_int_val(SELF)
- VTABLE_get_integer(INTERP, value);
return idiff > 0 ? 1 : idiff < 0 ? -1 : 0;
} else {
@@ -386,13 +386,13 @@ pmclass PerlInt extends perlscalar {
}
else if (value->vtable == Parrot_base_vtables[enum_class_PerlNum]) {
FLOATVAL diff;
- diff = (FLOATVAL)SELF->cache.int_val
+ diff = (FLOATVAL)PMC_int_val(SELF)
- VTABLE_get_number(INTERP, value);
return diff > 0 ? 1 : diff < 0 ? -1 : 0;
}
else {
/* int or undef */
- INTVAL diff = SELF->cache.int_val
+ INTVAL diff = PMC_int_val(SELF)
- VTABLE_get_integer(INTERP, value);
return diff > 0 ? 1 : diff < 0 ? -1 : 0;
}
@@ -401,7 +401,7 @@ pmclass PerlInt extends perlscalar {
void logical_not (PMC* value) {
VTABLE_set_integer_native(INTERP, value,
- !SELF->cache.int_val);
+ !PMC_int_val(SELF));
}
void repeat (PMC* value, PMC* dest) {
@@ -415,23 +415,23 @@ pmclass PerlInt extends perlscalar {
}
void increment () {
- SELF->cache.int_val ++;
+ PMC_int_val(SELF) ++;
}
void decrement () {
- SELF->cache.int_val --;
+ PMC_int_val(SELF) --;
}
void freeze(visit_info *info) {
IMAGE_IO *io = info->image_io;
SUPER(info);
- io->vtable->push_integer(INTERP, io, SELF->cache.int_val);
+ io->vtable->push_integer(INTERP, io, PMC_int_val(SELF));
}
void thaw(visit_info *info) {
IMAGE_IO *io = info->image_io;
SUPER(info);
if (info->extra_flags == EXTRA_IS_NULL)
- SELF->cache.int_val = io->vtable->shift_integer(INTERP, io);
+ PMC_int_val(SELF) = io->vtable->shift_integer(INTERP, io);
}
}
View
64 classes/perlnum.pmc
@@ -16,11 +16,11 @@
pmclass PerlNum extends perlscalar {
void init () {
- SELF->cache.num_val = 0.0;
+ PMC_num_val(SELF) = 0.0;
}
INTVAL get_integer () {
- return (INTVAL)SELF->cache.num_val;
+ return (INTVAL)PMC_num_val(SELF);
}
@@ -33,9 +33,9 @@ pmclass PerlNum extends perlscalar {
char* buff = mem_sys_allocate(80);
STRING* s;
#ifdef HAS_SNPRINTF
- snprintf(buff,80,FLOATVAL_FMT,SELF->cache.num_val);
+ snprintf(buff,80,FLOATVAL_FMT,PMC_num_val(SELF));
#else
- sprintf(buff,FLOATVAL_FMT,SELF->cache.num_val); /* XXX buffer overflow! */
+ sprintf(buff,FLOATVAL_FMT,PMC_num_val(SELF)); /* XXX buffer overflow! */
#endif
s = string_make(INTERP,buff,strlen(buff),NULL,0,NULL);
mem_sys_free(buff);
@@ -43,7 +43,7 @@ pmclass PerlNum extends perlscalar {
}
INTVAL get_bool () {
- return (INTVAL)(SELF->cache.num_val != 0.0);
+ return (INTVAL)(PMC_num_val(SELF) != 0.0);
}
void set_integer_native (INTVAL value) {
@@ -54,13 +54,13 @@ pmclass PerlNum extends perlscalar {
void set_number_native (FLOATVAL value) {
INTVAL vali = (INTVAL) value;
- SELF->cache.num_val = value;
+ PMC_num_val(SELF) = value;
if (value == vali)
DYNSELF.set_integer_native(vali);
}
void set_number_same (PMC* value) {
- SELF->cache.num_val = value->cache.num_val;
+ PMC_num_val(SELF) = PMC_num_val(value);
}
void set_bignum_native (BIGNUM* value) {
@@ -76,14 +76,14 @@ pmclass PerlNum extends perlscalar {
void add (PMC* value, PMC* dest) {
VTABLE_set_number_native(INTERP, dest,
- SELF->cache.num_val +
+ PMC_num_val(SELF) +
VTABLE_get_number(INTERP, value)
);
}
void add_int (INTVAL value, PMC* dest) {
VTABLE_set_number_native(INTERP, dest,
- SELF->cache.num_val + value);
+ PMC_num_val(SELF) + value);
}
void add_bignum (BIGNUM* value, PMC* dest) {
@@ -91,19 +91,19 @@ pmclass PerlNum extends perlscalar {
void add_float (FLOATVAL value, PMC* dest) {
VTABLE_set_number_native(INTERP, dest,
- SELF->cache.num_val + value);
+ PMC_num_val(SELF) + value);
}
void subtract (PMC* value, PMC* dest) {
VTABLE_set_number_native(INTERP, dest,
- SELF->cache.num_val -
+ PMC_num_val(SELF) -
VTABLE_get_number(INTERP, value)
);
}
void subtract_int (INTVAL value, PMC* dest) {
VTABLE_set_number_native(INTERP, dest,
- SELF->cache.num_val - (FLOATVAL)value
+ PMC_num_val(SELF) - (FLOATVAL)value
);
}
@@ -112,19 +112,19 @@ pmclass PerlNum extends perlscalar {
void subtract_float (FLOATVAL value, PMC* dest) {
VTABLE_set_number_native(INTERP, dest,
- SELF->cache.num_val - value);
+ PMC_num_val(SELF) - value);
}
void multiply (PMC* value, PMC* dest) {
VTABLE_set_number_native(INTERP, dest,
- SELF->cache.num_val *
+ PMC_num_val(SELF) *
VTABLE_get_number(INTERP, value)
);
}
void multiply_int (INTVAL value, PMC* dest) {
VTABLE_set_number_native(INTERP, dest,
- SELF->cache.num_val * value
+ PMC_num_val(SELF) * value
);
}
@@ -133,79 +133,79 @@ pmclass PerlNum extends perlscalar {
void multiply_float (FLOATVAL value, PMC* dest) {
VTABLE_set_number_native(INTERP, dest,
- SELF->cache.num_val * value);
+ PMC_num_val(SELF) * value);
}
void divide (PMC* value, PMC* dest) {
VTABLE_set_number_native(INTERP, dest,
- SELF->cache.num_val /
+ PMC_num_val(SELF) /
VTABLE_get_number(INTERP, value)
);
}
void divide_int (INTVAL value, PMC* dest) {
VTABLE_set_number_native(INTERP, dest,
- SELF->cache.num_val / value
+ PMC_num_val(SELF) / value
);
}
void divide_float (FLOATVAL value, PMC* dest) {
VTABLE_set_number_native(INTERP, dest,
- SELF->cache.num_val / value
+ PMC_num_val(SELF) / value
);
}
void cmodulus (PMC* value, PMC* dest) {
FLOATVAL f = VTABLE_get_number(INTERP, value);
VTABLE_set_number_native(INTERP, dest,
- fmod(SELF->cache.num_val, f));
+ fmod(PMC_num_val(SELF), f));
}
void cmodulus_float (FLOATVAL value, PMC* dest) {
VTABLE_set_number_native(INTERP, dest,
- fmod(SELF->cache.num_val, value));
+ fmod(PMC_num_val(SELF), value));
}
void cmodulus_int (INTVAL value, PMC* dest) {
VTABLE_set_number_native(INTERP, dest,
- fmod(SELF->cache.num_val, value));
+ fmod(PMC_num_val(SELF), value));
}
void modulus (PMC* value, PMC* dest) {
FLOATVAL f = VTABLE_get_number(INTERP, value);
VTABLE_set_number_native(INTERP, dest,
- floatval_mod(SELF->cache.num_val, f));
+ floatval_mod(PMC_num_val(SELF), f));
}
void modulus_float (FLOATVAL value, PMC* dest) {
VTABLE_set_number_native(INTERP, dest,
- floatval_mod(SELF->cache.num_val, value));
+ floatval_mod(PMC_num_val(SELF), value));
}
void modulus_int (INTVAL value, PMC* dest) {
VTABLE_set_number_native(INTERP, dest,
- floatval_mod(SELF->cache.num_val, value));
+ floatval_mod(PMC_num_val(SELF), value));
}
void neg (PMC * dest) {
if (!dest)
- SELF->cache.num_val = -SELF->cache.num_val;
+ PMC_num_val(SELF) = -PMC_num_val(SELF);
else
- VTABLE_set_number_native(INTERP, dest, -SELF->cache.num_val);
+ VTABLE_set_number_native(INTERP, dest, -PMC_num_val(SELF));
}
/* == operation */
INTVAL is_equal (PMC* value) {
- return (INTVAL)(SELF->cache.num_val == VTABLE_get_number(INTERP, value));
+ return (INTVAL)(PMC_num_val(SELF) == VTABLE_get_number(INTERP, value));
}
INTVAL cmp(PMC* value) {
FLOATVAL diff;
- diff = SELF->cache.num_val - VTABLE_get_number(INTERP, value);
+ diff = PMC_num_val(SELF) - VTABLE_get_number(INTERP, value);
return diff > 0 ? 1 : diff < 0 ? -1 : 0;
}
INTVAL cmp_num(PMC* value) {
FLOATVAL diff;
- diff = SELF->cache.num_val - VTABLE_get_number(INTERP, value);
+ diff = PMC_num_val(SELF) - VTABLE_get_number(INTERP, value);
return diff > 0 ? 1 : diff < 0 ? -1 : 0;
}
@@ -220,11 +220,11 @@ pmclass PerlNum extends perlscalar {
}
void increment () {
- SELF->cache.num_val ++;
+ PMC_num_val(SELF) ++;
}
void decrement () {
- SELF->cache.num_val --;
+ PMC_num_val(SELF) --;
}
}
View
110 classes/perlstring.pmc
@@ -17,29 +17,29 @@
pmclass PerlString extends perlscalar {
void init () {
- SELF->cache.string_val = string_make(INTERP,NULL,0,NULL,0,NULL);
+ PMC_str_val(SELF) = string_make(INTERP,NULL,0,NULL,0,NULL);
PObj_custom_mark_SET(SELF);
}
void mark () {
- if (SELF->cache.string_val)
- pobject_lives(INTERP, (PObj *)SELF->cache.string_val);
+ if (PMC_str_val(SELF))
+ pobject_lives(INTERP, (PObj *)PMC_str_val(SELF));
}
PMC* clone () {
PMC* dest = pmc_new_noinit(INTERP, SELF->vtable->base_type);
PObj_custom_mark_SET(dest);
- dest->cache.string_val = string_copy(INTERP,SELF->cache.string_val);
+ PMC_str_val(dest) = string_copy(INTERP,PMC_str_val(SELF));
return dest;
}
INTVAL get_integer () {
- STRING* s = (STRING*) SELF->cache.string_val;
+ STRING* s = (STRING*) PMC_str_val(SELF);
return string_to_int(s);
}
FLOATVAL get_number () {
- STRING* s = (STRING*) SELF->cache.string_val;
+ STRING* s = (STRING*) PMC_str_val(SELF);
return string_to_num(s);
}
@@ -49,12 +49,12 @@ pmclass PerlString extends perlscalar {
}
INTVAL get_bool () {
- return string_bool(SELF->cache.string_val);
+ return string_bool(PMC_str_val(SELF));
}
INTVAL is_same (PMC* other) {
- STRING* s1 = (STRING*)SELF->cache.string_val;
- STRING* s2 = (STRING*)other->cache.string_val;
+ STRING* s1 = (STRING*)PMC_str_val(SELF);
+ STRING* s2 = (STRING*)PMC_str_val(other);
return (INTVAL)( other->vtable == SELF->vtable &&
s1->bufused == s2->bufused &&
(memcmp(s1->strstart,s2->bufstart,(size_t)s1->bufused)==0));
@@ -71,13 +71,13 @@ pmclass PerlString extends perlscalar {
}
void set_string_native (STRING * value) {
- SELF->cache.string_val = string_set(INTERP, SELF->cache.string_val,
+ PMC_str_val(SELF) = string_set(INTERP, PMC_str_val(SELF),
value);
}
void set_string_same (PMC * value) {
- SELF->cache.string_val = string_set(INTERP, SELF->cache.string_val,
- value->cache.string_val);
+ PMC_str_val(SELF) = string_set(INTERP, PMC_str_val(SELF),
+ PMC_str_val(value));
}
/* XXX -lt: only add done yet, others will follow, when
@@ -91,7 +91,7 @@ pmclass PerlString extends perlscalar {
if (vtype == enum_class_PerlNum) {
VTABLE_set_number_native(INTERP, dest,
VTABLE_get_number(INTERP, SELF) +
- value->cache.num_val
+ PMC_num_val(value)
);
}
else {
@@ -112,13 +112,13 @@ pmclass PerlString extends perlscalar {
if(value->vtable == Parrot_base_vtables[enum_class_PerlInt]) {
VTABLE_set_integer_native(INTERP, dest,
VTABLE_get_integer(INTERP, SELF) -
- value->cache.int_val
+ PMC_int_val(value)
);
}
else if(value->vtable == Parrot_base_vtables[enum_class_PerlNum]) {
VTABLE_set_number_native(INTERP, dest,
VTABLE_get_number(INTERP, SELF) -
- value->cache.num_val
+ PMC_num_val(value)
);
}
else {
@@ -131,13 +131,13 @@ pmclass PerlString extends perlscalar {
if(value->vtable == Parrot_base_vtables[enum_class_PerlInt]) {
VTABLE_set_integer_native(INTERP, dest,
VTABLE_get_integer(INTERP, SELF) *
- value->cache.int_val
+ PMC_int_val(value)
);
}
else if(value->vtable == Parrot_base_vtables[enum_class_PerlNum]) {
VTABLE_set_number_native(INTERP, dest,
VTABLE_get_number(INTERP, SELF) *
- value->cache.num_val
+ PMC_num_val(value)
);
}
else {
@@ -149,13 +149,13 @@ pmclass PerlString extends perlscalar {
if(value->vtable == Parrot_base_vtables[enum_class_PerlInt]) {
VTABLE_set_integer_native(INTERP, dest,
VTABLE_get_integer(INTERP, SELF) /
- value->cache.int_val
+ PMC_int_val(value)
);
}
else if(value->vtable == Parrot_base_vtables[enum_class_PerlNum]) {
VTABLE_set_number_native(INTERP, dest,
VTABLE_get_number(INTERP, SELF) /
- value->cache.num_val
+ PMC_num_val(value)
);
}
else {
@@ -168,7 +168,7 @@ pmclass PerlString extends perlscalar {
if(value->vtable == Parrot_base_vtables[enum_class_PerlInt]) {
VTABLE_set_integer_native(INTERP, dest,
VTABLE_get_integer(INTERP, SELF) %
- value->cache.int_val
+ PMC_int_val(value)
);
}
else {
@@ -184,7 +184,7 @@ pmclass PerlString extends perlscalar {
void bitwise_ors (PMC* value, PMC* dest) {
STRING* result;
- result = string_bitwise_or(interpreter, SELF->cache.string_val,
+ result = string_bitwise_or(interpreter, PMC_str_val(SELF),
VTABLE_get_string(INTERP, value), NULL);
VTABLE_set_string_native(INTERP, dest, result);
}
@@ -192,7 +192,7 @@ pmclass PerlString extends perlscalar {
void bitwise_ors_str (STRING* value, PMC* dest) {
STRING* result;
- result = string_bitwise_or(interpreter, SELF->cache.string_val,
+ result = string_bitwise_or(interpreter, PMC_str_val(SELF),
value, NULL);
VTABLE_set_string_native(INTERP, dest, result);
}
@@ -200,7 +200,7 @@ pmclass PerlString extends perlscalar {
void bitwise_xors (PMC* value, PMC* dest) {
STRING* result;
- result = string_bitwise_xor(interpreter, SELF->cache.string_val,
+ result = string_bitwise_xor(interpreter, PMC_str_val(SELF),
VTABLE_get_string(INTERP, value), NULL);
VTABLE_set_string_native(INTERP, dest, result);
}
@@ -208,7 +208,7 @@ pmclass PerlString extends perlscalar {
void bitwise_xors_str (STRING* value, PMC* dest) {
STRING* result;
- result = string_bitwise_xor(interpreter, SELF->cache.string_val,
+ result = string_bitwise_xor(interpreter, PMC_str_val(SELF),
value, NULL);
VTABLE_set_string_native(INTERP, dest, result);
}
@@ -216,7 +216,7 @@ pmclass PerlString extends perlscalar {
void bitwise_ands (PMC* value, PMC* dest) {
STRING* result;
- result = string_bitwise_and(interpreter, SELF->cache.string_val,
+ result = string_bitwise_and(interpreter, PMC_str_val(SELF),
VTABLE_get_string(INTERP, value), NULL);
VTABLE_set_string_native(INTERP, dest, result);
}
@@ -224,42 +224,42 @@ pmclass PerlString extends perlscalar {
void bitwise_ands_str (STRING* value, PMC* dest) {
STRING* result;
- result = string_bitwise_and(interpreter, SELF->cache.string_val,
+ result = string_bitwise_and(interpreter, PMC_str_val(SELF),
value, NULL);
VTABLE_set_string_native(INTERP, dest, result);
}
void concatenate (PMC* value, PMC* dest) {
- STRING* s = SELF->cache.string_val;
+ STRING* s = PMC_str_val(SELF);
VTABLE_morph(INTERP, dest, enum_class_PerlString);
- dest->cache.string_val =
+ PMC_str_val(dest) =
string_concat(INTERP, s, VTABLE_get_string(INTERP, value), 0);
}
void concatenate_native (STRING* value, PMC* dest) {
- STRING* s = SELF->cache.string_val;
+ STRING* s = PMC_str_val(SELF);
VTABLE_morph(INTERP, dest, enum_class_PerlString);
- dest->cache.string_val = string_concat(INTERP, s, value, 0);
+ PMC_str_val(dest) = string_concat(INTERP, s, value, 0);
}
/* == operation */
INTVAL is_equal (PMC* value) {
return (INTVAL)( 0 == string_compare(INTERP,
- SELF->cache.string_val,
+ PMC_str_val(SELF),
VTABLE_get_string(INTERP, value)
));
}
INTVAL cmp(PMC* value) {
- return string_compare(INTERP, SELF->cache.string_val,
+ return string_compare(INTERP, PMC_str_val(SELF),
VTABLE_get_string(INTERP, value));
}
void repeat (PMC* value, PMC* dest) {
DYNSELF.morph(enum_class_PerlString);
VTABLE_morph(INTERP, dest, enum_class_PerlString);
- dest->cache.string_val =
- string_repeat(INTERP, SELF->cache.string_val,
+ PMC_str_val(dest) =
+ string_repeat(INTERP, PMC_str_val(SELF),
(UINTVAL)VTABLE_get_integer(INTERP, value), NULL
);
}
@@ -267,8 +267,8 @@ pmclass PerlString extends perlscalar {
void repeat_int (INTVAL value, PMC* dest) {
DYNSELF.morph(enum_class_PerlString);
VTABLE_morph(INTERP, dest, enum_class_PerlString);
- dest->cache.string_val = string_repeat(INTERP,
- SELF->cache.string_val, (UINTVAL)value, NULL);
+ PMC_str_val(dest) = string_repeat(INTERP,
+ PMC_str_val(SELF), (UINTVAL)value, NULL);
}
void increment () {
@@ -282,12 +282,12 @@ pmclass PerlString extends perlscalar {
void substr (INTVAL offset, INTVAL length, PMC* dest) {
DYNSELF.morph(enum_class_PerlString);
VTABLE_morph(INTERP, dest, enum_class_PerlString);
- dest->cache.string_val = string_substr(INTERP,
- SELF