[svn:parrot] r37668 - in trunk/src: . pmc
cotto at svn.parrot.org
cotto at svn.parrot.org
Tue Mar 24 07:09:27 UTC 2009
Author: cotto
Date: Tue Mar 24 07:09:26 2009
New Revision: 37668
URL: https://trac.parrot.org/parrot/changeset/37668
Log:
[PMC] replace a bunch of PMC_int_val instances and fix some correct-by-coincidence code in src/jit.c
Modified:
trunk/src/debug.c
trunk/src/jit.c
trunk/src/packdump.c
trunk/src/pmc/callsignature.pmc
trunk/src/pmc/capture.pmc
trunk/src/trace.c
Modified: trunk/src/debug.c
==============================================================================
--- trunk/src/debug.c Tue Mar 24 06:08:17 2009 (r37667)
+++ trunk/src/debug.c Tue Mar 24 07:09:26 2009 (r37668)
@@ -2539,7 +2539,7 @@
break;
case KEY_integer_FLAG:
Parrot_snprintf(interp, buf, sizeof (buf),
- INTVAL_FMT, PMC_int_val(k));
+ INTVAL_FMT, VTABLE_get_integer(interp, k));
strcpy(&dest[size], buf);
size += strlen(buf);
break;
@@ -2563,25 +2563,25 @@
break;
case KEY_integer_FLAG|KEY_register_FLAG:
Parrot_snprintf(interp, buf, sizeof (buf),
- "I" INTVAL_FMT, PMC_int_val(k));
+ "I" INTVAL_FMT, VTABLE_get_integer(interp, k));
strcpy(&dest[size], buf);
size += strlen(buf);
break;
case KEY_number_FLAG|KEY_register_FLAG:
Parrot_snprintf(interp, buf, sizeof (buf),
- "N" INTVAL_FMT, PMC_int_val(k));
+ "N" INTVAL_FMT, VTABLE_get_integer(interp, k));
strcpy(&dest[size], buf);
size += strlen(buf);
break;
case KEY_string_FLAG|KEY_register_FLAG:
Parrot_snprintf(interp, buf, sizeof (buf),
- "S" INTVAL_FMT, PMC_int_val(k));
+ "S" INTVAL_FMT, VTABLE_get_integer(interp, k));
strcpy(&dest[size], buf);
size += strlen(buf);
break;
case KEY_pmc_FLAG|KEY_register_FLAG:
Parrot_snprintf(interp, buf, sizeof (buf),
- "P" INTVAL_FMT, PMC_int_val(k));
+ "P" INTVAL_FMT, VTABLE_get_integer(interp, k));
strcpy(&dest[size], buf);
size += strlen(buf);
break;
Modified: trunk/src/jit.c
==============================================================================
--- trunk/src/jit.c Tue Mar 24 06:08:17 2009 (r37667)
+++ trunk/src/jit.c Tue Mar 24 07:09:26 2009 (r37668)
@@ -356,8 +356,9 @@
while (key) {
const UINTVAL flags = PObj_get_FLAGS(key);
if (flags & KEY_register_FLAG) {
- INTVAL n = PMC_int_val(key);
+ INTVAL n = 0;
if (flags & KEY_integer_FLAG) {
+ n = VTABLE_get_integer(interp, key);
typ = 0;
if (n < 0)
n = -1 - n;
Modified: trunk/src/packdump.c
==============================================================================
--- trunk/src/packdump.c Tue Mar 24 06:08:17 2009 (r37667)
+++ trunk/src/packdump.c Tue Mar 24 07:09:26 2009 (r37668)
@@ -200,7 +200,8 @@
switch (type) {
case KEY_integer_FLAG:
Parrot_io_printf(interp, " TYPE => INTEGER\n");
- Parrot_io_printf(interp, " DATA => %ld\n", PMC_int_val(key));
+ Parrot_io_printf(interp, " DATA => %ld\n",
+ VTABLE_get_integer(interp, key));
Parrot_io_printf(interp, " },\n");
break;
case KEY_number_FLAG:
@@ -233,22 +234,26 @@
break;
case KEY_integer_FLAG | KEY_register_FLAG:
Parrot_io_printf(interp, " TYPE => I REGISTER\n");
- Parrot_io_printf(interp, " DATA => %ld\n", PMC_int_val(key));
+ Parrot_io_printf(interp, " DATA => %ld\n",
+ VTABLE_get_integer(interp, key));
Parrot_io_printf(interp, " },\n");
break;
case KEY_number_FLAG | KEY_register_FLAG:
Parrot_io_printf(interp, " TYPE => N REGISTER\n");
- Parrot_io_printf(interp, " DATA => %ld\n", PMC_int_val(key));
+ Parrot_io_printf(interp, " DATA => %ld\n",
+ VTABLE_get_integer(interp, key));
Parrot_io_printf(interp, " },\n");
break;
case KEY_string_FLAG | KEY_register_FLAG:
Parrot_io_printf(interp, " TYPE => S REGISTER\n");
- Parrot_io_printf(interp, " DATA => %ld\n", PMC_int_val(key));
+ Parrot_io_printf(interp, " DATA => %ld\n",
+ VTABLE_get_integer(interp, key));
Parrot_io_printf(interp, " },\n");
break;
case KEY_pmc_FLAG | KEY_register_FLAG:
Parrot_io_printf(interp, " TYPE => P REGISTER\n");
- Parrot_io_printf(interp, " DATA => %ld\n", PMC_int_val(key));
+ Parrot_io_printf(interp, " DATA => %ld\n",
+ VTABLE_get_integer(interp, key));
Parrot_io_printf(interp, " },\n");
break;
default:
Modified: trunk/src/pmc/callsignature.pmc
==============================================================================
--- trunk/src/pmc/callsignature.pmc Tue Mar 24 06:08:17 2009 (r37667)
+++ trunk/src/pmc/callsignature.pmc Tue Mar 24 07:09:26 2009 (r37668)
@@ -33,7 +33,6 @@
ATTR PMC *returns; /* Result PMCs, if they were passed with the call */
ATTR PMC *type_tuple; /* Cached argument types for multiple dispatch */
ATTR STRING *short_sig; /* Simple string signature args & returns */
- ATTR INTVAL data_size; /* ? */
/*
Modified: trunk/src/pmc/capture.pmc
==============================================================================
--- trunk/src/pmc/capture.pmc Tue Mar 24 06:08:17 2009 (r37667)
+++ trunk/src/pmc/capture.pmc Tue Mar 24 07:09:26 2009 (r37668)
@@ -30,8 +30,9 @@
PARROT_CAPTURE(obj)->hash = pmc_new((i), enum_class_Hash);
pmclass Capture need_ext {
- ATTR PMC *array;
- ATTR PMC *hash;
+ ATTR PMC *array;
+ ATTR PMC *hash;
+ ATTR INTVAL data_size;
/*
@@ -52,7 +53,7 @@
PMC_data(SELF) = capture;
capture->array = NULL;
capture->hash = NULL;
- PMC_int_val(SELF) = CAPTURE_DATA_SIZE;
+ capture->data_size = CAPTURE_DATA_SIZE;
PObj_active_destroy_SET(SELF);
PObj_custom_mark_SET(SELF);
}
@@ -62,8 +63,6 @@
mem_sys_free(PARROT_CAPTURE(SELF));
PMC_data(SELF) = NULL;
}
-
- PMC_int_val(SELF) = 0;
}
/*
@@ -524,7 +523,7 @@
if (!data)
return;
- for (i = PMC_int_val(SELF) - 1; i >= 0; --i)
+ for (i = PARROT_CAPTURE(SELF)->data_size - 1; i >= 0; --i)
if (data[i])
pobject_lives(interp, (PObj *)data[i]);
}
Modified: trunk/src/trace.c
==============================================================================
--- trunk/src/trace.c Tue Mar 24 06:08:17 2009 (r37667)
+++ trunk/src/trace.c Tue Mar 24 07:09:26 2009 (r37668)
@@ -127,11 +127,11 @@
}
else if (pmc->vtable->base_type == enum_class_Boolean) {
Parrot_io_eprintf(debugger, "Boolean=PMC(%#p: %d)",
- pmc, PMC_int_val(pmc));
+ pmc, VTABLE_get_integer(interp, pmc));
}
else if (pmc->vtable->base_type == enum_class_Integer) {
Parrot_io_eprintf(debugger, "Integer=PMC(%#p: %d)",
- pmc, PMC_int_val(pmc));
+ pmc, VTABLE_get_integer(interp, pmc));
}
else if (pmc->vtable->base_type == enum_class_BigInt) {
STRING * const s = VTABLE_get_string(interp, pmc);
@@ -181,7 +181,7 @@
while (key) {
switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
case KEY_integer_FLAG:
- len += Parrot_io_eprintf(debugger, "%vi", PMC_int_val(key));
+ len += Parrot_io_eprintf(debugger, "%vi", VTABLE_get_integer(interp, key));
break;
case KEY_number_FLAG:
len += Parrot_io_eprintf(debugger, "%vg", VTABLE_get_number(interp, key));
@@ -198,29 +198,29 @@
}
break;
case KEY_integer_FLAG|KEY_register_FLAG:
- len += Parrot_io_eprintf(debugger, "I%vd=%vd", PMC_int_val(key),
- REG_INT(interp, PMC_int_val(key)));
+ len += Parrot_io_eprintf(debugger, "I%vd=%vd", VTABLE_get_integer(interp, key),
+ REG_INT(interp, VTABLE_get_integer(interp, key)));
break;
case KEY_number_FLAG|KEY_register_FLAG:
- len += Parrot_io_eprintf(debugger, "I%vd=%vd", PMC_int_val(key),
- REG_NUM(interp, PMC_int_val(key)));
+ len += Parrot_io_eprintf(debugger, "I%vd=%vd", VTABLE_get_integer(interp, key),
+ REG_NUM(interp, VTABLE_get_integer(interp, key)));
break;
case KEY_string_FLAG|KEY_register_FLAG:
{
- const STRING * const s = REG_STR(interp, PMC_int_val(key));
+ const STRING * const s = REG_STR(interp, VTABLE_get_integer(interp, key));
STRING* const escaped = Parrot_str_escape_truncate(
interp, s, 20);
if (escaped)
- len += Parrot_io_eprintf(debugger, "S%vd=\"%Ss\"", PMC_int_val(key),
+ len += Parrot_io_eprintf(debugger, "S%vd=\"%Ss\"", VTABLE_get_integer(interp, key),
escaped);
else
len += Parrot_io_eprintf(debugger, "S%vd=\"(null)\"",
- PMC_int_val(key));
+ VTABLE_get_integer(interp, key));
}
break;
case KEY_pmc_FLAG|KEY_register_FLAG:
- len += Parrot_io_eprintf(debugger, "P%vd=", PMC_int_val(key));
- trace_pmc_dump(debugger, REG_PMC(interp, PMC_int_val(key)));
+ len += Parrot_io_eprintf(debugger, "P%vd=", VTABLE_get_integer(interp, key));
+ trace_pmc_dump(debugger, REG_PMC(interp, VTABLE_get_integer(interp, key)));
break;
default:
len += Parrot_io_eprintf(debugger, "??");
More information about the parrot-commits
mailing list