Author: kjs
Date: Tue Jan 6 07:41:41 2009
New Revision: 35044
Modified:
trunk/compilers/pirc/src/piremit.c
trunk/compilers/pirc/src/pirpcc.c
trunk/compilers/pirc/src/pirsymbol.c
trunk/compilers/pirc/src/pirsymbol.h
Log:
[pirc] fix a bug. Constant nodes use value_type enumeration, not pir_type. Yes,
this is bug-sensitive, but alternatives suck more.
Modified: trunk/compilers/pirc/src/piremit.c
==============================================================================
--- trunk/compilers/pirc/src/piremit.c (original)
+++ trunk/compilers/pirc/src/piremit.c Tue Jan 6 07:41:41 2009
@@ -161,6 +161,7 @@
panic(lexer, "Unknown type detected in print_constant()");
break;
}
+
}
/*
Modified: trunk/compilers/pirc/src/pirpcc.c
==============================================================================
--- trunk/compilers/pirc/src/pirpcc.c (original)
+++ trunk/compilers/pirc/src/pirpcc.c Tue Jan 6 07:41:41 2009
@@ -85,8 +85,10 @@
SET_FLAG(flag, arg->value->expr.t->info->type);
break;
case EXPR_CONSTANT:
- /* copy the type of the constant */
- SET_FLAG(flag, arg->value->expr.c->type);
+ /* copy the type of the constant; note that constants store a
value_type,
+ * not a pir_type, so convert here.
+ */
+ SET_FLAG(flag, valuetype_pirtype_clut[arg->value->expr.c->type]);
/* set the flag indicating the argument is a constant literal, not
a register. */
SET_FLAG(flag, PARROT_ARG_CONSTANT);
break;
@@ -477,7 +479,7 @@
if (inv->retcc) { /* return continuation present? */
new_sub_instr(lexer, PARROT_OP_invoke_p_p, "invoke_p_p", 0);
- add_operands(lexer, "%T%T", inv->sub, inv->retcc);
+ add_operands(lexer, "%T%T", sub, inv->retcc);
}
else {
new_sub_instr(lexer, PARROT_OP_invokecc_p, "invokecc_p", 0);
Modified: trunk/compilers/pirc/src/pirsymbol.c
==============================================================================
--- trunk/compilers/pirc/src/pirsymbol.c (original)
+++ trunk/compilers/pirc/src/pirsymbol.c Tue Jan 6 07:41:41 2009
@@ -68,7 +68,7 @@
* When input is STRING_TYPE you'll only get STRING_VAL,
* never USTRING_VAL (indicating unicode string).
*/
-static const int valuetype_pirtype_clut[10] = {
+const int valuetype_pirtype_clut[10] = {
INT_VAL, /* INT_TYPE -> INT_VAL */
STRING_VAL, /* STRING_TYPE -> STRING_VAL */
PMC_VAL, /* PMC_TYPE -> PMC_VAL */
Modified: trunk/compilers/pirc/src/pirsymbol.h
==============================================================================
--- trunk/compilers/pirc/src/pirsymbol.h (original)
+++ trunk/compilers/pirc/src/pirsymbol.h Tue Jan 6 07:41:41 2009
@@ -72,6 +72,9 @@
} local_label;
+/* lookup table to convert value_type and pir_type values into one another. */
+extern const int valuetype_pirtype_clut[10];
+
/* symbol constructor */
symbol *new_symbol(struct lexer_state * const lexer, char const * const name,
pir_type type);