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
data/lua-hooks/ext/lua/lualib.h
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $
|
3
|
-
** Lua standard libraries
|
4
|
-
** See Copyright Notice in lua.h
|
5
|
-
*/
|
6
|
-
|
7
|
-
|
8
|
-
#ifndef lualib_h
|
9
|
-
#define lualib_h
|
10
|
-
|
11
|
-
#include "lua.h"
|
12
|
-
|
13
|
-
|
14
|
-
/* Key to file-handle type */
|
15
|
-
#define LUA_FILEHANDLE "FILE*"
|
16
|
-
|
17
|
-
|
18
|
-
#define LUA_COLIBNAME "coroutine"
|
19
|
-
LUALIB_API int (luaopen_base) (lua_State *L);
|
20
|
-
|
21
|
-
#define LUA_TABLIBNAME "table"
|
22
|
-
LUALIB_API int (luaopen_table) (lua_State *L);
|
23
|
-
|
24
|
-
#define LUA_IOLIBNAME "io"
|
25
|
-
LUALIB_API int (luaopen_io) (lua_State *L);
|
26
|
-
|
27
|
-
#define LUA_OSLIBNAME "os"
|
28
|
-
LUALIB_API int (luaopen_os) (lua_State *L);
|
29
|
-
|
30
|
-
#define LUA_STRLIBNAME "string"
|
31
|
-
LUALIB_API int (luaopen_string) (lua_State *L);
|
32
|
-
|
33
|
-
#define LUA_MATHLIBNAME "math"
|
34
|
-
LUALIB_API int (luaopen_math) (lua_State *L);
|
35
|
-
|
36
|
-
#define LUA_DBLIBNAME "debug"
|
37
|
-
LUALIB_API int (luaopen_debug) (lua_State *L);
|
38
|
-
|
39
|
-
#define LUA_LOADLIBNAME "package"
|
40
|
-
LUALIB_API int (luaopen_package) (lua_State *L);
|
41
|
-
|
42
|
-
|
43
|
-
/* open all previous libraries */
|
44
|
-
LUALIB_API void (luaL_openlibs) (lua_State *L);
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
#ifndef lua_assert
|
49
|
-
#define lua_assert(x) ((void)0)
|
50
|
-
#endif
|
51
|
-
|
52
|
-
|
53
|
-
#endif
|
data/lua-hooks/ext/lua/lundump.c
DELETED
@@ -1,227 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
** $Id: lundump.c,v 2.7.1.4 2008/04/04 19:51:41 roberto Exp $
|
3
|
-
** load precompiled Lua chunks
|
4
|
-
** See Copyright Notice in lua.h
|
5
|
-
*/
|
6
|
-
|
7
|
-
#include <string.h>
|
8
|
-
|
9
|
-
#define lundump_c
|
10
|
-
#define LUA_CORE
|
11
|
-
|
12
|
-
#include "lua.h"
|
13
|
-
|
14
|
-
#include "ldebug.h"
|
15
|
-
#include "ldo.h"
|
16
|
-
#include "lfunc.h"
|
17
|
-
#include "lmem.h"
|
18
|
-
#include "lobject.h"
|
19
|
-
#include "lstring.h"
|
20
|
-
#include "lundump.h"
|
21
|
-
#include "lzio.h"
|
22
|
-
|
23
|
-
typedef struct {
|
24
|
-
lua_State* L;
|
25
|
-
ZIO* Z;
|
26
|
-
Mbuffer* b;
|
27
|
-
const char* name;
|
28
|
-
} LoadState;
|
29
|
-
|
30
|
-
#ifdef LUAC_TRUST_BINARIES
|
31
|
-
#define IF(c,s)
|
32
|
-
#define error(S,s)
|
33
|
-
#else
|
34
|
-
#define IF(c,s) if (c) error(S,s)
|
35
|
-
|
36
|
-
static void error(LoadState* S, const char* why)
|
37
|
-
{
|
38
|
-
luaO_pushfstring(S->L,"%s: %s in precompiled chunk",S->name,why);
|
39
|
-
luaD_throw(S->L,LUA_ERRSYNTAX);
|
40
|
-
}
|
41
|
-
#endif
|
42
|
-
|
43
|
-
#define LoadMem(S,b,n,size) LoadBlock(S,b,(n)*(size))
|
44
|
-
#define LoadByte(S) (lu_byte)LoadChar(S)
|
45
|
-
#define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x))
|
46
|
-
#define LoadVector(S,b,n,size) LoadMem(S,b,n,size)
|
47
|
-
|
48
|
-
static void LoadBlock(LoadState* S, void* b, size_t size)
|
49
|
-
{
|
50
|
-
size_t r=luaZ_read(S->Z,b,size);
|
51
|
-
IF (r!=0, "unexpected end");
|
52
|
-
}
|
53
|
-
|
54
|
-
static int LoadChar(LoadState* S)
|
55
|
-
{
|
56
|
-
char x;
|
57
|
-
LoadVar(S,x);
|
58
|
-
return x;
|
59
|
-
}
|
60
|
-
|
61
|
-
static int LoadInt(LoadState* S)
|
62
|
-
{
|
63
|
-
int x;
|
64
|
-
LoadVar(S,x);
|
65
|
-
IF (x<0, "bad integer");
|
66
|
-
return x;
|
67
|
-
}
|
68
|
-
|
69
|
-
static lua_Number LoadNumber(LoadState* S)
|
70
|
-
{
|
71
|
-
lua_Number x;
|
72
|
-
LoadVar(S,x);
|
73
|
-
return x;
|
74
|
-
}
|
75
|
-
|
76
|
-
static TString* LoadString(LoadState* S)
|
77
|
-
{
|
78
|
-
size_t size;
|
79
|
-
LoadVar(S,size);
|
80
|
-
if (size==0)
|
81
|
-
return NULL;
|
82
|
-
else
|
83
|
-
{
|
84
|
-
char* s=luaZ_openspace(S->L,S->b,size);
|
85
|
-
LoadBlock(S,s,size);
|
86
|
-
return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */
|
87
|
-
}
|
88
|
-
}
|
89
|
-
|
90
|
-
static void LoadCode(LoadState* S, Proto* f)
|
91
|
-
{
|
92
|
-
int n=LoadInt(S);
|
93
|
-
f->code=luaM_newvector(S->L,n,Instruction);
|
94
|
-
f->sizecode=n;
|
95
|
-
LoadVector(S,f->code,n,sizeof(Instruction));
|
96
|
-
}
|
97
|
-
|
98
|
-
static Proto* LoadFunction(LoadState* S, TString* p);
|
99
|
-
|
100
|
-
static void LoadConstants(LoadState* S, Proto* f)
|
101
|
-
{
|
102
|
-
int i,n;
|
103
|
-
n=LoadInt(S);
|
104
|
-
f->k=luaM_newvector(S->L,n,TValue);
|
105
|
-
f->sizek=n;
|
106
|
-
for (i=0; i<n; i++) setnilvalue(&f->k[i]);
|
107
|
-
for (i=0; i<n; i++)
|
108
|
-
{
|
109
|
-
TValue* o=&f->k[i];
|
110
|
-
int t=LoadChar(S);
|
111
|
-
switch (t)
|
112
|
-
{
|
113
|
-
case LUA_TNIL:
|
114
|
-
setnilvalue(o);
|
115
|
-
break;
|
116
|
-
case LUA_TBOOLEAN:
|
117
|
-
setbvalue(o,LoadChar(S)!=0);
|
118
|
-
break;
|
119
|
-
case LUA_TNUMBER:
|
120
|
-
setnvalue(o,LoadNumber(S));
|
121
|
-
break;
|
122
|
-
case LUA_TSTRING:
|
123
|
-
setsvalue2n(S->L,o,LoadString(S));
|
124
|
-
break;
|
125
|
-
default:
|
126
|
-
error(S,"bad constant");
|
127
|
-
break;
|
128
|
-
}
|
129
|
-
}
|
130
|
-
n=LoadInt(S);
|
131
|
-
f->p=luaM_newvector(S->L,n,Proto*);
|
132
|
-
f->sizep=n;
|
133
|
-
for (i=0; i<n; i++) f->p[i]=NULL;
|
134
|
-
for (i=0; i<n; i++) f->p[i]=LoadFunction(S,f->source);
|
135
|
-
}
|
136
|
-
|
137
|
-
static void LoadDebug(LoadState* S, Proto* f)
|
138
|
-
{
|
139
|
-
int i,n;
|
140
|
-
n=LoadInt(S);
|
141
|
-
f->lineinfo=luaM_newvector(S->L,n,int);
|
142
|
-
f->sizelineinfo=n;
|
143
|
-
LoadVector(S,f->lineinfo,n,sizeof(int));
|
144
|
-
n=LoadInt(S);
|
145
|
-
f->locvars=luaM_newvector(S->L,n,LocVar);
|
146
|
-
f->sizelocvars=n;
|
147
|
-
for (i=0; i<n; i++) f->locvars[i].varname=NULL;
|
148
|
-
for (i=0; i<n; i++)
|
149
|
-
{
|
150
|
-
f->locvars[i].varname=LoadString(S);
|
151
|
-
f->locvars[i].startpc=LoadInt(S);
|
152
|
-
f->locvars[i].endpc=LoadInt(S);
|
153
|
-
}
|
154
|
-
n=LoadInt(S);
|
155
|
-
f->upvalues=luaM_newvector(S->L,n,TString*);
|
156
|
-
f->sizeupvalues=n;
|
157
|
-
for (i=0; i<n; i++) f->upvalues[i]=NULL;
|
158
|
-
for (i=0; i<n; i++) f->upvalues[i]=LoadString(S);
|
159
|
-
}
|
160
|
-
|
161
|
-
static Proto* LoadFunction(LoadState* S, TString* p)
|
162
|
-
{
|
163
|
-
Proto* f;
|
164
|
-
if (++S->L->nCcalls > LUAI_MAXCCALLS) error(S,"code too deep");
|
165
|
-
f=luaF_newproto(S->L);
|
166
|
-
setptvalue2s(S->L,S->L->top,f); incr_top(S->L);
|
167
|
-
f->source=LoadString(S); if (f->source==NULL) f->source=p;
|
168
|
-
f->linedefined=LoadInt(S);
|
169
|
-
f->lastlinedefined=LoadInt(S);
|
170
|
-
f->nups=LoadByte(S);
|
171
|
-
f->numparams=LoadByte(S);
|
172
|
-
f->is_vararg=LoadByte(S);
|
173
|
-
f->maxstacksize=LoadByte(S);
|
174
|
-
LoadCode(S,f);
|
175
|
-
LoadConstants(S,f);
|
176
|
-
LoadDebug(S,f);
|
177
|
-
IF (!luaG_checkcode(f), "bad code");
|
178
|
-
S->L->top--;
|
179
|
-
S->L->nCcalls--;
|
180
|
-
return f;
|
181
|
-
}
|
182
|
-
|
183
|
-
static void LoadHeader(LoadState* S)
|
184
|
-
{
|
185
|
-
char h[LUAC_HEADERSIZE];
|
186
|
-
char s[LUAC_HEADERSIZE];
|
187
|
-
luaU_header(h);
|
188
|
-
LoadBlock(S,s,LUAC_HEADERSIZE);
|
189
|
-
IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
|
190
|
-
}
|
191
|
-
|
192
|
-
/*
|
193
|
-
** load precompiled chunk
|
194
|
-
*/
|
195
|
-
Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name)
|
196
|
-
{
|
197
|
-
LoadState S;
|
198
|
-
if (*name=='@' || *name=='=')
|
199
|
-
S.name=name+1;
|
200
|
-
else if (*name==LUA_SIGNATURE[0])
|
201
|
-
S.name="binary string";
|
202
|
-
else
|
203
|
-
S.name=name;
|
204
|
-
S.L=L;
|
205
|
-
S.Z=Z;
|
206
|
-
S.b=buff;
|
207
|
-
LoadHeader(&S);
|
208
|
-
return LoadFunction(&S,luaS_newliteral(L,"=?"));
|
209
|
-
}
|
210
|
-
|
211
|
-
/*
|
212
|
-
* make header
|
213
|
-
*/
|
214
|
-
void luaU_header (char* h)
|
215
|
-
{
|
216
|
-
int x=1;
|
217
|
-
memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-1);
|
218
|
-
h+=sizeof(LUA_SIGNATURE)-1;
|
219
|
-
*h++=(char)LUAC_VERSION;
|
220
|
-
*h++=(char)LUAC_FORMAT;
|
221
|
-
*h++=(char)*(char*)&x; /* endianness */
|
222
|
-
*h++=(char)sizeof(int);
|
223
|
-
*h++=(char)sizeof(size_t);
|
224
|
-
*h++=(char)sizeof(Instruction);
|
225
|
-
*h++=(char)sizeof(lua_Number);
|
226
|
-
*h++=(char)(((lua_Number)0.5)==0); /* is lua_Number integral? */
|
227
|
-
}
|
data/lua-hooks/ext/lua/lundump.h
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $
|
3
|
-
** load precompiled Lua chunks
|
4
|
-
** See Copyright Notice in lua.h
|
5
|
-
*/
|
6
|
-
|
7
|
-
#ifndef lundump_h
|
8
|
-
#define lundump_h
|
9
|
-
|
10
|
-
#include "lobject.h"
|
11
|
-
#include "lzio.h"
|
12
|
-
|
13
|
-
/* load one chunk; from lundump.c */
|
14
|
-
LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name);
|
15
|
-
|
16
|
-
/* make header; from lundump.c */
|
17
|
-
LUAI_FUNC void luaU_header (char* h);
|
18
|
-
|
19
|
-
/* dump one chunk; from ldump.c */
|
20
|
-
LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);
|
21
|
-
|
22
|
-
#ifdef luac_c
|
23
|
-
/* print one chunk; from print.c */
|
24
|
-
LUAI_FUNC void luaU_print (const Proto* f, int full);
|
25
|
-
#endif
|
26
|
-
|
27
|
-
/* for header of binary files -- this is Lua 5.1 */
|
28
|
-
#define LUAC_VERSION 0x51
|
29
|
-
|
30
|
-
/* for header of binary files -- this is the official format */
|
31
|
-
#define LUAC_FORMAT 0
|
32
|
-
|
33
|
-
/* size of header of binary files */
|
34
|
-
#define LUAC_HEADERSIZE 12
|
35
|
-
|
36
|
-
#endif
|
data/lua-hooks/ext/lua/lvm.c
DELETED
@@ -1,767 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
** $Id: lvm.c,v 2.63.1.5 2011/08/17 20:43:11 roberto Exp $
|
3
|
-
** Lua virtual machine
|
4
|
-
** See Copyright Notice in lua.h
|
5
|
-
*/
|
6
|
-
|
7
|
-
|
8
|
-
#include <stdio.h>
|
9
|
-
#include <stdlib.h>
|
10
|
-
#include <string.h>
|
11
|
-
|
12
|
-
#define lvm_c
|
13
|
-
#define LUA_CORE
|
14
|
-
|
15
|
-
#include "lua.h"
|
16
|
-
|
17
|
-
#include "ldebug.h"
|
18
|
-
#include "ldo.h"
|
19
|
-
#include "lfunc.h"
|
20
|
-
#include "lgc.h"
|
21
|
-
#include "lobject.h"
|
22
|
-
#include "lopcodes.h"
|
23
|
-
#include "lstate.h"
|
24
|
-
#include "lstring.h"
|
25
|
-
#include "ltable.h"
|
26
|
-
#include "ltm.h"
|
27
|
-
#include "lvm.h"
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
/* limit for table tag-method chains (to avoid loops) */
|
32
|
-
#define MAXTAGLOOP 100
|
33
|
-
|
34
|
-
|
35
|
-
const TValue *luaV_tonumber (const TValue *obj, TValue *n) {
|
36
|
-
lua_Number num;
|
37
|
-
if (ttisnumber(obj)) return obj;
|
38
|
-
if (ttisstring(obj) && luaO_str2d(svalue(obj), &num)) {
|
39
|
-
setnvalue(n, num);
|
40
|
-
return n;
|
41
|
-
}
|
42
|
-
else
|
43
|
-
return NULL;
|
44
|
-
}
|
45
|
-
|
46
|
-
|
47
|
-
int luaV_tostring (lua_State *L, StkId obj) {
|
48
|
-
if (!ttisnumber(obj))
|
49
|
-
return 0;
|
50
|
-
else {
|
51
|
-
char s[LUAI_MAXNUMBER2STR];
|
52
|
-
lua_Number n = nvalue(obj);
|
53
|
-
lua_number2str(s, n);
|
54
|
-
setsvalue2s(L, obj, luaS_new(L, s));
|
55
|
-
return 1;
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
|
-
|
60
|
-
static void traceexec (lua_State *L, const Instruction *pc) {
|
61
|
-
lu_byte mask = L->hookmask;
|
62
|
-
const Instruction *oldpc = L->savedpc;
|
63
|
-
L->savedpc = pc;
|
64
|
-
if ((mask & LUA_MASKCOUNT) && L->hookcount == 0) {
|
65
|
-
resethookcount(L);
|
66
|
-
luaD_callhook(L, LUA_HOOKCOUNT, -1);
|
67
|
-
}
|
68
|
-
if (mask & LUA_MASKLINE) {
|
69
|
-
Proto *p = ci_func(L->ci)->l.p;
|
70
|
-
int npc = pcRel(pc, p);
|
71
|
-
int newline = lgetline(p, npc);
|
72
|
-
/* call linehook when enter a new function, when jump back (loop),
|
73
|
-
or when enter a new line */
|
74
|
-
if (npc == 0 || pc <= oldpc || newline != lgetline(p, pcRel(oldpc, p)))
|
75
|
-
luaD_callhook(L, LUA_HOOKLINE, newline);
|
76
|
-
}
|
77
|
-
}
|
78
|
-
|
79
|
-
|
80
|
-
static void callTMres (lua_State *L, StkId res, const TValue *f,
|
81
|
-
const TValue *p1, const TValue *p2) {
|
82
|
-
ptrdiff_t result = savestack(L, res);
|
83
|
-
setobj2s(L, L->top, f); /* push function */
|
84
|
-
setobj2s(L, L->top+1, p1); /* 1st argument */
|
85
|
-
setobj2s(L, L->top+2, p2); /* 2nd argument */
|
86
|
-
luaD_checkstack(L, 3);
|
87
|
-
L->top += 3;
|
88
|
-
luaD_call(L, L->top - 3, 1);
|
89
|
-
res = restorestack(L, result);
|
90
|
-
L->top--;
|
91
|
-
setobjs2s(L, res, L->top);
|
92
|
-
}
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
static void callTM (lua_State *L, const TValue *f, const TValue *p1,
|
97
|
-
const TValue *p2, const TValue *p3) {
|
98
|
-
setobj2s(L, L->top, f); /* push function */
|
99
|
-
setobj2s(L, L->top+1, p1); /* 1st argument */
|
100
|
-
setobj2s(L, L->top+2, p2); /* 2nd argument */
|
101
|
-
setobj2s(L, L->top+3, p3); /* 3th argument */
|
102
|
-
luaD_checkstack(L, 4);
|
103
|
-
L->top += 4;
|
104
|
-
luaD_call(L, L->top - 4, 0);
|
105
|
-
}
|
106
|
-
|
107
|
-
|
108
|
-
void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) {
|
109
|
-
int loop;
|
110
|
-
for (loop = 0; loop < MAXTAGLOOP; loop++) {
|
111
|
-
const TValue *tm;
|
112
|
-
if (ttistable(t)) { /* `t' is a table? */
|
113
|
-
Table *h = hvalue(t);
|
114
|
-
const TValue *res = luaH_get(h, key); /* do a primitive get */
|
115
|
-
if (!ttisnil(res) || /* result is no nil? */
|
116
|
-
(tm = fasttm(L, h->metatable, TM_INDEX)) == NULL) { /* or no TM? */
|
117
|
-
setobj2s(L, val, res);
|
118
|
-
return;
|
119
|
-
}
|
120
|
-
/* else will try the tag method */
|
121
|
-
}
|
122
|
-
else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX)))
|
123
|
-
luaG_typeerror(L, t, "index");
|
124
|
-
if (ttisfunction(tm)) {
|
125
|
-
callTMres(L, val, tm, t, key);
|
126
|
-
return;
|
127
|
-
}
|
128
|
-
t = tm; /* else repeat with `tm' */
|
129
|
-
}
|
130
|
-
luaG_runerror(L, "loop in gettable");
|
131
|
-
}
|
132
|
-
|
133
|
-
|
134
|
-
void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
|
135
|
-
int loop;
|
136
|
-
TValue temp;
|
137
|
-
for (loop = 0; loop < MAXTAGLOOP; loop++) {
|
138
|
-
const TValue *tm;
|
139
|
-
if (ttistable(t)) { /* `t' is a table? */
|
140
|
-
Table *h = hvalue(t);
|
141
|
-
TValue *oldval = luaH_set(L, h, key); /* do a primitive set */
|
142
|
-
if (!ttisnil(oldval) || /* result is no nil? */
|
143
|
-
(tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */
|
144
|
-
setobj2t(L, oldval, val);
|
145
|
-
h->flags = 0;
|
146
|
-
luaC_barriert(L, h, val);
|
147
|
-
return;
|
148
|
-
}
|
149
|
-
/* else will try the tag method */
|
150
|
-
}
|
151
|
-
else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX)))
|
152
|
-
luaG_typeerror(L, t, "index");
|
153
|
-
if (ttisfunction(tm)) {
|
154
|
-
callTM(L, tm, t, key, val);
|
155
|
-
return;
|
156
|
-
}
|
157
|
-
/* else repeat with `tm' */
|
158
|
-
setobj(L, &temp, tm); /* avoid pointing inside table (may rehash) */
|
159
|
-
t = &temp;
|
160
|
-
}
|
161
|
-
luaG_runerror(L, "loop in settable");
|
162
|
-
}
|
163
|
-
|
164
|
-
|
165
|
-
static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2,
|
166
|
-
StkId res, TMS event) {
|
167
|
-
const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */
|
168
|
-
if (ttisnil(tm))
|
169
|
-
tm = luaT_gettmbyobj(L, p2, event); /* try second operand */
|
170
|
-
if (ttisnil(tm)) return 0;
|
171
|
-
callTMres(L, res, tm, p1, p2);
|
172
|
-
return 1;
|
173
|
-
}
|
174
|
-
|
175
|
-
|
176
|
-
static const TValue *get_compTM (lua_State *L, Table *mt1, Table *mt2,
|
177
|
-
TMS event) {
|
178
|
-
const TValue *tm1 = fasttm(L, mt1, event);
|
179
|
-
const TValue *tm2;
|
180
|
-
if (tm1 == NULL) return NULL; /* no metamethod */
|
181
|
-
if (mt1 == mt2) return tm1; /* same metatables => same metamethods */
|
182
|
-
tm2 = fasttm(L, mt2, event);
|
183
|
-
if (tm2 == NULL) return NULL; /* no metamethod */
|
184
|
-
if (luaO_rawequalObj(tm1, tm2)) /* same metamethods? */
|
185
|
-
return tm1;
|
186
|
-
return NULL;
|
187
|
-
}
|
188
|
-
|
189
|
-
|
190
|
-
static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2,
|
191
|
-
TMS event) {
|
192
|
-
const TValue *tm1 = luaT_gettmbyobj(L, p1, event);
|
193
|
-
const TValue *tm2;
|
194
|
-
if (ttisnil(tm1)) return -1; /* no metamethod? */
|
195
|
-
tm2 = luaT_gettmbyobj(L, p2, event);
|
196
|
-
if (!luaO_rawequalObj(tm1, tm2)) /* different metamethods? */
|
197
|
-
return -1;
|
198
|
-
callTMres(L, L->top, tm1, p1, p2);
|
199
|
-
return !l_isfalse(L->top);
|
200
|
-
}
|
201
|
-
|
202
|
-
|
203
|
-
static int l_strcmp (const TString *ls, const TString *rs) {
|
204
|
-
const char *l = getstr(ls);
|
205
|
-
size_t ll = ls->tsv.len;
|
206
|
-
const char *r = getstr(rs);
|
207
|
-
size_t lr = rs->tsv.len;
|
208
|
-
for (;;) {
|
209
|
-
int temp = strcoll(l, r);
|
210
|
-
if (temp != 0) return temp;
|
211
|
-
else { /* strings are equal up to a `\0' */
|
212
|
-
size_t len = strlen(l); /* index of first `\0' in both strings */
|
213
|
-
if (len == lr) /* r is finished? */
|
214
|
-
return (len == ll) ? 0 : 1;
|
215
|
-
else if (len == ll) /* l is finished? */
|
216
|
-
return -1; /* l is smaller than r (because r is not finished) */
|
217
|
-
/* both strings longer than `len'; go on comparing (after the `\0') */
|
218
|
-
len++;
|
219
|
-
l += len; ll -= len; r += len; lr -= len;
|
220
|
-
}
|
221
|
-
}
|
222
|
-
}
|
223
|
-
|
224
|
-
|
225
|
-
int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) {
|
226
|
-
int res;
|
227
|
-
if (ttype(l) != ttype(r))
|
228
|
-
return luaG_ordererror(L, l, r);
|
229
|
-
else if (ttisnumber(l))
|
230
|
-
return luai_numlt(nvalue(l), nvalue(r));
|
231
|
-
else if (ttisstring(l))
|
232
|
-
return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0;
|
233
|
-
else if ((res = call_orderTM(L, l, r, TM_LT)) != -1)
|
234
|
-
return res;
|
235
|
-
return luaG_ordererror(L, l, r);
|
236
|
-
}
|
237
|
-
|
238
|
-
|
239
|
-
static int lessequal (lua_State *L, const TValue *l, const TValue *r) {
|
240
|
-
int res;
|
241
|
-
if (ttype(l) != ttype(r))
|
242
|
-
return luaG_ordererror(L, l, r);
|
243
|
-
else if (ttisnumber(l))
|
244
|
-
return luai_numle(nvalue(l), nvalue(r));
|
245
|
-
else if (ttisstring(l))
|
246
|
-
return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0;
|
247
|
-
else if ((res = call_orderTM(L, l, r, TM_LE)) != -1) /* first try `le' */
|
248
|
-
return res;
|
249
|
-
else if ((res = call_orderTM(L, r, l, TM_LT)) != -1) /* else try `lt' */
|
250
|
-
return !res;
|
251
|
-
return luaG_ordererror(L, l, r);
|
252
|
-
}
|
253
|
-
|
254
|
-
|
255
|
-
int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) {
|
256
|
-
const TValue *tm;
|
257
|
-
lua_assert(ttype(t1) == ttype(t2));
|
258
|
-
switch (ttype(t1)) {
|
259
|
-
case LUA_TNIL: return 1;
|
260
|
-
case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2));
|
261
|
-
case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */
|
262
|
-
case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2);
|
263
|
-
case LUA_TUSERDATA: {
|
264
|
-
if (uvalue(t1) == uvalue(t2)) return 1;
|
265
|
-
tm = get_compTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable,
|
266
|
-
TM_EQ);
|
267
|
-
break; /* will try TM */
|
268
|
-
}
|
269
|
-
case LUA_TTABLE: {
|
270
|
-
if (hvalue(t1) == hvalue(t2)) return 1;
|
271
|
-
tm = get_compTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ);
|
272
|
-
break; /* will try TM */
|
273
|
-
}
|
274
|
-
default: return gcvalue(t1) == gcvalue(t2);
|
275
|
-
}
|
276
|
-
if (tm == NULL) return 0; /* no TM? */
|
277
|
-
callTMres(L, L->top, tm, t1, t2); /* call TM */
|
278
|
-
return !l_isfalse(L->top);
|
279
|
-
}
|
280
|
-
|
281
|
-
|
282
|
-
void luaV_concat (lua_State *L, int total, int last) {
|
283
|
-
do {
|
284
|
-
StkId top = L->base + last + 1;
|
285
|
-
int n = 2; /* number of elements handled in this pass (at least 2) */
|
286
|
-
if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) {
|
287
|
-
if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT))
|
288
|
-
luaG_concaterror(L, top-2, top-1);
|
289
|
-
} else if (tsvalue(top-1)->len == 0) /* second op is empty? */
|
290
|
-
(void)tostring(L, top - 2); /* result is first op (as string) */
|
291
|
-
else {
|
292
|
-
/* at least two string values; get as many as possible */
|
293
|
-
size_t tl = tsvalue(top-1)->len;
|
294
|
-
char *buffer;
|
295
|
-
int i;
|
296
|
-
/* collect total length */
|
297
|
-
for (n = 1; n < total && tostring(L, top-n-1); n++) {
|
298
|
-
size_t l = tsvalue(top-n-1)->len;
|
299
|
-
if (l >= MAX_SIZET - tl) luaG_runerror(L, "string length overflow");
|
300
|
-
tl += l;
|
301
|
-
}
|
302
|
-
buffer = luaZ_openspace(L, &G(L)->buff, tl);
|
303
|
-
tl = 0;
|
304
|
-
for (i=n; i>0; i--) { /* concat all strings */
|
305
|
-
size_t l = tsvalue(top-i)->len;
|
306
|
-
memcpy(buffer+tl, svalue(top-i), l);
|
307
|
-
tl += l;
|
308
|
-
}
|
309
|
-
setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl));
|
310
|
-
}
|
311
|
-
total -= n-1; /* got `n' strings to create 1 new */
|
312
|
-
last -= n-1;
|
313
|
-
} while (total > 1); /* repeat until only 1 result left */
|
314
|
-
}
|
315
|
-
|
316
|
-
|
317
|
-
static void Arith (lua_State *L, StkId ra, const TValue *rb,
|
318
|
-
const TValue *rc, TMS op) {
|
319
|
-
TValue tempb, tempc;
|
320
|
-
const TValue *b, *c;
|
321
|
-
if ((b = luaV_tonumber(rb, &tempb)) != NULL &&
|
322
|
-
(c = luaV_tonumber(rc, &tempc)) != NULL) {
|
323
|
-
lua_Number nb = nvalue(b), nc = nvalue(c);
|
324
|
-
switch (op) {
|
325
|
-
case TM_ADD: setnvalue(ra, luai_numadd(nb, nc)); break;
|
326
|
-
case TM_SUB: setnvalue(ra, luai_numsub(nb, nc)); break;
|
327
|
-
case TM_MUL: setnvalue(ra, luai_nummul(nb, nc)); break;
|
328
|
-
case TM_DIV: setnvalue(ra, luai_numdiv(nb, nc)); break;
|
329
|
-
case TM_MOD: setnvalue(ra, luai_nummod(nb, nc)); break;
|
330
|
-
case TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break;
|
331
|
-
case TM_UNM: setnvalue(ra, luai_numunm(nb)); break;
|
332
|
-
default: lua_assert(0); break;
|
333
|
-
}
|
334
|
-
}
|
335
|
-
else if (!call_binTM(L, rb, rc, ra, op))
|
336
|
-
luaG_aritherror(L, rb, rc);
|
337
|
-
}
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
/*
|
342
|
-
** some macros for common tasks in `luaV_execute'
|
343
|
-
*/
|
344
|
-
|
345
|
-
#define runtime_check(L, c) { if (!(c)) break; }
|
346
|
-
|
347
|
-
#define RA(i) (base+GETARG_A(i))
|
348
|
-
/* to be used after possible stack reallocation */
|
349
|
-
#define RB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i))
|
350
|
-
#define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i))
|
351
|
-
#define RKB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \
|
352
|
-
ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i))
|
353
|
-
#define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \
|
354
|
-
ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i))
|
355
|
-
#define KBx(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, k+GETARG_Bx(i))
|
356
|
-
|
357
|
-
|
358
|
-
#define dojump(L,pc,i) {(pc) += (i); luai_threadyield(L);}
|
359
|
-
|
360
|
-
|
361
|
-
#define Protect(x) { L->savedpc = pc; {x;}; base = L->base; }
|
362
|
-
|
363
|
-
|
364
|
-
#define arith_op(op,tm) { \
|
365
|
-
TValue *rb = RKB(i); \
|
366
|
-
TValue *rc = RKC(i); \
|
367
|
-
if (ttisnumber(rb) && ttisnumber(rc)) { \
|
368
|
-
lua_Number nb = nvalue(rb), nc = nvalue(rc); \
|
369
|
-
setnvalue(ra, op(nb, nc)); \
|
370
|
-
} \
|
371
|
-
else \
|
372
|
-
Protect(Arith(L, ra, rb, rc, tm)); \
|
373
|
-
}
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
void luaV_execute (lua_State *L, int nexeccalls) {
|
378
|
-
LClosure *cl;
|
379
|
-
StkId base;
|
380
|
-
TValue *k;
|
381
|
-
const Instruction *pc;
|
382
|
-
reentry: /* entry point */
|
383
|
-
lua_assert(isLua(L->ci));
|
384
|
-
pc = L->savedpc;
|
385
|
-
cl = &clvalue(L->ci->func)->l;
|
386
|
-
base = L->base;
|
387
|
-
k = cl->p->k;
|
388
|
-
/* main loop of interpreter */
|
389
|
-
for (;;) {
|
390
|
-
const Instruction i = *pc++;
|
391
|
-
StkId ra;
|
392
|
-
if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) &&
|
393
|
-
(--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) {
|
394
|
-
traceexec(L, pc);
|
395
|
-
if (L->status == LUA_YIELD) { /* did hook yield? */
|
396
|
-
L->savedpc = pc - 1;
|
397
|
-
return;
|
398
|
-
}
|
399
|
-
base = L->base;
|
400
|
-
}
|
401
|
-
/* warning!! several calls may realloc the stack and invalidate `ra' */
|
402
|
-
ra = RA(i);
|
403
|
-
lua_assert(base == L->base && L->base == L->ci->base);
|
404
|
-
lua_assert(base <= L->top && L->top <= L->stack + L->stacksize);
|
405
|
-
lua_assert(L->top == L->ci->top || luaG_checkopenop(i));
|
406
|
-
switch (GET_OPCODE(i)) {
|
407
|
-
case OP_MOVE: {
|
408
|
-
setobjs2s(L, ra, RB(i));
|
409
|
-
continue;
|
410
|
-
}
|
411
|
-
case OP_LOADK: {
|
412
|
-
setobj2s(L, ra, KBx(i));
|
413
|
-
continue;
|
414
|
-
}
|
415
|
-
case OP_LOADBOOL: {
|
416
|
-
setbvalue(ra, GETARG_B(i));
|
417
|
-
if (GETARG_C(i)) pc++; /* skip next instruction (if C) */
|
418
|
-
continue;
|
419
|
-
}
|
420
|
-
case OP_LOADNIL: {
|
421
|
-
TValue *rb = RB(i);
|
422
|
-
do {
|
423
|
-
setnilvalue(rb--);
|
424
|
-
} while (rb >= ra);
|
425
|
-
continue;
|
426
|
-
}
|
427
|
-
case OP_GETUPVAL: {
|
428
|
-
int b = GETARG_B(i);
|
429
|
-
setobj2s(L, ra, cl->upvals[b]->v);
|
430
|
-
continue;
|
431
|
-
}
|
432
|
-
case OP_GETGLOBAL: {
|
433
|
-
TValue g;
|
434
|
-
TValue *rb = KBx(i);
|
435
|
-
sethvalue(L, &g, cl->env);
|
436
|
-
lua_assert(ttisstring(rb));
|
437
|
-
Protect(luaV_gettable(L, &g, rb, ra));
|
438
|
-
continue;
|
439
|
-
}
|
440
|
-
case OP_GETTABLE: {
|
441
|
-
Protect(luaV_gettable(L, RB(i), RKC(i), ra));
|
442
|
-
continue;
|
443
|
-
}
|
444
|
-
case OP_SETGLOBAL: {
|
445
|
-
TValue g;
|
446
|
-
sethvalue(L, &g, cl->env);
|
447
|
-
lua_assert(ttisstring(KBx(i)));
|
448
|
-
Protect(luaV_settable(L, &g, KBx(i), ra));
|
449
|
-
continue;
|
450
|
-
}
|
451
|
-
case OP_SETUPVAL: {
|
452
|
-
UpVal *uv = cl->upvals[GETARG_B(i)];
|
453
|
-
setobj(L, uv->v, ra);
|
454
|
-
luaC_barrier(L, uv, ra);
|
455
|
-
continue;
|
456
|
-
}
|
457
|
-
case OP_SETTABLE: {
|
458
|
-
Protect(luaV_settable(L, ra, RKB(i), RKC(i)));
|
459
|
-
continue;
|
460
|
-
}
|
461
|
-
case OP_NEWTABLE: {
|
462
|
-
int b = GETARG_B(i);
|
463
|
-
int c = GETARG_C(i);
|
464
|
-
sethvalue(L, ra, luaH_new(L, luaO_fb2int(b), luaO_fb2int(c)));
|
465
|
-
Protect(luaC_checkGC(L));
|
466
|
-
continue;
|
467
|
-
}
|
468
|
-
case OP_SELF: {
|
469
|
-
StkId rb = RB(i);
|
470
|
-
setobjs2s(L, ra+1, rb);
|
471
|
-
Protect(luaV_gettable(L, rb, RKC(i), ra));
|
472
|
-
continue;
|
473
|
-
}
|
474
|
-
case OP_ADD: {
|
475
|
-
arith_op(luai_numadd, TM_ADD);
|
476
|
-
continue;
|
477
|
-
}
|
478
|
-
case OP_SUB: {
|
479
|
-
arith_op(luai_numsub, TM_SUB);
|
480
|
-
continue;
|
481
|
-
}
|
482
|
-
case OP_MUL: {
|
483
|
-
arith_op(luai_nummul, TM_MUL);
|
484
|
-
continue;
|
485
|
-
}
|
486
|
-
case OP_DIV: {
|
487
|
-
arith_op(luai_numdiv, TM_DIV);
|
488
|
-
continue;
|
489
|
-
}
|
490
|
-
case OP_MOD: {
|
491
|
-
arith_op(luai_nummod, TM_MOD);
|
492
|
-
continue;
|
493
|
-
}
|
494
|
-
case OP_POW: {
|
495
|
-
arith_op(luai_numpow, TM_POW);
|
496
|
-
continue;
|
497
|
-
}
|
498
|
-
case OP_UNM: {
|
499
|
-
TValue *rb = RB(i);
|
500
|
-
if (ttisnumber(rb)) {
|
501
|
-
lua_Number nb = nvalue(rb);
|
502
|
-
setnvalue(ra, luai_numunm(nb));
|
503
|
-
}
|
504
|
-
else {
|
505
|
-
Protect(Arith(L, ra, rb, rb, TM_UNM));
|
506
|
-
}
|
507
|
-
continue;
|
508
|
-
}
|
509
|
-
case OP_NOT: {
|
510
|
-
int res = l_isfalse(RB(i)); /* next assignment may change this value */
|
511
|
-
setbvalue(ra, res);
|
512
|
-
continue;
|
513
|
-
}
|
514
|
-
case OP_LEN: {
|
515
|
-
const TValue *rb = RB(i);
|
516
|
-
switch (ttype(rb)) {
|
517
|
-
case LUA_TTABLE: {
|
518
|
-
setnvalue(ra, cast_num(luaH_getn(hvalue(rb))));
|
519
|
-
break;
|
520
|
-
}
|
521
|
-
case LUA_TSTRING: {
|
522
|
-
setnvalue(ra, cast_num(tsvalue(rb)->len));
|
523
|
-
break;
|
524
|
-
}
|
525
|
-
default: { /* try metamethod */
|
526
|
-
Protect(
|
527
|
-
if (!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN))
|
528
|
-
luaG_typeerror(L, rb, "get length of");
|
529
|
-
)
|
530
|
-
}
|
531
|
-
}
|
532
|
-
continue;
|
533
|
-
}
|
534
|
-
case OP_CONCAT: {
|
535
|
-
int b = GETARG_B(i);
|
536
|
-
int c = GETARG_C(i);
|
537
|
-
Protect(luaV_concat(L, c-b+1, c); luaC_checkGC(L));
|
538
|
-
setobjs2s(L, RA(i), base+b);
|
539
|
-
continue;
|
540
|
-
}
|
541
|
-
case OP_JMP: {
|
542
|
-
dojump(L, pc, GETARG_sBx(i));
|
543
|
-
continue;
|
544
|
-
}
|
545
|
-
case OP_EQ: {
|
546
|
-
TValue *rb = RKB(i);
|
547
|
-
TValue *rc = RKC(i);
|
548
|
-
Protect(
|
549
|
-
if (equalobj(L, rb, rc) == GETARG_A(i))
|
550
|
-
dojump(L, pc, GETARG_sBx(*pc));
|
551
|
-
)
|
552
|
-
pc++;
|
553
|
-
continue;
|
554
|
-
}
|
555
|
-
case OP_LT: {
|
556
|
-
Protect(
|
557
|
-
if (luaV_lessthan(L, RKB(i), RKC(i)) == GETARG_A(i))
|
558
|
-
dojump(L, pc, GETARG_sBx(*pc));
|
559
|
-
)
|
560
|
-
pc++;
|
561
|
-
continue;
|
562
|
-
}
|
563
|
-
case OP_LE: {
|
564
|
-
Protect(
|
565
|
-
if (lessequal(L, RKB(i), RKC(i)) == GETARG_A(i))
|
566
|
-
dojump(L, pc, GETARG_sBx(*pc));
|
567
|
-
)
|
568
|
-
pc++;
|
569
|
-
continue;
|
570
|
-
}
|
571
|
-
case OP_TEST: {
|
572
|
-
if (l_isfalse(ra) != GETARG_C(i))
|
573
|
-
dojump(L, pc, GETARG_sBx(*pc));
|
574
|
-
pc++;
|
575
|
-
continue;
|
576
|
-
}
|
577
|
-
case OP_TESTSET: {
|
578
|
-
TValue *rb = RB(i);
|
579
|
-
if (l_isfalse(rb) != GETARG_C(i)) {
|
580
|
-
setobjs2s(L, ra, rb);
|
581
|
-
dojump(L, pc, GETARG_sBx(*pc));
|
582
|
-
}
|
583
|
-
pc++;
|
584
|
-
continue;
|
585
|
-
}
|
586
|
-
case OP_CALL: {
|
587
|
-
int b = GETARG_B(i);
|
588
|
-
int nresults = GETARG_C(i) - 1;
|
589
|
-
if (b != 0) L->top = ra+b; /* else previous instruction set top */
|
590
|
-
L->savedpc = pc;
|
591
|
-
switch (luaD_precall(L, ra, nresults)) {
|
592
|
-
case PCRLUA: {
|
593
|
-
nexeccalls++;
|
594
|
-
goto reentry; /* restart luaV_execute over new Lua function */
|
595
|
-
}
|
596
|
-
case PCRC: {
|
597
|
-
/* it was a C function (`precall' called it); adjust results */
|
598
|
-
if (nresults >= 0) L->top = L->ci->top;
|
599
|
-
base = L->base;
|
600
|
-
continue;
|
601
|
-
}
|
602
|
-
default: {
|
603
|
-
return; /* yield */
|
604
|
-
}
|
605
|
-
}
|
606
|
-
}
|
607
|
-
case OP_TAILCALL: {
|
608
|
-
int b = GETARG_B(i);
|
609
|
-
if (b != 0) L->top = ra+b; /* else previous instruction set top */
|
610
|
-
L->savedpc = pc;
|
611
|
-
lua_assert(GETARG_C(i) - 1 == LUA_MULTRET);
|
612
|
-
switch (luaD_precall(L, ra, LUA_MULTRET)) {
|
613
|
-
case PCRLUA: {
|
614
|
-
/* tail call: put new frame in place of previous one */
|
615
|
-
CallInfo *ci = L->ci - 1; /* previous frame */
|
616
|
-
int aux;
|
617
|
-
StkId func = ci->func;
|
618
|
-
StkId pfunc = (ci+1)->func; /* previous function index */
|
619
|
-
if (L->openupval) luaF_close(L, ci->base);
|
620
|
-
L->base = ci->base = ci->func + ((ci+1)->base - pfunc);
|
621
|
-
for (aux = 0; pfunc+aux < L->top; aux++) /* move frame down */
|
622
|
-
setobjs2s(L, func+aux, pfunc+aux);
|
623
|
-
ci->top = L->top = func+aux; /* correct top */
|
624
|
-
lua_assert(L->top == L->base + clvalue(func)->l.p->maxstacksize);
|
625
|
-
ci->savedpc = L->savedpc;
|
626
|
-
ci->tailcalls++; /* one more call lost */
|
627
|
-
L->ci--; /* remove new frame */
|
628
|
-
goto reentry;
|
629
|
-
}
|
630
|
-
case PCRC: { /* it was a C function (`precall' called it) */
|
631
|
-
base = L->base;
|
632
|
-
continue;
|
633
|
-
}
|
634
|
-
default: {
|
635
|
-
return; /* yield */
|
636
|
-
}
|
637
|
-
}
|
638
|
-
}
|
639
|
-
case OP_RETURN: {
|
640
|
-
int b = GETARG_B(i);
|
641
|
-
if (b != 0) L->top = ra+b-1;
|
642
|
-
if (L->openupval) luaF_close(L, base);
|
643
|
-
L->savedpc = pc;
|
644
|
-
b = luaD_poscall(L, ra);
|
645
|
-
if (--nexeccalls == 0) /* was previous function running `here'? */
|
646
|
-
return; /* no: return */
|
647
|
-
else { /* yes: continue its execution */
|
648
|
-
if (b) L->top = L->ci->top;
|
649
|
-
lua_assert(isLua(L->ci));
|
650
|
-
lua_assert(GET_OPCODE(*((L->ci)->savedpc - 1)) == OP_CALL);
|
651
|
-
goto reentry;
|
652
|
-
}
|
653
|
-
}
|
654
|
-
case OP_FORLOOP: {
|
655
|
-
lua_Number step = nvalue(ra+2);
|
656
|
-
lua_Number idx = luai_numadd(nvalue(ra), step); /* increment index */
|
657
|
-
lua_Number limit = nvalue(ra+1);
|
658
|
-
if (luai_numlt(0, step) ? luai_numle(idx, limit)
|
659
|
-
: luai_numle(limit, idx)) {
|
660
|
-
dojump(L, pc, GETARG_sBx(i)); /* jump back */
|
661
|
-
setnvalue(ra, idx); /* update internal index... */
|
662
|
-
setnvalue(ra+3, idx); /* ...and external index */
|
663
|
-
}
|
664
|
-
continue;
|
665
|
-
}
|
666
|
-
case OP_FORPREP: {
|
667
|
-
const TValue *init = ra;
|
668
|
-
const TValue *plimit = ra+1;
|
669
|
-
const TValue *pstep = ra+2;
|
670
|
-
L->savedpc = pc; /* next steps may throw errors */
|
671
|
-
if (!tonumber(init, ra))
|
672
|
-
luaG_runerror(L, LUA_QL("for") " initial value must be a number");
|
673
|
-
else if (!tonumber(plimit, ra+1))
|
674
|
-
luaG_runerror(L, LUA_QL("for") " limit must be a number");
|
675
|
-
else if (!tonumber(pstep, ra+2))
|
676
|
-
luaG_runerror(L, LUA_QL("for") " step must be a number");
|
677
|
-
setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep)));
|
678
|
-
dojump(L, pc, GETARG_sBx(i));
|
679
|
-
continue;
|
680
|
-
}
|
681
|
-
case OP_TFORLOOP: {
|
682
|
-
StkId cb = ra + 3; /* call base */
|
683
|
-
setobjs2s(L, cb+2, ra+2);
|
684
|
-
setobjs2s(L, cb+1, ra+1);
|
685
|
-
setobjs2s(L, cb, ra);
|
686
|
-
L->top = cb+3; /* func. + 2 args (state and index) */
|
687
|
-
Protect(luaD_call(L, cb, GETARG_C(i)));
|
688
|
-
L->top = L->ci->top;
|
689
|
-
cb = RA(i) + 3; /* previous call may change the stack */
|
690
|
-
if (!ttisnil(cb)) { /* continue loop? */
|
691
|
-
setobjs2s(L, cb-1, cb); /* save control variable */
|
692
|
-
dojump(L, pc, GETARG_sBx(*pc)); /* jump back */
|
693
|
-
}
|
694
|
-
pc++;
|
695
|
-
continue;
|
696
|
-
}
|
697
|
-
case OP_SETLIST: {
|
698
|
-
int n = GETARG_B(i);
|
699
|
-
int c = GETARG_C(i);
|
700
|
-
int last;
|
701
|
-
Table *h;
|
702
|
-
if (n == 0) {
|
703
|
-
n = cast_int(L->top - ra) - 1;
|
704
|
-
L->top = L->ci->top;
|
705
|
-
}
|
706
|
-
if (c == 0) c = cast_int(*pc++);
|
707
|
-
runtime_check(L, ttistable(ra));
|
708
|
-
h = hvalue(ra);
|
709
|
-
last = ((c-1)*LFIELDS_PER_FLUSH) + n;
|
710
|
-
if (last > h->sizearray) /* needs more space? */
|
711
|
-
luaH_resizearray(L, h, last); /* pre-alloc it at once */
|
712
|
-
for (; n > 0; n--) {
|
713
|
-
TValue *val = ra+n;
|
714
|
-
setobj2t(L, luaH_setnum(L, h, last--), val);
|
715
|
-
luaC_barriert(L, h, val);
|
716
|
-
}
|
717
|
-
continue;
|
718
|
-
}
|
719
|
-
case OP_CLOSE: {
|
720
|
-
luaF_close(L, ra);
|
721
|
-
continue;
|
722
|
-
}
|
723
|
-
case OP_CLOSURE: {
|
724
|
-
Proto *p;
|
725
|
-
Closure *ncl;
|
726
|
-
int nup, j;
|
727
|
-
p = cl->p->p[GETARG_Bx(i)];
|
728
|
-
nup = p->nups;
|
729
|
-
ncl = luaF_newLclosure(L, nup, cl->env);
|
730
|
-
ncl->l.p = p;
|
731
|
-
for (j=0; j<nup; j++, pc++) {
|
732
|
-
if (GET_OPCODE(*pc) == OP_GETUPVAL)
|
733
|
-
ncl->l.upvals[j] = cl->upvals[GETARG_B(*pc)];
|
734
|
-
else {
|
735
|
-
lua_assert(GET_OPCODE(*pc) == OP_MOVE);
|
736
|
-
ncl->l.upvals[j] = luaF_findupval(L, base + GETARG_B(*pc));
|
737
|
-
}
|
738
|
-
}
|
739
|
-
setclvalue(L, ra, ncl);
|
740
|
-
Protect(luaC_checkGC(L));
|
741
|
-
continue;
|
742
|
-
}
|
743
|
-
case OP_VARARG: {
|
744
|
-
int b = GETARG_B(i) - 1;
|
745
|
-
int j;
|
746
|
-
CallInfo *ci = L->ci;
|
747
|
-
int n = cast_int(ci->base - ci->func) - cl->p->numparams - 1;
|
748
|
-
if (b == LUA_MULTRET) {
|
749
|
-
Protect(luaD_checkstack(L, n));
|
750
|
-
ra = RA(i); /* previous call may change the stack */
|
751
|
-
b = n;
|
752
|
-
L->top = ra + n;
|
753
|
-
}
|
754
|
-
for (j = 0; j < b; j++) {
|
755
|
-
if (j < n) {
|
756
|
-
setobjs2s(L, ra + j, ci->base - n + j);
|
757
|
-
}
|
758
|
-
else {
|
759
|
-
setnilvalue(ra + j);
|
760
|
-
}
|
761
|
-
}
|
762
|
-
continue;
|
763
|
-
}
|
764
|
-
}
|
765
|
-
}
|
766
|
-
}
|
767
|
-
|