mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Simplify lj_ir_kvalue(). Fix IR_KNULL + IRT_P64 case.
This commit is contained in:
parent
4755765e32
commit
73bc83cda1
29
src/lj_ir.c
29
src/lj_ir.c
@ -374,26 +374,15 @@ void lj_ir_kvalue(lua_State *L, TValue *tv, const IRIns *ir)
|
|||||||
{
|
{
|
||||||
UNUSED(L);
|
UNUSED(L);
|
||||||
lua_assert(ir->o != IR_KSLOT); /* Common mistake. */
|
lua_assert(ir->o != IR_KSLOT); /* Common mistake. */
|
||||||
if (irt_isint(ir->t)) {
|
switch (ir->o) {
|
||||||
lua_assert(ir->o == IR_KINT);
|
case IR_KPRI: setitype(tv, irt_toitype(ir->t)); break;
|
||||||
setintV(tv, ir->i);
|
case IR_KINT: setintV(tv, ir->i); break;
|
||||||
} else if (irt_isnum(ir->t)) {
|
case IR_KGC: setgcV(L, tv, ir_kgc(ir), irt_toitype(ir->t)); break;
|
||||||
lua_assert(ir->o == IR_KNUM);
|
case IR_KPTR: case IR_KNULL: setlightudV(tv, mref(ir->ptr, void)); break;
|
||||||
setnumV(tv, ir_knum(ir)->n);
|
case IR_KNUM: setnumV(tv, ir_knum(ir)->n); break;
|
||||||
} else if (irt_is64(ir->t)) {
|
/* NYI: use FFI int64_t. */
|
||||||
lua_assert(ir->o == IR_KINT64);
|
case IR_KINT64: setnumV(tv, (int64_t)ir_kint64(ir)->u64); break;
|
||||||
setnumV(tv, (int64_t)ir_kint64(ir)->u64); /* NYI: use FFI int64_t. */
|
default: lua_assert(0); break;
|
||||||
} else if (irt_ispri(ir->t)) {
|
|
||||||
lua_assert(ir->o == IR_KPRI);
|
|
||||||
setitype(tv, irt_toitype(ir->t));
|
|
||||||
} else {
|
|
||||||
if (ir->o == IR_KGC) {
|
|
||||||
lua_assert(irt_isgcv(ir->t));
|
|
||||||
setgcV(L, tv, ir_kgc(ir), irt_toitype(ir->t));
|
|
||||||
} else {
|
|
||||||
lua_assert(ir->o == IR_KPTR || ir->o == IR_KNULL);
|
|
||||||
setlightudV(tv, mref(ir->ptr, void));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user