aboutsummaryrefslogtreecommitdiff
path: root/src/lj_func.c
diff options
context:
space:
mode:
authorMike Pall <mike>2010-01-09 23:59:43 +0100
committerMike Pall <mike>2010-01-09 23:59:43 +0100
commit99d153bef9725db226614558d01df829afafee3c (patch)
treeec5c4778a0ac5e054fc8c3d337381e1d52f626bc /src/lj_func.c
parent2cc554db0cb37ac3600cccab97c657bb532e3c4e (diff)
downloadluajit-99d153bef9725db226614558d01df829afafee3c.tar.gz
luajit-99d153bef9725db226614558d01df829afafee3c.tar.bz2
luajit-99d153bef9725db226614558d01df829afafee3c.zip
Improve alias analysis of upvalues using a disambiguation hash value.
All upvalue objects hold a disambiguation hash value now. It's built from the parent prototype and the slot number. Different hash values imply the upvalues cannot alias. Same hash values don't imply anything (collision or different closures). Upvalue disambiguation makes use of a reduced hash due to IR contraints.
Diffstat (limited to 'src/lj_func.c')
-rw-r--r--src/lj_func.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lj_func.c b/src/lj_func.c
index 231701db..078ced92 100644
--- a/src/lj_func.c
+++ b/src/lj_func.c
@@ -169,10 +169,11 @@ GCfunc *lj_func_newL_gc(lua_State *L, GCproto *pt, GCfuncL *parent)
169 nuv = fn->l.nupvalues; 169 nuv = fn->l.nupvalues;
170 base = L->base; 170 base = L->base;
171 for (i = 0; i < nuv; i++) { 171 for (i = 0; i < nuv; i++) {
172 ptrdiff_t v = pt->uv[i]; 172 uint32_t v = pt->uv[i];
173 GCupval *uv; 173 GCupval *uv;
174 if ((v & 0x8000)) { 174 if ((v & 0x8000)) {
175 uv = func_finduv(L, base + (v & 0xff)); 175 uv = func_finduv(L, base + (v & 0xff));
176 uv->dhash = (uint32_t)(uintptr_t)gcref(parent->pt) ^ (v << 24);
176 } else { 177 } else {
177 uv = &gcref(puv[v])->uv; 178 uv = &gcref(puv[v])->uv;
178 } 179 }