Jump tables for switch now go in ROM (required by the EM spec). Forward gotos

now work.
This commit is contained in:
David Given 2017-01-01 23:28:41 +00:00
parent 8b8910595a
commit 62bc2ab97a

View file

@ -759,13 +759,13 @@ pswitch(void)
deflab = brklab; deflab = brklab;
C_df_dlb(swlab); C_df_dlb(swlab);
C_con_ilb(deflab); C_rom_ilb(deflab);
C_con_cst(swp - sswp); C_rom_cst(swp - sswp);
while (swp > sswp && swp > swtab) { while (swp > sswp && swp > swtab) {
--swp; --swp;
C_con_cst(swp->swval); C_rom_cst(swp->swval);
C_con_ilb(swp->swlab); C_rom_ilb(swp->swlab);
} }
C_df_ilb(brklab); C_df_ilb(brklab);
@ -812,6 +812,8 @@ stmt:
case GOTO: case GOTO:
if ((o = symbol()) != NAME) if ((o = symbol()) != NAME)
goto syntax; goto syntax;
if (bsym->offset == 0)
bsym->offset = isn++;
jump(bsym->offset); jump(bsym->offset);
goto semi; goto semi;
@ -913,7 +915,8 @@ stmt:
goto stmt; goto stmt;
} }
bsym->class = INTERN; bsym->class = INTERN;
bsym->offset = isn++; if (bsym->offset == 0)
bsym->offset = isn++;
fnlabel(bsym->offset); fnlabel(bsym->offset);
goto stmt; goto stmt;
} }