diff options
author | Mike Pall <mike> | 2011-01-02 22:20:08 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2011-01-02 22:20:08 +0100 |
commit | 331b14873731a4377b7487a247a33dfc6fba1f0b (patch) | |
tree | 9792a00ed964464d9857ba9e303a14649e54d6d3 /src | |
parent | e66b5b6eeefa0cadfd80a859c71d41c2f9e076b8 (diff) | |
download | luajit-331b14873731a4377b7487a247a33dfc6fba1f0b.tar.gz luajit-331b14873731a4377b7487a247a33dfc6fba1f0b.tar.bz2 luajit-331b14873731a4377b7487a247a33dfc6fba1f0b.zip |
Use cdata to pass IR_KINT64 to -jdump.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.dep | 2 | ||||
-rw-r--r-- | src/lj_ir.c | 14 | ||||
-rw-r--r-- | src/lj_ir.h | 1 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/Makefile.dep b/src/Makefile.dep index 31c54bcf..f3a2e710 100644 --- a/src/Makefile.dep +++ b/src/Makefile.dep | |||
@@ -91,7 +91,7 @@ lj_gdbjit.o: lj_gdbjit.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ | |||
91 | lj_dispatch.h | 91 | lj_dispatch.h |
92 | lj_ir.o: lj_ir.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \ | 92 | lj_ir.o: lj_ir.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \ |
93 | lj_str.h lj_tab.h lj_ir.h lj_jit.h lj_iropt.h lj_trace.h lj_dispatch.h \ | 93 | lj_str.h lj_tab.h lj_ir.h lj_jit.h lj_iropt.h lj_trace.h lj_dispatch.h \ |
94 | lj_bc.h lj_traceerr.h lj_lib.h | 94 | lj_bc.h lj_traceerr.h lj_ctype.h lj_cdata.h lj_lib.h |
95 | lj_lex.o: lj_lex.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \ | 95 | lj_lex.o: lj_lex.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \ |
96 | lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_ctype.h lj_cdata.h lualib.h \ | 96 | lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_ctype.h lj_cdata.h lualib.h \ |
97 | lj_lex.h lj_parse.h lj_char.h | 97 | lj_lex.h lj_parse.h lj_char.h |
diff --git a/src/lj_ir.c b/src/lj_ir.c index 89be71aa..e2ec22b2 100644 --- a/src/lj_ir.c +++ b/src/lj_ir.c | |||
@@ -21,6 +21,10 @@ | |||
21 | #include "lj_jit.h" | 21 | #include "lj_jit.h" |
22 | #include "lj_iropt.h" | 22 | #include "lj_iropt.h" |
23 | #include "lj_trace.h" | 23 | #include "lj_trace.h" |
24 | #if LJ_HASFFI | ||
25 | #include "lj_ctype.h" | ||
26 | #include "lj_cdata.h" | ||
27 | #endif | ||
24 | #include "lj_lib.h" | 28 | #include "lj_lib.h" |
25 | 29 | ||
26 | /* Some local macros to save typing. Undef'd at the end. */ | 30 | /* 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) | |||
380 | case IR_KGC: setgcV(L, tv, ir_kgc(ir), irt_toitype(ir->t)); break; | 384 | case IR_KGC: setgcV(L, tv, ir_kgc(ir), irt_toitype(ir->t)); break; |
381 | case IR_KPTR: case IR_KNULL: setlightudV(tv, mref(ir->ptr, void)); break; | 385 | case IR_KPTR: case IR_KNULL: setlightudV(tv, mref(ir->ptr, void)); break; |
382 | case IR_KNUM: setnumV(tv, ir_knum(ir)->n); break; | 386 | case IR_KNUM: setnumV(tv, ir_knum(ir)->n); break; |
383 | /* NYI: use FFI int64_t. */ | 387 | #if LJ_HASFFI |
384 | case IR_KINT64: setnumV(tv, (lua_Number)(int64_t)ir_kint64(ir)->u64); break; | 388 | case IR_KINT64: { |
389 | GCcdata *cd = lj_cdata_new_(L, CTID_INT64, 8); | ||
390 | *(uint64_t *)cdataptr(cd) = ir_kint64(ir)->u64; | ||
391 | setcdataV(L, tv, cd); | ||
392 | break; | ||
393 | } | ||
394 | #endif | ||
385 | default: lua_assert(0); break; | 395 | default: lua_assert(0); break; |
386 | } | 396 | } |
387 | } | 397 | } |
diff --git a/src/lj_ir.h b/src/lj_ir.h index 4cf412cf..7d1e6daf 100644 --- a/src/lj_ir.h +++ b/src/lj_ir.h | |||
@@ -553,6 +553,7 @@ typedef union IRIns { | |||
553 | #define ir_kstr(ir) (gco2str(ir_kgc((ir)))) | 553 | #define ir_kstr(ir) (gco2str(ir_kgc((ir)))) |
554 | #define ir_ktab(ir) (gco2tab(ir_kgc((ir)))) | 554 | #define ir_ktab(ir) (gco2tab(ir_kgc((ir)))) |
555 | #define ir_kfunc(ir) (gco2func(ir_kgc((ir)))) | 555 | #define ir_kfunc(ir) (gco2func(ir_kgc((ir)))) |
556 | #define ir_kcdata(ir) (gco2cd(ir_kgc((ir)))) | ||
556 | #define ir_knum(ir) check_exp((ir)->o == IR_KNUM, mref((ir)->ptr, cTValue)) | 557 | #define ir_knum(ir) check_exp((ir)->o == IR_KNUM, mref((ir)->ptr, cTValue)) |
557 | #define ir_kint64(ir) check_exp((ir)->o == IR_KINT64, mref((ir)->ptr,cTValue)) | 558 | #define ir_kint64(ir) check_exp((ir)->o == IR_KINT64, mref((ir)->ptr,cTValue)) |
558 | #define ir_k64(ir) \ | 559 | #define ir_k64(ir) \ |