diff options
author | Mike Pall <mike> | 2010-07-21 21:42:40 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2010-07-21 22:06:38 +0200 |
commit | d05873ee0ae63ee47710a2c9843d032010cc296f (patch) | |
tree | 6b104afc208df5cdbf54a2865380df2bebf2615d /src/lj_record.c | |
parent | 6667ab0f266b12909cf0eedd025525b24d987592 (diff) | |
download | luajit-d05873ee0ae63ee47710a2c9843d032010cc296f.tar.gz luajit-d05873ee0ae63ee47710a2c9843d032010cc296f.tar.bz2 luajit-d05873ee0ae63ee47710a2c9843d032010cc296f.zip |
Abstract out pointer hash to hashrot(). Tune hash constants.
Diffstat (limited to 'src/lj_record.c')
-rw-r--r-- | src/lj_record.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/src/lj_record.c b/src/lj_record.c index 55daaae6..9355cb38 100644 --- a/src/lj_record.c +++ b/src/lj_record.c | |||
@@ -1051,15 +1051,6 @@ static TRef rec_idx(jit_State *J, RecordIndex *ix) | |||
1051 | 1051 | ||
1052 | /* -- Upvalue access ------------------------------------------------------ */ | 1052 | /* -- Upvalue access ------------------------------------------------------ */ |
1053 | 1053 | ||
1054 | /* Shrink disambiguation hash into an 8 bit value. */ | ||
1055 | static uint32_t shrink_dhash(uint32_t lo, uint32_t hi) | ||
1056 | { | ||
1057 | lo ^= hi; hi = lj_rol(hi, 14); | ||
1058 | lo -= hi; hi = lj_rol(hi, 5); | ||
1059 | hi ^= lo; hi -= lj_rol(lo, 27); | ||
1060 | return (hi & 0xff); | ||
1061 | } | ||
1062 | |||
1063 | /* Record upvalue load/store. */ | 1054 | /* Record upvalue load/store. */ |
1064 | static TRef rec_upvalue(jit_State *J, uint32_t uv, TRef val) | 1055 | static TRef rec_upvalue(jit_State *J, uint32_t uv, TRef val) |
1065 | { | 1056 | { |
@@ -1068,7 +1059,7 @@ static TRef rec_upvalue(jit_State *J, uint32_t uv, TRef val) | |||
1068 | IRRef uref; | 1059 | IRRef uref; |
1069 | int needbarrier = 0; | 1060 | int needbarrier = 0; |
1070 | /* Note: this effectively limits LJ_MAX_UPVAL to 127. */ | 1061 | /* Note: this effectively limits LJ_MAX_UPVAL to 127. */ |
1071 | uv = (uv << 8) | shrink_dhash(uvp->dhash, uvp->dhash-0x04c11db7); | 1062 | uv = (uv << 8) | (hashrot(uvp->dhash, uvp->dhash + HASH_BIAS) & 0xff); |
1072 | if (!uvp->closed) { | 1063 | if (!uvp->closed) { |
1073 | /* In current stack? */ | 1064 | /* In current stack? */ |
1074 | if (uvval(uvp) >= J->L->stack && uvval(uvp) < J->L->maxstack) { | 1065 | if (uvval(uvp) >= J->L->stack && uvval(uvp) < J->L->maxstack) { |