summaryrefslogtreecommitdiff
path: root/src/lj_record.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_record.c')
-rw-r--r--src/lj_record.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lj_record.c b/src/lj_record.c
index 0dfd1f73..b998c020 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -781,6 +781,15 @@ static TRef rec_idx(jit_State *J, RecordIndex *ix)
781 781
782/* -- Upvalue access ------------------------------------------------------ */ 782/* -- Upvalue access ------------------------------------------------------ */
783 783
784/* Shrink disambiguation hash into an 8 bit value. */
785static uint32_t shrink_dhash(uint32_t lo, uint32_t hi)
786{
787 lo ^= hi; hi = lj_rol(hi, 14);
788 lo -= hi; hi = lj_rol(hi, 5);
789 hi ^= lo; hi -= lj_rol(lo, 27);
790 return (hi & 0xff);
791}
792
784/* Record upvalue load/store. */ 793/* Record upvalue load/store. */
785static TRef rec_upvalue(jit_State *J, uint32_t uv, TRef val) 794static TRef rec_upvalue(jit_State *J, uint32_t uv, TRef val)
786{ 795{
@@ -788,6 +797,8 @@ static TRef rec_upvalue(jit_State *J, uint32_t uv, TRef val)
788 TRef fn = getcurrf(J); 797 TRef fn = getcurrf(J);
789 IRRef uref; 798 IRRef uref;
790 int needbarrier = 0; 799 int needbarrier = 0;
800 /* Note: this effectively limits LJ_MAX_UPVAL to 127. */
801 uv = (uv << 8) | shrink_dhash(uvp->dhash, uvp->dhash-0x04c11db7);
791 if (!uvp->closed) { 802 if (!uvp->closed) {
792 /* In current stack? */ 803 /* In current stack? */
793 if (uvval(uvp) >= J->L->stack && uvval(uvp) < J->L->maxstack) { 804 if (uvval(uvp) >= J->L->stack && uvval(uvp) < J->L->maxstack) {