diff options
author | Mike Pall <mike> | 2012-09-12 16:58:47 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2012-09-12 16:58:47 +0200 |
commit | aed20093781541c19b5c7d6149eda71a7141bc1c (patch) | |
tree | f86023d78e716262282c23d639a318dce1af7b65 | |
parent | 23932a6c8b7ef434bc963139b4160b1058fa6f7f (diff) | |
download | luajit-aed20093781541c19b5c7d6149eda71a7141bc1c.tar.gz luajit-aed20093781541c19b5c7d6149eda71a7141bc1c.tar.bz2 luajit-aed20093781541c19b5c7d6149eda71a7141bc1c.zip |
Fix despecialization of ITERN when already running.
-rw-r--r-- | src/lj_tab.c | 2 | ||||
-rw-r--r-- | src/vm_arm.dasc | 3 | ||||
-rw-r--r-- | src/vm_mips.dasc | 3 | ||||
-rw-r--r-- | src/vm_ppc.dasc | 3 | ||||
-rw-r--r-- | src/vm_ppcspe.dasc | 3 | ||||
-rw-r--r-- | src/vm_x86.dasc | 3 |
6 files changed, 15 insertions, 2 deletions
diff --git a/src/lj_tab.c b/src/lj_tab.c index 40f75269..33d6d75b 100644 --- a/src/lj_tab.c +++ b/src/lj_tab.c | |||
@@ -545,6 +545,8 @@ static uint32_t keyindex(lua_State *L, GCtab *t, cTValue *key) | |||
545 | return t->asize + (uint32_t)(n - noderef(t->node)); | 545 | return t->asize + (uint32_t)(n - noderef(t->node)); |
546 | /* Hash key indexes: [t->asize..t->asize+t->nmask] */ | 546 | /* Hash key indexes: [t->asize..t->asize+t->nmask] */ |
547 | } while ((n = nextnode(n))); | 547 | } while ((n = nextnode(n))); |
548 | if (key->u32.hi == 0xfffe7fff) /* ITERN was despecialized while running. */ | ||
549 | return key->u32.lo - 1; | ||
548 | lj_err_msg(L, LJ_ERR_NEXTIDX); | 550 | lj_err_msg(L, LJ_ERR_NEXTIDX); |
549 | return 0; /* unreachable */ | 551 | return 0; /* unreachable */ |
550 | } | 552 | } |
diff --git a/src/vm_arm.dasc b/src/vm_arm.dasc index b2c15f49..31657b70 100644 --- a/src/vm_arm.dasc +++ b/src/vm_arm.dasc | |||
@@ -3897,7 +3897,8 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
3897 | | ins_next1 | 3897 | | ins_next1 |
3898 | | ins_next2 | 3898 | | ins_next2 |
3899 | | mov CARG1, #0 | 3899 | | mov CARG1, #0 |
3900 | | str CARG1, [RA, #-8] // Initialize control var. | 3900 | | mvn CARG2, #0x00018000 |
3901 | | strd CARG1, [RA, #-8] // Initialize control var. | ||
3901 | |1: | 3902 | |1: |
3902 | | ins_next3 | 3903 | | ins_next3 |
3903 | |5: // Despecialize bytecode if any of the checks fail. | 3904 | |5: // Despecialize bytecode if any of the checks fail. |
diff --git a/src/vm_mips.dasc b/src/vm_mips.dasc index 6da7d4d2..fdf07343 100644 --- a/src/vm_mips.dasc +++ b/src/vm_mips.dasc | |||
@@ -3617,7 +3617,10 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
3617 | | bnez TMP1, >5 | 3617 | | bnez TMP1, >5 |
3618 | |. lui TMP2, (-(BCBIAS_J*4 >> 16) & 65535) | 3618 | |. lui TMP2, (-(BCBIAS_J*4 >> 16) & 65535) |
3619 | | addu PC, TMP0, TMP2 | 3619 | | addu PC, TMP0, TMP2 |
3620 | | lui TMP1, 0xfffe | ||
3621 | | ori TMP1, TMP1, 0x7fff | ||
3620 | | sw r0, -8+LO(RA) // Initialize control var. | 3622 | | sw r0, -8+LO(RA) // Initialize control var. |
3623 | | sw TMP1, -8+HI(RA) | ||
3621 | |1: | 3624 | |1: |
3622 | | ins_next | 3625 | | ins_next |
3623 | |5: // Despecialize bytecode if any of the checks fail. | 3626 | |5: // Despecialize bytecode if any of the checks fail. |
diff --git a/src/vm_ppc.dasc b/src/vm_ppc.dasc index 1a7c31ad..7c567aad 100644 --- a/src/vm_ppc.dasc +++ b/src/vm_ppc.dasc | |||
@@ -4376,7 +4376,10 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
4376 | | crand 4*cr0+eq, 4*cr0+eq, 4*cr7+eq | 4376 | | crand 4*cr0+eq, 4*cr0+eq, 4*cr7+eq |
4377 | | add TMP3, PC, TMP0 | 4377 | | add TMP3, PC, TMP0 |
4378 | | bne cr0, >5 | 4378 | | bne cr0, >5 |
4379 | | lus TMP1, 0xfffe | ||
4380 | | ori TMP1, TMP1, 0x7fff | ||
4379 | | stw ZERO, -4(RA) // Initialize control var. | 4381 | | stw ZERO, -4(RA) // Initialize control var. |
4382 | | stw TMP1, -8(RA) | ||
4380 | | addis PC, TMP3, -(BCBIAS_J*4 >> 16) | 4383 | | addis PC, TMP3, -(BCBIAS_J*4 >> 16) |
4381 | |1: | 4384 | |1: |
4382 | | ins_next | 4385 | | ins_next |
diff --git a/src/vm_ppcspe.dasc b/src/vm_ppcspe.dasc index 31e4c6c4..0adbcd7e 100644 --- a/src/vm_ppcspe.dasc +++ b/src/vm_ppcspe.dasc | |||
@@ -3188,7 +3188,10 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
3188 | | crand 4*cr0+eq, 4*cr0+eq, 4*cr7+eq | 3188 | | crand 4*cr0+eq, 4*cr0+eq, 4*cr7+eq |
3189 | | add TMP3, PC, TMP0 | 3189 | | add TMP3, PC, TMP0 |
3190 | | bne cr0, >5 | 3190 | | bne cr0, >5 |
3191 | | lus TMP1, 0xfffe | ||
3192 | | ori TMP1, TMP1, 0x7fff | ||
3191 | | stw ZERO, -4(RA) // Initialize control var. | 3193 | | stw ZERO, -4(RA) // Initialize control var. |
3194 | | stw TMP1, -8(RA) | ||
3192 | | addis PC, TMP3, -(BCBIAS_J*4 >> 16) | 3195 | | addis PC, TMP3, -(BCBIAS_J*4 >> 16) |
3193 | |1: | 3196 | |1: |
3194 | | ins_next | 3197 | | ins_next |
diff --git a/src/vm_x86.dasc b/src/vm_x86.dasc index 8fe07a65..67984c6c 100644 --- a/src/vm_x86.dasc +++ b/src/vm_x86.dasc | |||
@@ -1566,7 +1566,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
1566 | | add BASE, 8 | 1566 | | add BASE, 8 |
1567 | | mov ARG3, BASE | 1567 | | mov ARG3, BASE |
1568 | |.endif | 1568 | |.endif |
1569 | | mov SAVE_PC, PC // Redundant (but a defined value). | 1569 | | mov SAVE_PC, PC // Needed for ITERN fallback. |
1570 | | call extern lj_tab_next // (lua_State *L, GCtab *t, TValue *key) | 1570 | | call extern lj_tab_next // (lua_State *L, GCtab *t, TValue *key) |
1571 | | // Flag returned in eax (RD). | 1571 | | // Flag returned in eax (RD). |
1572 | | mov BASE, L:RB->base | 1572 | | mov BASE, L:RB->base |
@@ -5433,6 +5433,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
5433 | | cmp byte CFUNC:RB->ffid, FF_next_N; jne >5 | 5433 | | cmp byte CFUNC:RB->ffid, FF_next_N; jne >5 |
5434 | | branchPC RD | 5434 | | branchPC RD |
5435 | | mov dword [BASE+RA*8-8], 0 // Initialize control var. | 5435 | | mov dword [BASE+RA*8-8], 0 // Initialize control var. |
5436 | | mov dword [BASE+RA*8-4], 0xfffe7fff | ||
5436 | |1: | 5437 | |1: |
5437 | | ins_next | 5438 | | ins_next |
5438 | |5: // Despecialize bytecode if any of the checks fail. | 5439 | |5: // Despecialize bytecode if any of the checks fail. |