aboutsummaryrefslogtreecommitdiff
path: root/src/lj_record.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_record.c')
-rw-r--r--src/lj_record.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/lj_record.c b/src/lj_record.c
index d44f7737..1dd310d4 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -1772,12 +1772,12 @@ noconstify:
1772 /* Note: this effectively limits LJ_MAX_UPVAL to 127. */ 1772 /* Note: this effectively limits LJ_MAX_UPVAL to 127. */
1773 uv = (uv << 8) | (hashrot(uvp->dhash, uvp->dhash + HASH_BIAS) & 0xff); 1773 uv = (uv << 8) | (hashrot(uvp->dhash, uvp->dhash + HASH_BIAS) & 0xff);
1774 if (!uvp->closed) { 1774 if (!uvp->closed) {
1775 uref = tref_ref(emitir(IRTG(IR_UREFO, IRT_PGC), fn, uv));
1776 /* In current stack? */ 1775 /* In current stack? */
1777 if (uvval(uvp) >= tvref(J->L->stack) && 1776 if (uvval(uvp) >= tvref(J->L->stack) &&
1778 uvval(uvp) < tvref(J->L->maxstack)) { 1777 uvval(uvp) < tvref(J->L->maxstack)) {
1779 int32_t slot = (int32_t)(uvval(uvp) - (J->L->base - J->baseslot)); 1778 int32_t slot = (int32_t)(uvval(uvp) - (J->L->base - J->baseslot));
1780 if (slot >= 0) { /* Aliases an SSA slot? */ 1779 if (slot >= 0) { /* Aliases an SSA slot? */
1780 uref = tref_ref(emitir(IRT(IR_UREFO, IRT_PGC), fn, uv));
1781 emitir(IRTG(IR_EQ, IRT_PGC), 1781 emitir(IRTG(IR_EQ, IRT_PGC),
1782 REF_BASE, 1782 REF_BASE,
1783 emitir(IRT(IR_ADD, IRT_PGC), uref, 1783 emitir(IRT(IR_ADD, IRT_PGC), uref,
@@ -1792,12 +1792,21 @@ noconstify:
1792 } 1792 }
1793 } 1793 }
1794 } 1794 }
1795 /* IR_UREFO+IRT_IGC is not checked for open-ness at runtime.
1796 ** Always marked as a guard, since it might get promoted to IRT_PGC later.
1797 */
1798 uref = emitir(IRTG(IR_UREFO, tref_isgcv(val) ? IRT_PGC : IRT_IGC), fn, uv);
1799 uref = tref_ref(uref);
1795 emitir(IRTG(IR_UGT, IRT_PGC), 1800 emitir(IRTG(IR_UGT, IRT_PGC),
1796 emitir(IRT(IR_SUB, IRT_PGC), uref, REF_BASE), 1801 emitir(IRT(IR_SUB, IRT_PGC), uref, REF_BASE),
1797 lj_ir_kintpgc(J, (J->baseslot + J->maxslot) * 8)); 1802 lj_ir_kintpgc(J, (J->baseslot + J->maxslot) * 8));
1798 } else { 1803 } else {
1804 /* If fn is constant, then so is the GCupval*, and the upvalue cannot
1805 ** transition back to open, so no guard is required in this case.
1806 */
1807 IRType t = (tref_isk(fn) ? 0 : IRT_GUARD) | IRT_PGC;
1808 uref = tref_ref(emitir(IRT(IR_UREFC, t), fn, uv));
1799 needbarrier = 1; 1809 needbarrier = 1;
1800 uref = tref_ref(emitir(IRTG(IR_UREFC, IRT_PGC), fn, uv));
1801 } 1810 }
1802 if (val == 0) { /* Upvalue load */ 1811 if (val == 0) { /* Upvalue load */
1803 IRType t = itype2irt(uvval(uvp)); 1812 IRType t = itype2irt(uvval(uvp));