immunio 0.15.4 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +0 -27
- data/ext/immunio/Rakefile +9 -0
- data/lib/immunio/plugins/active_record.rb +1 -1
- data/lib/immunio/plugins/active_record_relation.rb +1 -1
- data/lib/immunio/plugins/environment_reporter.rb +20 -0
- data/lib/immunio/rufus_lua_ext/ref.rb +1 -3
- data/lib/immunio/version.rb +1 -1
- data/lib/immunio/vm.rb +1 -2
- data/lua-hooks/Makefile +97 -0
- data/lua-hooks/ext/all.c +41 -52
- data/lua-hooks/ext/all.o +0 -0
- data/lua-hooks/ext/libinjection/libinjection_html5.o +0 -0
- data/lua-hooks/ext/libinjection/libinjection_sqli.o +0 -0
- data/lua-hooks/ext/libinjection/libinjection_xss.o +0 -0
- data/lua-hooks/ext/libinjection/lualib.c +2 -2
- data/lua-hooks/ext/lpeg/lpcap.c +2 -2
- data/lua-hooks/ext/lpeg/lpcap.o +0 -0
- data/lua-hooks/ext/lpeg/lpcode.c +2 -2
- data/lua-hooks/ext/lpeg/lpcode.h +1 -1
- data/lua-hooks/ext/lpeg/lpcode.o +0 -0
- data/lua-hooks/ext/lpeg/lpprint.o +0 -0
- data/lua-hooks/ext/lpeg/lptree.c +2 -2
- data/lua-hooks/ext/lpeg/lptypes.h +1 -1
- data/lua-hooks/ext/lpeg/lpvm.c +2 -2
- data/lua-hooks/ext/lpeg/lpvm.o +0 -0
- data/lua-hooks/ext/lua-cmsgpack/lua_cmsgpack.c +16 -3
- data/lua-hooks/ext/lua-snapshot/snapshot.c +14 -7
- data/lua-hooks/ext/luajit/COPYRIGHT +56 -0
- data/lua-hooks/ext/luajit/Makefile +159 -0
- data/lua-hooks/ext/luajit/README +16 -0
- data/lua-hooks/ext/luajit/doc/bluequad-print.css +166 -0
- data/lua-hooks/ext/luajit/doc/bluequad.css +325 -0
- data/lua-hooks/ext/luajit/doc/changes.html +804 -0
- data/lua-hooks/ext/luajit/doc/contact.html +104 -0
- data/lua-hooks/ext/luajit/doc/ext_c_api.html +189 -0
- data/lua-hooks/ext/luajit/doc/ext_ffi.html +332 -0
- data/lua-hooks/ext/luajit/doc/ext_ffi_api.html +570 -0
- data/lua-hooks/ext/luajit/doc/ext_ffi_semantics.html +1261 -0
- data/lua-hooks/ext/luajit/doc/ext_ffi_tutorial.html +603 -0
- data/lua-hooks/ext/luajit/doc/ext_jit.html +201 -0
- data/lua-hooks/ext/luajit/doc/ext_profiler.html +365 -0
- data/lua-hooks/ext/luajit/doc/extensions.html +448 -0
- data/lua-hooks/ext/luajit/doc/faq.html +186 -0
- data/lua-hooks/ext/luajit/doc/img/contact.png +0 -0
- data/lua-hooks/ext/luajit/doc/install.html +659 -0
- data/lua-hooks/ext/luajit/doc/luajit.html +236 -0
- data/lua-hooks/ext/luajit/doc/running.html +309 -0
- data/lua-hooks/ext/luajit/doc/status.html +118 -0
- data/lua-hooks/ext/luajit/dynasm/dasm_arm.h +456 -0
- data/lua-hooks/ext/luajit/dynasm/dasm_arm.lua +1125 -0
- data/lua-hooks/ext/luajit/dynasm/dasm_arm64.h +518 -0
- data/lua-hooks/ext/luajit/dynasm/dasm_arm64.lua +1166 -0
- data/lua-hooks/ext/luajit/dynasm/dasm_mips.h +416 -0
- data/lua-hooks/ext/luajit/dynasm/dasm_mips.lua +953 -0
- data/lua-hooks/ext/luajit/dynasm/dasm_ppc.h +419 -0
- data/lua-hooks/ext/luajit/dynasm/dasm_ppc.lua +1919 -0
- data/lua-hooks/ext/luajit/dynasm/dasm_proto.h +83 -0
- data/lua-hooks/ext/luajit/dynasm/dasm_x64.lua +12 -0
- data/lua-hooks/ext/luajit/dynasm/dasm_x86.h +471 -0
- data/lua-hooks/ext/luajit/dynasm/dasm_x86.lua +1945 -0
- data/lua-hooks/ext/luajit/dynasm/dynasm.lua +1094 -0
- data/lua-hooks/ext/luajit/etc/luajit.1 +88 -0
- data/lua-hooks/ext/luajit/etc/luajit.pc +25 -0
- data/lua-hooks/ext/luajit/src/Makefile +697 -0
- data/lua-hooks/ext/luajit/src/Makefile.dep +244 -0
- data/lua-hooks/ext/luajit/src/host/README +4 -0
- data/lua-hooks/ext/luajit/src/host/buildvm +0 -0
- data/lua-hooks/ext/luajit/src/host/buildvm.c +518 -0
- data/lua-hooks/ext/luajit/src/host/buildvm.h +105 -0
- data/lua-hooks/ext/luajit/src/host/buildvm.o +0 -0
- data/lua-hooks/ext/luajit/src/host/buildvm_arch.h +7449 -0
- data/lua-hooks/ext/luajit/src/host/buildvm_asm.c +345 -0
- data/lua-hooks/ext/luajit/src/host/buildvm_asm.o +0 -0
- data/lua-hooks/ext/luajit/src/host/buildvm_fold.c +229 -0
- data/lua-hooks/ext/luajit/src/host/buildvm_fold.o +0 -0
- data/lua-hooks/ext/luajit/src/host/buildvm_lib.c +457 -0
- data/lua-hooks/ext/luajit/src/host/buildvm_lib.o +0 -0
- data/lua-hooks/ext/luajit/src/host/buildvm_libbc.h +45 -0
- data/lua-hooks/ext/luajit/src/host/buildvm_peobj.c +368 -0
- data/lua-hooks/ext/luajit/src/host/buildvm_peobj.o +0 -0
- data/lua-hooks/ext/luajit/src/host/genlibbc.lua +197 -0
- data/lua-hooks/ext/luajit/src/host/genminilua.lua +428 -0
- data/lua-hooks/ext/luajit/src/host/minilua +0 -0
- data/lua-hooks/ext/luajit/src/host/minilua.c +7770 -0
- data/lua-hooks/ext/luajit/src/host/minilua.o +0 -0
- data/lua-hooks/ext/luajit/src/jit/bc.lua +190 -0
- data/lua-hooks/ext/luajit/src/jit/bcsave.lua +661 -0
- data/lua-hooks/ext/luajit/src/jit/dis_arm.lua +689 -0
- data/lua-hooks/ext/luajit/src/jit/dis_mips.lua +428 -0
- data/lua-hooks/ext/luajit/src/jit/dis_mipsel.lua +17 -0
- data/lua-hooks/ext/luajit/src/jit/dis_ppc.lua +591 -0
- data/lua-hooks/ext/luajit/src/jit/dis_x64.lua +17 -0
- data/lua-hooks/ext/luajit/src/jit/dis_x86.lua +838 -0
- data/lua-hooks/ext/luajit/src/jit/dump.lua +706 -0
- data/lua-hooks/ext/luajit/src/jit/p.lua +310 -0
- data/lua-hooks/ext/luajit/src/jit/v.lua +170 -0
- data/lua-hooks/ext/luajit/src/jit/vmdef.lua +362 -0
- data/lua-hooks/ext/luajit/src/jit/zone.lua +45 -0
- data/lua-hooks/ext/{lua → luajit/src}/lauxlib.h +10 -17
- data/lua-hooks/ext/luajit/src/lib_aux.c +356 -0
- data/lua-hooks/ext/luajit/src/lib_aux.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_aux_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_base.c +664 -0
- data/lua-hooks/ext/luajit/src/lib_base.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_base_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_bit.c +180 -0
- data/lua-hooks/ext/luajit/src/lib_bit.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_bit_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_debug.c +405 -0
- data/lua-hooks/ext/luajit/src/lib_debug.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_debug_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_ffi.c +872 -0
- data/lua-hooks/ext/luajit/src/lib_ffi.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_ffi_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_init.c +55 -0
- data/lua-hooks/ext/luajit/src/lib_init.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_init_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_io.c +541 -0
- data/lua-hooks/ext/luajit/src/lib_io.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_io_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_jit.c +767 -0
- data/lua-hooks/ext/luajit/src/lib_jit.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_jit_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_math.c +230 -0
- data/lua-hooks/ext/luajit/src/lib_math.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_math_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_os.c +292 -0
- data/lua-hooks/ext/luajit/src/lib_os.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_os_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_package.c +610 -0
- data/lua-hooks/ext/luajit/src/lib_package.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_package_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_string.c +752 -0
- data/lua-hooks/ext/luajit/src/lib_string.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_string_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_table.c +307 -0
- data/lua-hooks/ext/luajit/src/lib_table.o +0 -0
- data/lua-hooks/ext/luajit/src/lib_table_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/libluajit.a +0 -0
- data/lua-hooks/ext/luajit/src/libluajit.so +0 -0
- data/lua-hooks/ext/luajit/src/lj.supp +26 -0
- data/lua-hooks/ext/luajit/src/lj_alloc.c +1398 -0
- data/lua-hooks/ext/luajit/src/lj_alloc.h +17 -0
- data/lua-hooks/ext/luajit/src/lj_alloc.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_alloc_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_api.c +1210 -0
- data/lua-hooks/ext/luajit/src/lj_api.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_api_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_arch.h +509 -0
- data/lua-hooks/ext/luajit/src/lj_asm.c +2278 -0
- data/lua-hooks/ext/luajit/src/lj_asm.h +17 -0
- data/lua-hooks/ext/luajit/src/lj_asm.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_asm_arm.h +2217 -0
- data/lua-hooks/ext/luajit/src/lj_asm_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_asm_mips.h +1833 -0
- data/lua-hooks/ext/luajit/src/lj_asm_ppc.h +2015 -0
- data/lua-hooks/ext/luajit/src/lj_asm_x86.h +2634 -0
- data/lua-hooks/ext/luajit/src/lj_bc.c +14 -0
- data/lua-hooks/ext/luajit/src/lj_bc.h +265 -0
- data/lua-hooks/ext/luajit/src/lj_bc.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_bc_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_bcdef.h +220 -0
- data/lua-hooks/ext/luajit/src/lj_bcdump.h +68 -0
- data/lua-hooks/ext/luajit/src/lj_bcread.c +457 -0
- data/lua-hooks/ext/luajit/src/lj_bcread.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_bcread_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_bcwrite.c +361 -0
- data/lua-hooks/ext/luajit/src/lj_bcwrite.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_bcwrite_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_buf.c +234 -0
- data/lua-hooks/ext/luajit/src/lj_buf.h +105 -0
- data/lua-hooks/ext/luajit/src/lj_buf.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_buf_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_carith.c +429 -0
- data/lua-hooks/ext/luajit/src/lj_carith.h +37 -0
- data/lua-hooks/ext/luajit/src/lj_carith.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_carith_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_ccall.c +984 -0
- data/lua-hooks/ext/luajit/src/lj_ccall.h +178 -0
- data/lua-hooks/ext/luajit/src/lj_ccall.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_ccall_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_ccallback.c +712 -0
- data/lua-hooks/ext/luajit/src/lj_ccallback.h +25 -0
- data/lua-hooks/ext/luajit/src/lj_ccallback.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_ccallback_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_cconv.c +752 -0
- data/lua-hooks/ext/luajit/src/lj_cconv.h +70 -0
- data/lua-hooks/ext/luajit/src/lj_cconv.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_cconv_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_cdata.c +288 -0
- data/lua-hooks/ext/luajit/src/lj_cdata.h +76 -0
- data/lua-hooks/ext/luajit/src/lj_cdata.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_cdata_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_char.c +43 -0
- data/lua-hooks/ext/luajit/src/lj_char.h +42 -0
- data/lua-hooks/ext/luajit/src/lj_char.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_char_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_clib.c +418 -0
- data/lua-hooks/ext/luajit/src/lj_clib.h +29 -0
- data/lua-hooks/ext/luajit/src/lj_clib.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_clib_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_cparse.c +1862 -0
- data/lua-hooks/ext/luajit/src/lj_cparse.h +65 -0
- data/lua-hooks/ext/luajit/src/lj_cparse.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_cparse_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_crecord.c +1834 -0
- data/lua-hooks/ext/luajit/src/lj_crecord.h +38 -0
- data/lua-hooks/ext/luajit/src/lj_crecord.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_crecord_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_ctype.c +635 -0
- data/lua-hooks/ext/luajit/src/lj_ctype.h +461 -0
- data/lua-hooks/ext/luajit/src/lj_ctype.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_ctype_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_debug.c +699 -0
- data/lua-hooks/ext/luajit/src/lj_debug.h +65 -0
- data/lua-hooks/ext/luajit/src/lj_debug.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_debug_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_def.h +365 -0
- data/lua-hooks/ext/luajit/src/lj_dispatch.c +557 -0
- data/lua-hooks/ext/luajit/src/lj_dispatch.h +138 -0
- data/lua-hooks/ext/luajit/src/lj_dispatch.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_dispatch_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_emit_arm.h +356 -0
- data/lua-hooks/ext/luajit/src/lj_emit_mips.h +211 -0
- data/lua-hooks/ext/luajit/src/lj_emit_ppc.h +238 -0
- data/lua-hooks/ext/luajit/src/lj_emit_x86.h +462 -0
- data/lua-hooks/ext/luajit/src/lj_err.c +794 -0
- data/lua-hooks/ext/luajit/src/lj_err.h +41 -0
- data/lua-hooks/ext/luajit/src/lj_err.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_err_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_errmsg.h +190 -0
- data/lua-hooks/ext/luajit/src/lj_ff.h +18 -0
- data/lua-hooks/ext/luajit/src/lj_ffdef.h +209 -0
- data/lua-hooks/ext/luajit/src/lj_ffrecord.c +1247 -0
- data/lua-hooks/ext/luajit/src/lj_ffrecord.h +24 -0
- data/lua-hooks/ext/luajit/src/lj_ffrecord.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_ffrecord_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_folddef.h +1138 -0
- data/lua-hooks/ext/luajit/src/lj_frame.h +259 -0
- data/lua-hooks/ext/luajit/src/lj_func.c +185 -0
- data/lua-hooks/ext/luajit/src/lj_func.h +24 -0
- data/lua-hooks/ext/luajit/src/lj_func.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_func_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_gc.c +845 -0
- data/lua-hooks/ext/luajit/src/lj_gc.h +134 -0
- data/lua-hooks/ext/luajit/src/lj_gc.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_gc_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_gdbjit.c +787 -0
- data/lua-hooks/ext/luajit/src/lj_gdbjit.h +22 -0
- data/lua-hooks/ext/luajit/src/lj_gdbjit.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_gdbjit_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_ir.c +505 -0
- data/lua-hooks/ext/luajit/src/lj_ir.h +577 -0
- data/lua-hooks/ext/luajit/src/lj_ir.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_ir_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_ircall.h +321 -0
- data/lua-hooks/ext/luajit/src/lj_iropt.h +161 -0
- data/lua-hooks/ext/luajit/src/lj_jit.h +440 -0
- data/lua-hooks/ext/luajit/src/lj_lex.c +482 -0
- data/lua-hooks/ext/luajit/src/lj_lex.h +86 -0
- data/lua-hooks/ext/luajit/src/lj_lex.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_lex_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_lib.c +303 -0
- data/lua-hooks/ext/luajit/src/lj_lib.h +115 -0
- data/lua-hooks/ext/luajit/src/lj_lib.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_lib_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_libdef.h +414 -0
- data/lua-hooks/ext/luajit/src/lj_load.c +168 -0
- data/lua-hooks/ext/luajit/src/lj_load.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_load_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_mcode.c +386 -0
- data/lua-hooks/ext/luajit/src/lj_mcode.h +30 -0
- data/lua-hooks/ext/luajit/src/lj_mcode.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_mcode_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_meta.c +477 -0
- data/lua-hooks/ext/luajit/src/lj_meta.h +38 -0
- data/lua-hooks/ext/luajit/src/lj_meta.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_meta_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_obj.c +50 -0
- data/lua-hooks/ext/luajit/src/lj_obj.h +976 -0
- data/lua-hooks/ext/luajit/src/lj_obj.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_obj_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_opt_dce.c +78 -0
- data/lua-hooks/ext/luajit/src/lj_opt_dce.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_opt_dce_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_opt_fold.c +2488 -0
- data/lua-hooks/ext/luajit/src/lj_opt_fold.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_opt_fold_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_opt_loop.c +449 -0
- data/lua-hooks/ext/luajit/src/lj_opt_loop.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_opt_loop_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_opt_mem.c +935 -0
- data/lua-hooks/ext/luajit/src/lj_opt_mem.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_opt_mem_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_opt_narrow.c +652 -0
- data/lua-hooks/ext/luajit/src/lj_opt_narrow.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_opt_narrow_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_opt_sink.c +245 -0
- data/lua-hooks/ext/luajit/src/lj_opt_sink.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_opt_sink_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_opt_split.c +856 -0
- data/lua-hooks/ext/luajit/src/lj_opt_split.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_opt_split_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_parse.c +2725 -0
- data/lua-hooks/ext/luajit/src/lj_parse.h +18 -0
- data/lua-hooks/ext/luajit/src/lj_parse.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_parse_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_profile.c +368 -0
- data/lua-hooks/ext/luajit/src/lj_profile.h +21 -0
- data/lua-hooks/ext/luajit/src/lj_profile.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_profile_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_recdef.h +270 -0
- data/lua-hooks/ext/luajit/src/lj_record.c +2554 -0
- data/lua-hooks/ext/luajit/src/lj_record.h +45 -0
- data/lua-hooks/ext/luajit/src/lj_record.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_record_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_snap.c +870 -0
- data/lua-hooks/ext/luajit/src/lj_snap.h +34 -0
- data/lua-hooks/ext/luajit/src/lj_snap.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_snap_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_state.c +300 -0
- data/lua-hooks/ext/luajit/src/lj_state.h +35 -0
- data/lua-hooks/ext/luajit/src/lj_state.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_state_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_str.c +197 -0
- data/lua-hooks/ext/luajit/src/lj_str.h +27 -0
- data/lua-hooks/ext/luajit/src/lj_str.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_str_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_strfmt.c +554 -0
- data/lua-hooks/ext/luajit/src/lj_strfmt.h +125 -0
- data/lua-hooks/ext/luajit/src/lj_strfmt.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_strfmt_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_strscan.c +547 -0
- data/lua-hooks/ext/luajit/src/lj_strscan.h +39 -0
- data/lua-hooks/ext/luajit/src/lj_strscan.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_strscan_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_tab.c +666 -0
- data/lua-hooks/ext/luajit/src/lj_tab.h +73 -0
- data/lua-hooks/ext/luajit/src/lj_tab.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_tab_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_target.h +164 -0
- data/lua-hooks/ext/luajit/src/lj_target_arm.h +270 -0
- data/lua-hooks/ext/luajit/src/lj_target_arm64.h +97 -0
- data/lua-hooks/ext/luajit/src/lj_target_mips.h +260 -0
- data/lua-hooks/ext/luajit/src/lj_target_ppc.h +280 -0
- data/lua-hooks/ext/luajit/src/lj_target_x86.h +345 -0
- data/lua-hooks/ext/luajit/src/lj_trace.c +859 -0
- data/lua-hooks/ext/luajit/src/lj_trace.h +54 -0
- data/lua-hooks/ext/luajit/src/lj_trace.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_trace_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_traceerr.h +63 -0
- data/lua-hooks/ext/luajit/src/lj_udata.c +34 -0
- data/lua-hooks/ext/luajit/src/lj_udata.h +14 -0
- data/lua-hooks/ext/luajit/src/lj_udata.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_udata_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_vm.S +2730 -0
- data/lua-hooks/ext/luajit/src/lj_vm.h +114 -0
- data/lua-hooks/ext/luajit/src/lj_vm.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_vm_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_vmevent.c +58 -0
- data/lua-hooks/ext/luajit/src/lj_vmevent.h +59 -0
- data/lua-hooks/ext/luajit/src/lj_vmevent.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_vmevent_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_vmmath.c +152 -0
- data/lua-hooks/ext/luajit/src/lj_vmmath.o +0 -0
- data/lua-hooks/ext/luajit/src/lj_vmmath_dyn.o +0 -0
- data/lua-hooks/ext/luajit/src/ljamalg.c +96 -0
- data/lua-hooks/ext/{lua → luajit/src}/lua.h +12 -7
- data/lua-hooks/ext/luajit/src/lua.hpp +9 -0
- data/lua-hooks/ext/luajit/src/luaconf.h +156 -0
- data/lua-hooks/ext/luajit/src/luajit +0 -0
- data/lua-hooks/ext/luajit/src/luajit.c +570 -0
- data/lua-hooks/ext/luajit/src/luajit.h +79 -0
- data/lua-hooks/ext/luajit/src/luajit.o +0 -0
- data/lua-hooks/ext/luajit/src/lualib.h +43 -0
- data/lua-hooks/ext/luajit/src/msvcbuild.bat +114 -0
- data/lua-hooks/ext/luajit/src/ps4build.bat +103 -0
- data/lua-hooks/ext/luajit/src/psvitabuild.bat +93 -0
- data/lua-hooks/ext/luajit/src/vm_arm.dasc +4585 -0
- data/lua-hooks/ext/luajit/src/vm_arm64.dasc +3764 -0
- data/lua-hooks/ext/luajit/src/vm_mips.dasc +4355 -0
- data/lua-hooks/ext/luajit/src/vm_ppc.dasc +5252 -0
- data/lua-hooks/ext/luajit/src/vm_x64.dasc +4902 -0
- data/lua-hooks/ext/luajit/src/vm_x86.dasc +5710 -0
- data/lua-hooks/ext/luajit/src/xb1build.bat +101 -0
- data/lua-hooks/ext/luajit/src/xedkbuild.bat +92 -0
- data/lua-hooks/ext/luautf8/lutf8lib.c +3 -3
- data/lua-hooks/lib/boot.lua +37 -2
- metadata +372 -69
- data/lua-hooks/ext/bitop/README +0 -22
- data/lua-hooks/ext/bitop/bit.c +0 -189
- data/lua-hooks/ext/extconf.rb +0 -38
- data/lua-hooks/ext/lua/COPYRIGHT +0 -34
- data/lua-hooks/ext/lua/lapi.c +0 -1087
- data/lua-hooks/ext/lua/lapi.h +0 -16
- data/lua-hooks/ext/lua/lauxlib.c +0 -652
- data/lua-hooks/ext/lua/lbaselib.c +0 -659
- data/lua-hooks/ext/lua/lcode.c +0 -831
- data/lua-hooks/ext/lua/lcode.h +0 -76
- data/lua-hooks/ext/lua/ldblib.c +0 -398
- data/lua-hooks/ext/lua/ldebug.c +0 -638
- data/lua-hooks/ext/lua/ldebug.h +0 -33
- data/lua-hooks/ext/lua/ldo.c +0 -519
- data/lua-hooks/ext/lua/ldo.h +0 -57
- data/lua-hooks/ext/lua/ldump.c +0 -164
- data/lua-hooks/ext/lua/lfunc.c +0 -174
- data/lua-hooks/ext/lua/lfunc.h +0 -34
- data/lua-hooks/ext/lua/lgc.c +0 -710
- data/lua-hooks/ext/lua/lgc.h +0 -110
- data/lua-hooks/ext/lua/linit.c +0 -38
- data/lua-hooks/ext/lua/liolib.c +0 -556
- data/lua-hooks/ext/lua/llex.c +0 -463
- data/lua-hooks/ext/lua/llex.h +0 -81
- data/lua-hooks/ext/lua/llimits.h +0 -128
- data/lua-hooks/ext/lua/lmathlib.c +0 -263
- data/lua-hooks/ext/lua/lmem.c +0 -86
- data/lua-hooks/ext/lua/lmem.h +0 -49
- data/lua-hooks/ext/lua/loadlib.c +0 -705
- data/lua-hooks/ext/lua/loadlib_rel.c +0 -760
- data/lua-hooks/ext/lua/lobject.c +0 -214
- data/lua-hooks/ext/lua/lobject.h +0 -381
- data/lua-hooks/ext/lua/lopcodes.c +0 -102
- data/lua-hooks/ext/lua/lopcodes.h +0 -268
- data/lua-hooks/ext/lua/loslib.c +0 -243
- data/lua-hooks/ext/lua/lparser.c +0 -1339
- data/lua-hooks/ext/lua/lparser.h +0 -82
- data/lua-hooks/ext/lua/lstate.c +0 -214
- data/lua-hooks/ext/lua/lstate.h +0 -169
- data/lua-hooks/ext/lua/lstring.c +0 -111
- data/lua-hooks/ext/lua/lstring.h +0 -31
- data/lua-hooks/ext/lua/lstrlib.c +0 -871
- data/lua-hooks/ext/lua/ltable.c +0 -588
- data/lua-hooks/ext/lua/ltable.h +0 -40
- data/lua-hooks/ext/lua/ltablib.c +0 -287
- data/lua-hooks/ext/lua/ltm.c +0 -75
- data/lua-hooks/ext/lua/ltm.h +0 -54
- data/lua-hooks/ext/lua/lua.c +0 -392
- data/lua-hooks/ext/lua/lua.def +0 -131
- data/lua-hooks/ext/lua/lua.rc +0 -28
- data/lua-hooks/ext/lua/lua_dll.rc +0 -26
- data/lua-hooks/ext/lua/luac.c +0 -200
- data/lua-hooks/ext/lua/luac.rc +0 -1
- data/lua-hooks/ext/lua/luaconf.h +0 -763
- data/lua-hooks/ext/lua/luaconf.h.in +0 -724
- data/lua-hooks/ext/lua/luaconf.h.orig +0 -763
- data/lua-hooks/ext/lua/lualib.h +0 -53
- data/lua-hooks/ext/lua/lundump.c +0 -227
- data/lua-hooks/ext/lua/lundump.h +0 -36
- data/lua-hooks/ext/lua/lvm.c +0 -767
- data/lua-hooks/ext/lua/lvm.h +0 -36
- data/lua-hooks/ext/lua/lzio.c +0 -82
- data/lua-hooks/ext/lua/lzio.h +0 -67
- data/lua-hooks/ext/lua/print.c +0 -227
@@ -0,0 +1,706 @@
|
|
1
|
+
----------------------------------------------------------------------------
|
2
|
+
-- LuaJIT compiler dump module.
|
3
|
+
--
|
4
|
+
-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
|
5
|
+
-- Released under the MIT license. See Copyright Notice in luajit.h
|
6
|
+
----------------------------------------------------------------------------
|
7
|
+
--
|
8
|
+
-- This module can be used to debug the JIT compiler itself. It dumps the
|
9
|
+
-- code representations and structures used in various compiler stages.
|
10
|
+
--
|
11
|
+
-- Example usage:
|
12
|
+
--
|
13
|
+
-- luajit -jdump -e "local x=0; for i=1,1e6 do x=x+i end; print(x)"
|
14
|
+
-- luajit -jdump=im -e "for i=1,1000 do for j=1,1000 do end end" | less -R
|
15
|
+
-- luajit -jdump=is myapp.lua | less -R
|
16
|
+
-- luajit -jdump=-b myapp.lua
|
17
|
+
-- luajit -jdump=+aH,myapp.html myapp.lua
|
18
|
+
-- luajit -jdump=ixT,myapp.dump myapp.lua
|
19
|
+
--
|
20
|
+
-- The first argument specifies the dump mode. The second argument gives
|
21
|
+
-- the output file name. Default output is to stdout, unless the environment
|
22
|
+
-- variable LUAJIT_DUMPFILE is set. The file is overwritten every time the
|
23
|
+
-- module is started.
|
24
|
+
--
|
25
|
+
-- Different features can be turned on or off with the dump mode. If the
|
26
|
+
-- mode starts with a '+', the following features are added to the default
|
27
|
+
-- set of features; a '-' removes them. Otherwise the features are replaced.
|
28
|
+
--
|
29
|
+
-- The following dump features are available (* marks the default):
|
30
|
+
--
|
31
|
+
-- * t Print a line for each started, ended or aborted trace (see also -jv).
|
32
|
+
-- * b Dump the traced bytecode.
|
33
|
+
-- * i Dump the IR (intermediate representation).
|
34
|
+
-- r Augment the IR with register/stack slots.
|
35
|
+
-- s Dump the snapshot map.
|
36
|
+
-- * m Dump the generated machine code.
|
37
|
+
-- x Print each taken trace exit.
|
38
|
+
-- X Print each taken trace exit and the contents of all registers.
|
39
|
+
-- a Print the IR of aborted traces, too.
|
40
|
+
--
|
41
|
+
-- The output format can be set with the following characters:
|
42
|
+
--
|
43
|
+
-- T Plain text output.
|
44
|
+
-- A ANSI-colored text output
|
45
|
+
-- H Colorized HTML + CSS output.
|
46
|
+
--
|
47
|
+
-- The default output format is plain text. It's set to ANSI-colored text
|
48
|
+
-- if the COLORTERM variable is set. Note: this is independent of any output
|
49
|
+
-- redirection, which is actually considered a feature.
|
50
|
+
--
|
51
|
+
-- You probably want to use less -R to enjoy viewing ANSI-colored text from
|
52
|
+
-- a pipe or a file. Add this to your ~/.bashrc: export LESS="-R"
|
53
|
+
--
|
54
|
+
------------------------------------------------------------------------------
|
55
|
+
|
56
|
+
-- Cache some library functions and objects.
|
57
|
+
local jit = require("jit")
|
58
|
+
assert(jit.version_num == 20100, "LuaJIT core/library version mismatch")
|
59
|
+
local jutil = require("jit.util")
|
60
|
+
local vmdef = require("jit.vmdef")
|
61
|
+
local funcinfo, funcbc = jutil.funcinfo, jutil.funcbc
|
62
|
+
local traceinfo, traceir, tracek = jutil.traceinfo, jutil.traceir, jutil.tracek
|
63
|
+
local tracemc, tracesnap = jutil.tracemc, jutil.tracesnap
|
64
|
+
local traceexitstub, ircalladdr = jutil.traceexitstub, jutil.ircalladdr
|
65
|
+
local bit = require("bit")
|
66
|
+
local band, shl, shr, tohex = bit.band, bit.lshift, bit.rshift, bit.tohex
|
67
|
+
local sub, gsub, format = string.sub, string.gsub, string.format
|
68
|
+
local byte, char, rep = string.byte, string.char, string.rep
|
69
|
+
local type, tostring = type, tostring
|
70
|
+
local stdout, stderr = io.stdout, io.stderr
|
71
|
+
|
72
|
+
-- Load other modules on-demand.
|
73
|
+
local bcline, disass
|
74
|
+
|
75
|
+
-- Active flag, output file handle and dump mode.
|
76
|
+
local active, out, dumpmode
|
77
|
+
|
78
|
+
------------------------------------------------------------------------------
|
79
|
+
|
80
|
+
local symtabmt = { __index = false }
|
81
|
+
local symtab = {}
|
82
|
+
local nexitsym = 0
|
83
|
+
|
84
|
+
-- Fill nested symbol table with per-trace exit stub addresses.
|
85
|
+
local function fillsymtab_tr(tr, nexit)
|
86
|
+
local t = {}
|
87
|
+
symtabmt.__index = t
|
88
|
+
if jit.arch == "mips" or jit.arch == "mipsel" then
|
89
|
+
t[traceexitstub(tr, 0)] = "exit"
|
90
|
+
return
|
91
|
+
end
|
92
|
+
for i=0,nexit-1 do
|
93
|
+
local addr = traceexitstub(tr, i)
|
94
|
+
if addr < 0 then addr = addr + 2^32 end
|
95
|
+
t[addr] = tostring(i)
|
96
|
+
end
|
97
|
+
local addr = traceexitstub(tr, nexit)
|
98
|
+
if addr then t[addr] = "stack_check" end
|
99
|
+
end
|
100
|
+
|
101
|
+
-- Fill symbol table with trace exit stub addresses.
|
102
|
+
local function fillsymtab(tr, nexit)
|
103
|
+
local t = symtab
|
104
|
+
if nexitsym == 0 then
|
105
|
+
local ircall = vmdef.ircall
|
106
|
+
for i=0,#ircall do
|
107
|
+
local addr = ircalladdr(i)
|
108
|
+
if addr ~= 0 then
|
109
|
+
if addr < 0 then addr = addr + 2^32 end
|
110
|
+
t[addr] = ircall[i]
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
if nexitsym == 1000000 then -- Per-trace exit stubs.
|
115
|
+
fillsymtab_tr(tr, nexit)
|
116
|
+
elseif nexit > nexitsym then -- Shared exit stubs.
|
117
|
+
for i=nexitsym,nexit-1 do
|
118
|
+
local addr = traceexitstub(i)
|
119
|
+
if addr == nil then -- Fall back to per-trace exit stubs.
|
120
|
+
fillsymtab_tr(tr, nexit)
|
121
|
+
setmetatable(symtab, symtabmt)
|
122
|
+
nexit = 1000000
|
123
|
+
break
|
124
|
+
end
|
125
|
+
if addr < 0 then addr = addr + 2^32 end
|
126
|
+
t[addr] = tostring(i)
|
127
|
+
end
|
128
|
+
nexitsym = nexit
|
129
|
+
end
|
130
|
+
return t
|
131
|
+
end
|
132
|
+
|
133
|
+
local function dumpwrite(s)
|
134
|
+
out:write(s)
|
135
|
+
end
|
136
|
+
|
137
|
+
-- Disassemble machine code.
|
138
|
+
local function dump_mcode(tr)
|
139
|
+
local info = traceinfo(tr)
|
140
|
+
if not info then return end
|
141
|
+
local mcode, addr, loop = tracemc(tr)
|
142
|
+
if not mcode then return end
|
143
|
+
if not disass then disass = require("jit.dis_"..jit.arch) end
|
144
|
+
if addr < 0 then addr = addr + 2^32 end
|
145
|
+
out:write("---- TRACE ", tr, " mcode ", #mcode, "\n")
|
146
|
+
local ctx = disass.create(mcode, addr, dumpwrite)
|
147
|
+
ctx.hexdump = 0
|
148
|
+
ctx.symtab = fillsymtab(tr, info.nexit)
|
149
|
+
if loop ~= 0 then
|
150
|
+
symtab[addr+loop] = "LOOP"
|
151
|
+
ctx:disass(0, loop)
|
152
|
+
out:write("->LOOP:\n")
|
153
|
+
ctx:disass(loop, #mcode-loop)
|
154
|
+
symtab[addr+loop] = nil
|
155
|
+
else
|
156
|
+
ctx:disass(0, #mcode)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
------------------------------------------------------------------------------
|
161
|
+
|
162
|
+
local irtype_text = {
|
163
|
+
[0] = "nil",
|
164
|
+
"fal",
|
165
|
+
"tru",
|
166
|
+
"lud",
|
167
|
+
"str",
|
168
|
+
"p32",
|
169
|
+
"thr",
|
170
|
+
"pro",
|
171
|
+
"fun",
|
172
|
+
"p64",
|
173
|
+
"cdt",
|
174
|
+
"tab",
|
175
|
+
"udt",
|
176
|
+
"flt",
|
177
|
+
"num",
|
178
|
+
"i8 ",
|
179
|
+
"u8 ",
|
180
|
+
"i16",
|
181
|
+
"u16",
|
182
|
+
"int",
|
183
|
+
"u32",
|
184
|
+
"i64",
|
185
|
+
"u64",
|
186
|
+
"sfp",
|
187
|
+
}
|
188
|
+
|
189
|
+
local colortype_ansi = {
|
190
|
+
[0] = "%s",
|
191
|
+
"%s",
|
192
|
+
"%s",
|
193
|
+
"\027[36m%s\027[m",
|
194
|
+
"\027[32m%s\027[m",
|
195
|
+
"%s",
|
196
|
+
"\027[1m%s\027[m",
|
197
|
+
"%s",
|
198
|
+
"\027[1m%s\027[m",
|
199
|
+
"%s",
|
200
|
+
"\027[33m%s\027[m",
|
201
|
+
"\027[31m%s\027[m",
|
202
|
+
"\027[36m%s\027[m",
|
203
|
+
"\027[34m%s\027[m",
|
204
|
+
"\027[34m%s\027[m",
|
205
|
+
"\027[35m%s\027[m",
|
206
|
+
"\027[35m%s\027[m",
|
207
|
+
"\027[35m%s\027[m",
|
208
|
+
"\027[35m%s\027[m",
|
209
|
+
"\027[35m%s\027[m",
|
210
|
+
"\027[35m%s\027[m",
|
211
|
+
"\027[35m%s\027[m",
|
212
|
+
"\027[35m%s\027[m",
|
213
|
+
"\027[35m%s\027[m",
|
214
|
+
}
|
215
|
+
|
216
|
+
local function colorize_text(s, t)
|
217
|
+
return s
|
218
|
+
end
|
219
|
+
|
220
|
+
local function colorize_ansi(s, t)
|
221
|
+
return format(colortype_ansi[t], s)
|
222
|
+
end
|
223
|
+
|
224
|
+
local irtype_ansi = setmetatable({},
|
225
|
+
{ __index = function(tab, t)
|
226
|
+
local s = colorize_ansi(irtype_text[t], t); tab[t] = s; return s; end })
|
227
|
+
|
228
|
+
local html_escape = { ["<"] = "<", [">"] = ">", ["&"] = "&", }
|
229
|
+
|
230
|
+
local function colorize_html(s, t)
|
231
|
+
s = gsub(s, "[<>&]", html_escape)
|
232
|
+
return format('<span class="irt_%s">%s</span>', irtype_text[t], s)
|
233
|
+
end
|
234
|
+
|
235
|
+
local irtype_html = setmetatable({},
|
236
|
+
{ __index = function(tab, t)
|
237
|
+
local s = colorize_html(irtype_text[t], t); tab[t] = s; return s; end })
|
238
|
+
|
239
|
+
local header_html = [[
|
240
|
+
<style type="text/css">
|
241
|
+
background { background: #ffffff; color: #000000; }
|
242
|
+
pre.ljdump {
|
243
|
+
font-size: 10pt;
|
244
|
+
background: #f0f4ff;
|
245
|
+
color: #000000;
|
246
|
+
border: 1px solid #bfcfff;
|
247
|
+
padding: 0.5em;
|
248
|
+
margin-left: 2em;
|
249
|
+
margin-right: 2em;
|
250
|
+
}
|
251
|
+
span.irt_str { color: #00a000; }
|
252
|
+
span.irt_thr, span.irt_fun { color: #404040; font-weight: bold; }
|
253
|
+
span.irt_tab { color: #c00000; }
|
254
|
+
span.irt_udt, span.irt_lud { color: #00c0c0; }
|
255
|
+
span.irt_num { color: #4040c0; }
|
256
|
+
span.irt_int, span.irt_i8, span.irt_u8, span.irt_i16, span.irt_u16 { color: #b040b0; }
|
257
|
+
</style>
|
258
|
+
]]
|
259
|
+
|
260
|
+
local colorize, irtype
|
261
|
+
|
262
|
+
-- Lookup tables to convert some literals into names.
|
263
|
+
local litname = {
|
264
|
+
["SLOAD "] = setmetatable({}, { __index = function(t, mode)
|
265
|
+
local s = ""
|
266
|
+
if band(mode, 1) ~= 0 then s = s.."P" end
|
267
|
+
if band(mode, 2) ~= 0 then s = s.."F" end
|
268
|
+
if band(mode, 4) ~= 0 then s = s.."T" end
|
269
|
+
if band(mode, 8) ~= 0 then s = s.."C" end
|
270
|
+
if band(mode, 16) ~= 0 then s = s.."R" end
|
271
|
+
if band(mode, 32) ~= 0 then s = s.."I" end
|
272
|
+
t[mode] = s
|
273
|
+
return s
|
274
|
+
end}),
|
275
|
+
["XLOAD "] = { [0] = "", "R", "V", "RV", "U", "RU", "VU", "RVU", },
|
276
|
+
["CONV "] = setmetatable({}, { __index = function(t, mode)
|
277
|
+
local s = irtype[band(mode, 31)]
|
278
|
+
s = irtype[band(shr(mode, 5), 31)].."."..s
|
279
|
+
if band(mode, 0x800) ~= 0 then s = s.." sext" end
|
280
|
+
local c = shr(mode, 14)
|
281
|
+
if c == 2 then s = s.." index" elseif c == 3 then s = s.." check" end
|
282
|
+
t[mode] = s
|
283
|
+
return s
|
284
|
+
end}),
|
285
|
+
["FLOAD "] = vmdef.irfield,
|
286
|
+
["FREF "] = vmdef.irfield,
|
287
|
+
["FPMATH"] = vmdef.irfpm,
|
288
|
+
["BUFHDR"] = { [0] = "RESET", "APPEND" },
|
289
|
+
["TOSTR "] = { [0] = "INT", "NUM", "CHAR" },
|
290
|
+
}
|
291
|
+
|
292
|
+
local function ctlsub(c)
|
293
|
+
if c == "\n" then return "\\n"
|
294
|
+
elseif c == "\r" then return "\\r"
|
295
|
+
elseif c == "\t" then return "\\t"
|
296
|
+
else return format("\\%03d", byte(c))
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
local function fmtfunc(func, pc)
|
301
|
+
local fi = funcinfo(func, pc)
|
302
|
+
if fi.loc then
|
303
|
+
return fi.loc
|
304
|
+
elseif fi.ffid then
|
305
|
+
return vmdef.ffnames[fi.ffid]
|
306
|
+
elseif fi.addr then
|
307
|
+
return format("C:%x", fi.addr)
|
308
|
+
else
|
309
|
+
return "(?)"
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
local function formatk(tr, idx)
|
314
|
+
local k, t, slot = tracek(tr, idx)
|
315
|
+
local tn = type(k)
|
316
|
+
local s
|
317
|
+
if tn == "number" then
|
318
|
+
if k == 2^52+2^51 then
|
319
|
+
s = "bias"
|
320
|
+
else
|
321
|
+
s = format("%+.14g", k)
|
322
|
+
end
|
323
|
+
elseif tn == "string" then
|
324
|
+
s = format(#k > 20 and '"%.20s"~' or '"%s"', gsub(k, "%c", ctlsub))
|
325
|
+
elseif tn == "function" then
|
326
|
+
s = fmtfunc(k)
|
327
|
+
elseif tn == "table" then
|
328
|
+
s = format("{%p}", k)
|
329
|
+
elseif tn == "userdata" then
|
330
|
+
if t == 12 then
|
331
|
+
s = format("userdata:%p", k)
|
332
|
+
else
|
333
|
+
s = format("[%p]", k)
|
334
|
+
if s == "[0x00000000]" then s = "NULL" end
|
335
|
+
end
|
336
|
+
elseif t == 21 then -- int64_t
|
337
|
+
s = sub(tostring(k), 1, -3)
|
338
|
+
if sub(s, 1, 1) ~= "-" then s = "+"..s end
|
339
|
+
else
|
340
|
+
s = tostring(k) -- For primitives.
|
341
|
+
end
|
342
|
+
s = colorize(format("%-4s", s), t)
|
343
|
+
if slot then
|
344
|
+
s = format("%s @%d", s, slot)
|
345
|
+
end
|
346
|
+
return s
|
347
|
+
end
|
348
|
+
|
349
|
+
local function printsnap(tr, snap)
|
350
|
+
local n = 2
|
351
|
+
for s=0,snap[1]-1 do
|
352
|
+
local sn = snap[n]
|
353
|
+
if shr(sn, 24) == s then
|
354
|
+
n = n + 1
|
355
|
+
local ref = band(sn, 0xffff) - 0x8000 -- REF_BIAS
|
356
|
+
if ref < 0 then
|
357
|
+
out:write(formatk(tr, ref))
|
358
|
+
elseif band(sn, 0x80000) ~= 0 then -- SNAP_SOFTFPNUM
|
359
|
+
out:write(colorize(format("%04d/%04d", ref, ref+1), 14))
|
360
|
+
else
|
361
|
+
local m, ot, op1, op2 = traceir(tr, ref)
|
362
|
+
out:write(colorize(format("%04d", ref), band(ot, 31)))
|
363
|
+
end
|
364
|
+
out:write(band(sn, 0x10000) == 0 and " " or "|") -- SNAP_FRAME
|
365
|
+
else
|
366
|
+
out:write("---- ")
|
367
|
+
end
|
368
|
+
end
|
369
|
+
out:write("]\n")
|
370
|
+
end
|
371
|
+
|
372
|
+
-- Dump snapshots (not interleaved with IR).
|
373
|
+
local function dump_snap(tr)
|
374
|
+
out:write("---- TRACE ", tr, " snapshots\n")
|
375
|
+
for i=0,1000000000 do
|
376
|
+
local snap = tracesnap(tr, i)
|
377
|
+
if not snap then break end
|
378
|
+
out:write(format("#%-3d %04d [ ", i, snap[0]))
|
379
|
+
printsnap(tr, snap)
|
380
|
+
end
|
381
|
+
end
|
382
|
+
|
383
|
+
-- Return a register name or stack slot for a rid/sp location.
|
384
|
+
local function ridsp_name(ridsp, ins)
|
385
|
+
if not disass then disass = require("jit.dis_"..jit.arch) end
|
386
|
+
local rid, slot = band(ridsp, 0xff), shr(ridsp, 8)
|
387
|
+
if rid == 253 or rid == 254 then
|
388
|
+
return (slot == 0 or slot == 255) and " {sink" or format(" {%04d", ins-slot)
|
389
|
+
end
|
390
|
+
if ridsp > 255 then return format("[%x]", slot*4) end
|
391
|
+
if rid < 128 then return disass.regname(rid) end
|
392
|
+
return ""
|
393
|
+
end
|
394
|
+
|
395
|
+
-- Dump CALL* function ref and return optional ctype.
|
396
|
+
local function dumpcallfunc(tr, ins)
|
397
|
+
local ctype
|
398
|
+
if ins > 0 then
|
399
|
+
local m, ot, op1, op2 = traceir(tr, ins)
|
400
|
+
if band(ot, 31) == 0 then -- nil type means CARG(func, ctype).
|
401
|
+
ins = op1
|
402
|
+
ctype = formatk(tr, op2)
|
403
|
+
end
|
404
|
+
end
|
405
|
+
if ins < 0 then
|
406
|
+
out:write(format("[0x%x](", tonumber((tracek(tr, ins)))))
|
407
|
+
else
|
408
|
+
out:write(format("%04d (", ins))
|
409
|
+
end
|
410
|
+
return ctype
|
411
|
+
end
|
412
|
+
|
413
|
+
-- Recursively gather CALL* args and dump them.
|
414
|
+
local function dumpcallargs(tr, ins)
|
415
|
+
if ins < 0 then
|
416
|
+
out:write(formatk(tr, ins))
|
417
|
+
else
|
418
|
+
local m, ot, op1, op2 = traceir(tr, ins)
|
419
|
+
local oidx = 6*shr(ot, 8)
|
420
|
+
local op = sub(vmdef.irnames, oidx+1, oidx+6)
|
421
|
+
if op == "CARG " then
|
422
|
+
dumpcallargs(tr, op1)
|
423
|
+
if op2 < 0 then
|
424
|
+
out:write(" ", formatk(tr, op2))
|
425
|
+
else
|
426
|
+
out:write(" ", format("%04d", op2))
|
427
|
+
end
|
428
|
+
else
|
429
|
+
out:write(format("%04d", ins))
|
430
|
+
end
|
431
|
+
end
|
432
|
+
end
|
433
|
+
|
434
|
+
-- Dump IR and interleaved snapshots.
|
435
|
+
local function dump_ir(tr, dumpsnap, dumpreg)
|
436
|
+
local info = traceinfo(tr)
|
437
|
+
if not info then return end
|
438
|
+
local nins = info.nins
|
439
|
+
out:write("---- TRACE ", tr, " IR\n")
|
440
|
+
local irnames = vmdef.irnames
|
441
|
+
local snapref = 65536
|
442
|
+
local snap, snapno
|
443
|
+
if dumpsnap then
|
444
|
+
snap = tracesnap(tr, 0)
|
445
|
+
snapref = snap[0]
|
446
|
+
snapno = 0
|
447
|
+
end
|
448
|
+
for ins=1,nins do
|
449
|
+
if ins >= snapref then
|
450
|
+
if dumpreg then
|
451
|
+
out:write(format(".... SNAP #%-3d [ ", snapno))
|
452
|
+
else
|
453
|
+
out:write(format(".... SNAP #%-3d [ ", snapno))
|
454
|
+
end
|
455
|
+
printsnap(tr, snap)
|
456
|
+
snapno = snapno + 1
|
457
|
+
snap = tracesnap(tr, snapno)
|
458
|
+
snapref = snap and snap[0] or 65536
|
459
|
+
end
|
460
|
+
local m, ot, op1, op2, ridsp = traceir(tr, ins)
|
461
|
+
local oidx, t = 6*shr(ot, 8), band(ot, 31)
|
462
|
+
local op = sub(irnames, oidx+1, oidx+6)
|
463
|
+
if op == "LOOP " then
|
464
|
+
if dumpreg then
|
465
|
+
out:write(format("%04d ------------ LOOP ------------\n", ins))
|
466
|
+
else
|
467
|
+
out:write(format("%04d ------ LOOP ------------\n", ins))
|
468
|
+
end
|
469
|
+
elseif op ~= "NOP " and op ~= "CARG " and
|
470
|
+
(dumpreg or op ~= "RENAME") then
|
471
|
+
local rid = band(ridsp, 255)
|
472
|
+
if dumpreg then
|
473
|
+
out:write(format("%04d %-6s", ins, ridsp_name(ridsp, ins)))
|
474
|
+
else
|
475
|
+
out:write(format("%04d ", ins))
|
476
|
+
end
|
477
|
+
out:write(format("%s%s %s %s ",
|
478
|
+
(rid == 254 or rid == 253) and "}" or
|
479
|
+
(band(ot, 128) == 0 and " " or ">"),
|
480
|
+
band(ot, 64) == 0 and " " or "+",
|
481
|
+
irtype[t], op))
|
482
|
+
local m1, m2 = band(m, 3), band(m, 3*4)
|
483
|
+
if sub(op, 1, 4) == "CALL" then
|
484
|
+
local ctype
|
485
|
+
if m2 == 1*4 then -- op2 == IRMlit
|
486
|
+
out:write(format("%-10s (", vmdef.ircall[op2]))
|
487
|
+
else
|
488
|
+
ctype = dumpcallfunc(tr, op2)
|
489
|
+
end
|
490
|
+
if op1 ~= -1 then dumpcallargs(tr, op1) end
|
491
|
+
out:write(")")
|
492
|
+
if ctype then out:write(" ctype ", ctype) end
|
493
|
+
elseif op == "CNEW " and op2 == -1 then
|
494
|
+
out:write(formatk(tr, op1))
|
495
|
+
elseif m1 ~= 3 then -- op1 != IRMnone
|
496
|
+
if op1 < 0 then
|
497
|
+
out:write(formatk(tr, op1))
|
498
|
+
else
|
499
|
+
out:write(format(m1 == 0 and "%04d" or "#%-3d", op1))
|
500
|
+
end
|
501
|
+
if m2 ~= 3*4 then -- op2 != IRMnone
|
502
|
+
if m2 == 1*4 then -- op2 == IRMlit
|
503
|
+
local litn = litname[op]
|
504
|
+
if litn and litn[op2] then
|
505
|
+
out:write(" ", litn[op2])
|
506
|
+
elseif op == "UREFO " or op == "UREFC " then
|
507
|
+
out:write(format(" #%-3d", shr(op2, 8)))
|
508
|
+
else
|
509
|
+
out:write(format(" #%-3d", op2))
|
510
|
+
end
|
511
|
+
elseif op2 < 0 then
|
512
|
+
out:write(" ", formatk(tr, op2))
|
513
|
+
else
|
514
|
+
out:write(format(" %04d", op2))
|
515
|
+
end
|
516
|
+
end
|
517
|
+
end
|
518
|
+
out:write("\n")
|
519
|
+
end
|
520
|
+
end
|
521
|
+
if snap then
|
522
|
+
if dumpreg then
|
523
|
+
out:write(format(".... SNAP #%-3d [ ", snapno))
|
524
|
+
else
|
525
|
+
out:write(format(".... SNAP #%-3d [ ", snapno))
|
526
|
+
end
|
527
|
+
printsnap(tr, snap)
|
528
|
+
end
|
529
|
+
end
|
530
|
+
|
531
|
+
------------------------------------------------------------------------------
|
532
|
+
|
533
|
+
local recprefix = ""
|
534
|
+
local recdepth = 0
|
535
|
+
|
536
|
+
-- Format trace error message.
|
537
|
+
local function fmterr(err, info)
|
538
|
+
if type(err) == "number" then
|
539
|
+
if type(info) == "function" then info = fmtfunc(info) end
|
540
|
+
err = format(vmdef.traceerr[err], info)
|
541
|
+
end
|
542
|
+
return err
|
543
|
+
end
|
544
|
+
|
545
|
+
-- Dump trace states.
|
546
|
+
local function dump_trace(what, tr, func, pc, otr, oex)
|
547
|
+
if what == "stop" or (what == "abort" and dumpmode.a) then
|
548
|
+
if dumpmode.i then dump_ir(tr, dumpmode.s, dumpmode.r and what == "stop")
|
549
|
+
elseif dumpmode.s then dump_snap(tr) end
|
550
|
+
if dumpmode.m then dump_mcode(tr) end
|
551
|
+
end
|
552
|
+
if what == "start" then
|
553
|
+
if dumpmode.H then out:write('<pre class="ljdump">\n') end
|
554
|
+
out:write("---- TRACE ", tr, " ", what)
|
555
|
+
if otr then out:write(" ", otr, "/", oex) end
|
556
|
+
out:write(" ", fmtfunc(func, pc), "\n")
|
557
|
+
elseif what == "stop" or what == "abort" then
|
558
|
+
out:write("---- TRACE ", tr, " ", what)
|
559
|
+
if what == "abort" then
|
560
|
+
out:write(" ", fmtfunc(func, pc), " -- ", fmterr(otr, oex), "\n")
|
561
|
+
else
|
562
|
+
local info = traceinfo(tr)
|
563
|
+
local link, ltype = info.link, info.linktype
|
564
|
+
if link == tr or link == 0 then
|
565
|
+
out:write(" -> ", ltype, "\n")
|
566
|
+
elseif ltype == "root" then
|
567
|
+
out:write(" -> ", link, "\n")
|
568
|
+
else
|
569
|
+
out:write(" -> ", link, " ", ltype, "\n")
|
570
|
+
end
|
571
|
+
end
|
572
|
+
if dumpmode.H then out:write("</pre>\n\n") else out:write("\n") end
|
573
|
+
else
|
574
|
+
out:write("---- TRACE ", what, "\n\n")
|
575
|
+
end
|
576
|
+
out:flush()
|
577
|
+
end
|
578
|
+
|
579
|
+
-- Dump recorded bytecode.
|
580
|
+
local function dump_record(tr, func, pc, depth, callee)
|
581
|
+
if depth ~= recdepth then
|
582
|
+
recdepth = depth
|
583
|
+
recprefix = rep(" .", depth)
|
584
|
+
end
|
585
|
+
local line
|
586
|
+
if pc >= 0 then
|
587
|
+
line = bcline(func, pc, recprefix)
|
588
|
+
if dumpmode.H then line = gsub(line, "[<>&]", html_escape) end
|
589
|
+
else
|
590
|
+
line = "0000 "..recprefix.." FUNCC \n"
|
591
|
+
callee = func
|
592
|
+
end
|
593
|
+
if pc <= 0 then
|
594
|
+
out:write(sub(line, 1, -2), " ; ", fmtfunc(func), "\n")
|
595
|
+
else
|
596
|
+
out:write(line)
|
597
|
+
end
|
598
|
+
if pc >= 0 and band(funcbc(func, pc), 0xff) < 16 then -- ORDER BC
|
599
|
+
out:write(bcline(func, pc+1, recprefix)) -- Write JMP for cond.
|
600
|
+
end
|
601
|
+
end
|
602
|
+
|
603
|
+
------------------------------------------------------------------------------
|
604
|
+
|
605
|
+
-- Dump taken trace exits.
|
606
|
+
local function dump_texit(tr, ex, ngpr, nfpr, ...)
|
607
|
+
out:write("---- TRACE ", tr, " exit ", ex, "\n")
|
608
|
+
if dumpmode.X then
|
609
|
+
local regs = {...}
|
610
|
+
if jit.arch == "x64" then
|
611
|
+
for i=1,ngpr do
|
612
|
+
out:write(format(" %016x", regs[i]))
|
613
|
+
if i % 4 == 0 then out:write("\n") end
|
614
|
+
end
|
615
|
+
else
|
616
|
+
for i=1,ngpr do
|
617
|
+
out:write(" ", tohex(regs[i]))
|
618
|
+
if i % 8 == 0 then out:write("\n") end
|
619
|
+
end
|
620
|
+
end
|
621
|
+
if jit.arch == "mips" or jit.arch == "mipsel" then
|
622
|
+
for i=1,nfpr,2 do
|
623
|
+
out:write(format(" %+17.14g", regs[ngpr+i]))
|
624
|
+
if i % 8 == 7 then out:write("\n") end
|
625
|
+
end
|
626
|
+
else
|
627
|
+
for i=1,nfpr do
|
628
|
+
out:write(format(" %+17.14g", regs[ngpr+i]))
|
629
|
+
if i % 4 == 0 then out:write("\n") end
|
630
|
+
end
|
631
|
+
end
|
632
|
+
end
|
633
|
+
end
|
634
|
+
|
635
|
+
------------------------------------------------------------------------------
|
636
|
+
|
637
|
+
-- Detach dump handlers.
|
638
|
+
local function dumpoff()
|
639
|
+
if active then
|
640
|
+
active = false
|
641
|
+
jit.attach(dump_texit)
|
642
|
+
jit.attach(dump_record)
|
643
|
+
jit.attach(dump_trace)
|
644
|
+
if out and out ~= stdout and out ~= stderr then out:close() end
|
645
|
+
out = nil
|
646
|
+
end
|
647
|
+
end
|
648
|
+
|
649
|
+
-- Open the output file and attach dump handlers.
|
650
|
+
local function dumpon(opt, outfile)
|
651
|
+
if active then dumpoff() end
|
652
|
+
|
653
|
+
local colormode = os.getenv("COLORTERM") and "A" or "T"
|
654
|
+
if opt then
|
655
|
+
opt = gsub(opt, "[TAH]", function(mode) colormode = mode; return ""; end)
|
656
|
+
end
|
657
|
+
|
658
|
+
local m = { t=true, b=true, i=true, m=true, }
|
659
|
+
if opt and opt ~= "" then
|
660
|
+
local o = sub(opt, 1, 1)
|
661
|
+
if o ~= "+" and o ~= "-" then m = {} end
|
662
|
+
for i=1,#opt do m[sub(opt, i, i)] = (o ~= "-") end
|
663
|
+
end
|
664
|
+
dumpmode = m
|
665
|
+
|
666
|
+
if m.t or m.b or m.i or m.s or m.m then
|
667
|
+
jit.attach(dump_trace, "trace")
|
668
|
+
end
|
669
|
+
if m.b then
|
670
|
+
jit.attach(dump_record, "record")
|
671
|
+
if not bcline then bcline = require("jit.bc").line end
|
672
|
+
end
|
673
|
+
if m.x or m.X then
|
674
|
+
jit.attach(dump_texit, "texit")
|
675
|
+
end
|
676
|
+
|
677
|
+
if not outfile then outfile = os.getenv("LUAJIT_DUMPFILE") end
|
678
|
+
if outfile then
|
679
|
+
out = outfile == "-" and stdout or assert(io.open(outfile, "w"))
|
680
|
+
else
|
681
|
+
out = stdout
|
682
|
+
end
|
683
|
+
|
684
|
+
m[colormode] = true
|
685
|
+
if colormode == "A" then
|
686
|
+
colorize = colorize_ansi
|
687
|
+
irtype = irtype_ansi
|
688
|
+
elseif colormode == "H" then
|
689
|
+
colorize = colorize_html
|
690
|
+
irtype = irtype_html
|
691
|
+
out:write(header_html)
|
692
|
+
else
|
693
|
+
colorize = colorize_text
|
694
|
+
irtype = irtype_text
|
695
|
+
end
|
696
|
+
|
697
|
+
active = true
|
698
|
+
end
|
699
|
+
|
700
|
+
-- Public module functions.
|
701
|
+
return {
|
702
|
+
on = dumpon,
|
703
|
+
off = dumpoff,
|
704
|
+
start = dumpon -- For -j command line option.
|
705
|
+
}
|
706
|
+
|