diff options
Diffstat (limited to 'src/lj_record.c')
-rw-r--r-- | src/lj_record.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lj_record.c b/src/lj_record.c index ff7825ee..44b3667f 100644 --- a/src/lj_record.c +++ b/src/lj_record.c | |||
@@ -1343,13 +1343,17 @@ noconstify: | |||
1343 | /* Note: this effectively limits LJ_MAX_UPVAL to 127. */ | 1343 | /* Note: this effectively limits LJ_MAX_UPVAL to 127. */ |
1344 | uv = (uv << 8) | (hashrot(uvp->dhash, uvp->dhash + HASH_BIAS) & 0xff); | 1344 | uv = (uv << 8) | (hashrot(uvp->dhash, uvp->dhash + HASH_BIAS) & 0xff); |
1345 | if (!uvp->closed) { | 1345 | if (!uvp->closed) { |
1346 | uref = tref_ref(emitir(IRTG(IR_UREFO, IRT_P32), fn, uv)); | ||
1346 | /* In current stack? */ | 1347 | /* In current stack? */ |
1347 | if (uvval(uvp) >= tvref(J->L->stack) && | 1348 | if (uvval(uvp) >= tvref(J->L->stack) && |
1348 | uvval(uvp) < tvref(J->L->maxstack)) { | 1349 | uvval(uvp) < tvref(J->L->maxstack)) { |
1349 | int32_t slot = (int32_t)(uvval(uvp) - (J->L->base - J->baseslot)); | 1350 | int32_t slot = (int32_t)(uvval(uvp) - (J->L->base - J->baseslot)); |
1350 | if (slot >= 0) { /* Aliases an SSA slot? */ | 1351 | if (slot >= 0) { /* Aliases an SSA slot? */ |
1352 | emitir(IRTG(IR_EQ, IRT_P32), | ||
1353 | REF_BASE, | ||
1354 | emitir(IRT(IR_ADD, IRT_P32), uref, | ||
1355 | lj_ir_kint(J, (slot - 1) * -8))); | ||
1351 | slot -= (int32_t)J->baseslot; /* Note: slot number may be negative! */ | 1356 | slot -= (int32_t)J->baseslot; /* Note: slot number may be negative! */ |
1352 | /* NYI: add IR to guard that it's still aliasing the same slot. */ | ||
1353 | if (val == 0) { | 1357 | if (val == 0) { |
1354 | return getslot(J, slot); | 1358 | return getslot(J, slot); |
1355 | } else { | 1359 | } else { |
@@ -1359,7 +1363,9 @@ noconstify: | |||
1359 | } | 1363 | } |
1360 | } | 1364 | } |
1361 | } | 1365 | } |
1362 | uref = tref_ref(emitir(IRTG(IR_UREFO, IRT_P32), fn, uv)); | 1366 | emitir(IRTG(IR_UGT, IRT_P32), |
1367 | emitir(IRT(IR_SUB, IRT_P32), uref, REF_BASE), | ||
1368 | lj_ir_kint(J, (J->baseslot + J->maxslot) * 8)); | ||
1363 | } else { | 1369 | } else { |
1364 | needbarrier = 1; | 1370 | needbarrier = 1; |
1365 | uref = tref_ref(emitir(IRTG(IR_UREFC, IRT_P32), fn, uv)); | 1371 | uref = tref_ref(emitir(IRTG(IR_UREFC, IRT_P32), fn, uv)); |