Use cdata to pass IR_KINT64 to -jdump.
This commit is contained in:
@@ -91,7 +91,7 @@ lj_gdbjit.o: lj_gdbjit.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
|
||||
lj_dispatch.h
|
||||
lj_ir.o: lj_ir.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
|
||||
lj_str.h lj_tab.h lj_ir.h lj_jit.h lj_iropt.h lj_trace.h lj_dispatch.h \
|
||||
lj_bc.h lj_traceerr.h lj_lib.h
|
||||
lj_bc.h lj_traceerr.h lj_ctype.h lj_cdata.h lj_lib.h
|
||||
lj_lex.o: lj_lex.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
|
||||
lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_ctype.h lj_cdata.h lualib.h \
|
||||
lj_lex.h lj_parse.h lj_char.h
|
||||
|
||||
14
src/lj_ir.c
14
src/lj_ir.c
@@ -21,6 +21,10 @@
|
||||
#include "lj_jit.h"
|
||||
#include "lj_iropt.h"
|
||||
#include "lj_trace.h"
|
||||
#if LJ_HASFFI
|
||||
#include "lj_ctype.h"
|
||||
#include "lj_cdata.h"
|
||||
#endif
|
||||
#include "lj_lib.h"
|
||||
|
||||
/* Some local macros to save typing. Undef'd at the end. */
|
||||
@@ -380,8 +384,14 @@ void lj_ir_kvalue(lua_State *L, TValue *tv, const IRIns *ir)
|
||||
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_KNUM: setnumV(tv, ir_knum(ir)->n); break;
|
||||
/* NYI: use FFI int64_t. */
|
||||
case IR_KINT64: setnumV(tv, (lua_Number)(int64_t)ir_kint64(ir)->u64); break;
|
||||
#if LJ_HASFFI
|
||||
case IR_KINT64: {
|
||||
GCcdata *cd = lj_cdata_new_(L, CTID_INT64, 8);
|
||||
*(uint64_t *)cdataptr(cd) = ir_kint64(ir)->u64;
|
||||
setcdataV(L, tv, cd);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default: lua_assert(0); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -553,6 +553,7 @@ typedef union IRIns {
|
||||
#define ir_kstr(ir) (gco2str(ir_kgc((ir))))
|
||||
#define ir_ktab(ir) (gco2tab(ir_kgc((ir))))
|
||||
#define ir_kfunc(ir) (gco2func(ir_kgc((ir))))
|
||||
#define ir_kcdata(ir) (gco2cd(ir_kgc((ir))))
|
||||
#define ir_knum(ir) check_exp((ir)->o == IR_KNUM, mref((ir)->ptr, cTValue))
|
||||
#define ir_kint64(ir) check_exp((ir)->o == IR_KINT64, mref((ir)->ptr,cTValue))
|
||||
#define ir_k64(ir) \
|
||||
|
||||
Reference in New Issue
Block a user