diff options
author | Mike Pall <mike> | 2010-01-09 23:59:43 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2010-01-09 23:59:43 +0100 |
commit | 99d153bef9725db226614558d01df829afafee3c (patch) | |
tree | ec5c4778a0ac5e054fc8c3d337381e1d52f626bc /src/lj_asm.c | |
parent | 2cc554db0cb37ac3600cccab97c657bb532e3c4e (diff) | |
download | luajit-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_asm.c')
-rw-r--r-- | src/lj_asm.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c index 50f877e7..20d26278 100644 --- a/src/lj_asm.c +++ b/src/lj_asm.c | |||
@@ -1105,7 +1105,7 @@ static void asm_fuseahuref(ASMState *as, IRRef ref, RegSet allow) | |||
1105 | case IR_UREFC: | 1105 | case IR_UREFC: |
1106 | if (irref_isk(ir->op1)) { | 1106 | if (irref_isk(ir->op1)) { |
1107 | GCfunc *fn = ir_kfunc(IR(ir->op1)); | 1107 | GCfunc *fn = ir_kfunc(IR(ir->op1)); |
1108 | GCupval *uv = &gcref(fn->l.uvptr[ir->op2])->uv; | 1108 | GCupval *uv = &gcref(fn->l.uvptr[(ir->op2 >> 8)])->uv; |
1109 | as->mrm.ofs = ptr2addr(&uv->tv); | 1109 | as->mrm.ofs = ptr2addr(&uv->tv); |
1110 | as->mrm.base = as->mrm.idx = RID_NONE; | 1110 | as->mrm.base = as->mrm.idx = RID_NONE; |
1111 | return; | 1111 | return; |
@@ -1702,7 +1702,7 @@ static void asm_uref(ASMState *as, IRIns *ir) | |||
1702 | Reg dest = ra_dest(as, ir, RSET_GPR); | 1702 | Reg dest = ra_dest(as, ir, RSET_GPR); |
1703 | if (irref_isk(ir->op1)) { | 1703 | if (irref_isk(ir->op1)) { |
1704 | GCfunc *fn = ir_kfunc(IR(ir->op1)); | 1704 | GCfunc *fn = ir_kfunc(IR(ir->op1)); |
1705 | MRef *v = &gcref(fn->l.uvptr[ir->op2])->uv.v; | 1705 | MRef *v = &gcref(fn->l.uvptr[(ir->op2 >> 8)])->uv.v; |
1706 | emit_rma(as, XO_MOV, dest, v); | 1706 | emit_rma(as, XO_MOV, dest, v); |
1707 | } else { | 1707 | } else { |
1708 | Reg uv = ra_scratch(as, RSET_GPR); | 1708 | Reg uv = ra_scratch(as, RSET_GPR); |
@@ -1716,7 +1716,7 @@ static void asm_uref(ASMState *as, IRIns *ir) | |||
1716 | emit_rmro(as, XO_MOV, dest, uv, offsetof(GCupval, v)); | 1716 | emit_rmro(as, XO_MOV, dest, uv, offsetof(GCupval, v)); |
1717 | } | 1717 | } |
1718 | emit_rmro(as, XO_MOV, uv, func, | 1718 | emit_rmro(as, XO_MOV, uv, func, |
1719 | (int32_t)offsetof(GCfuncL, uvptr) + 4*(int32_t)ir->op2); | 1719 | (int32_t)offsetof(GCfuncL, uvptr) + 4*(int32_t)(ir->op2 >> 8)); |
1720 | } | 1720 | } |
1721 | } | 1721 | } |
1722 | } | 1722 | } |