# New Ticket Created by JÃrgen BÃmmels
# Please include the string: [perl #27983]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=27983 >
Hi,
over a year ago the cache element was removed from the PMC-struct. For
compatibility a macro was introduced:
#define cache obj.u
It allowed old code to compile in a clean way, but it prevents the use
of a local variable named cache in any file that includes pobj.h
This patch removes this #define cache hack and uses the
accessor-macros PMC_*_val instead.
Ok to commit?
bÃ
Index: include/parrot/pobj.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/pobj.h,v
retrieving revision 1.38
diff -u -r1.38 pobj.h
--- include/parrot/pobj.h 19 Mar 2004 04:08:22 -0000 1.38
+++ include/parrot/pobj.h 26 Mar 2004 17:23:54 -0000
@@ -110,10 +110,6 @@
INTVAL language;
};
- /* cache.* is intended to just be *shortcuts* to*/
- /* commonly-accessed data, *not* pointers to */
- /* completely different data. That's why it's */
- /* referred to as a "cache". */
/* put data into the PMC_EXT structure */
#define PMC_DATA_IN_EXT 1
@@ -172,7 +168,6 @@
#define PMC_union(pmc) (pmc)->obj.u
/* macro for accessing union data */
-#define cache obj.u
#define next_for_GC pmc_ext->_next_for_GC
#define metadata pmc_ext->_metadata
#define synchronize pmc_ext->_synchronize
Index: io/io.c
===================================================================
RCS file: /cvs/public/parrot/io/io.c,v
retrieving revision 1.83
diff -u -r1.83 io.c
--- io/io.c 4 Mar 2004 11:15:02 -0000 1.83
+++ io/io.c 26 Mar 2004 17:23:55 -0000
@@ -659,7 +659,7 @@
INTVAL
PIO_peek(theINTERP, PMC *pmc, void *buffer)
{
- ParrotIOLayer *l = pmc->cache.struct_val;
+ ParrotIOLayer *l = PMC_struct_val(pmc);
ParrotIO *io = PMC_data(pmc);
if(!io)
return -1;
Index: jit/i386/jit_emit.h
===================================================================
RCS file: /cvs/public/parrot/jit/i386/jit_emit.h,v
retrieving revision 1.102
diff -u -r1.102 jit_emit.h
--- jit/i386/jit_emit.h 3 Mar 2004 10:12:56 -0000 1.102
+++ jit/i386/jit_emit.h 26 Mar 2004 17:24:01 -0000
@@ -3007,7 +3007,7 @@
emitm_movl_m_r(pc, emit_EAX, emit_EBP, 0, 1, 12);
/* call the thing in struct_val, i.e. offset 12 - call *(12)%eax */
emitm_callm(pc, emit_EAX, emit_None, emit_None,
- offsetof(struct PMC, cache.struct_val));
+ offsetof(struct PMC, obj.u._ptrs._struct_val));
/*
* TODO
* if we have strings in the signature, then we are leaking memory
Index: src/debug.c
===================================================================
RCS file: /cvs/public/parrot/src/debug.c,v
retrieving revision 1.125
diff -u -r1.125 debug.c
--- src/debug.c 24 Mar 2004 17:41:31 -0000 1.125
+++ src/debug.c 26 Mar 2004 17:24:02 -0000
@@ -1534,13 +1534,13 @@
break;
case KEY_integer_FLAG:
Parrot_snprintf(interpreter, buf, sizeof(buf),
- INTVAL_FMT, k->cache.int_val);
+ INTVAL_FMT, PMC_int_val(k));
strcpy(&dest[size], buf);
size += strlen(buf);
break;
case KEY_number_FLAG:
Parrot_snprintf(interpreter, buf, sizeof(buf),
- FLOATVAL_FMT, k->cache.num_val);
+ FLOATVAL_FMT, PMC_num_val(k));
strcpy(&dest[size], buf);
size += strlen(buf);
break;
@@ -1548,34 +1548,34 @@
dest[size++] = '"';
{
char *temp = string_to_cstring(interpreter,
- k->cache.string_val);
+ PMC_str_val(k));
strcpy(&dest[size], temp);
string_cstring_free(temp);
}
- size += string_length(k->cache.string_val);
+ size += string_length(PMC_str_val(k));
dest[size++] = '"';
break;
case KEY_integer_FLAG|KEY_register_FLAG:
Parrot_snprintf(interpreter, buf, sizeof(buf),
- "I" INTVAL_FMT, k->cache.int_val);
+ "I" INTVAL_FMT, PMC_int_val(k));
strcpy(&dest[size], buf);
size += strlen(buf);
break;
case KEY_number_FLAG|KEY_register_FLAG:
Parrot_snprintf(interpreter, buf, sizeof(buf),
- "N" INTVAL_FMT, k->cache.int_val);
+ "N" INTVAL_FMT, PMC_int_val(k));
strcpy(&dest[size], buf);
size += strlen(buf);
break;
case KEY_string_FLAG|KEY_register_FLAG:
Parrot_snprintf(interpreter, buf, sizeof(buf),
- "S" INTVAL_FMT, k->cache.int_val);
+ "S" INTVAL_FMT, PMC_int_val(k));
strcpy(&dest[size], buf);
size += strlen(buf);
break;
case KEY_pmc_FLAG|KEY_register_FLAG:
Parrot_snprintf(interpreter, buf, sizeof(buf),
- "P" INTVAL_FMT, k->cache.int_val);
+ "P" INTVAL_FMT, PMC_int_val(k));
strcpy(&dest[size], buf);
size += strlen(buf);
break;
@@ -2049,7 +2049,7 @@
buf = Parrot_sprintf_c(interpreter, "%s%s", command, end);
code = VTABLE_invoke(interpreter, compiler, buf);
- return code->cache.struct_val;
+ return PMC_struct_val(code);
}
/*
Index: src/dynext.c
===================================================================
RCS file: /cvs/public/parrot/src/dynext.c,v
retrieving revision 1.19
diff -u -r1.19 dynext.c
--- src/dynext.c 7 Feb 2004 16:44:30 -0000 1.19
+++ src/dynext.c 26 Mar 2004 17:24:02 -0000
@@ -259,7 +259,7 @@
* but currently only ops files have struct_val set
*/
type = const_string(interpreter,
- lib_pmc->cache.struct_val ? "Ops" : "PMC");
+ PMC_struct_val(lib_pmc) ? "Ops" : "PMC");
}
/*
* call init, if it exists
Index: src/exceptions.c
===================================================================
RCS file: /cvs/public/parrot/src/exceptions.c,v
retrieving revision 1.51
diff -u -r1.51 exceptions.c
--- src/exceptions.c 21 Feb 2004 11:23:12 -0000 1.51
+++ src/exceptions.c 26 Mar 2004 17:24:02 -0000
@@ -268,7 +268,7 @@
{
PMC *handler = pmc_new(interpreter, enum_class_Exception_Handler);
PObj_get_FLAGS(handler) |= PObj_private0_FLAG;
- handler->cache.struct_val = jb;
+ PMC_struct_val(handler) = jb;
return handler;
}
@@ -328,11 +328,11 @@
REG_PMC(5) = exception;
if (PObj_get_FLAGS(handler) & PObj_private0_FLAG) {
/* its a C exception handler */
- Parrot_exception *jb = (Parrot_exception *) handler->cache.struct_val;
+ Parrot_exception *jb = (Parrot_exception *) PMC_struct_val(handler);
longjmp(jb->destination, 1);
}
/* return the address of the handler */
- return handler->cache.struct_val;
+ return PMC_struct_val(handler);
}
/*
@@ -360,7 +360,7 @@
/* put exception object in P5 */
REG_PMC(5) = exception;
/* return the address of the handler */
- return handler->cache.struct_val;
+ return PMC_struct_val(handler);
}
/*
@@ -390,7 +390,7 @@
/*
* if there was no user handler, interpreter is already shutdown
*/
- the_exception->resume = handler->cache.struct_val;
+ the_exception->resume = PMC_struct_val(handler);
the_exception->error = VTABLE_get_integer_keyed_int(interpreter,
exception, 1);
the_exception->severity = VTABLE_get_integer_keyed_int(interpreter,
Index: src/hash.c
===================================================================
RCS file: /cvs/public/parrot/src/hash.c,v
retrieving revision 1.74
diff -u -r1.74 hash.c
--- src/hash.c 7 Mar 2004 19:07:31 -0000 1.74
+++ src/hash.c 26 Mar 2004 17:24:02 -0000
@@ -781,7 +781,7 @@
STRING *
hash_get_idx(Interp *interpreter, Hash *hash, PMC * key)
{
- HashIndex i = key->cache.int_val;
+ HashIndex i = PMC_int_val(key);
BucketIndex bi = (BucketIndex)PMC_data(key);
HashBucket *b;
/* locate initial */
@@ -805,7 +805,7 @@
}
bi = lookupBucketIndex(hash, i);
}
- key->cache.int_val = i;
+ PMC_int_val(key) = i;
PMC_data(key) = (void *)bi;
return b->key;
}
Index: src/interpreter.c
===================================================================
RCS file: /cvs/public/parrot/src/interpreter.c,v
retrieving revision 1.286
diff -u -r1.286 interpreter.c
--- src/interpreter.c 21 Mar 2004 11:07:32 -0000 1.286
+++ src/interpreter.c 26 Mar 2004 17:24:02 -0000
@@ -328,7 +328,7 @@
internal_exception(1, "Couldn't find init_func for core %d", which);
return init_func;
}
- return (oplib_init_f) D2FPTR(lib->cache.struct_val);
+ return (oplib_init_f) D2FPTR(PMC_struct_val(lib));
}
/*
Index: src/jit.c
===================================================================
RCS file: /cvs/public/parrot/src/jit.c,v
retrieving revision 1.84
diff -u -r1.84 jit.c
--- src/jit.c 26 Mar 2004 09:16:19 -0000 1.84
+++ src/jit.c 26 Mar 2004 17:24:02 -0000
@@ -327,7 +327,7 @@
while (key) {
UINTVAL flags = PObj_get_FLAGS(key);
if (flags & KEY_register_FLAG) {
- INTVAL n = key->cache.int_val;
+ INTVAL n = PMC_int_val(key);
if (flags & KEY_integer_FLAG) {
typ = 0;
if (n < 0)
Index: src/key.c
===================================================================
RCS file: /cvs/public/parrot/src/key.c,v
retrieving revision 1.45
diff -u -r1.45 key.c
--- src/key.c 26 Jan 2004 23:16:05 -0000 1.45
+++ src/key.c 26 Mar 2004 17:24:02 -0000
@@ -56,7 +56,7 @@
PMC *key = pmc_new(interpreter, enum_class_Key);
PObj_get_FLAGS(key) |= KEY_integer_FLAG;
- key->cache.int_val = value;
+ PMC_int_val(key) = value;
return key;
}
@@ -78,7 +78,7 @@
PMC *key = pmc_new(interpreter, enum_class_Key);
PObj_get_FLAGS(key) |= KEY_number_FLAG;
- key->cache.num_val = value;
+ PMC_num_val(key) = value;
return key;
}
@@ -100,7 +100,7 @@
PMC *key = pmc_new(interpreter, enum_class_Key);
PObj_get_FLAGS(key) |= KEY_string_FLAG;
- key->cache.string_val = value;
+ PMC_str_val(key) = value;
return key;
}
@@ -141,7 +141,7 @@
PMC *key = pmc_new(interpreter, enum_class_Key);
PObj_get_FLAGS(key) |= KEY_pmc_FLAG;
- key->cache.pmc_val = value;
+ PMC_pmc_val(key) = value;
return key;
}
@@ -162,7 +162,7 @@
{
PObj_get_FLAGS(key) &= ~KEY_type_FLAGS;
PObj_get_FLAGS(key) |= KEY_integer_FLAG;
- key->cache.int_val = value;
+ PMC_int_val(key) = value;
return;
}
@@ -185,7 +185,7 @@
{
PObj_get_FLAGS(key) &= ~KEY_type_FLAGS;
PObj_get_FLAGS(key) |= KEY_register_FLAG | flag;
- key->cache.int_val = value;
+ PMC_int_val(key) = value;
return;
}
@@ -206,7 +206,7 @@
{
PObj_get_FLAGS(key) &= ~KEY_type_FLAGS;
PObj_get_FLAGS(key) |= KEY_number_FLAG;
- key->cache.num_val = value;
+ PMC_num_val(key) = value;
return;
}
@@ -227,7 +227,7 @@
{
PObj_get_FLAGS(key) &= ~KEY_type_FLAGS;
PObj_get_FLAGS(key) |= KEY_string_FLAG;
- key->cache.string_val = value;
+ PMC_str_val(key) = value;
return;
}
@@ -248,7 +248,7 @@
{
PObj_get_FLAGS(key) &= ~KEY_type_FLAGS;
PObj_get_FLAGS(key) |= KEY_pmc_FLAG;
- key->cache.pmc_val = value;
+ PMC_pmc_val(key) = value;
return;
}
@@ -286,14 +286,13 @@
switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
case KEY_integer_FLAG:
- return key->cache.int_val;
+ return PMC_int_val(key);
case KEY_integer_FLAG | KEY_register_FLAG:
- return interpreter->int_reg.registers[key->cache.int_val];
+ return interpreter->int_reg.registers[PMC_int_val(key)];
case KEY_pmc_FLAG:
- return VTABLE_get_integer(interpreter,
- key->cache.pmc_val);
+ return VTABLE_get_integer(interpreter, PMC_pmc_val(key));
case KEY_pmc_FLAG | KEY_register_FLAG:
- reg = interpreter->pmc_reg.registers[key->cache.int_val];
+ reg = interpreter->pmc_reg.registers[PMC_int_val(key)];
return VTABLE_get_integer(interpreter, reg);
default:
internal_exception(INVALID_OPERATION, "Key not an integer!\n");
@@ -317,14 +316,13 @@
switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
case KEY_number_FLAG:
- return key->cache.num_val;
+ return PMC_num_val(key);
case KEY_number_FLAG | KEY_register_FLAG:
- return interpreter->num_reg.registers[key->cache.int_val];
+ return interpreter->num_reg.registers[PMC_int_val(key)];
case KEY_pmc_FLAG:
- return VTABLE_get_number(interpreter,
- key->cache.pmc_val);
+ return VTABLE_get_number(interpreter,PMC_pmc_val(key));
case KEY_pmc_FLAG | KEY_register_FLAG:
- reg = interpreter->pmc_reg.registers[key->cache.int_val];
+ reg = interpreter->pmc_reg.registers[PMC_int_val(key)];
return VTABLE_get_number(interpreter, reg);
default:
internal_exception(INVALID_OPERATION, "Key not a number!\n");
@@ -348,14 +346,13 @@
switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
case KEY_string_FLAG:
- return key->cache.string_val;
+ return PMC_str_val(key);
case KEY_string_FLAG | KEY_register_FLAG:
- return interpreter->string_reg.registers[key->cache.int_val];
+ return interpreter->string_reg.registers[PMC_int_val(key)];
case KEY_pmc_FLAG:
- return VTABLE_get_string(interpreter,
- key->cache.pmc_val);
+ return VTABLE_get_string(interpreter, PMC_pmc_val(key));
case KEY_pmc_FLAG | KEY_register_FLAG:
- reg = interpreter->pmc_reg.registers[key->cache.int_val];
+ reg = interpreter->pmc_reg.registers[PMC_int_val(key)];
return VTABLE_get_string(interpreter, reg);
default:
internal_exception(INVALID_OPERATION, "Key not a string!\n");
@@ -380,9 +377,9 @@
{
switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
case KEY_pmc_FLAG:
- return key->cache.pmc_val;
+ return PMC_pmc_val(key);
case KEY_pmc_FLAG | KEY_register_FLAG:
- return interpreter->pmc_reg.registers[key->cache.int_val];
+ return interpreter->pmc_reg.registers[PMC_int_val(key)];
default:
internal_exception(INVALID_OPERATION, "Key not a PMC!\n");
return 0;
@@ -453,7 +450,7 @@
pobject_lives(interpreter, (PObj *) key);
if ( ((PObj_get_FLAGS(key) & KEY_type_FLAGS) == KEY_string_FLAG) ||
((PObj_get_FLAGS(key) & KEY_type_FLAGS) == KEY_pmc_FLAG) )
- pobject_lives(interpreter, (PObj *)key->cache.string_val);
+ pobject_lives(interpreter, (PObj *) PMC_str_val(key));
if ((PObj_get_FLAGS(key) & KEY_type_FLAGS) == KEY_integer_FLAG)
return;
Index: src/method_util.c
===================================================================
RCS file: /cvs/public/parrot/src/method_util.c,v
retrieving revision 1.21
diff -u -r1.21 method_util.c
--- src/method_util.c 21 Feb 2004 16:33:48 -0000 1.21
+++ src/method_util.c 26 Mar 2004 17:24:02 -0000
@@ -39,7 +39,7 @@
Parrot_new_csub(struct Parrot_Interp *interp, Parrot_csub_t func)
{
PMC *ret = pmc_new(interp, enum_class_CSub);
- ret->cache.struct_val = (DPOINTER *)F2DPTR(func);
+ PMC_struct_val(ret) = (DPOINTER *)F2DPTR(func);
return ret;
}
Index: src/objects.c
===================================================================
RCS file: /cvs/public/parrot/src/objects.c,v
retrieving revision 1.67
diff -u -r1.67 objects.c
--- src/objects.c 26 Mar 2004 12:10:50 -0000 1.67
+++ src/objects.c 26 Mar 2004 17:24:03 -0000
@@ -210,7 +210,7 @@
set_attrib_num(class_slots, PCD_ATTRIBUTES, attr_offset_hash);
set_attrib_num(class_slots, PCD_ATTRIB_OFFS, class_offset_hash);
/* And note the totals */
- class->cache.int_val = cur_offset - POD_FIRST_ATTRIB;
+ PMC_int_val(class) = cur_offset - POD_FIRST_ATTRIB;
return;
}
@@ -253,7 +253,7 @@
set_attrib_array_size(child_class_array, PCD_MAX);
/* We have the same number of attributes as our parent */
- child_class->cache.int_val = base_class->cache.int_val;
+ PMC_int_val(child_class) = PMC_int_val(base_class);
/* Our parent class array has a single member in it */
parents = pmc_new(interpreter, enum_class_Array);
@@ -503,7 +503,7 @@
object->vtable = PMC_struct_val(vtable_pmc);
/* Grab the attribute count from the parent */
- attrib_count = class->cache.int_val;
+ attrib_count = PMC_int_val(class);
class_array = PMC_data(class);
class_name = get_attrib_num(class_array, PCD_CLASS_NAME);
@@ -1034,11 +1034,11 @@
* while there are already child class attrs
*/
idx = VTABLE_elements(interpreter, attr_hash);
- assert(class->cache.int_val == idx);
+ assert(PMC_int_val(class) == idx);
VTABLE_set_integer_keyed_str(interpreter, attr_hash,
full_attr_name, idx);
assert(idx + 1 == VTABLE_elements(interpreter, attr_hash));
- class->cache.int_val = idx + 1;
+ PMC_int_val(class) = idx + 1;
return idx;
}
Index: src/packfile.c
===================================================================
RCS file: /cvs/public/parrot/src/packfile.c,v
retrieving revision 1.157
diff -u -r1.157 packfile.c
--- src/packfile.c 21 Mar 2004 12:35:37 -0000 1.157
+++ src/packfile.c 26 Mar 2004 17:24:04 -0000
@@ -445,10 +445,10 @@
case enum_class_Coroutine:
if (PObj_get_FLAGS(sub_pmc) & PObj_private1_FLAG)
continue;
- rel = (INTVAL) sub_pmc->cache.struct_val *
+ rel = (INTVAL) PMC_struct_val(sub_pmc) *
sizeof(opcode_t);
rel += (INTVAL) self->cur_cs->base.data;
- sub_pmc->cache.struct_val = (void*) rel;
+ PMC_struct_val(sub_pmc) = (void*) rel;
sub = (struct Parrot_Sub*) PMC_sub(sub_pmc);
rel = (INTVAL) sub->end * sizeof(opcode_t);
rel += (INTVAL) self->cur_cs->base.data;
@@ -2909,7 +2909,7 @@
/* both start and end are relative, so are small -
* cast for 64-bit compilers where sizeof(int)=4, sizeof(long)=8
*/
- sub_pmc->cache.struct_val = (void *)(long) start;
+ PMC_struct_val(sub_pmc) = (void *)(long) start;
sub = PMC_sub(sub_pmc);
sub->end = (opcode_t*)(long)end;
sub->packed = pmcs;
@@ -3090,7 +3090,7 @@
fprintf(stderr, "packfile.c: VTABLE: compiler->invoke '%s'\n", filename);
#endif
code = VTABLE_invoke(interpreter, compiler, file);
- pf = code->cache.struct_val;
+ pf = PMC_struct_val(code);
if (pf) {
PackFile_add_segment(&interpreter->code->directory,
&pf->directory.base);
Index: src/packout.c
===================================================================
RCS file: /cvs/public/parrot/src/packout.c,v
retrieving revision 1.34
diff -u -r1.34 packout.c
--- src/packout.c 25 Jan 2004 19:33:27 -0000 1.34
+++ src/packout.c 26 Mar 2004 17:24:04 -0000
@@ -187,11 +187,11 @@
{
int i;
for (i = 0; i < ct->const_count; i++)
- if (type == PFC_STRING && ct->constants[i]->u.string ==
- key->cache.string_val)
+ if (type == PFC_STRING
+ && ct->constants[i]->u.string == PMC_str_val(key))
return i;
- else if (type == PFC_NUMBER && ct->constants[i]->u.number ==
- key->cache.num_val)
+ else if (type == PFC_NUMBER
+ && ct->constants[i]->u.number == PMC_num_val(key))
return i;
PIO_eprintf(NULL, "find_in_const: couldn't find const for key\n");
Parrot_exit(1);
@@ -267,7 +267,7 @@
switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
case KEY_integer_FLAG:
*cursor++ = PARROT_ARG_IC;
- *cursor++ = key->cache.int_val;
+ *cursor++ = PMC_int_val(key);
break;
case KEY_number_FLAG:
*cursor++ = PARROT_ARG_NC;
@@ -280,19 +280,19 @@
case KEY_integer_FLAG | KEY_register_FLAG:
*cursor++ = PARROT_ARG_I;
- *cursor++ = key->cache.int_val;
+ *cursor++ = PMC_int_val(key);
break;
case KEY_number_FLAG | KEY_register_FLAG:
*cursor++ = PARROT_ARG_N;
- *cursor++ = key->cache.int_val;
+ *cursor++ = PMC_int_val(key);
break;
case KEY_string_FLAG | KEY_register_FLAG:
*cursor++ = PARROT_ARG_S;
- *cursor++ = key->cache.int_val;
+ *cursor++ = PMC_int_val(key);
break;
case KEY_pmc_FLAG | KEY_register_FLAG:
*cursor++ = PARROT_ARG_P;
- *cursor++ = key->cache.int_val;
+ *cursor++ = PMC_int_val(key);
break;
default:
PIO_eprintf(NULL, "PackFile_Constant_pack: "
Index: src/sub.c
===================================================================
RCS file: /cvs/public/parrot/src/sub.c,v
retrieving revision 1.53
diff -u -r1.53 sub.c
--- src/sub.c 25 Mar 2004 09:23:01 -0000 1.53
+++ src/sub.c 26 Mar 2004 17:24:05 -0000
@@ -434,7 +434,7 @@
PObj_get_FLAGS(continuation) |= (
PObj_private1_FLAG|PObj_private2_FLAG);
}
- continuation->cache.struct_val = address;
+ PMC_struct_val(continuation) = address;
return continuation;
}
@@ -462,9 +462,9 @@
{
/* if scope_index is negative we count out from current pad */
scope_index = scope_index < 0 ?
- pad->cache.int_val + scope_index : scope_index;
+ PMC_int_val(pad) + scope_index : scope_index;
- if (scope_index >= pad->cache.int_val || scope_index < 0) {
+ if (scope_index >= PMC_int_val(pad) || scope_index < 0) {
internal_exception(-1, "Pad index out of range");
return NULL;
}
@@ -540,7 +540,7 @@
INTVAL i, pos = 0;
struct Parrot_Lexicals * lex = NULL;
- for (i = pad->cache.int_val - 1; i >= 0; i--) {
+ for (i = PMC_int_val(pad) - 1; i >= 0; i--) {
lex = &(((struct Parrot_Lexicals *)PMC_data(pad))[i]);
pos = lexicals_get_position(interp, lex, name);
if (pos == list_length(interp, lex->names))
@@ -572,11 +572,11 @@
Parrot_block_DOD(interp);
pad_pmc = pmc_new(interp, enum_class_Scratchpad);
if (base && depth < 0) {
- depth = base->cache.int_val + depth + 1;
+ depth = PMC_int_val(base) + depth + 1;
}
if ((depth < 0)
- || (base && depth > base->cache.int_val)
+ || (base && depth > PMC_int_val(base))
|| (!base && depth != 0)) {
Parrot_unblock_DOD(interp);
internal_exception(-1, "-scratch_pad: too deep\n");
@@ -594,7 +594,7 @@
sizeof(struct Parrot_Lexicals));
}
- pad_pmc->cache.int_val = depth + 1;
+ PMC_int_val(pad_pmc) = depth + 1;
/* in case call to list_new triggers gc */
((struct Parrot_Lexicals *)PMC_data(pad_pmc))[depth].values = NULL;
Index: src/thread.c
===================================================================
RCS file: /cvs/public/parrot/src/thread.c,v
retrieving revision 1.22
diff -u -r1.22 thread.c
--- src/thread.c 17 Mar 2004 22:25:12 -0000 1.22
+++ src/thread.c 26 Mar 2004 17:24:05 -0000
@@ -44,7 +44,7 @@
PMC *ret_val = NULL;
Parrot_Interp interpreter = PMC_data(self);
- runops(interpreter, (opcode_t *)self->cache.struct_val -
+ runops(interpreter, (opcode_t *)PMC_struct_val(self) -
(opcode_t *)interpreter->code->byte_code);
/*
* thread is finito
@@ -156,7 +156,7 @@
* TODO thread pools
*/
- dest_interp->cache.struct_val = sub->cache.struct_val;
+ PMC_struct_val(dest_interp) = PMC_struct_val(sub);
pt_thread_prepare_for_run(interpreter, interp);
/*
* set regs according to pdd03
Index: src/trace.c
===================================================================
RCS file: /cvs/public/parrot/src/trace.c,v
retrieving revision 1.51
diff -u -r1.51 trace.c
--- src/trace.c 10 Mar 2004 09:31:16 -0000 1.51
+++ src/trace.c 26 Mar 2004 17:24:05 -0000
@@ -100,13 +100,13 @@
case 0:
break;
case KEY_integer_FLAG:
- PIO_eprintf(interpreter, "%vi", key->cache.int_val);
+ PIO_eprintf(interpreter, "%vi", PMC_int_val(key));
break;
case KEY_number_FLAG:
- PIO_eprintf(interpreter, "%vg", key->cache.num_val);
+ PIO_eprintf(interpreter, "%vg", PMC_num_val(key));
break;
case KEY_string_FLAG:
- s = key->cache.string_val;
+ s = PMC_str_val(key);
/* XXX do it w/o degrading to C string */
escaped = PDB_escape(s->bufstart, s->strlen);
PIO_eprintf(interpreter, "\"%s\"", escaped?escaped:"(null)");
@@ -114,24 +114,24 @@
mem_sys_free(escaped);
break;
case KEY_integer_FLAG|KEY_register_FLAG:
- PIO_eprintf(interpreter, "I%vd=%vd", key->cache.int_val,
- interpreter->int_reg.registers[key->cache.int_val]);
+ PIO_eprintf(interpreter, "I%vd=%vd", PMC_int_val(key),
+ interpreter->int_reg.registers[PMC_int_val(key)]);
break;
case KEY_number_FLAG|KEY_register_FLAG:
- PIO_eprintf(interpreter, "I%vd=%vd", key->cache.int_val,
- interpreter->num_reg.registers[key->cache.int_val]);
+ PIO_eprintf(interpreter, "I%vd=%vd", PMC_int_val(key),
+ interpreter->num_reg.registers[PMC_int_val(key)]);
break;
case KEY_string_FLAG|KEY_register_FLAG:
- s = interpreter->string_reg.registers[key->cache.int_val];
+ s = interpreter->string_reg.registers[PMC_int_val(key)];
escaped = PDB_escape(s->bufstart, s->strlen);
- PIO_eprintf(interpreter, "S%vd=\"%s\"", key->cache.int_val,
+ PIO_eprintf(interpreter, "S%vd=\"%s\"", PMC_int_val(key),
escaped ? escaped : "(null");
if (escaped)
mem_sys_free(escaped);
break;
case KEY_pmc_FLAG|KEY_register_FLAG:
- PIO_eprintf(interpreter, "P%vd=", key->cache.int_val);
- trace_pmc_dump(interpreter, interpreter->pmc_reg.registers[key->cache.int_val]);
+ PIO_eprintf(interpreter, "P%vd=", PMC_int_val(key));
+ trace_pmc_dump(interpreter, interpreter->pmc_reg.registers[PMC_int_val(key)]);
break;
default:
PIO_eprintf(interpreter, "??");