immunio 1.2.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -5
- data/ext/immunio/Rakefile +14 -6
- data/lib/immunio/context.rb +2 -0
- data/lib/immunio/plugins/action_view.rb +7 -668
- data/lib/immunio/plugins/action_view/action_view.rb +22 -0
- data/lib/immunio/plugins/action_view/active_support_hash.rb +29 -0
- data/lib/immunio/plugins/action_view/cache_store.rb +24 -0
- data/lib/immunio/plugins/action_view/erubi.rb +38 -0
- data/lib/immunio/plugins/action_view/erubis.rb +39 -0
- data/lib/immunio/plugins/action_view/fragment_caching.rb +29 -0
- data/lib/immunio/plugins/action_view/haml.rb +46 -0
- data/lib/immunio/plugins/action_view/slim.rb +42 -0
- data/lib/immunio/plugins/action_view/template.rb +431 -0
- data/lib/immunio/plugins/action_view/template_rendering.rb +45 -0
- data/lib/immunio/plugins/http_tracker.rb +2 -0
- data/lib/immunio/plugins/io.rb +34 -0
- data/lib/immunio/version.rb +1 -1
- data/lua-hooks/Makefile +36 -9
- data/lua-hooks/ext/luajit/COPYRIGHT +1 -1
- data/lua-hooks/ext/luajit/Makefile +22 -15
- data/lua-hooks/ext/luajit/README +2 -2
- data/lua-hooks/ext/luajit/doc/bluequad-print.css +1 -1
- data/lua-hooks/ext/luajit/doc/bluequad.css +1 -1
- data/lua-hooks/ext/luajit/doc/changes.html +69 -3
- data/lua-hooks/ext/luajit/doc/contact.html +10 -3
- data/lua-hooks/ext/luajit/doc/ext_c_api.html +2 -2
- data/lua-hooks/ext/luajit/doc/ext_ffi.html +2 -2
- data/lua-hooks/ext/luajit/doc/ext_ffi_api.html +2 -2
- data/lua-hooks/ext/luajit/doc/ext_ffi_semantics.html +3 -4
- data/lua-hooks/ext/luajit/doc/ext_ffi_tutorial.html +2 -2
- data/lua-hooks/ext/luajit/doc/ext_jit.html +3 -3
- data/lua-hooks/ext/luajit/doc/ext_profiler.html +2 -2
- data/lua-hooks/ext/luajit/doc/extensions.html +47 -20
- data/lua-hooks/ext/luajit/doc/faq.html +2 -2
- data/lua-hooks/ext/luajit/doc/install.html +74 -45
- data/lua-hooks/ext/luajit/doc/luajit.html +5 -5
- data/lua-hooks/ext/luajit/doc/running.html +3 -3
- data/lua-hooks/ext/luajit/doc/status.html +13 -8
- data/lua-hooks/ext/luajit/dynasm/dasm_arm.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_arm.lua +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_arm64.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_arm64.lua +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_mips.h +8 -5
- data/lua-hooks/ext/luajit/dynasm/dasm_mips.lua +66 -11
- data/lua-hooks/ext/luajit/dynasm/dasm_mips64.lua +12 -0
- data/lua-hooks/ext/luajit/dynasm/dasm_ppc.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_ppc.lua +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_proto.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_x64.lua +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_x86.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_x86.lua +5 -1
- data/lua-hooks/ext/luajit/dynasm/dynasm.lua +2 -2
- data/lua-hooks/ext/luajit/etc/luajit.1 +1 -1
- data/lua-hooks/ext/luajit/etc/luajit.pc +1 -1
- data/lua-hooks/ext/luajit/src/Makefile +15 -11
- data/lua-hooks/ext/luajit/src/Makefile.dep +16 -16
- data/lua-hooks/ext/luajit/src/host/buildvm.c +2 -2
- data/lua-hooks/ext/luajit/src/host/buildvm.h +1 -1
- data/lua-hooks/ext/luajit/src/host/buildvm_asm.c +9 -4
- data/lua-hooks/ext/luajit/src/host/buildvm_fold.c +2 -2
- data/lua-hooks/ext/luajit/src/host/buildvm_lib.c +1 -1
- data/lua-hooks/ext/luajit/src/host/buildvm_libbc.h +14 -3
- data/lua-hooks/ext/luajit/src/host/buildvm_peobj.c +27 -3
- data/lua-hooks/ext/luajit/src/host/genlibbc.lua +1 -1
- data/lua-hooks/ext/luajit/src/host/genminilua.lua +6 -5
- data/lua-hooks/ext/luajit/src/host/minilua.c +1 -1
- data/lua-hooks/ext/luajit/src/jit/bc.lua +1 -1
- data/lua-hooks/ext/luajit/src/jit/bcsave.lua +8 -8
- data/lua-hooks/ext/luajit/src/jit/dis_arm.lua +2 -2
- data/lua-hooks/ext/luajit/src/jit/dis_arm64.lua +1216 -0
- data/lua-hooks/ext/luajit/src/jit/dis_arm64be.lua +12 -0
- data/lua-hooks/ext/luajit/src/jit/dis_mips.lua +35 -20
- data/lua-hooks/ext/luajit/src/jit/dis_mips64.lua +17 -0
- data/lua-hooks/ext/luajit/src/jit/dis_mips64el.lua +17 -0
- data/lua-hooks/ext/luajit/src/jit/dis_mipsel.lua +1 -1
- data/lua-hooks/ext/luajit/src/jit/dis_ppc.lua +2 -2
- data/lua-hooks/ext/luajit/src/jit/dis_x64.lua +1 -1
- data/lua-hooks/ext/luajit/src/jit/dis_x86.lua +7 -4
- data/lua-hooks/ext/luajit/src/jit/dump.lua +17 -12
- data/lua-hooks/ext/luajit/src/jit/p.lua +3 -2
- data/lua-hooks/ext/luajit/src/jit/v.lua +2 -2
- data/lua-hooks/ext/luajit/src/jit/zone.lua +1 -1
- data/lua-hooks/ext/luajit/src/lauxlib.h +14 -20
- data/lua-hooks/ext/luajit/src/lib_aux.c +38 -27
- data/lua-hooks/ext/luajit/src/lib_base.c +12 -5
- data/lua-hooks/ext/luajit/src/lib_bit.c +1 -1
- data/lua-hooks/ext/luajit/src/lib_debug.c +5 -5
- data/lua-hooks/ext/luajit/src/lib_ffi.c +2 -2
- data/lua-hooks/ext/luajit/src/lib_init.c +16 -16
- data/lua-hooks/ext/luajit/src/lib_io.c +6 -7
- data/lua-hooks/ext/luajit/src/lib_jit.c +14 -4
- data/lua-hooks/ext/luajit/src/lib_math.c +1 -5
- data/lua-hooks/ext/luajit/src/lib_os.c +1 -1
- data/lua-hooks/ext/luajit/src/lib_package.c +14 -23
- data/lua-hooks/ext/luajit/src/lib_string.c +1 -5
- data/lua-hooks/ext/luajit/src/lib_table.c +21 -1
- data/lua-hooks/ext/luajit/src/lj.supp +3 -3
- data/lua-hooks/ext/luajit/src/lj_alloc.c +174 -83
- data/lua-hooks/ext/luajit/src/lj_api.c +97 -18
- data/lua-hooks/ext/luajit/src/lj_arch.h +54 -22
- data/lua-hooks/ext/luajit/src/lj_asm.c +172 -53
- data/lua-hooks/ext/luajit/src/lj_asm.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_asm_arm.h +19 -16
- data/lua-hooks/ext/luajit/src/lj_asm_arm64.h +2022 -0
- data/lua-hooks/ext/luajit/src/lj_asm_mips.h +564 -158
- data/lua-hooks/ext/luajit/src/lj_asm_ppc.h +19 -18
- data/lua-hooks/ext/luajit/src/lj_asm_x86.h +578 -92
- data/lua-hooks/ext/luajit/src/lj_bc.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_bc.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_bcdump.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_bcread.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_bcwrite.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_buf.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_buf.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_carith.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_carith.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ccall.c +172 -7
- data/lua-hooks/ext/luajit/src/lj_ccall.h +21 -5
- data/lua-hooks/ext/luajit/src/lj_ccallback.c +71 -17
- data/lua-hooks/ext/luajit/src/lj_ccallback.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_cconv.c +4 -2
- data/lua-hooks/ext/luajit/src/lj_cconv.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_cdata.c +7 -5
- data/lua-hooks/ext/luajit/src/lj_cdata.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_clib.c +5 -5
- data/lua-hooks/ext/luajit/src/lj_clib.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_cparse.c +11 -6
- data/lua-hooks/ext/luajit/src/lj_cparse.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_crecord.c +70 -14
- data/lua-hooks/ext/luajit/src/lj_crecord.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ctype.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_ctype.h +8 -8
- data/lua-hooks/ext/luajit/src/lj_debug.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_debug.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_def.h +6 -9
- data/lua-hooks/ext/luajit/src/lj_dispatch.c +3 -3
- data/lua-hooks/ext/luajit/src/lj_dispatch.h +2 -1
- data/lua-hooks/ext/luajit/src/lj_emit_arm.h +5 -4
- data/lua-hooks/ext/luajit/src/lj_emit_arm64.h +419 -0
- data/lua-hooks/ext/luajit/src/lj_emit_mips.h +100 -20
- data/lua-hooks/ext/luajit/src/lj_emit_ppc.h +4 -4
- data/lua-hooks/ext/luajit/src/lj_emit_x86.h +116 -25
- data/lua-hooks/ext/luajit/src/lj_err.c +34 -13
- data/lua-hooks/ext/luajit/src/lj_err.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_errmsg.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ff.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ffrecord.c +58 -49
- data/lua-hooks/ext/luajit/src/lj_ffrecord.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_frame.h +33 -6
- data/lua-hooks/ext/luajit/src/lj_func.c +4 -2
- data/lua-hooks/ext/luajit/src/lj_func.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_gc.c +16 -7
- data/lua-hooks/ext/luajit/src/lj_gc.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_gdbjit.c +31 -1
- data/lua-hooks/ext/luajit/src/lj_gdbjit.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ir.c +69 -96
- data/lua-hooks/ext/luajit/src/lj_ir.h +29 -18
- data/lua-hooks/ext/luajit/src/lj_ircall.h +24 -30
- data/lua-hooks/ext/luajit/src/lj_iropt.h +9 -9
- data/lua-hooks/ext/luajit/src/lj_jit.h +67 -9
- data/lua-hooks/ext/luajit/src/lj_lex.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_lex.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_lib.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_lib.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_load.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_mcode.c +11 -10
- data/lua-hooks/ext/luajit/src/lj_mcode.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_meta.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_meta.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_obj.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_obj.h +7 -3
- data/lua-hooks/ext/luajit/src/lj_opt_dce.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_opt_fold.c +84 -17
- data/lua-hooks/ext/luajit/src/lj_opt_loop.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_opt_mem.c +3 -3
- data/lua-hooks/ext/luajit/src/lj_opt_narrow.c +24 -22
- data/lua-hooks/ext/luajit/src/lj_opt_sink.c +11 -6
- data/lua-hooks/ext/luajit/src/lj_opt_split.c +11 -2
- data/lua-hooks/ext/luajit/src/lj_parse.c +9 -7
- data/lua-hooks/ext/luajit/src/lj_parse.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_profile.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_profile.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_record.c +201 -117
- data/lua-hooks/ext/luajit/src/lj_record.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_snap.c +72 -26
- data/lua-hooks/ext/luajit/src/lj_snap.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_state.c +6 -6
- data/lua-hooks/ext/luajit/src/lj_state.h +2 -2
- data/lua-hooks/ext/luajit/src/lj_str.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_str.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_strfmt.c +7 -3
- data/lua-hooks/ext/luajit/src/lj_strfmt.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_strfmt_num.c +4 -3
- data/lua-hooks/ext/luajit/src/lj_strscan.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_strscan.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_tab.c +1 -2
- data/lua-hooks/ext/luajit/src/lj_tab.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_target.h +3 -3
- data/lua-hooks/ext/luajit/src/lj_target_arm.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_target_arm64.h +239 -7
- data/lua-hooks/ext/luajit/src/lj_target_mips.h +111 -22
- data/lua-hooks/ext/luajit/src/lj_target_ppc.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_target_x86.h +21 -4
- data/lua-hooks/ext/luajit/src/lj_trace.c +63 -18
- data/lua-hooks/ext/luajit/src/lj_trace.h +2 -1
- data/lua-hooks/ext/luajit/src/lj_traceerr.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_udata.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_udata.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_vm.h +5 -1
- data/lua-hooks/ext/luajit/src/lj_vmevent.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_vmevent.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_vmmath.c +1 -1
- data/lua-hooks/ext/luajit/src/ljamalg.c +1 -1
- data/lua-hooks/ext/luajit/src/lua.h +9 -1
- data/lua-hooks/ext/luajit/src/luaconf.h +3 -7
- data/lua-hooks/ext/luajit/src/luajit.c +69 -54
- data/lua-hooks/ext/luajit/src/luajit.h +4 -4
- data/lua-hooks/ext/luajit/src/lualib.h +1 -1
- data/lua-hooks/ext/luajit/src/msvcbuild.bat +12 -4
- data/lua-hooks/ext/luajit/src/vm_arm.dasc +1 -1
- data/lua-hooks/ext/luajit/src/vm_arm64.dasc +255 -32
- data/lua-hooks/ext/luajit/src/vm_mips.dasc +26 -23
- data/lua-hooks/ext/luajit/src/vm_mips64.dasc +5062 -0
- data/lua-hooks/ext/luajit/src/vm_ppc.dasc +1 -1
- data/lua-hooks/ext/luajit/src/vm_x64.dasc +24 -25
- data/lua-hooks/ext/luajit/src/vm_x86.dasc +77 -4
- data/lua-hooks/libluahooks.darwin.a +0 -0
- data/lua-hooks/libluahooks.linux.a +0 -0
- data/lua-hooks/options.mk +1 -1
- metadata +37 -77
- data/lua-hooks/ext/all.c +0 -69
- data/lua-hooks/ext/libinjection/COPYING +0 -37
- data/lua-hooks/ext/libinjection/libinjection.h +0 -65
- data/lua-hooks/ext/libinjection/libinjection_html5.c +0 -847
- data/lua-hooks/ext/libinjection/libinjection_html5.h +0 -54
- data/lua-hooks/ext/libinjection/libinjection_sqli.c +0 -2301
- data/lua-hooks/ext/libinjection/libinjection_sqli.h +0 -295
- data/lua-hooks/ext/libinjection/libinjection_sqli_data.h +0 -9349
- data/lua-hooks/ext/libinjection/libinjection_xss.c +0 -531
- data/lua-hooks/ext/libinjection/libinjection_xss.h +0 -21
- data/lua-hooks/ext/libinjection/lualib.c +0 -145
- data/lua-hooks/ext/libinjection/module.mk +0 -5
- data/lua-hooks/ext/lpeg/HISTORY +0 -96
- data/lua-hooks/ext/lpeg/lpcap.c +0 -537
- data/lua-hooks/ext/lpeg/lpcap.h +0 -56
- data/lua-hooks/ext/lpeg/lpcode.c +0 -1014
- data/lua-hooks/ext/lpeg/lpcode.h +0 -40
- data/lua-hooks/ext/lpeg/lpeg-128.gif +0 -0
- data/lua-hooks/ext/lpeg/lpeg.html +0 -1445
- data/lua-hooks/ext/lpeg/lpprint.c +0 -244
- data/lua-hooks/ext/lpeg/lpprint.h +0 -36
- data/lua-hooks/ext/lpeg/lptree.c +0 -1303
- data/lua-hooks/ext/lpeg/lptree.h +0 -82
- data/lua-hooks/ext/lpeg/lptypes.h +0 -149
- data/lua-hooks/ext/lpeg/lpvm.c +0 -364
- data/lua-hooks/ext/lpeg/lpvm.h +0 -58
- data/lua-hooks/ext/lpeg/makefile +0 -55
- data/lua-hooks/ext/lpeg/module.mk +0 -6
- data/lua-hooks/ext/lpeg/re.html +0 -498
- data/lua-hooks/ext/lua-cmsgpack/.gitignore +0 -13
- data/lua-hooks/ext/lua-cmsgpack/CMakeLists.txt +0 -45
- data/lua-hooks/ext/lua-cmsgpack/README.md +0 -115
- data/lua-hooks/ext/lua-cmsgpack/lua_cmsgpack.c +0 -970
- data/lua-hooks/ext/lua-cmsgpack/module.mk +0 -2
- data/lua-hooks/ext/lua-cmsgpack/test.lua +0 -570
- data/lua-hooks/ext/lua-snapshot/LICENSE +0 -7
- data/lua-hooks/ext/lua-snapshot/Makefile +0 -12
- data/lua-hooks/ext/lua-snapshot/README.md +0 -18
- data/lua-hooks/ext/lua-snapshot/dump.lua +0 -15
- data/lua-hooks/ext/lua-snapshot/module.mk +0 -2
- data/lua-hooks/ext/lua-snapshot/snapshot.c +0 -462
- data/lua-hooks/ext/luautf8/README.md +0 -152
- data/lua-hooks/ext/luautf8/lutf8lib.c +0 -1274
- data/lua-hooks/ext/luautf8/module.mk +0 -2
- data/lua-hooks/ext/luautf8/unidata.h +0 -3064
- data/lua-hooks/ext/module.mk +0 -15
- data/lua-hooks/ext/modules.h +0 -17
- data/lua-hooks/ext/perf/luacpu.c +0 -114
- data/lua-hooks/ext/perf/lualoadavg.c +0 -40
- data/lua-hooks/ext/perf/luameminfo.c +0 -38
- data/lua-hooks/ext/perf/luaoslib.c +0 -203
- data/lua-hooks/ext/perf/module.mk +0 -5
- data/lua-hooks/ext/sha1/luasha1.c +0 -74
- data/lua-hooks/ext/sha1/module.mk +0 -5
- data/lua-hooks/ext/sha1/sha1.c +0 -145
- data/lua-hooks/ext/sha2/luasha256.c +0 -77
- data/lua-hooks/ext/sha2/module.mk +0 -5
- data/lua-hooks/ext/sha2/sha256.c +0 -196
- data/lua-hooks/ext/sysutils/lua_utils.c +0 -56
- data/lua-hooks/ext/sysutils/module.mk +0 -2
@@ -1,8 +1,30 @@
|
|
1
1
|
/*
|
2
2
|
** MIPS instruction emitter.
|
3
|
-
** Copyright (C) 2005-
|
3
|
+
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
4
4
|
*/
|
5
5
|
|
6
|
+
#if LJ_64
|
7
|
+
static intptr_t get_k64val(IRIns *ir)
|
8
|
+
{
|
9
|
+
if (ir->o == IR_KINT64) {
|
10
|
+
return (intptr_t)ir_kint64(ir)->u64;
|
11
|
+
} else if (ir->o == IR_KGC) {
|
12
|
+
return (intptr_t)ir_kgc(ir);
|
13
|
+
} else if (ir->o == IR_KPTR || ir->o == IR_KKPTR) {
|
14
|
+
return (intptr_t)ir_kptr(ir);
|
15
|
+
} else {
|
16
|
+
lua_assert(ir->o == IR_KINT || ir->o == IR_KNULL);
|
17
|
+
return ir->i; /* Sign-extended. */
|
18
|
+
}
|
19
|
+
}
|
20
|
+
#endif
|
21
|
+
|
22
|
+
#if LJ_64
|
23
|
+
#define get_kval(ir) get_k64val(ir)
|
24
|
+
#else
|
25
|
+
#define get_kval(ir) ((ir)->i)
|
26
|
+
#endif
|
27
|
+
|
6
28
|
/* -- Emit basic instructions --------------------------------------------- */
|
7
29
|
|
8
30
|
static void emit_dst(ASMState *as, MIPSIns mi, Reg rd, Reg rs, Reg rt)
|
@@ -35,7 +57,7 @@ static void emit_fgh(ASMState *as, MIPSIns mi, Reg rf, Reg rg, Reg rh)
|
|
35
57
|
|
36
58
|
static void emit_rotr(ASMState *as, Reg dest, Reg src, Reg tmp, uint32_t shift)
|
37
59
|
{
|
38
|
-
if ((as->flags &
|
60
|
+
if (LJ_64 || (as->flags & JIT_F_MIPSXXR2)) {
|
39
61
|
emit_dta(as, MIPSI_ROTR, dest, src, shift);
|
40
62
|
} else {
|
41
63
|
emit_dst(as, MIPSI_OR, dest, dest, tmp);
|
@@ -44,13 +66,21 @@ static void emit_rotr(ASMState *as, Reg dest, Reg src, Reg tmp, uint32_t shift)
|
|
44
66
|
}
|
45
67
|
}
|
46
68
|
|
69
|
+
#if LJ_64
|
70
|
+
static void emit_tsml(ASMState *as, MIPSIns mi, Reg rt, Reg rs, uint32_t msb,
|
71
|
+
uint32_t lsb)
|
72
|
+
{
|
73
|
+
*--as->mcp = mi | MIPSF_T(rt) | MIPSF_S(rs) | MIPSF_M(msb) | MIPSF_L(lsb);
|
74
|
+
}
|
75
|
+
#endif
|
76
|
+
|
47
77
|
/* -- Emit loads/stores --------------------------------------------------- */
|
48
78
|
|
49
79
|
/* Prefer rematerialization of BASE/L from global_State over spills. */
|
50
80
|
#define emit_canremat(ref) ((ref) <= REF_BASE)
|
51
81
|
|
52
82
|
/* Try to find a one step delta relative to another constant. */
|
53
|
-
static int emit_kdelta1(ASMState *as, Reg t,
|
83
|
+
static int emit_kdelta1(ASMState *as, Reg t, intptr_t i)
|
54
84
|
{
|
55
85
|
RegSet work = ~as->freeset & RSET_GPR;
|
56
86
|
while (work) {
|
@@ -58,9 +88,10 @@ static int emit_kdelta1(ASMState *as, Reg t, int32_t i)
|
|
58
88
|
IRRef ref = regcost_ref(as->cost[r]);
|
59
89
|
lua_assert(r != t);
|
60
90
|
if (ref < ASMREF_L) {
|
61
|
-
|
91
|
+
intptr_t delta = (intptr_t)((uintptr_t)i -
|
92
|
+
(uintptr_t)(ra_iskref(ref) ? ra_krefk(as, ref) : get_kval(IR(ref))));
|
62
93
|
if (checki16(delta)) {
|
63
|
-
emit_tsi(as,
|
94
|
+
emit_tsi(as, MIPSI_AADDIU, t, r, delta);
|
64
95
|
return 1;
|
65
96
|
}
|
66
97
|
}
|
@@ -76,8 +107,8 @@ static void emit_loadi(ASMState *as, Reg r, int32_t i)
|
|
76
107
|
emit_ti(as, MIPSI_LI, r, i);
|
77
108
|
} else {
|
78
109
|
if ((i & 0xffff)) {
|
79
|
-
|
80
|
-
if ((
|
110
|
+
intptr_t jgl = (intptr_t)(void *)J2G(as->J);
|
111
|
+
if ((uintptr_t)(i-jgl) < 65536) {
|
81
112
|
emit_tsi(as, MIPSI_ADDIU, r, RID_JGL, i-jgl-32768);
|
82
113
|
return;
|
83
114
|
} else if (emit_kdelta1(as, r, i)) {
|
@@ -92,16 +123,48 @@ static void emit_loadi(ASMState *as, Reg r, int32_t i)
|
|
92
123
|
}
|
93
124
|
}
|
94
125
|
|
126
|
+
#if LJ_64
|
127
|
+
/* Load a 64 bit constant into a GPR. */
|
128
|
+
static void emit_loadu64(ASMState *as, Reg r, uint64_t u64)
|
129
|
+
{
|
130
|
+
if (checki32((int64_t)u64)) {
|
131
|
+
emit_loadi(as, r, (int32_t)u64);
|
132
|
+
} else {
|
133
|
+
uint64_t delta = u64 - (uint64_t)(void *)J2G(as->J);
|
134
|
+
if (delta < 65536) {
|
135
|
+
emit_tsi(as, MIPSI_DADDIU, r, RID_JGL, (int32_t)(delta-32768));
|
136
|
+
} else if (emit_kdelta1(as, r, (intptr_t)u64)) {
|
137
|
+
return;
|
138
|
+
} else {
|
139
|
+
if ((u64 & 0xffff)) {
|
140
|
+
emit_tsi(as, MIPSI_ORI, r, r, u64 & 0xffff);
|
141
|
+
}
|
142
|
+
if (((u64 >> 16) & 0xffff)) {
|
143
|
+
emit_dta(as, MIPSI_DSLL, r, r, 16);
|
144
|
+
emit_tsi(as, MIPSI_ORI, r, r, (u64 >> 16) & 0xffff);
|
145
|
+
emit_dta(as, MIPSI_DSLL, r, r, 16);
|
146
|
+
} else {
|
147
|
+
emit_dta(as, MIPSI_DSLL32, r, r, 0);
|
148
|
+
}
|
149
|
+
emit_loadi(as, r, (int32_t)(u64 >> 32));
|
150
|
+
}
|
151
|
+
/* TODO: There are probably more optimization opportunities. */
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
#define emit_loada(as, r, addr) emit_loadu64(as, (r), u64ptr((addr)))
|
156
|
+
#else
|
95
157
|
#define emit_loada(as, r, addr) emit_loadi(as, (r), i32ptr((addr)))
|
158
|
+
#endif
|
96
159
|
|
97
|
-
static Reg ra_allock(ASMState *as,
|
98
|
-
static void ra_allockreg(ASMState *as,
|
160
|
+
static Reg ra_allock(ASMState *as, intptr_t k, RegSet allow);
|
161
|
+
static void ra_allockreg(ASMState *as, intptr_t k, Reg r);
|
99
162
|
|
100
163
|
/* Get/set from constant pointer. */
|
101
164
|
static void emit_lsptr(ASMState *as, MIPSIns mi, Reg r, void *p, RegSet allow)
|
102
165
|
{
|
103
|
-
|
104
|
-
|
166
|
+
intptr_t jgl = (intptr_t)(J2G(as->J));
|
167
|
+
intptr_t i = (intptr_t)(p);
|
105
168
|
Reg base;
|
106
169
|
if ((uint32_t)(i-jgl) < 65536) {
|
107
170
|
i = i-jgl-32768;
|
@@ -112,8 +175,24 @@ static void emit_lsptr(ASMState *as, MIPSIns mi, Reg r, void *p, RegSet allow)
|
|
112
175
|
emit_tsi(as, mi, r, base, i);
|
113
176
|
}
|
114
177
|
|
115
|
-
#
|
116
|
-
|
178
|
+
#if LJ_64
|
179
|
+
static void emit_loadk64(ASMState *as, Reg r, IRIns *ir)
|
180
|
+
{
|
181
|
+
const uint64_t *k = &ir_k64(ir)->u64;
|
182
|
+
Reg r64 = r;
|
183
|
+
if (rset_test(RSET_FPR, r)) {
|
184
|
+
r64 = RID_TMP;
|
185
|
+
emit_tg(as, MIPSI_DMTC1, r64, r);
|
186
|
+
}
|
187
|
+
if ((uint32_t)((intptr_t)k-(intptr_t)J2G(as->J)) < 65536)
|
188
|
+
emit_lsptr(as, MIPSI_LD, r64, (void *)k, 0);
|
189
|
+
else
|
190
|
+
emit_loadu64(as, r64, *k);
|
191
|
+
}
|
192
|
+
#else
|
193
|
+
#define emit_loadk64(as, r, ir) \
|
194
|
+
emit_lsptr(as, MIPSI_LDC1, ((r) & 31), (void *)&ir_knum((ir))->u64, RSET_GPR)
|
195
|
+
#endif
|
117
196
|
|
118
197
|
/* Get/set global_State fields. */
|
119
198
|
static void emit_lsglptr(ASMState *as, MIPSIns mi, Reg r, int32_t ofs)
|
@@ -122,9 +201,9 @@ static void emit_lsglptr(ASMState *as, MIPSIns mi, Reg r, int32_t ofs)
|
|
122
201
|
}
|
123
202
|
|
124
203
|
#define emit_getgl(as, r, field) \
|
125
|
-
emit_lsglptr(as,
|
204
|
+
emit_lsglptr(as, MIPSI_AL, (r), (int32_t)offsetof(global_State, field))
|
126
205
|
#define emit_setgl(as, r, field) \
|
127
|
-
emit_lsglptr(as,
|
206
|
+
emit_lsglptr(as, MIPSI_AS, (r), (int32_t)offsetof(global_State, field))
|
128
207
|
|
129
208
|
/* Trace number is determined from per-trace exit stubs. */
|
130
209
|
#define emit_setvmstate(as, i) UNUSED(i)
|
@@ -157,13 +236,14 @@ static void emit_call(ASMState *as, void *target, int needcfa)
|
|
157
236
|
MCode *p = as->mcp;
|
158
237
|
*--p = MIPSI_NOP;
|
159
238
|
if ((((uintptr_t)target ^ (uintptr_t)p) >> 28) == 0) {
|
160
|
-
*--p =
|
239
|
+
*--p = (((uintptr_t)target & 1) ? MIPSI_JALX : MIPSI_JAL) |
|
240
|
+
(((uintptr_t)target >>2) & 0x03ffffffu);
|
161
241
|
} else { /* Target out of range: need indirect call. */
|
162
242
|
*--p = MIPSI_JALR | MIPSF_S(RID_CFUNCADDR);
|
163
243
|
needcfa = 1;
|
164
244
|
}
|
165
245
|
as->mcp = p;
|
166
|
-
if (needcfa) ra_allockreg(as,
|
246
|
+
if (needcfa) ra_allockreg(as, (intptr_t)target, RID_CFUNCADDR);
|
167
247
|
}
|
168
248
|
|
169
249
|
/* -- Emit generic operations --------------------------------------------- */
|
@@ -184,7 +264,7 @@ static void emit_movrr(ASMState *as, IRIns *ir, Reg dst, Reg src)
|
|
184
264
|
static void emit_loadofs(ASMState *as, IRIns *ir, Reg r, Reg base, int32_t ofs)
|
185
265
|
{
|
186
266
|
if (r < RID_MAX_GPR)
|
187
|
-
emit_tsi(as, MIPSI_LW, r, base, ofs);
|
267
|
+
emit_tsi(as, irt_is64(ir->t) ? MIPSI_LD : MIPSI_LW, r, base, ofs);
|
188
268
|
else
|
189
269
|
emit_tsi(as, irt_isnum(ir->t) ? MIPSI_LDC1 : MIPSI_LWC1,
|
190
270
|
(r & 31), base, ofs);
|
@@ -194,7 +274,7 @@ static void emit_loadofs(ASMState *as, IRIns *ir, Reg r, Reg base, int32_t ofs)
|
|
194
274
|
static void emit_storeofs(ASMState *as, IRIns *ir, Reg r, Reg base, int32_t ofs)
|
195
275
|
{
|
196
276
|
if (r < RID_MAX_GPR)
|
197
|
-
emit_tsi(as, MIPSI_SW, r, base, ofs);
|
277
|
+
emit_tsi(as, irt_is64(ir->t) ? MIPSI_SD : MIPSI_SW, r, base, ofs);
|
198
278
|
else
|
199
279
|
emit_tsi(as, irt_isnum(ir->t) ? MIPSI_SDC1 : MIPSI_SWC1,
|
200
280
|
(r&31), base, ofs);
|
@@ -205,7 +285,7 @@ static void emit_addptr(ASMState *as, Reg r, int32_t ofs)
|
|
205
285
|
{
|
206
286
|
if (ofs) {
|
207
287
|
lua_assert(checki16(ofs));
|
208
|
-
emit_tsi(as,
|
288
|
+
emit_tsi(as, MIPSI_AADDIU, r, r, ofs);
|
209
289
|
}
|
210
290
|
}
|
211
291
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
** PPC instruction emitter.
|
3
|
-
** Copyright (C) 2005-
|
3
|
+
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
4
4
|
*/
|
5
5
|
|
6
6
|
/* -- Emit basic instructions --------------------------------------------- */
|
@@ -98,7 +98,7 @@ static void emit_loadi(ASMState *as, Reg r, int32_t i)
|
|
98
98
|
|
99
99
|
#define emit_loada(as, r, addr) emit_loadi(as, (r), i32ptr((addr)))
|
100
100
|
|
101
|
-
static Reg ra_allock(ASMState *as,
|
101
|
+
static Reg ra_allock(ASMState *as, intptr_t k, RegSet allow);
|
102
102
|
|
103
103
|
/* Get/set from constant pointer. */
|
104
104
|
static void emit_lsptr(ASMState *as, PPCIns pi, Reg r, void *p, RegSet allow)
|
@@ -115,8 +115,8 @@ static void emit_lsptr(ASMState *as, PPCIns pi, Reg r, void *p, RegSet allow)
|
|
115
115
|
emit_tai(as, pi, r, base, i);
|
116
116
|
}
|
117
117
|
|
118
|
-
#define
|
119
|
-
emit_lsptr(as, PPCI_LFD, ((r) & 31), (void *)(
|
118
|
+
#define emit_loadk64(as, r, ir) \
|
119
|
+
emit_lsptr(as, PPCI_LFD, ((r) & 31), (void *)&ir_knum((ir))->u64, RSET_GPR)
|
120
120
|
|
121
121
|
/* Get/set global_State fields. */
|
122
122
|
static void emit_lsglptr(ASMState *as, PPCIns pi, Reg r, int32_t ofs)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
** x86/x64 instruction emitter.
|
3
|
-
** Copyright (C) 2005-
|
3
|
+
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
4
4
|
*/
|
5
5
|
|
6
6
|
/* -- Emit basic instructions --------------------------------------------- */
|
@@ -13,10 +13,17 @@
|
|
13
13
|
if (rex != 0x40) *--(p) = rex; }
|
14
14
|
#define FORCE_REX 0x200
|
15
15
|
#define REX_64 (FORCE_REX|0x080000)
|
16
|
+
#define VEX_64 0x800000
|
16
17
|
#else
|
17
18
|
#define REXRB(p, rr, rb) ((void)0)
|
18
19
|
#define FORCE_REX 0
|
19
20
|
#define REX_64 0
|
21
|
+
#define VEX_64 0
|
22
|
+
#endif
|
23
|
+
#if LJ_GC64
|
24
|
+
#define REX_GC64 REX_64
|
25
|
+
#else
|
26
|
+
#define REX_GC64 0
|
20
27
|
#endif
|
21
28
|
|
22
29
|
#define emit_i8(as, i) (*--as->mcp = (MCode)(i))
|
@@ -31,6 +38,13 @@ static LJ_AINLINE MCode *emit_op(x86Op xo, Reg rr, Reg rb, Reg rx,
|
|
31
38
|
MCode *p, int delta)
|
32
39
|
{
|
33
40
|
int n = (int8_t)xo;
|
41
|
+
if (n == -60) { /* VEX-encoded instruction */
|
42
|
+
#if LJ_64
|
43
|
+
xo ^= (((rr>>1)&4)+((rx>>2)&2)+((rb>>3)&1))<<13;
|
44
|
+
#endif
|
45
|
+
*(uint32_t *)(p+delta-5) = (uint32_t)xo;
|
46
|
+
return p+delta-5;
|
47
|
+
}
|
34
48
|
#if defined(__GNUC__)
|
35
49
|
if (__builtin_constant_p(xo) && n == -2)
|
36
50
|
p[delta-2] = (MCode)(xo >> 24);
|
@@ -85,26 +99,17 @@ static int32_t ptr2addr(const void *p)
|
|
85
99
|
#define ptr2addr(p) (i32ptr((p)))
|
86
100
|
#endif
|
87
101
|
|
88
|
-
/* op r, [addr] */
|
89
|
-
static void emit_rma(ASMState *as, x86Op xo, Reg rr, const void *addr)
|
90
|
-
{
|
91
|
-
MCode *p = as->mcp;
|
92
|
-
*(int32_t *)(p-4) = ptr2addr(addr);
|
93
|
-
#if LJ_64
|
94
|
-
p[-5] = MODRM(XM_SCALE1, RID_ESP, RID_EBP);
|
95
|
-
as->mcp = emit_opm(xo, XM_OFS0, rr, RID_ESP, p, -5);
|
96
|
-
#else
|
97
|
-
as->mcp = emit_opm(xo, XM_OFS0, rr, RID_EBP, p, -4);
|
98
|
-
#endif
|
99
|
-
}
|
100
|
-
|
101
102
|
/* op r, [base+ofs] */
|
102
103
|
static void emit_rmro(ASMState *as, x86Op xo, Reg rr, Reg rb, int32_t ofs)
|
103
104
|
{
|
104
105
|
MCode *p = as->mcp;
|
105
106
|
x86Mode mode;
|
106
107
|
if (ra_hasreg(rb)) {
|
107
|
-
if (
|
108
|
+
if (LJ_GC64 && rb == RID_RIP) {
|
109
|
+
mode = XM_OFS0;
|
110
|
+
p -= 4;
|
111
|
+
*(int32_t *)p = ofs;
|
112
|
+
} else if (ofs == 0 && (rb&7) != RID_EBP) {
|
108
113
|
mode = XM_OFS0;
|
109
114
|
} else if (checki8(ofs)) {
|
110
115
|
*--p = (MCode)ofs;
|
@@ -202,6 +207,11 @@ static void emit_mrm(ASMState *as, x86Op xo, Reg rr, Reg rb)
|
|
202
207
|
*--p = MODRM(XM_SCALE1, RID_ESP, RID_EBP);
|
203
208
|
rb = RID_ESP;
|
204
209
|
#endif
|
210
|
+
} else if (LJ_GC64 && rb == RID_RIP) {
|
211
|
+
lua_assert(as->mrm.idx == RID_NONE);
|
212
|
+
mode = XM_OFS0;
|
213
|
+
p -= 4;
|
214
|
+
*(int32_t *)p = as->mrm.ofs;
|
205
215
|
} else {
|
206
216
|
if (as->mrm.ofs == 0 && (rb&7) != RID_EBP) {
|
207
217
|
mode = XM_OFS0;
|
@@ -255,8 +265,8 @@ static void emit_movmroi(ASMState *as, Reg base, int32_t ofs, int32_t i)
|
|
255
265
|
/* Get/set global_State fields. */
|
256
266
|
#define emit_opgl(as, xo, r, field) \
|
257
267
|
emit_rma(as, (xo), (r), (void *)&J2G(as->J)->field)
|
258
|
-
#define emit_getgl(as, r, field)
|
259
|
-
#define emit_setgl(as, r, field)
|
268
|
+
#define emit_getgl(as, r, field) emit_opgl(as, XO_MOV, (r)|REX_GC64, field)
|
269
|
+
#define emit_setgl(as, r, field) emit_opgl(as, XO_MOVto, (r)|REX_GC64, field)
|
260
270
|
|
261
271
|
#define emit_setvmstate(as, i) \
|
262
272
|
(emit_i32(as, i), emit_opgl(as, XO_MOVmi, 0, vmstate))
|
@@ -279,9 +289,21 @@ static void emit_loadi(ASMState *as, Reg r, int32_t i)
|
|
279
289
|
}
|
280
290
|
}
|
281
291
|
|
292
|
+
#if LJ_GC64
|
293
|
+
#define dispofs(as, k) \
|
294
|
+
((intptr_t)((uintptr_t)(k) - (uintptr_t)J2GG(as->J)->dispatch))
|
295
|
+
#define mcpofs(as, k) \
|
296
|
+
((intptr_t)((uintptr_t)(k) - (uintptr_t)as->mcp))
|
297
|
+
#define mctopofs(as, k) \
|
298
|
+
((intptr_t)((uintptr_t)(k) - (uintptr_t)as->mctop))
|
299
|
+
/* mov r, addr */
|
300
|
+
#define emit_loada(as, r, addr) \
|
301
|
+
emit_loadu64(as, (r), (uintptr_t)(addr))
|
302
|
+
#else
|
282
303
|
/* mov r, addr */
|
283
304
|
#define emit_loada(as, r, addr) \
|
284
305
|
emit_loadi(as, (r), ptr2addr((addr)))
|
306
|
+
#endif
|
285
307
|
|
286
308
|
#if LJ_64
|
287
309
|
/* mov r, imm64 or shorter 32 bit extended load. */
|
@@ -293,6 +315,15 @@ static void emit_loadu64(ASMState *as, Reg r, uint64_t u64)
|
|
293
315
|
MCode *p = as->mcp;
|
294
316
|
*(int32_t *)(p-4) = (int32_t)u64;
|
295
317
|
as->mcp = emit_opm(XO_MOVmi, XM_REG, REX_64, r, p, -4);
|
318
|
+
#if LJ_GC64
|
319
|
+
} else if (checki32(dispofs(as, u64))) {
|
320
|
+
emit_rmro(as, XO_LEA, r|REX_64, RID_DISPATCH, (int32_t)dispofs(as, u64));
|
321
|
+
} else if (checki32(mcpofs(as, u64)) && checki32(mctopofs(as, u64))) {
|
322
|
+
/* Since as->realign assumes the code size doesn't change, check
|
323
|
+
** RIP-relative addressing reachability for both as->mcp and as->mctop.
|
324
|
+
*/
|
325
|
+
emit_rmro(as, XO_LEA, r|REX_64, RID_RIP, (int32_t)mcpofs(as, u64));
|
326
|
+
#endif
|
296
327
|
} else { /* Full-size 64 bit load. */
|
297
328
|
MCode *p = as->mcp;
|
298
329
|
*(uint64_t *)(p-8) = u64;
|
@@ -304,13 +335,71 @@ static void emit_loadu64(ASMState *as, Reg r, uint64_t u64)
|
|
304
335
|
}
|
305
336
|
#endif
|
306
337
|
|
307
|
-
/*
|
308
|
-
static void
|
338
|
+
/* op r, [addr] */
|
339
|
+
static void emit_rma(ASMState *as, x86Op xo, Reg rr, const void *addr)
|
309
340
|
{
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
341
|
+
#if LJ_GC64
|
342
|
+
if (checki32(dispofs(as, addr))) {
|
343
|
+
emit_rmro(as, xo, rr, RID_DISPATCH, (int32_t)dispofs(as, addr));
|
344
|
+
} else if (checki32(mcpofs(as, addr)) && checki32(mctopofs(as, addr))) {
|
345
|
+
emit_rmro(as, xo, rr, RID_RIP, (int32_t)mcpofs(as, addr));
|
346
|
+
} else if (!checki32((intptr_t)addr) && (xo == XO_MOV || xo == XO_MOVSD)) {
|
347
|
+
emit_rmro(as, xo, rr, rr, 0);
|
348
|
+
emit_loadu64(as, rr, (uintptr_t)addr);
|
349
|
+
} else
|
350
|
+
#endif
|
351
|
+
{
|
352
|
+
MCode *p = as->mcp;
|
353
|
+
*(int32_t *)(p-4) = ptr2addr(addr);
|
354
|
+
#if LJ_64
|
355
|
+
p[-5] = MODRM(XM_SCALE1, RID_ESP, RID_EBP);
|
356
|
+
as->mcp = emit_opm(xo, XM_OFS0, rr, RID_ESP, p, -5);
|
357
|
+
#else
|
358
|
+
as->mcp = emit_opm(xo, XM_OFS0, rr, RID_EBP, p, -4);
|
359
|
+
#endif
|
360
|
+
}
|
361
|
+
}
|
362
|
+
|
363
|
+
/* Load 64 bit IR constant into register. */
|
364
|
+
static void emit_loadk64(ASMState *as, Reg r, IRIns *ir)
|
365
|
+
{
|
366
|
+
Reg r64;
|
367
|
+
x86Op xo;
|
368
|
+
const uint64_t *k = &ir_k64(ir)->u64;
|
369
|
+
if (rset_test(RSET_FPR, r)) {
|
370
|
+
r64 = r;
|
371
|
+
xo = XO_MOVSD;
|
372
|
+
} else {
|
373
|
+
r64 = r | REX_64;
|
374
|
+
xo = XO_MOV;
|
375
|
+
}
|
376
|
+
if (*k == 0) {
|
377
|
+
emit_rr(as, rset_test(RSET_FPR, r) ? XO_XORPS : XO_ARITH(XOg_XOR), r, r);
|
378
|
+
#if LJ_GC64
|
379
|
+
} else if (checki32((intptr_t)k) || checki32(dispofs(as, k)) ||
|
380
|
+
(checki32(mcpofs(as, k)) && checki32(mctopofs(as, k)))) {
|
381
|
+
emit_rma(as, xo, r64, k);
|
382
|
+
} else {
|
383
|
+
if (ir->i) {
|
384
|
+
lua_assert(*k == *(uint64_t*)(as->mctop - ir->i));
|
385
|
+
} else if (as->curins <= as->stopins && rset_test(RSET_GPR, r)) {
|
386
|
+
emit_loadu64(as, r, *k);
|
387
|
+
return;
|
388
|
+
} else {
|
389
|
+
/* If all else fails, add the FP constant at the MCode area bottom. */
|
390
|
+
while ((uintptr_t)as->mcbot & 7) *as->mcbot++ = XI_INT3;
|
391
|
+
*(uint64_t *)as->mcbot = *k;
|
392
|
+
ir->i = (int32_t)(as->mctop - as->mcbot);
|
393
|
+
as->mcbot += 8;
|
394
|
+
as->mclim = as->mcbot + MCLIM_REDZONE;
|
395
|
+
lj_mcode_commitbot(as->J, as->mcbot);
|
396
|
+
}
|
397
|
+
emit_rmro(as, xo, r64, RID_RIP, (int32_t)mcpofs(as, as->mctop - ir->i));
|
398
|
+
#else
|
399
|
+
} else {
|
400
|
+
emit_rma(as, xo, r64, k);
|
401
|
+
#endif
|
402
|
+
}
|
314
403
|
}
|
315
404
|
|
316
405
|
/* -- Emit control-flow instructions -------------------------------------- */
|
@@ -412,8 +501,10 @@ static void emit_call_(ASMState *as, MCode *target)
|
|
412
501
|
/* Use 64 bit operations to handle 64 bit IR types. */
|
413
502
|
#if LJ_64
|
414
503
|
#define REX_64IR(ir, r) ((r) + (irt_is64((ir)->t) ? REX_64 : 0))
|
504
|
+
#define VEX_64IR(ir, r) ((r) + (irt_is64((ir)->t) ? VEX_64 : 0))
|
415
505
|
#else
|
416
506
|
#define REX_64IR(ir, r) (r)
|
507
|
+
#define VEX_64IR(ir, r) (r)
|
417
508
|
#endif
|
418
509
|
|
419
510
|
/* Generic move between two regs. */
|
@@ -449,9 +540,9 @@ static void emit_addptr(ASMState *as, Reg r, int32_t ofs)
|
|
449
540
|
{
|
450
541
|
if (ofs) {
|
451
542
|
if ((as->flags & JIT_F_LEA_AGU))
|
452
|
-
emit_rmro(as, XO_LEA, r, r, ofs);
|
543
|
+
emit_rmro(as, XO_LEA, r|REX_GC64, r, ofs);
|
453
544
|
else
|
454
|
-
emit_gri(as, XG_ARITHi(XOg_ADD), r, ofs);
|
545
|
+
emit_gri(as, XG_ARITHi(XOg_ADD), r|REX_GC64, ofs);
|
455
546
|
}
|
456
547
|
}
|
457
548
|
|