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,38 @@
|
|
1
|
+
/*
|
2
|
+
** Trace recorder for C data operations.
|
3
|
+
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
4
|
+
*/
|
5
|
+
|
6
|
+
#ifndef _LJ_CRECORD_H
|
7
|
+
#define _LJ_CRECORD_H
|
8
|
+
|
9
|
+
#include "lj_obj.h"
|
10
|
+
#include "lj_jit.h"
|
11
|
+
#include "lj_ffrecord.h"
|
12
|
+
|
13
|
+
#if LJ_HASJIT && LJ_HASFFI
|
14
|
+
LJ_FUNC void LJ_FASTCALL recff_cdata_index(jit_State *J, RecordFFData *rd);
|
15
|
+
LJ_FUNC void LJ_FASTCALL recff_cdata_call(jit_State *J, RecordFFData *rd);
|
16
|
+
LJ_FUNC void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd);
|
17
|
+
LJ_FUNC void LJ_FASTCALL recff_clib_index(jit_State *J, RecordFFData *rd);
|
18
|
+
LJ_FUNC void LJ_FASTCALL recff_ffi_new(jit_State *J, RecordFFData *rd);
|
19
|
+
LJ_FUNC void LJ_FASTCALL recff_ffi_errno(jit_State *J, RecordFFData *rd);
|
20
|
+
LJ_FUNC void LJ_FASTCALL recff_ffi_string(jit_State *J, RecordFFData *rd);
|
21
|
+
LJ_FUNC void LJ_FASTCALL recff_ffi_copy(jit_State *J, RecordFFData *rd);
|
22
|
+
LJ_FUNC void LJ_FASTCALL recff_ffi_fill(jit_State *J, RecordFFData *rd);
|
23
|
+
LJ_FUNC void LJ_FASTCALL recff_ffi_typeof(jit_State *J, RecordFFData *rd);
|
24
|
+
LJ_FUNC void LJ_FASTCALL recff_ffi_istype(jit_State *J, RecordFFData *rd);
|
25
|
+
LJ_FUNC void LJ_FASTCALL recff_ffi_abi(jit_State *J, RecordFFData *rd);
|
26
|
+
LJ_FUNC void LJ_FASTCALL recff_ffi_xof(jit_State *J, RecordFFData *rd);
|
27
|
+
LJ_FUNC void LJ_FASTCALL recff_ffi_gc(jit_State *J, RecordFFData *rd);
|
28
|
+
|
29
|
+
LJ_FUNC void LJ_FASTCALL recff_bit64_tobit(jit_State *J, RecordFFData *rd);
|
30
|
+
LJ_FUNC int LJ_FASTCALL recff_bit64_unary(jit_State *J, RecordFFData *rd);
|
31
|
+
LJ_FUNC int LJ_FASTCALL recff_bit64_nary(jit_State *J, RecordFFData *rd);
|
32
|
+
LJ_FUNC int LJ_FASTCALL recff_bit64_shift(jit_State *J, RecordFFData *rd);
|
33
|
+
LJ_FUNC TRef recff_bit64_tohex(jit_State *J, RecordFFData *rd, TRef hdr);
|
34
|
+
|
35
|
+
LJ_FUNC void LJ_FASTCALL lj_crecord_tonumber(jit_State *J, RecordFFData *rd);
|
36
|
+
#endif
|
37
|
+
|
38
|
+
#endif
|
Binary file
|
Binary file
|
@@ -0,0 +1,635 @@
|
|
1
|
+
/*
|
2
|
+
** C type management.
|
3
|
+
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
4
|
+
*/
|
5
|
+
|
6
|
+
#include "lj_obj.h"
|
7
|
+
|
8
|
+
#if LJ_HASFFI
|
9
|
+
|
10
|
+
#include "lj_gc.h"
|
11
|
+
#include "lj_err.h"
|
12
|
+
#include "lj_str.h"
|
13
|
+
#include "lj_tab.h"
|
14
|
+
#include "lj_strfmt.h"
|
15
|
+
#include "lj_ctype.h"
|
16
|
+
#include "lj_ccallback.h"
|
17
|
+
|
18
|
+
/* -- C type definitions -------------------------------------------------- */
|
19
|
+
|
20
|
+
/* Predefined typedefs. */
|
21
|
+
#define CTTDDEF(_) \
|
22
|
+
/* Vararg handling. */ \
|
23
|
+
_("va_list", P_VOID) \
|
24
|
+
_("__builtin_va_list", P_VOID) \
|
25
|
+
_("__gnuc_va_list", P_VOID) \
|
26
|
+
/* From stddef.h. */ \
|
27
|
+
_("ptrdiff_t", INT_PSZ) \
|
28
|
+
_("size_t", UINT_PSZ) \
|
29
|
+
_("wchar_t", WCHAR) \
|
30
|
+
/* Subset of stdint.h. */ \
|
31
|
+
_("int8_t", INT8) \
|
32
|
+
_("int16_t", INT16) \
|
33
|
+
_("int32_t", INT32) \
|
34
|
+
_("int64_t", INT64) \
|
35
|
+
_("uint8_t", UINT8) \
|
36
|
+
_("uint16_t", UINT16) \
|
37
|
+
_("uint32_t", UINT32) \
|
38
|
+
_("uint64_t", UINT64) \
|
39
|
+
_("intptr_t", INT_PSZ) \
|
40
|
+
_("uintptr_t", UINT_PSZ) \
|
41
|
+
/* End of typedef list. */
|
42
|
+
|
43
|
+
/* Keywords (only the ones we actually care for). */
|
44
|
+
#define CTKWDEF(_) \
|
45
|
+
/* Type specifiers. */ \
|
46
|
+
_("void", -1, CTOK_VOID) \
|
47
|
+
_("_Bool", 0, CTOK_BOOL) \
|
48
|
+
_("bool", 1, CTOK_BOOL) \
|
49
|
+
_("char", 1, CTOK_CHAR) \
|
50
|
+
_("int", 4, CTOK_INT) \
|
51
|
+
_("__int8", 1, CTOK_INT) \
|
52
|
+
_("__int16", 2, CTOK_INT) \
|
53
|
+
_("__int32", 4, CTOK_INT) \
|
54
|
+
_("__int64", 8, CTOK_INT) \
|
55
|
+
_("float", 4, CTOK_FP) \
|
56
|
+
_("double", 8, CTOK_FP) \
|
57
|
+
_("long", 0, CTOK_LONG) \
|
58
|
+
_("short", 0, CTOK_SHORT) \
|
59
|
+
_("_Complex", 0, CTOK_COMPLEX) \
|
60
|
+
_("complex", 0, CTOK_COMPLEX) \
|
61
|
+
_("__complex", 0, CTOK_COMPLEX) \
|
62
|
+
_("__complex__", 0, CTOK_COMPLEX) \
|
63
|
+
_("signed", 0, CTOK_SIGNED) \
|
64
|
+
_("__signed", 0, CTOK_SIGNED) \
|
65
|
+
_("__signed__", 0, CTOK_SIGNED) \
|
66
|
+
_("unsigned", 0, CTOK_UNSIGNED) \
|
67
|
+
/* Type qualifiers. */ \
|
68
|
+
_("const", 0, CTOK_CONST) \
|
69
|
+
_("__const", 0, CTOK_CONST) \
|
70
|
+
_("__const__", 0, CTOK_CONST) \
|
71
|
+
_("volatile", 0, CTOK_VOLATILE) \
|
72
|
+
_("__volatile", 0, CTOK_VOLATILE) \
|
73
|
+
_("__volatile__", 0, CTOK_VOLATILE) \
|
74
|
+
_("restrict", 0, CTOK_RESTRICT) \
|
75
|
+
_("__restrict", 0, CTOK_RESTRICT) \
|
76
|
+
_("__restrict__", 0, CTOK_RESTRICT) \
|
77
|
+
_("inline", 0, CTOK_INLINE) \
|
78
|
+
_("__inline", 0, CTOK_INLINE) \
|
79
|
+
_("__inline__", 0, CTOK_INLINE) \
|
80
|
+
/* Storage class specifiers. */ \
|
81
|
+
_("typedef", 0, CTOK_TYPEDEF) \
|
82
|
+
_("extern", 0, CTOK_EXTERN) \
|
83
|
+
_("static", 0, CTOK_STATIC) \
|
84
|
+
_("auto", 0, CTOK_AUTO) \
|
85
|
+
_("register", 0, CTOK_REGISTER) \
|
86
|
+
/* GCC Attributes. */ \
|
87
|
+
_("__extension__", 0, CTOK_EXTENSION) \
|
88
|
+
_("__attribute", 0, CTOK_ATTRIBUTE) \
|
89
|
+
_("__attribute__", 0, CTOK_ATTRIBUTE) \
|
90
|
+
_("asm", 0, CTOK_ASM) \
|
91
|
+
_("__asm", 0, CTOK_ASM) \
|
92
|
+
_("__asm__", 0, CTOK_ASM) \
|
93
|
+
/* MSVC Attributes. */ \
|
94
|
+
_("__declspec", 0, CTOK_DECLSPEC) \
|
95
|
+
_("__cdecl", CTCC_CDECL, CTOK_CCDECL) \
|
96
|
+
_("__thiscall", CTCC_THISCALL, CTOK_CCDECL) \
|
97
|
+
_("__fastcall", CTCC_FASTCALL, CTOK_CCDECL) \
|
98
|
+
_("__stdcall", CTCC_STDCALL, CTOK_CCDECL) \
|
99
|
+
_("__ptr32", 4, CTOK_PTRSZ) \
|
100
|
+
_("__ptr64", 8, CTOK_PTRSZ) \
|
101
|
+
/* Other type specifiers. */ \
|
102
|
+
_("struct", 0, CTOK_STRUCT) \
|
103
|
+
_("union", 0, CTOK_UNION) \
|
104
|
+
_("enum", 0, CTOK_ENUM) \
|
105
|
+
/* Operators. */ \
|
106
|
+
_("sizeof", 0, CTOK_SIZEOF) \
|
107
|
+
_("__alignof", 0, CTOK_ALIGNOF) \
|
108
|
+
_("__alignof__", 0, CTOK_ALIGNOF) \
|
109
|
+
/* End of keyword list. */
|
110
|
+
|
111
|
+
/* Type info for predefined types. Size merged in. */
|
112
|
+
static CTInfo lj_ctype_typeinfo[] = {
|
113
|
+
#define CTTYINFODEF(id, sz, ct, info) CTINFO((ct),(((sz)&0x3fu)<<10)+(info)),
|
114
|
+
#define CTTDINFODEF(name, id) CTINFO(CT_TYPEDEF, CTID_##id),
|
115
|
+
#define CTKWINFODEF(name, sz, kw) CTINFO(CT_KW,(((sz)&0x3fu)<<10)+(kw)),
|
116
|
+
CTTYDEF(CTTYINFODEF)
|
117
|
+
CTTDDEF(CTTDINFODEF)
|
118
|
+
CTKWDEF(CTKWINFODEF)
|
119
|
+
#undef CTTYINFODEF
|
120
|
+
#undef CTTDINFODEF
|
121
|
+
#undef CTKWINFODEF
|
122
|
+
0
|
123
|
+
};
|
124
|
+
|
125
|
+
/* Predefined type names collected in a single string. */
|
126
|
+
static const char * const lj_ctype_typenames =
|
127
|
+
#define CTTDNAMEDEF(name, id) name "\0"
|
128
|
+
#define CTKWNAMEDEF(name, sz, cds) name "\0"
|
129
|
+
CTTDDEF(CTTDNAMEDEF)
|
130
|
+
CTKWDEF(CTKWNAMEDEF)
|
131
|
+
#undef CTTDNAMEDEF
|
132
|
+
#undef CTKWNAMEDEF
|
133
|
+
;
|
134
|
+
|
135
|
+
#define CTTYPEINFO_NUM (sizeof(lj_ctype_typeinfo)/sizeof(CTInfo)-1)
|
136
|
+
#ifdef LUAJIT_CTYPE_CHECK_ANCHOR
|
137
|
+
#define CTTYPETAB_MIN CTTYPEINFO_NUM
|
138
|
+
#else
|
139
|
+
#define CTTYPETAB_MIN 128
|
140
|
+
#endif
|
141
|
+
|
142
|
+
/* -- C type interning ---------------------------------------------------- */
|
143
|
+
|
144
|
+
#define ct_hashtype(info, size) (hashrot(info, size) & CTHASH_MASK)
|
145
|
+
#define ct_hashname(name) \
|
146
|
+
(hashrot(u32ptr(name), u32ptr(name) + HASH_BIAS) & CTHASH_MASK)
|
147
|
+
|
148
|
+
/* Create new type element. */
|
149
|
+
CTypeID lj_ctype_new(CTState *cts, CType **ctp)
|
150
|
+
{
|
151
|
+
CTypeID id = cts->top;
|
152
|
+
CType *ct;
|
153
|
+
lua_assert(cts->L);
|
154
|
+
if (LJ_UNLIKELY(id >= cts->sizetab)) {
|
155
|
+
if (id >= CTID_MAX) lj_err_msg(cts->L, LJ_ERR_TABOV);
|
156
|
+
#ifdef LUAJIT_CTYPE_CHECK_ANCHOR
|
157
|
+
ct = lj_mem_newvec(cts->L, id+1, CType);
|
158
|
+
memcpy(ct, cts->tab, id*sizeof(CType));
|
159
|
+
memset(cts->tab, 0, id*sizeof(CType));
|
160
|
+
lj_mem_freevec(cts->g, cts->tab, cts->sizetab, CType);
|
161
|
+
cts->tab = ct;
|
162
|
+
cts->sizetab = id+1;
|
163
|
+
#else
|
164
|
+
lj_mem_growvec(cts->L, cts->tab, cts->sizetab, CTID_MAX, CType);
|
165
|
+
#endif
|
166
|
+
}
|
167
|
+
cts->top = id+1;
|
168
|
+
*ctp = ct = &cts->tab[id];
|
169
|
+
ct->info = 0;
|
170
|
+
ct->size = 0;
|
171
|
+
ct->sib = 0;
|
172
|
+
ct->next = 0;
|
173
|
+
setgcrefnull(ct->name);
|
174
|
+
return id;
|
175
|
+
}
|
176
|
+
|
177
|
+
/* Intern a type element. */
|
178
|
+
CTypeID lj_ctype_intern(CTState *cts, CTInfo info, CTSize size)
|
179
|
+
{
|
180
|
+
uint32_t h = ct_hashtype(info, size);
|
181
|
+
CTypeID id = cts->hash[h];
|
182
|
+
lua_assert(cts->L);
|
183
|
+
while (id) {
|
184
|
+
CType *ct = ctype_get(cts, id);
|
185
|
+
if (ct->info == info && ct->size == size)
|
186
|
+
return id;
|
187
|
+
id = ct->next;
|
188
|
+
}
|
189
|
+
id = cts->top;
|
190
|
+
if (LJ_UNLIKELY(id >= cts->sizetab)) {
|
191
|
+
if (id >= CTID_MAX) lj_err_msg(cts->L, LJ_ERR_TABOV);
|
192
|
+
lj_mem_growvec(cts->L, cts->tab, cts->sizetab, CTID_MAX, CType);
|
193
|
+
}
|
194
|
+
cts->top = id+1;
|
195
|
+
cts->tab[id].info = info;
|
196
|
+
cts->tab[id].size = size;
|
197
|
+
cts->tab[id].sib = 0;
|
198
|
+
cts->tab[id].next = cts->hash[h];
|
199
|
+
setgcrefnull(cts->tab[id].name);
|
200
|
+
cts->hash[h] = (CTypeID1)id;
|
201
|
+
return id;
|
202
|
+
}
|
203
|
+
|
204
|
+
/* Add type element to hash table. */
|
205
|
+
static void ctype_addtype(CTState *cts, CType *ct, CTypeID id)
|
206
|
+
{
|
207
|
+
uint32_t h = ct_hashtype(ct->info, ct->size);
|
208
|
+
ct->next = cts->hash[h];
|
209
|
+
cts->hash[h] = (CTypeID1)id;
|
210
|
+
}
|
211
|
+
|
212
|
+
/* Add named element to hash table. */
|
213
|
+
void lj_ctype_addname(CTState *cts, CType *ct, CTypeID id)
|
214
|
+
{
|
215
|
+
uint32_t h = ct_hashname(gcref(ct->name));
|
216
|
+
ct->next = cts->hash[h];
|
217
|
+
cts->hash[h] = (CTypeID1)id;
|
218
|
+
}
|
219
|
+
|
220
|
+
/* Get a C type by name, matching the type mask. */
|
221
|
+
CTypeID lj_ctype_getname(CTState *cts, CType **ctp, GCstr *name, uint32_t tmask)
|
222
|
+
{
|
223
|
+
CTypeID id = cts->hash[ct_hashname(name)];
|
224
|
+
while (id) {
|
225
|
+
CType *ct = ctype_get(cts, id);
|
226
|
+
if (gcref(ct->name) == obj2gco(name) &&
|
227
|
+
((tmask >> ctype_type(ct->info)) & 1)) {
|
228
|
+
*ctp = ct;
|
229
|
+
return id;
|
230
|
+
}
|
231
|
+
id = ct->next;
|
232
|
+
}
|
233
|
+
*ctp = &cts->tab[0]; /* Simplify caller logic. ctype_get() would assert. */
|
234
|
+
return 0;
|
235
|
+
}
|
236
|
+
|
237
|
+
/* Get a struct/union/enum/function field by name. */
|
238
|
+
CType *lj_ctype_getfieldq(CTState *cts, CType *ct, GCstr *name, CTSize *ofs,
|
239
|
+
CTInfo *qual)
|
240
|
+
{
|
241
|
+
while (ct->sib) {
|
242
|
+
ct = ctype_get(cts, ct->sib);
|
243
|
+
if (gcref(ct->name) == obj2gco(name)) {
|
244
|
+
*ofs = ct->size;
|
245
|
+
return ct;
|
246
|
+
}
|
247
|
+
if (ctype_isxattrib(ct->info, CTA_SUBTYPE)) {
|
248
|
+
CType *fct, *cct = ctype_child(cts, ct);
|
249
|
+
CTInfo q = 0;
|
250
|
+
while (ctype_isattrib(cct->info)) {
|
251
|
+
if (ctype_attrib(cct->info) == CTA_QUAL) q |= cct->size;
|
252
|
+
cct = ctype_child(cts, cct);
|
253
|
+
}
|
254
|
+
fct = lj_ctype_getfieldq(cts, cct, name, ofs, qual);
|
255
|
+
if (fct) {
|
256
|
+
if (qual) *qual |= q;
|
257
|
+
*ofs += ct->size;
|
258
|
+
return fct;
|
259
|
+
}
|
260
|
+
}
|
261
|
+
}
|
262
|
+
return NULL; /* Not found. */
|
263
|
+
}
|
264
|
+
|
265
|
+
/* -- C type information -------------------------------------------------- */
|
266
|
+
|
267
|
+
/* Follow references and get raw type for a C type ID. */
|
268
|
+
CType *lj_ctype_rawref(CTState *cts, CTypeID id)
|
269
|
+
{
|
270
|
+
CType *ct = ctype_get(cts, id);
|
271
|
+
while (ctype_isattrib(ct->info) || ctype_isref(ct->info))
|
272
|
+
ct = ctype_child(cts, ct);
|
273
|
+
return ct;
|
274
|
+
}
|
275
|
+
|
276
|
+
/* Get size for a C type ID. Does NOT support VLA/VLS. */
|
277
|
+
CTSize lj_ctype_size(CTState *cts, CTypeID id)
|
278
|
+
{
|
279
|
+
CType *ct = ctype_raw(cts, id);
|
280
|
+
return ctype_hassize(ct->info) ? ct->size : CTSIZE_INVALID;
|
281
|
+
}
|
282
|
+
|
283
|
+
/* Get size for a variable-length C type. Does NOT support other C types. */
|
284
|
+
CTSize lj_ctype_vlsize(CTState *cts, CType *ct, CTSize nelem)
|
285
|
+
{
|
286
|
+
uint64_t xsz = 0;
|
287
|
+
if (ctype_isstruct(ct->info)) {
|
288
|
+
CTypeID arrid = 0, fid = ct->sib;
|
289
|
+
xsz = ct->size; /* Add the struct size. */
|
290
|
+
while (fid) {
|
291
|
+
CType *ctf = ctype_get(cts, fid);
|
292
|
+
if (ctype_type(ctf->info) == CT_FIELD)
|
293
|
+
arrid = ctype_cid(ctf->info); /* Remember last field of VLS. */
|
294
|
+
fid = ctf->sib;
|
295
|
+
}
|
296
|
+
ct = ctype_raw(cts, arrid);
|
297
|
+
}
|
298
|
+
lua_assert(ctype_isvlarray(ct->info)); /* Must be a VLA. */
|
299
|
+
ct = ctype_rawchild(cts, ct); /* Get array element. */
|
300
|
+
lua_assert(ctype_hassize(ct->info));
|
301
|
+
/* Calculate actual size of VLA and check for overflow. */
|
302
|
+
xsz += (uint64_t)ct->size * nelem;
|
303
|
+
return xsz < 0x80000000u ? (CTSize)xsz : CTSIZE_INVALID;
|
304
|
+
}
|
305
|
+
|
306
|
+
/* Get type, qualifiers, size and alignment for a C type ID. */
|
307
|
+
CTInfo lj_ctype_info(CTState *cts, CTypeID id, CTSize *szp)
|
308
|
+
{
|
309
|
+
CTInfo qual = 0;
|
310
|
+
CType *ct = ctype_get(cts, id);
|
311
|
+
for (;;) {
|
312
|
+
CTInfo info = ct->info;
|
313
|
+
if (ctype_isenum(info)) {
|
314
|
+
/* Follow child. Need to look at its attributes, too. */
|
315
|
+
} else if (ctype_isattrib(info)) {
|
316
|
+
if (ctype_isxattrib(info, CTA_QUAL))
|
317
|
+
qual |= ct->size;
|
318
|
+
else if (ctype_isxattrib(info, CTA_ALIGN) && !(qual & CTFP_ALIGNED))
|
319
|
+
qual |= CTFP_ALIGNED + CTALIGN(ct->size);
|
320
|
+
} else {
|
321
|
+
if (!(qual & CTFP_ALIGNED)) qual |= (info & CTF_ALIGN);
|
322
|
+
qual |= (info & ~(CTF_ALIGN|CTMASK_CID));
|
323
|
+
lua_assert(ctype_hassize(info) || ctype_isfunc(info));
|
324
|
+
*szp = ctype_isfunc(info) ? CTSIZE_INVALID : ct->size;
|
325
|
+
break;
|
326
|
+
}
|
327
|
+
ct = ctype_get(cts, ctype_cid(info));
|
328
|
+
}
|
329
|
+
return qual;
|
330
|
+
}
|
331
|
+
|
332
|
+
/* Get ctype metamethod. */
|
333
|
+
cTValue *lj_ctype_meta(CTState *cts, CTypeID id, MMS mm)
|
334
|
+
{
|
335
|
+
CType *ct = ctype_get(cts, id);
|
336
|
+
cTValue *tv;
|
337
|
+
while (ctype_isattrib(ct->info) || ctype_isref(ct->info)) {
|
338
|
+
id = ctype_cid(ct->info);
|
339
|
+
ct = ctype_get(cts, id);
|
340
|
+
}
|
341
|
+
if (ctype_isptr(ct->info) &&
|
342
|
+
ctype_isfunc(ctype_get(cts, ctype_cid(ct->info))->info))
|
343
|
+
tv = lj_tab_getstr(cts->miscmap, &cts->g->strempty);
|
344
|
+
else
|
345
|
+
tv = lj_tab_getinth(cts->miscmap, -(int32_t)id);
|
346
|
+
if (tv && tvistab(tv) &&
|
347
|
+
(tv = lj_tab_getstr(tabV(tv), mmname_str(cts->g, mm))) && !tvisnil(tv))
|
348
|
+
return tv;
|
349
|
+
return NULL;
|
350
|
+
}
|
351
|
+
|
352
|
+
/* -- C type representation ----------------------------------------------- */
|
353
|
+
|
354
|
+
/* Fixed max. length of a C type representation. */
|
355
|
+
#define CTREPR_MAX 512
|
356
|
+
|
357
|
+
typedef struct CTRepr {
|
358
|
+
char *pb, *pe;
|
359
|
+
CTState *cts;
|
360
|
+
lua_State *L;
|
361
|
+
int needsp;
|
362
|
+
int ok;
|
363
|
+
char buf[CTREPR_MAX];
|
364
|
+
} CTRepr;
|
365
|
+
|
366
|
+
/* Prepend string. */
|
367
|
+
static void ctype_prepstr(CTRepr *ctr, const char *str, MSize len)
|
368
|
+
{
|
369
|
+
char *p = ctr->pb;
|
370
|
+
if (ctr->buf + len+1 > p) { ctr->ok = 0; return; }
|
371
|
+
if (ctr->needsp) *--p = ' ';
|
372
|
+
ctr->needsp = 1;
|
373
|
+
p -= len;
|
374
|
+
while (len-- > 0) p[len] = str[len];
|
375
|
+
ctr->pb = p;
|
376
|
+
}
|
377
|
+
|
378
|
+
#define ctype_preplit(ctr, str) ctype_prepstr((ctr), "" str, sizeof(str)-1)
|
379
|
+
|
380
|
+
/* Prepend char. */
|
381
|
+
static void ctype_prepc(CTRepr *ctr, int c)
|
382
|
+
{
|
383
|
+
if (ctr->buf >= ctr->pb) { ctr->ok = 0; return; }
|
384
|
+
*--ctr->pb = c;
|
385
|
+
}
|
386
|
+
|
387
|
+
/* Prepend number. */
|
388
|
+
static void ctype_prepnum(CTRepr *ctr, uint32_t n)
|
389
|
+
{
|
390
|
+
char *p = ctr->pb;
|
391
|
+
if (ctr->buf + 10+1 > p) { ctr->ok = 0; return; }
|
392
|
+
do { *--p = (char)('0' + n % 10); } while (n /= 10);
|
393
|
+
ctr->pb = p;
|
394
|
+
ctr->needsp = 0;
|
395
|
+
}
|
396
|
+
|
397
|
+
/* Append char. */
|
398
|
+
static void ctype_appc(CTRepr *ctr, int c)
|
399
|
+
{
|
400
|
+
if (ctr->pe >= ctr->buf + CTREPR_MAX) { ctr->ok = 0; return; }
|
401
|
+
*ctr->pe++ = c;
|
402
|
+
}
|
403
|
+
|
404
|
+
/* Append number. */
|
405
|
+
static void ctype_appnum(CTRepr *ctr, uint32_t n)
|
406
|
+
{
|
407
|
+
char buf[10];
|
408
|
+
char *p = buf+sizeof(buf);
|
409
|
+
char *q = ctr->pe;
|
410
|
+
if (q > ctr->buf + CTREPR_MAX - 10) { ctr->ok = 0; return; }
|
411
|
+
do { *--p = (char)('0' + n % 10); } while (n /= 10);
|
412
|
+
do { *q++ = *p++; } while (p < buf+sizeof(buf));
|
413
|
+
ctr->pe = q;
|
414
|
+
}
|
415
|
+
|
416
|
+
/* Prepend qualifiers. */
|
417
|
+
static void ctype_prepqual(CTRepr *ctr, CTInfo info)
|
418
|
+
{
|
419
|
+
if ((info & CTF_VOLATILE)) ctype_preplit(ctr, "volatile");
|
420
|
+
if ((info & CTF_CONST)) ctype_preplit(ctr, "const");
|
421
|
+
}
|
422
|
+
|
423
|
+
/* Prepend named type. */
|
424
|
+
static void ctype_preptype(CTRepr *ctr, CType *ct, CTInfo qual, const char *t)
|
425
|
+
{
|
426
|
+
if (gcref(ct->name)) {
|
427
|
+
GCstr *str = gco2str(gcref(ct->name));
|
428
|
+
ctype_prepstr(ctr, strdata(str), str->len);
|
429
|
+
} else {
|
430
|
+
if (ctr->needsp) ctype_prepc(ctr, ' ');
|
431
|
+
ctype_prepnum(ctr, ctype_typeid(ctr->cts, ct));
|
432
|
+
ctr->needsp = 1;
|
433
|
+
}
|
434
|
+
ctype_prepstr(ctr, t, (MSize)strlen(t));
|
435
|
+
ctype_prepqual(ctr, qual);
|
436
|
+
}
|
437
|
+
|
438
|
+
static void ctype_repr(CTRepr *ctr, CTypeID id)
|
439
|
+
{
|
440
|
+
CType *ct = ctype_get(ctr->cts, id);
|
441
|
+
CTInfo qual = 0;
|
442
|
+
int ptrto = 0;
|
443
|
+
for (;;) {
|
444
|
+
CTInfo info = ct->info;
|
445
|
+
CTSize size = ct->size;
|
446
|
+
switch (ctype_type(info)) {
|
447
|
+
case CT_NUM:
|
448
|
+
if ((info & CTF_BOOL)) {
|
449
|
+
ctype_preplit(ctr, "bool");
|
450
|
+
} else if ((info & CTF_FP)) {
|
451
|
+
if (size == sizeof(double)) ctype_preplit(ctr, "double");
|
452
|
+
else if (size == sizeof(float)) ctype_preplit(ctr, "float");
|
453
|
+
else ctype_preplit(ctr, "long double");
|
454
|
+
} else if (size == 1) {
|
455
|
+
if (!((info ^ CTF_UCHAR) & CTF_UNSIGNED)) ctype_preplit(ctr, "char");
|
456
|
+
else if (CTF_UCHAR) ctype_preplit(ctr, "signed char");
|
457
|
+
else ctype_preplit(ctr, "unsigned char");
|
458
|
+
} else if (size < 8) {
|
459
|
+
if (size == 4) ctype_preplit(ctr, "int");
|
460
|
+
else ctype_preplit(ctr, "short");
|
461
|
+
if ((info & CTF_UNSIGNED)) ctype_preplit(ctr, "unsigned");
|
462
|
+
} else {
|
463
|
+
ctype_preplit(ctr, "_t");
|
464
|
+
ctype_prepnum(ctr, size*8);
|
465
|
+
ctype_preplit(ctr, "int");
|
466
|
+
if ((info & CTF_UNSIGNED)) ctype_prepc(ctr, 'u');
|
467
|
+
}
|
468
|
+
ctype_prepqual(ctr, (qual|info));
|
469
|
+
return;
|
470
|
+
case CT_VOID:
|
471
|
+
ctype_preplit(ctr, "void");
|
472
|
+
ctype_prepqual(ctr, (qual|info));
|
473
|
+
return;
|
474
|
+
case CT_STRUCT:
|
475
|
+
ctype_preptype(ctr, ct, qual, (info & CTF_UNION) ? "union" : "struct");
|
476
|
+
return;
|
477
|
+
case CT_ENUM:
|
478
|
+
if (id == CTID_CTYPEID) {
|
479
|
+
ctype_preplit(ctr, "ctype");
|
480
|
+
return;
|
481
|
+
}
|
482
|
+
ctype_preptype(ctr, ct, qual, "enum");
|
483
|
+
return;
|
484
|
+
case CT_ATTRIB:
|
485
|
+
if (ctype_attrib(info) == CTA_QUAL) qual |= size;
|
486
|
+
break;
|
487
|
+
case CT_PTR:
|
488
|
+
if ((info & CTF_REF)) {
|
489
|
+
ctype_prepc(ctr, '&');
|
490
|
+
} else {
|
491
|
+
ctype_prepqual(ctr, (qual|info));
|
492
|
+
if (LJ_64 && size == 4) ctype_preplit(ctr, "__ptr32");
|
493
|
+
ctype_prepc(ctr, '*');
|
494
|
+
}
|
495
|
+
qual = 0;
|
496
|
+
ptrto = 1;
|
497
|
+
ctr->needsp = 1;
|
498
|
+
break;
|
499
|
+
case CT_ARRAY:
|
500
|
+
if (ctype_isrefarray(info)) {
|
501
|
+
ctr->needsp = 1;
|
502
|
+
if (ptrto) { ptrto = 0; ctype_prepc(ctr, '('); ctype_appc(ctr, ')'); }
|
503
|
+
ctype_appc(ctr, '[');
|
504
|
+
if (size != CTSIZE_INVALID) {
|
505
|
+
CTSize csize = ctype_child(ctr->cts, ct)->size;
|
506
|
+
ctype_appnum(ctr, csize ? size/csize : 0);
|
507
|
+
} else if ((info & CTF_VLA)) {
|
508
|
+
ctype_appc(ctr, '?');
|
509
|
+
}
|
510
|
+
ctype_appc(ctr, ']');
|
511
|
+
} else if ((info & CTF_COMPLEX)) {
|
512
|
+
if (size == 2*sizeof(float)) ctype_preplit(ctr, "float");
|
513
|
+
ctype_preplit(ctr, "complex");
|
514
|
+
return;
|
515
|
+
} else {
|
516
|
+
ctype_preplit(ctr, ")))");
|
517
|
+
ctype_prepnum(ctr, size);
|
518
|
+
ctype_preplit(ctr, "__attribute__((vector_size(");
|
519
|
+
}
|
520
|
+
break;
|
521
|
+
case CT_FUNC:
|
522
|
+
ctr->needsp = 1;
|
523
|
+
if (ptrto) { ptrto = 0; ctype_prepc(ctr, '('); ctype_appc(ctr, ')'); }
|
524
|
+
ctype_appc(ctr, '(');
|
525
|
+
ctype_appc(ctr, ')');
|
526
|
+
break;
|
527
|
+
default:
|
528
|
+
lua_assert(0);
|
529
|
+
break;
|
530
|
+
}
|
531
|
+
ct = ctype_get(ctr->cts, ctype_cid(info));
|
532
|
+
}
|
533
|
+
}
|
534
|
+
|
535
|
+
/* Return a printable representation of a C type. */
|
536
|
+
GCstr *lj_ctype_repr(lua_State *L, CTypeID id, GCstr *name)
|
537
|
+
{
|
538
|
+
global_State *g = G(L);
|
539
|
+
CTRepr ctr;
|
540
|
+
ctr.pb = ctr.pe = &ctr.buf[CTREPR_MAX/2];
|
541
|
+
ctr.cts = ctype_ctsG(g);
|
542
|
+
ctr.L = L;
|
543
|
+
ctr.ok = 1;
|
544
|
+
ctr.needsp = 0;
|
545
|
+
if (name) ctype_prepstr(&ctr, strdata(name), name->len);
|
546
|
+
ctype_repr(&ctr, id);
|
547
|
+
if (LJ_UNLIKELY(!ctr.ok)) return lj_str_newlit(L, "?");
|
548
|
+
return lj_str_new(L, ctr.pb, ctr.pe - ctr.pb);
|
549
|
+
}
|
550
|
+
|
551
|
+
/* Convert int64_t/uint64_t to string with 'LL' or 'ULL' suffix. */
|
552
|
+
GCstr *lj_ctype_repr_int64(lua_State *L, uint64_t n, int isunsigned)
|
553
|
+
{
|
554
|
+
char buf[1+20+3];
|
555
|
+
char *p = buf+sizeof(buf);
|
556
|
+
int sign = 0;
|
557
|
+
*--p = 'L'; *--p = 'L';
|
558
|
+
if (isunsigned) {
|
559
|
+
*--p = 'U';
|
560
|
+
} else if ((int64_t)n < 0) {
|
561
|
+
n = (uint64_t)-(int64_t)n;
|
562
|
+
sign = 1;
|
563
|
+
}
|
564
|
+
do { *--p = (char)('0' + n % 10); } while (n /= 10);
|
565
|
+
if (sign) *--p = '-';
|
566
|
+
return lj_str_new(L, p, (size_t)(buf+sizeof(buf)-p));
|
567
|
+
}
|
568
|
+
|
569
|
+
/* Convert complex to string with 'i' or 'I' suffix. */
|
570
|
+
GCstr *lj_ctype_repr_complex(lua_State *L, void *sp, CTSize size)
|
571
|
+
{
|
572
|
+
char buf[2*STRFMT_MAXBUF_NUM+2+1], *p = buf;
|
573
|
+
TValue re, im;
|
574
|
+
if (size == 2*sizeof(double)) {
|
575
|
+
re.n = *(double *)sp; im.n = ((double *)sp)[1];
|
576
|
+
} else {
|
577
|
+
re.n = (double)*(float *)sp; im.n = (double)((float *)sp)[1];
|
578
|
+
}
|
579
|
+
p = lj_strfmt_wnum(p, &re);
|
580
|
+
if (!(im.u32.hi & 0x80000000u) || im.n != im.n) *p++ = '+';
|
581
|
+
p = lj_strfmt_wnum(p, &im);
|
582
|
+
*p = *(p-1) >= 'a' ? 'I' : 'i';
|
583
|
+
p++;
|
584
|
+
return lj_str_new(L, buf, p-buf);
|
585
|
+
}
|
586
|
+
|
587
|
+
/* -- C type state -------------------------------------------------------- */
|
588
|
+
|
589
|
+
/* Initialize C type table and state. */
|
590
|
+
CTState *lj_ctype_init(lua_State *L)
|
591
|
+
{
|
592
|
+
CTState *cts = lj_mem_newt(L, sizeof(CTState), CTState);
|
593
|
+
CType *ct = lj_mem_newvec(L, CTTYPETAB_MIN, CType);
|
594
|
+
const char *name = lj_ctype_typenames;
|
595
|
+
CTypeID id;
|
596
|
+
memset(cts, 0, sizeof(CTState));
|
597
|
+
cts->tab = ct;
|
598
|
+
cts->sizetab = CTTYPETAB_MIN;
|
599
|
+
cts->top = CTTYPEINFO_NUM;
|
600
|
+
cts->L = NULL;
|
601
|
+
cts->g = G(L);
|
602
|
+
for (id = 0; id < CTTYPEINFO_NUM; id++, ct++) {
|
603
|
+
CTInfo info = lj_ctype_typeinfo[id];
|
604
|
+
ct->size = (CTSize)((int32_t)(info << 16) >> 26);
|
605
|
+
ct->info = info & 0xffff03ffu;
|
606
|
+
ct->sib = 0;
|
607
|
+
if (ctype_type(info) == CT_KW || ctype_istypedef(info)) {
|
608
|
+
size_t len = strlen(name);
|
609
|
+
GCstr *str = lj_str_new(L, name, len);
|
610
|
+
ctype_setname(ct, str);
|
611
|
+
name += len+1;
|
612
|
+
lj_ctype_addname(cts, ct, id);
|
613
|
+
} else {
|
614
|
+
setgcrefnull(ct->name);
|
615
|
+
ct->next = 0;
|
616
|
+
if (!ctype_isenum(info)) ctype_addtype(cts, ct, id);
|
617
|
+
}
|
618
|
+
}
|
619
|
+
setmref(G(L)->ctype_state, cts);
|
620
|
+
return cts;
|
621
|
+
}
|
622
|
+
|
623
|
+
/* Free C type table and state. */
|
624
|
+
void lj_ctype_freestate(global_State *g)
|
625
|
+
{
|
626
|
+
CTState *cts = ctype_ctsG(g);
|
627
|
+
if (cts) {
|
628
|
+
lj_ccallback_mcode_free(cts);
|
629
|
+
lj_mem_freevec(g, cts->tab, cts->sizetab, CType);
|
630
|
+
lj_mem_freevec(g, cts->cb.cbid, cts->cb.sizeid, CTypeID1);
|
631
|
+
lj_mem_freet(g, cts);
|
632
|
+
}
|
633
|
+
}
|
634
|
+
|
635
|
+
#endif
|