diff options
| author | Mike Pall <mike> | 2010-12-06 02:12:08 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2010-12-06 02:12:08 +0100 |
| commit | 73bc83cda155c690024254cab12069db92b753ac (patch) | |
| tree | 083dea7e58584f258ffa43da42a97b37c019a81e | |
| parent | 4755765e32a2a38dd746afa6485472121ff5c5b6 (diff) | |
| download | luajit-73bc83cda155c690024254cab12069db92b753ac.tar.gz luajit-73bc83cda155c690024254cab12069db92b753ac.tar.bz2 luajit-73bc83cda155c690024254cab12069db92b753ac.zip | |
Simplify lj_ir_kvalue(). Fix IR_KNULL + IRT_P64 case.
| -rw-r--r-- | src/lj_ir.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/src/lj_ir.c b/src/lj_ir.c index d39a345f..fca83904 100644 --- a/src/lj_ir.c +++ b/src/lj_ir.c | |||
| @@ -374,26 +374,15 @@ void lj_ir_kvalue(lua_State *L, TValue *tv, const IRIns *ir) | |||
| 374 | { | 374 | { |
| 375 | UNUSED(L); | 375 | UNUSED(L); |
| 376 | lua_assert(ir->o != IR_KSLOT); /* Common mistake. */ | 376 | lua_assert(ir->o != IR_KSLOT); /* Common mistake. */ |
| 377 | if (irt_isint(ir->t)) { | 377 | switch (ir->o) { |
| 378 | lua_assert(ir->o == IR_KINT); | 378 | case IR_KPRI: setitype(tv, irt_toitype(ir->t)); break; |
| 379 | setintV(tv, ir->i); | 379 | case IR_KINT: setintV(tv, ir->i); break; |
| 380 | } else if (irt_isnum(ir->t)) { | 380 | case IR_KGC: setgcV(L, tv, ir_kgc(ir), irt_toitype(ir->t)); break; |
| 381 | lua_assert(ir->o == IR_KNUM); | 381 | case IR_KPTR: case IR_KNULL: setlightudV(tv, mref(ir->ptr, void)); break; |
| 382 | setnumV(tv, ir_knum(ir)->n); | 382 | case IR_KNUM: setnumV(tv, ir_knum(ir)->n); break; |
| 383 | } else if (irt_is64(ir->t)) { | 383 | /* NYI: use FFI int64_t. */ |
| 384 | lua_assert(ir->o == IR_KINT64); | 384 | case IR_KINT64: setnumV(tv, (int64_t)ir_kint64(ir)->u64); break; |
| 385 | setnumV(tv, (int64_t)ir_kint64(ir)->u64); /* NYI: use FFI int64_t. */ | 385 | default: lua_assert(0); break; |
| 386 | } else if (irt_ispri(ir->t)) { | ||
| 387 | lua_assert(ir->o == IR_KPRI); | ||
| 388 | setitype(tv, irt_toitype(ir->t)); | ||
| 389 | } else { | ||
| 390 | if (ir->o == IR_KGC) { | ||
| 391 | lua_assert(irt_isgcv(ir->t)); | ||
| 392 | setgcV(L, tv, ir_kgc(ir), irt_toitype(ir->t)); | ||
| 393 | } else { | ||
| 394 | lua_assert(ir->o == IR_KPTR || ir->o == IR_KNULL); | ||
| 395 | setlightudV(tv, mref(ir->ptr, void)); | ||
| 396 | } | ||
| 397 | } | 386 | } |
| 398 | } | 387 | } |
| 399 | 388 | ||
