cvsuser 03/02/11 03:34:36
Modified: languages/imcc imcc.l imcc.y pbc.c
Log:
imcc: #20839; jump Ix works now; drop PRINT (print 2, 'x' name clash)
Revision Changes Path
1.26 +0 -1 parrot/languages/imcc/imcc.l
Index: imcc.l
===================================================================
RCS file: /cvs/public/parrot/languages/imcc/imcc.l,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -w -r1.25 -r1.26
--- imcc.l 31 Jan 2003 10:54:08 -0000 1.25
+++ imcc.l 11 Feb 2003 11:34:36 -0000 1.26
@@ -112,7 +112,6 @@
"clone" return(CLONE);
"string" return(STRINGV);
"call" return(CALL);
-"print" return(PRINT);
"saveall" return(SAVEALL);
"restoreall" return(RESTOREALL);
"<<" return(SHIFT_LEFT);
1.44 +2 -3 parrot/languages/imcc/imcc.y
Index: imcc.y
===================================================================
RCS file: /cvs/public/parrot/languages/imcc/imcc.y,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -w -r1.43 -r1.44
--- imcc.y 8 Feb 2003 11:50:34 -0000 1.43
+++ imcc.y 11 Feb 2003 11:34:36 -0000 1.44
@@ -201,7 +201,7 @@
static int p = 0;
SymReg *preg[IMCC_MAX_REGS]; /* px,py,pz */
SymReg *nreg[IMCC_MAX_REGS];
- Instruction * ins;
+ Instruction *ins = 0;
/* count keys in keyvec */
kv = keyvec;
@@ -406,7 +406,7 @@
Instruction *i;
}
-%token <t> CALL GOTO ARG PRINT IF UNLESS NEW END SAVEALL RESTOREALL
+%token <t> CALL GOTO ARG IF UNLESS NEW END SAVEALL RESTOREALL
%token <t> SUB NAMESPACE ENDNAMESPACE CLASS ENDCLASS SYM LOCAL CONST PARAM
%token <t> INC DEC
%token <t> SHIFT_LEFT SHIFT_RIGHT INTV FLOATV STRINGV DEFINED LOG_XOR
@@ -526,7 +526,6 @@
R1(mk_address($2, U_add_once)));}
| INC var { $$ = MK_I(interp, "inc",R1($2)); }
| DEC var { $$ = MK_I(interp, "dec",R1($2)); }
- | PRINT var { $$ = MK_I(interp, "print",R1($2)); }
| SAVEALL { $$ = MK_I(interp, "saveall" ,R0()); }
| RESTOREALL { $$ = MK_I(interp, "restoreall" ,R0()); }
| END { $$ = MK_I(interp, "end" ,R0()); }
1.23 +10 -3 parrot/languages/imcc/pbc.c
Index: pbc.c
===================================================================
RCS file: /cvs/public/parrot/languages/imcc/pbc.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -w -r1.22 -r1.23
--- pbc.c 7 Feb 2003 14:05:51 -0000 1.22
+++ pbc.c 11 Feb 2003 11:34:36 -0000 1.23
@@ -208,6 +208,8 @@
struct PackFile_FixupTable *ft = interpreter->code->fixup_table;
opcode_t i;
+ if (!ft)
+ return -1;
for (i = 0; i < ft->fixup_count; i++) {
switch (ft->fixups[i]->type) {
case 0:
@@ -257,8 +259,10 @@
store_label(ins->r[0], pc);
ins->r[0]->color = pc;
}
- else if (!strcmp(ins->op, "bsr"))
+ else if (!strcmp(ins->op, "bsr")) {
+ if (!(ins->r[0]->type & VTREGISTER))
store_bsr(ins->r[0], pc, 1);
+ }
else if (!strcmp(ins->op, "set_addr"))
store_bsr(ins->r[1], pc, 2);
else if (!strcmp(ins->op, "compile"))
@@ -296,6 +300,9 @@
/* if no jump */
if ((addr = get_branch_reg(ins)) == 0)
continue;
+ /* it's kind of a register */
+ if (addr->type & VTREGISTER)
+ continue;
/* branch found */
label = _get_sym(globals.cs->subs->labels, addr->name);
/* maybe global */
@@ -688,7 +695,7 @@
if (ins->op && *ins->op) {
/* fixup local jumps */
SymReg *addr, *r;
- if ((addr = get_branch_reg(ins)) != 0) {
+ if ((addr = get_branch_reg(ins)) != 0 && !(addr->type & VTREGISTER)) {
SymReg *label = _get_sym(globals.cs->subs->labels, addr->name);
/* maybe global */
if (label) {