diff options
author | Mike Pall <mike> | 2011-01-19 00:40:03 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2011-01-19 00:40:03 +0100 |
commit | 925050fe3ffae269f77757679270432dbad7f010 (patch) | |
tree | b332535f323ca99d7ee9d5b99c73f15de09ea43b /src/lj_ir.c | |
parent | 685dfc317270642fbf2a686799ca2b31ea42e0de (diff) | |
download | luajit2-925050fe3ffae269f77757679270432dbad7f010.tar.gz |
Differentiate between IR_KPTR and IR_KKPTR.
IR_KPTR holds a const pointer to possibly non-const content.
IR_KKPTR holds a const pointer to definitely const content.
Note that only content known by the VM to be const qualifies.
Content tagged as const by users (e.g. const char *) doesn't.
Diffstat (limited to 'src/lj_ir.c')
-rw-r--r-- | src/lj_ir.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lj_ir.c b/src/lj_ir.c index e81beb81..e1ce5839 100644 --- a/src/lj_ir.c +++ b/src/lj_ir.c @@ -311,21 +311,21 @@ found: } /* Intern 32 bit pointer constant. */ -TRef lj_ir_kptr(jit_State *J, void *ptr) +TRef lj_ir_kptr_(jit_State *J, IROp op, void *ptr) { IRIns *ir, *cir = J->cur.ir; IRRef ref; lua_assert((void *)(intptr_t)i32ptr(ptr) == ptr); - for (ref = J->chain[IR_KPTR]; ref; ref = cir[ref].prev) + for (ref = J->chain[op]; ref; ref = cir[ref].prev) if (mref(cir[ref].ptr, void) == ptr) goto found; ref = ir_nextk(J); ir = IR(ref); setmref(ir->ptr, ptr); ir->t.irt = IRT_P32; - ir->o = IR_KPTR; - ir->prev = J->chain[IR_KPTR]; - J->chain[IR_KPTR] = (IRRef1)ref; + ir->o = op; + ir->prev = J->chain[op]; + J->chain[op] = (IRRef1)ref; found: return TREF(ref, IRT_P32); } @@ -382,7 +382,9 @@ void lj_ir_kvalue(lua_State *L, TValue *tv, const IRIns *ir) case IR_KPRI: setitype(tv, irt_toitype(ir->t)); break; case IR_KINT: setintV(tv, ir->i); break; case IR_KGC: setgcV(L, tv, ir_kgc(ir), irt_toitype(ir->t)); break; - case IR_KPTR: case IR_KNULL: setlightudV(tv, mref(ir->ptr, void)); break; + case IR_KPTR: case IR_KKPTR: case IR_KNULL: + setlightudV(tv, mref(ir->ptr, void)); + break; case IR_KNUM: setnumV(tv, ir_knum(ir)->n); break; #if LJ_HASFFI case IR_KINT64: { |