immunio 0.15.4 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (454) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +0 -27
  3. data/ext/immunio/Rakefile +9 -0
  4. data/lib/immunio/plugins/active_record.rb +1 -1
  5. data/lib/immunio/plugins/active_record_relation.rb +1 -1
  6. data/lib/immunio/plugins/environment_reporter.rb +20 -0
  7. data/lib/immunio/rufus_lua_ext/ref.rb +1 -3
  8. data/lib/immunio/version.rb +1 -1
  9. data/lib/immunio/vm.rb +1 -2
  10. data/lua-hooks/Makefile +97 -0
  11. data/lua-hooks/ext/all.c +41 -52
  12. data/lua-hooks/ext/all.o +0 -0
  13. data/lua-hooks/ext/libinjection/libinjection_html5.o +0 -0
  14. data/lua-hooks/ext/libinjection/libinjection_sqli.o +0 -0
  15. data/lua-hooks/ext/libinjection/libinjection_xss.o +0 -0
  16. data/lua-hooks/ext/libinjection/lualib.c +2 -2
  17. data/lua-hooks/ext/lpeg/lpcap.c +2 -2
  18. data/lua-hooks/ext/lpeg/lpcap.o +0 -0
  19. data/lua-hooks/ext/lpeg/lpcode.c +2 -2
  20. data/lua-hooks/ext/lpeg/lpcode.h +1 -1
  21. data/lua-hooks/ext/lpeg/lpcode.o +0 -0
  22. data/lua-hooks/ext/lpeg/lpprint.o +0 -0
  23. data/lua-hooks/ext/lpeg/lptree.c +2 -2
  24. data/lua-hooks/ext/lpeg/lptypes.h +1 -1
  25. data/lua-hooks/ext/lpeg/lpvm.c +2 -2
  26. data/lua-hooks/ext/lpeg/lpvm.o +0 -0
  27. data/lua-hooks/ext/lua-cmsgpack/lua_cmsgpack.c +16 -3
  28. data/lua-hooks/ext/lua-snapshot/snapshot.c +14 -7
  29. data/lua-hooks/ext/luajit/COPYRIGHT +56 -0
  30. data/lua-hooks/ext/luajit/Makefile +159 -0
  31. data/lua-hooks/ext/luajit/README +16 -0
  32. data/lua-hooks/ext/luajit/doc/bluequad-print.css +166 -0
  33. data/lua-hooks/ext/luajit/doc/bluequad.css +325 -0
  34. data/lua-hooks/ext/luajit/doc/changes.html +804 -0
  35. data/lua-hooks/ext/luajit/doc/contact.html +104 -0
  36. data/lua-hooks/ext/luajit/doc/ext_c_api.html +189 -0
  37. data/lua-hooks/ext/luajit/doc/ext_ffi.html +332 -0
  38. data/lua-hooks/ext/luajit/doc/ext_ffi_api.html +570 -0
  39. data/lua-hooks/ext/luajit/doc/ext_ffi_semantics.html +1261 -0
  40. data/lua-hooks/ext/luajit/doc/ext_ffi_tutorial.html +603 -0
  41. data/lua-hooks/ext/luajit/doc/ext_jit.html +201 -0
  42. data/lua-hooks/ext/luajit/doc/ext_profiler.html +365 -0
  43. data/lua-hooks/ext/luajit/doc/extensions.html +448 -0
  44. data/lua-hooks/ext/luajit/doc/faq.html +186 -0
  45. data/lua-hooks/ext/luajit/doc/img/contact.png +0 -0
  46. data/lua-hooks/ext/luajit/doc/install.html +659 -0
  47. data/lua-hooks/ext/luajit/doc/luajit.html +236 -0
  48. data/lua-hooks/ext/luajit/doc/running.html +309 -0
  49. data/lua-hooks/ext/luajit/doc/status.html +118 -0
  50. data/lua-hooks/ext/luajit/dynasm/dasm_arm.h +456 -0
  51. data/lua-hooks/ext/luajit/dynasm/dasm_arm.lua +1125 -0
  52. data/lua-hooks/ext/luajit/dynasm/dasm_arm64.h +518 -0
  53. data/lua-hooks/ext/luajit/dynasm/dasm_arm64.lua +1166 -0
  54. data/lua-hooks/ext/luajit/dynasm/dasm_mips.h +416 -0
  55. data/lua-hooks/ext/luajit/dynasm/dasm_mips.lua +953 -0
  56. data/lua-hooks/ext/luajit/dynasm/dasm_ppc.h +419 -0
  57. data/lua-hooks/ext/luajit/dynasm/dasm_ppc.lua +1919 -0
  58. data/lua-hooks/ext/luajit/dynasm/dasm_proto.h +83 -0
  59. data/lua-hooks/ext/luajit/dynasm/dasm_x64.lua +12 -0
  60. data/lua-hooks/ext/luajit/dynasm/dasm_x86.h +471 -0
  61. data/lua-hooks/ext/luajit/dynasm/dasm_x86.lua +1945 -0
  62. data/lua-hooks/ext/luajit/dynasm/dynasm.lua +1094 -0
  63. data/lua-hooks/ext/luajit/etc/luajit.1 +88 -0
  64. data/lua-hooks/ext/luajit/etc/luajit.pc +25 -0
  65. data/lua-hooks/ext/luajit/src/Makefile +697 -0
  66. data/lua-hooks/ext/luajit/src/Makefile.dep +244 -0
  67. data/lua-hooks/ext/luajit/src/host/README +4 -0
  68. data/lua-hooks/ext/luajit/src/host/buildvm +0 -0
  69. data/lua-hooks/ext/luajit/src/host/buildvm.c +518 -0
  70. data/lua-hooks/ext/luajit/src/host/buildvm.h +105 -0
  71. data/lua-hooks/ext/luajit/src/host/buildvm.o +0 -0
  72. data/lua-hooks/ext/luajit/src/host/buildvm_arch.h +7449 -0
  73. data/lua-hooks/ext/luajit/src/host/buildvm_asm.c +345 -0
  74. data/lua-hooks/ext/luajit/src/host/buildvm_asm.o +0 -0
  75. data/lua-hooks/ext/luajit/src/host/buildvm_fold.c +229 -0
  76. data/lua-hooks/ext/luajit/src/host/buildvm_fold.o +0 -0
  77. data/lua-hooks/ext/luajit/src/host/buildvm_lib.c +457 -0
  78. data/lua-hooks/ext/luajit/src/host/buildvm_lib.o +0 -0
  79. data/lua-hooks/ext/luajit/src/host/buildvm_libbc.h +45 -0
  80. data/lua-hooks/ext/luajit/src/host/buildvm_peobj.c +368 -0
  81. data/lua-hooks/ext/luajit/src/host/buildvm_peobj.o +0 -0
  82. data/lua-hooks/ext/luajit/src/host/genlibbc.lua +197 -0
  83. data/lua-hooks/ext/luajit/src/host/genminilua.lua +428 -0
  84. data/lua-hooks/ext/luajit/src/host/minilua +0 -0
  85. data/lua-hooks/ext/luajit/src/host/minilua.c +7770 -0
  86. data/lua-hooks/ext/luajit/src/host/minilua.o +0 -0
  87. data/lua-hooks/ext/luajit/src/jit/bc.lua +190 -0
  88. data/lua-hooks/ext/luajit/src/jit/bcsave.lua +661 -0
  89. data/lua-hooks/ext/luajit/src/jit/dis_arm.lua +689 -0
  90. data/lua-hooks/ext/luajit/src/jit/dis_mips.lua +428 -0
  91. data/lua-hooks/ext/luajit/src/jit/dis_mipsel.lua +17 -0
  92. data/lua-hooks/ext/luajit/src/jit/dis_ppc.lua +591 -0
  93. data/lua-hooks/ext/luajit/src/jit/dis_x64.lua +17 -0
  94. data/lua-hooks/ext/luajit/src/jit/dis_x86.lua +838 -0
  95. data/lua-hooks/ext/luajit/src/jit/dump.lua +706 -0
  96. data/lua-hooks/ext/luajit/src/jit/p.lua +310 -0
  97. data/lua-hooks/ext/luajit/src/jit/v.lua +170 -0
  98. data/lua-hooks/ext/luajit/src/jit/vmdef.lua +362 -0
  99. data/lua-hooks/ext/luajit/src/jit/zone.lua +45 -0
  100. data/lua-hooks/ext/{lua → luajit/src}/lauxlib.h +10 -17
  101. data/lua-hooks/ext/luajit/src/lib_aux.c +356 -0
  102. data/lua-hooks/ext/luajit/src/lib_aux.o +0 -0
  103. data/lua-hooks/ext/luajit/src/lib_aux_dyn.o +0 -0
  104. data/lua-hooks/ext/luajit/src/lib_base.c +664 -0
  105. data/lua-hooks/ext/luajit/src/lib_base.o +0 -0
  106. data/lua-hooks/ext/luajit/src/lib_base_dyn.o +0 -0
  107. data/lua-hooks/ext/luajit/src/lib_bit.c +180 -0
  108. data/lua-hooks/ext/luajit/src/lib_bit.o +0 -0
  109. data/lua-hooks/ext/luajit/src/lib_bit_dyn.o +0 -0
  110. data/lua-hooks/ext/luajit/src/lib_debug.c +405 -0
  111. data/lua-hooks/ext/luajit/src/lib_debug.o +0 -0
  112. data/lua-hooks/ext/luajit/src/lib_debug_dyn.o +0 -0
  113. data/lua-hooks/ext/luajit/src/lib_ffi.c +872 -0
  114. data/lua-hooks/ext/luajit/src/lib_ffi.o +0 -0
  115. data/lua-hooks/ext/luajit/src/lib_ffi_dyn.o +0 -0
  116. data/lua-hooks/ext/luajit/src/lib_init.c +55 -0
  117. data/lua-hooks/ext/luajit/src/lib_init.o +0 -0
  118. data/lua-hooks/ext/luajit/src/lib_init_dyn.o +0 -0
  119. data/lua-hooks/ext/luajit/src/lib_io.c +541 -0
  120. data/lua-hooks/ext/luajit/src/lib_io.o +0 -0
  121. data/lua-hooks/ext/luajit/src/lib_io_dyn.o +0 -0
  122. data/lua-hooks/ext/luajit/src/lib_jit.c +767 -0
  123. data/lua-hooks/ext/luajit/src/lib_jit.o +0 -0
  124. data/lua-hooks/ext/luajit/src/lib_jit_dyn.o +0 -0
  125. data/lua-hooks/ext/luajit/src/lib_math.c +230 -0
  126. data/lua-hooks/ext/luajit/src/lib_math.o +0 -0
  127. data/lua-hooks/ext/luajit/src/lib_math_dyn.o +0 -0
  128. data/lua-hooks/ext/luajit/src/lib_os.c +292 -0
  129. data/lua-hooks/ext/luajit/src/lib_os.o +0 -0
  130. data/lua-hooks/ext/luajit/src/lib_os_dyn.o +0 -0
  131. data/lua-hooks/ext/luajit/src/lib_package.c +610 -0
  132. data/lua-hooks/ext/luajit/src/lib_package.o +0 -0
  133. data/lua-hooks/ext/luajit/src/lib_package_dyn.o +0 -0
  134. data/lua-hooks/ext/luajit/src/lib_string.c +752 -0
  135. data/lua-hooks/ext/luajit/src/lib_string.o +0 -0
  136. data/lua-hooks/ext/luajit/src/lib_string_dyn.o +0 -0
  137. data/lua-hooks/ext/luajit/src/lib_table.c +307 -0
  138. data/lua-hooks/ext/luajit/src/lib_table.o +0 -0
  139. data/lua-hooks/ext/luajit/src/lib_table_dyn.o +0 -0
  140. data/lua-hooks/ext/luajit/src/libluajit.a +0 -0
  141. data/lua-hooks/ext/luajit/src/libluajit.so +0 -0
  142. data/lua-hooks/ext/luajit/src/lj.supp +26 -0
  143. data/lua-hooks/ext/luajit/src/lj_alloc.c +1398 -0
  144. data/lua-hooks/ext/luajit/src/lj_alloc.h +17 -0
  145. data/lua-hooks/ext/luajit/src/lj_alloc.o +0 -0
  146. data/lua-hooks/ext/luajit/src/lj_alloc_dyn.o +0 -0
  147. data/lua-hooks/ext/luajit/src/lj_api.c +1210 -0
  148. data/lua-hooks/ext/luajit/src/lj_api.o +0 -0
  149. data/lua-hooks/ext/luajit/src/lj_api_dyn.o +0 -0
  150. data/lua-hooks/ext/luajit/src/lj_arch.h +509 -0
  151. data/lua-hooks/ext/luajit/src/lj_asm.c +2278 -0
  152. data/lua-hooks/ext/luajit/src/lj_asm.h +17 -0
  153. data/lua-hooks/ext/luajit/src/lj_asm.o +0 -0
  154. data/lua-hooks/ext/luajit/src/lj_asm_arm.h +2217 -0
  155. data/lua-hooks/ext/luajit/src/lj_asm_dyn.o +0 -0
  156. data/lua-hooks/ext/luajit/src/lj_asm_mips.h +1833 -0
  157. data/lua-hooks/ext/luajit/src/lj_asm_ppc.h +2015 -0
  158. data/lua-hooks/ext/luajit/src/lj_asm_x86.h +2634 -0
  159. data/lua-hooks/ext/luajit/src/lj_bc.c +14 -0
  160. data/lua-hooks/ext/luajit/src/lj_bc.h +265 -0
  161. data/lua-hooks/ext/luajit/src/lj_bc.o +0 -0
  162. data/lua-hooks/ext/luajit/src/lj_bc_dyn.o +0 -0
  163. data/lua-hooks/ext/luajit/src/lj_bcdef.h +220 -0
  164. data/lua-hooks/ext/luajit/src/lj_bcdump.h +68 -0
  165. data/lua-hooks/ext/luajit/src/lj_bcread.c +457 -0
  166. data/lua-hooks/ext/luajit/src/lj_bcread.o +0 -0
  167. data/lua-hooks/ext/luajit/src/lj_bcread_dyn.o +0 -0
  168. data/lua-hooks/ext/luajit/src/lj_bcwrite.c +361 -0
  169. data/lua-hooks/ext/luajit/src/lj_bcwrite.o +0 -0
  170. data/lua-hooks/ext/luajit/src/lj_bcwrite_dyn.o +0 -0
  171. data/lua-hooks/ext/luajit/src/lj_buf.c +234 -0
  172. data/lua-hooks/ext/luajit/src/lj_buf.h +105 -0
  173. data/lua-hooks/ext/luajit/src/lj_buf.o +0 -0
  174. data/lua-hooks/ext/luajit/src/lj_buf_dyn.o +0 -0
  175. data/lua-hooks/ext/luajit/src/lj_carith.c +429 -0
  176. data/lua-hooks/ext/luajit/src/lj_carith.h +37 -0
  177. data/lua-hooks/ext/luajit/src/lj_carith.o +0 -0
  178. data/lua-hooks/ext/luajit/src/lj_carith_dyn.o +0 -0
  179. data/lua-hooks/ext/luajit/src/lj_ccall.c +984 -0
  180. data/lua-hooks/ext/luajit/src/lj_ccall.h +178 -0
  181. data/lua-hooks/ext/luajit/src/lj_ccall.o +0 -0
  182. data/lua-hooks/ext/luajit/src/lj_ccall_dyn.o +0 -0
  183. data/lua-hooks/ext/luajit/src/lj_ccallback.c +712 -0
  184. data/lua-hooks/ext/luajit/src/lj_ccallback.h +25 -0
  185. data/lua-hooks/ext/luajit/src/lj_ccallback.o +0 -0
  186. data/lua-hooks/ext/luajit/src/lj_ccallback_dyn.o +0 -0
  187. data/lua-hooks/ext/luajit/src/lj_cconv.c +752 -0
  188. data/lua-hooks/ext/luajit/src/lj_cconv.h +70 -0
  189. data/lua-hooks/ext/luajit/src/lj_cconv.o +0 -0
  190. data/lua-hooks/ext/luajit/src/lj_cconv_dyn.o +0 -0
  191. data/lua-hooks/ext/luajit/src/lj_cdata.c +288 -0
  192. data/lua-hooks/ext/luajit/src/lj_cdata.h +76 -0
  193. data/lua-hooks/ext/luajit/src/lj_cdata.o +0 -0
  194. data/lua-hooks/ext/luajit/src/lj_cdata_dyn.o +0 -0
  195. data/lua-hooks/ext/luajit/src/lj_char.c +43 -0
  196. data/lua-hooks/ext/luajit/src/lj_char.h +42 -0
  197. data/lua-hooks/ext/luajit/src/lj_char.o +0 -0
  198. data/lua-hooks/ext/luajit/src/lj_char_dyn.o +0 -0
  199. data/lua-hooks/ext/luajit/src/lj_clib.c +418 -0
  200. data/lua-hooks/ext/luajit/src/lj_clib.h +29 -0
  201. data/lua-hooks/ext/luajit/src/lj_clib.o +0 -0
  202. data/lua-hooks/ext/luajit/src/lj_clib_dyn.o +0 -0
  203. data/lua-hooks/ext/luajit/src/lj_cparse.c +1862 -0
  204. data/lua-hooks/ext/luajit/src/lj_cparse.h +65 -0
  205. data/lua-hooks/ext/luajit/src/lj_cparse.o +0 -0
  206. data/lua-hooks/ext/luajit/src/lj_cparse_dyn.o +0 -0
  207. data/lua-hooks/ext/luajit/src/lj_crecord.c +1834 -0
  208. data/lua-hooks/ext/luajit/src/lj_crecord.h +38 -0
  209. data/lua-hooks/ext/luajit/src/lj_crecord.o +0 -0
  210. data/lua-hooks/ext/luajit/src/lj_crecord_dyn.o +0 -0
  211. data/lua-hooks/ext/luajit/src/lj_ctype.c +635 -0
  212. data/lua-hooks/ext/luajit/src/lj_ctype.h +461 -0
  213. data/lua-hooks/ext/luajit/src/lj_ctype.o +0 -0
  214. data/lua-hooks/ext/luajit/src/lj_ctype_dyn.o +0 -0
  215. data/lua-hooks/ext/luajit/src/lj_debug.c +699 -0
  216. data/lua-hooks/ext/luajit/src/lj_debug.h +65 -0
  217. data/lua-hooks/ext/luajit/src/lj_debug.o +0 -0
  218. data/lua-hooks/ext/luajit/src/lj_debug_dyn.o +0 -0
  219. data/lua-hooks/ext/luajit/src/lj_def.h +365 -0
  220. data/lua-hooks/ext/luajit/src/lj_dispatch.c +557 -0
  221. data/lua-hooks/ext/luajit/src/lj_dispatch.h +138 -0
  222. data/lua-hooks/ext/luajit/src/lj_dispatch.o +0 -0
  223. data/lua-hooks/ext/luajit/src/lj_dispatch_dyn.o +0 -0
  224. data/lua-hooks/ext/luajit/src/lj_emit_arm.h +356 -0
  225. data/lua-hooks/ext/luajit/src/lj_emit_mips.h +211 -0
  226. data/lua-hooks/ext/luajit/src/lj_emit_ppc.h +238 -0
  227. data/lua-hooks/ext/luajit/src/lj_emit_x86.h +462 -0
  228. data/lua-hooks/ext/luajit/src/lj_err.c +794 -0
  229. data/lua-hooks/ext/luajit/src/lj_err.h +41 -0
  230. data/lua-hooks/ext/luajit/src/lj_err.o +0 -0
  231. data/lua-hooks/ext/luajit/src/lj_err_dyn.o +0 -0
  232. data/lua-hooks/ext/luajit/src/lj_errmsg.h +190 -0
  233. data/lua-hooks/ext/luajit/src/lj_ff.h +18 -0
  234. data/lua-hooks/ext/luajit/src/lj_ffdef.h +209 -0
  235. data/lua-hooks/ext/luajit/src/lj_ffrecord.c +1247 -0
  236. data/lua-hooks/ext/luajit/src/lj_ffrecord.h +24 -0
  237. data/lua-hooks/ext/luajit/src/lj_ffrecord.o +0 -0
  238. data/lua-hooks/ext/luajit/src/lj_ffrecord_dyn.o +0 -0
  239. data/lua-hooks/ext/luajit/src/lj_folddef.h +1138 -0
  240. data/lua-hooks/ext/luajit/src/lj_frame.h +259 -0
  241. data/lua-hooks/ext/luajit/src/lj_func.c +185 -0
  242. data/lua-hooks/ext/luajit/src/lj_func.h +24 -0
  243. data/lua-hooks/ext/luajit/src/lj_func.o +0 -0
  244. data/lua-hooks/ext/luajit/src/lj_func_dyn.o +0 -0
  245. data/lua-hooks/ext/luajit/src/lj_gc.c +845 -0
  246. data/lua-hooks/ext/luajit/src/lj_gc.h +134 -0
  247. data/lua-hooks/ext/luajit/src/lj_gc.o +0 -0
  248. data/lua-hooks/ext/luajit/src/lj_gc_dyn.o +0 -0
  249. data/lua-hooks/ext/luajit/src/lj_gdbjit.c +787 -0
  250. data/lua-hooks/ext/luajit/src/lj_gdbjit.h +22 -0
  251. data/lua-hooks/ext/luajit/src/lj_gdbjit.o +0 -0
  252. data/lua-hooks/ext/luajit/src/lj_gdbjit_dyn.o +0 -0
  253. data/lua-hooks/ext/luajit/src/lj_ir.c +505 -0
  254. data/lua-hooks/ext/luajit/src/lj_ir.h +577 -0
  255. data/lua-hooks/ext/luajit/src/lj_ir.o +0 -0
  256. data/lua-hooks/ext/luajit/src/lj_ir_dyn.o +0 -0
  257. data/lua-hooks/ext/luajit/src/lj_ircall.h +321 -0
  258. data/lua-hooks/ext/luajit/src/lj_iropt.h +161 -0
  259. data/lua-hooks/ext/luajit/src/lj_jit.h +440 -0
  260. data/lua-hooks/ext/luajit/src/lj_lex.c +482 -0
  261. data/lua-hooks/ext/luajit/src/lj_lex.h +86 -0
  262. data/lua-hooks/ext/luajit/src/lj_lex.o +0 -0
  263. data/lua-hooks/ext/luajit/src/lj_lex_dyn.o +0 -0
  264. data/lua-hooks/ext/luajit/src/lj_lib.c +303 -0
  265. data/lua-hooks/ext/luajit/src/lj_lib.h +115 -0
  266. data/lua-hooks/ext/luajit/src/lj_lib.o +0 -0
  267. data/lua-hooks/ext/luajit/src/lj_lib_dyn.o +0 -0
  268. data/lua-hooks/ext/luajit/src/lj_libdef.h +414 -0
  269. data/lua-hooks/ext/luajit/src/lj_load.c +168 -0
  270. data/lua-hooks/ext/luajit/src/lj_load.o +0 -0
  271. data/lua-hooks/ext/luajit/src/lj_load_dyn.o +0 -0
  272. data/lua-hooks/ext/luajit/src/lj_mcode.c +386 -0
  273. data/lua-hooks/ext/luajit/src/lj_mcode.h +30 -0
  274. data/lua-hooks/ext/luajit/src/lj_mcode.o +0 -0
  275. data/lua-hooks/ext/luajit/src/lj_mcode_dyn.o +0 -0
  276. data/lua-hooks/ext/luajit/src/lj_meta.c +477 -0
  277. data/lua-hooks/ext/luajit/src/lj_meta.h +38 -0
  278. data/lua-hooks/ext/luajit/src/lj_meta.o +0 -0
  279. data/lua-hooks/ext/luajit/src/lj_meta_dyn.o +0 -0
  280. data/lua-hooks/ext/luajit/src/lj_obj.c +50 -0
  281. data/lua-hooks/ext/luajit/src/lj_obj.h +976 -0
  282. data/lua-hooks/ext/luajit/src/lj_obj.o +0 -0
  283. data/lua-hooks/ext/luajit/src/lj_obj_dyn.o +0 -0
  284. data/lua-hooks/ext/luajit/src/lj_opt_dce.c +78 -0
  285. data/lua-hooks/ext/luajit/src/lj_opt_dce.o +0 -0
  286. data/lua-hooks/ext/luajit/src/lj_opt_dce_dyn.o +0 -0
  287. data/lua-hooks/ext/luajit/src/lj_opt_fold.c +2488 -0
  288. data/lua-hooks/ext/luajit/src/lj_opt_fold.o +0 -0
  289. data/lua-hooks/ext/luajit/src/lj_opt_fold_dyn.o +0 -0
  290. data/lua-hooks/ext/luajit/src/lj_opt_loop.c +449 -0
  291. data/lua-hooks/ext/luajit/src/lj_opt_loop.o +0 -0
  292. data/lua-hooks/ext/luajit/src/lj_opt_loop_dyn.o +0 -0
  293. data/lua-hooks/ext/luajit/src/lj_opt_mem.c +935 -0
  294. data/lua-hooks/ext/luajit/src/lj_opt_mem.o +0 -0
  295. data/lua-hooks/ext/luajit/src/lj_opt_mem_dyn.o +0 -0
  296. data/lua-hooks/ext/luajit/src/lj_opt_narrow.c +652 -0
  297. data/lua-hooks/ext/luajit/src/lj_opt_narrow.o +0 -0
  298. data/lua-hooks/ext/luajit/src/lj_opt_narrow_dyn.o +0 -0
  299. data/lua-hooks/ext/luajit/src/lj_opt_sink.c +245 -0
  300. data/lua-hooks/ext/luajit/src/lj_opt_sink.o +0 -0
  301. data/lua-hooks/ext/luajit/src/lj_opt_sink_dyn.o +0 -0
  302. data/lua-hooks/ext/luajit/src/lj_opt_split.c +856 -0
  303. data/lua-hooks/ext/luajit/src/lj_opt_split.o +0 -0
  304. data/lua-hooks/ext/luajit/src/lj_opt_split_dyn.o +0 -0
  305. data/lua-hooks/ext/luajit/src/lj_parse.c +2725 -0
  306. data/lua-hooks/ext/luajit/src/lj_parse.h +18 -0
  307. data/lua-hooks/ext/luajit/src/lj_parse.o +0 -0
  308. data/lua-hooks/ext/luajit/src/lj_parse_dyn.o +0 -0
  309. data/lua-hooks/ext/luajit/src/lj_profile.c +368 -0
  310. data/lua-hooks/ext/luajit/src/lj_profile.h +21 -0
  311. data/lua-hooks/ext/luajit/src/lj_profile.o +0 -0
  312. data/lua-hooks/ext/luajit/src/lj_profile_dyn.o +0 -0
  313. data/lua-hooks/ext/luajit/src/lj_recdef.h +270 -0
  314. data/lua-hooks/ext/luajit/src/lj_record.c +2554 -0
  315. data/lua-hooks/ext/luajit/src/lj_record.h +45 -0
  316. data/lua-hooks/ext/luajit/src/lj_record.o +0 -0
  317. data/lua-hooks/ext/luajit/src/lj_record_dyn.o +0 -0
  318. data/lua-hooks/ext/luajit/src/lj_snap.c +870 -0
  319. data/lua-hooks/ext/luajit/src/lj_snap.h +34 -0
  320. data/lua-hooks/ext/luajit/src/lj_snap.o +0 -0
  321. data/lua-hooks/ext/luajit/src/lj_snap_dyn.o +0 -0
  322. data/lua-hooks/ext/luajit/src/lj_state.c +300 -0
  323. data/lua-hooks/ext/luajit/src/lj_state.h +35 -0
  324. data/lua-hooks/ext/luajit/src/lj_state.o +0 -0
  325. data/lua-hooks/ext/luajit/src/lj_state_dyn.o +0 -0
  326. data/lua-hooks/ext/luajit/src/lj_str.c +197 -0
  327. data/lua-hooks/ext/luajit/src/lj_str.h +27 -0
  328. data/lua-hooks/ext/luajit/src/lj_str.o +0 -0
  329. data/lua-hooks/ext/luajit/src/lj_str_dyn.o +0 -0
  330. data/lua-hooks/ext/luajit/src/lj_strfmt.c +554 -0
  331. data/lua-hooks/ext/luajit/src/lj_strfmt.h +125 -0
  332. data/lua-hooks/ext/luajit/src/lj_strfmt.o +0 -0
  333. data/lua-hooks/ext/luajit/src/lj_strfmt_dyn.o +0 -0
  334. data/lua-hooks/ext/luajit/src/lj_strscan.c +547 -0
  335. data/lua-hooks/ext/luajit/src/lj_strscan.h +39 -0
  336. data/lua-hooks/ext/luajit/src/lj_strscan.o +0 -0
  337. data/lua-hooks/ext/luajit/src/lj_strscan_dyn.o +0 -0
  338. data/lua-hooks/ext/luajit/src/lj_tab.c +666 -0
  339. data/lua-hooks/ext/luajit/src/lj_tab.h +73 -0
  340. data/lua-hooks/ext/luajit/src/lj_tab.o +0 -0
  341. data/lua-hooks/ext/luajit/src/lj_tab_dyn.o +0 -0
  342. data/lua-hooks/ext/luajit/src/lj_target.h +164 -0
  343. data/lua-hooks/ext/luajit/src/lj_target_arm.h +270 -0
  344. data/lua-hooks/ext/luajit/src/lj_target_arm64.h +97 -0
  345. data/lua-hooks/ext/luajit/src/lj_target_mips.h +260 -0
  346. data/lua-hooks/ext/luajit/src/lj_target_ppc.h +280 -0
  347. data/lua-hooks/ext/luajit/src/lj_target_x86.h +345 -0
  348. data/lua-hooks/ext/luajit/src/lj_trace.c +859 -0
  349. data/lua-hooks/ext/luajit/src/lj_trace.h +54 -0
  350. data/lua-hooks/ext/luajit/src/lj_trace.o +0 -0
  351. data/lua-hooks/ext/luajit/src/lj_trace_dyn.o +0 -0
  352. data/lua-hooks/ext/luajit/src/lj_traceerr.h +63 -0
  353. data/lua-hooks/ext/luajit/src/lj_udata.c +34 -0
  354. data/lua-hooks/ext/luajit/src/lj_udata.h +14 -0
  355. data/lua-hooks/ext/luajit/src/lj_udata.o +0 -0
  356. data/lua-hooks/ext/luajit/src/lj_udata_dyn.o +0 -0
  357. data/lua-hooks/ext/luajit/src/lj_vm.S +2730 -0
  358. data/lua-hooks/ext/luajit/src/lj_vm.h +114 -0
  359. data/lua-hooks/ext/luajit/src/lj_vm.o +0 -0
  360. data/lua-hooks/ext/luajit/src/lj_vm_dyn.o +0 -0
  361. data/lua-hooks/ext/luajit/src/lj_vmevent.c +58 -0
  362. data/lua-hooks/ext/luajit/src/lj_vmevent.h +59 -0
  363. data/lua-hooks/ext/luajit/src/lj_vmevent.o +0 -0
  364. data/lua-hooks/ext/luajit/src/lj_vmevent_dyn.o +0 -0
  365. data/lua-hooks/ext/luajit/src/lj_vmmath.c +152 -0
  366. data/lua-hooks/ext/luajit/src/lj_vmmath.o +0 -0
  367. data/lua-hooks/ext/luajit/src/lj_vmmath_dyn.o +0 -0
  368. data/lua-hooks/ext/luajit/src/ljamalg.c +96 -0
  369. data/lua-hooks/ext/{lua → luajit/src}/lua.h +12 -7
  370. data/lua-hooks/ext/luajit/src/lua.hpp +9 -0
  371. data/lua-hooks/ext/luajit/src/luaconf.h +156 -0
  372. data/lua-hooks/ext/luajit/src/luajit +0 -0
  373. data/lua-hooks/ext/luajit/src/luajit.c +570 -0
  374. data/lua-hooks/ext/luajit/src/luajit.h +79 -0
  375. data/lua-hooks/ext/luajit/src/luajit.o +0 -0
  376. data/lua-hooks/ext/luajit/src/lualib.h +43 -0
  377. data/lua-hooks/ext/luajit/src/msvcbuild.bat +114 -0
  378. data/lua-hooks/ext/luajit/src/ps4build.bat +103 -0
  379. data/lua-hooks/ext/luajit/src/psvitabuild.bat +93 -0
  380. data/lua-hooks/ext/luajit/src/vm_arm.dasc +4585 -0
  381. data/lua-hooks/ext/luajit/src/vm_arm64.dasc +3764 -0
  382. data/lua-hooks/ext/luajit/src/vm_mips.dasc +4355 -0
  383. data/lua-hooks/ext/luajit/src/vm_ppc.dasc +5252 -0
  384. data/lua-hooks/ext/luajit/src/vm_x64.dasc +4902 -0
  385. data/lua-hooks/ext/luajit/src/vm_x86.dasc +5710 -0
  386. data/lua-hooks/ext/luajit/src/xb1build.bat +101 -0
  387. data/lua-hooks/ext/luajit/src/xedkbuild.bat +92 -0
  388. data/lua-hooks/ext/luautf8/lutf8lib.c +3 -3
  389. data/lua-hooks/lib/boot.lua +37 -2
  390. metadata +372 -69
  391. data/lua-hooks/ext/bitop/README +0 -22
  392. data/lua-hooks/ext/bitop/bit.c +0 -189
  393. data/lua-hooks/ext/extconf.rb +0 -38
  394. data/lua-hooks/ext/lua/COPYRIGHT +0 -34
  395. data/lua-hooks/ext/lua/lapi.c +0 -1087
  396. data/lua-hooks/ext/lua/lapi.h +0 -16
  397. data/lua-hooks/ext/lua/lauxlib.c +0 -652
  398. data/lua-hooks/ext/lua/lbaselib.c +0 -659
  399. data/lua-hooks/ext/lua/lcode.c +0 -831
  400. data/lua-hooks/ext/lua/lcode.h +0 -76
  401. data/lua-hooks/ext/lua/ldblib.c +0 -398
  402. data/lua-hooks/ext/lua/ldebug.c +0 -638
  403. data/lua-hooks/ext/lua/ldebug.h +0 -33
  404. data/lua-hooks/ext/lua/ldo.c +0 -519
  405. data/lua-hooks/ext/lua/ldo.h +0 -57
  406. data/lua-hooks/ext/lua/ldump.c +0 -164
  407. data/lua-hooks/ext/lua/lfunc.c +0 -174
  408. data/lua-hooks/ext/lua/lfunc.h +0 -34
  409. data/lua-hooks/ext/lua/lgc.c +0 -710
  410. data/lua-hooks/ext/lua/lgc.h +0 -110
  411. data/lua-hooks/ext/lua/linit.c +0 -38
  412. data/lua-hooks/ext/lua/liolib.c +0 -556
  413. data/lua-hooks/ext/lua/llex.c +0 -463
  414. data/lua-hooks/ext/lua/llex.h +0 -81
  415. data/lua-hooks/ext/lua/llimits.h +0 -128
  416. data/lua-hooks/ext/lua/lmathlib.c +0 -263
  417. data/lua-hooks/ext/lua/lmem.c +0 -86
  418. data/lua-hooks/ext/lua/lmem.h +0 -49
  419. data/lua-hooks/ext/lua/loadlib.c +0 -705
  420. data/lua-hooks/ext/lua/loadlib_rel.c +0 -760
  421. data/lua-hooks/ext/lua/lobject.c +0 -214
  422. data/lua-hooks/ext/lua/lobject.h +0 -381
  423. data/lua-hooks/ext/lua/lopcodes.c +0 -102
  424. data/lua-hooks/ext/lua/lopcodes.h +0 -268
  425. data/lua-hooks/ext/lua/loslib.c +0 -243
  426. data/lua-hooks/ext/lua/lparser.c +0 -1339
  427. data/lua-hooks/ext/lua/lparser.h +0 -82
  428. data/lua-hooks/ext/lua/lstate.c +0 -214
  429. data/lua-hooks/ext/lua/lstate.h +0 -169
  430. data/lua-hooks/ext/lua/lstring.c +0 -111
  431. data/lua-hooks/ext/lua/lstring.h +0 -31
  432. data/lua-hooks/ext/lua/lstrlib.c +0 -871
  433. data/lua-hooks/ext/lua/ltable.c +0 -588
  434. data/lua-hooks/ext/lua/ltable.h +0 -40
  435. data/lua-hooks/ext/lua/ltablib.c +0 -287
  436. data/lua-hooks/ext/lua/ltm.c +0 -75
  437. data/lua-hooks/ext/lua/ltm.h +0 -54
  438. data/lua-hooks/ext/lua/lua.c +0 -392
  439. data/lua-hooks/ext/lua/lua.def +0 -131
  440. data/lua-hooks/ext/lua/lua.rc +0 -28
  441. data/lua-hooks/ext/lua/lua_dll.rc +0 -26
  442. data/lua-hooks/ext/lua/luac.c +0 -200
  443. data/lua-hooks/ext/lua/luac.rc +0 -1
  444. data/lua-hooks/ext/lua/luaconf.h +0 -763
  445. data/lua-hooks/ext/lua/luaconf.h.in +0 -724
  446. data/lua-hooks/ext/lua/luaconf.h.orig +0 -763
  447. data/lua-hooks/ext/lua/lualib.h +0 -53
  448. data/lua-hooks/ext/lua/lundump.c +0 -227
  449. data/lua-hooks/ext/lua/lundump.h +0 -36
  450. data/lua-hooks/ext/lua/lvm.c +0 -767
  451. data/lua-hooks/ext/lua/lvm.h +0 -36
  452. data/lua-hooks/ext/lua/lzio.c +0 -82
  453. data/lua-hooks/ext/lua/lzio.h +0 -67
  454. data/lua-hooks/ext/lua/print.c +0 -227
@@ -0,0 +1,577 @@
1
+ /*
2
+ ** SSA IR (Intermediate Representation) format.
3
+ ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
4
+ */
5
+
6
+ #ifndef _LJ_IR_H
7
+ #define _LJ_IR_H
8
+
9
+ #include "lj_obj.h"
10
+
11
+ /* -- IR instructions ----------------------------------------------------- */
12
+
13
+ /* IR instruction definition. Order matters, see below. ORDER IR */
14
+ #define IRDEF(_) \
15
+ /* Guarded assertions. */ \
16
+ /* Must be properly aligned to flip opposites (^1) and (un)ordered (^4). */ \
17
+ _(LT, N , ref, ref) \
18
+ _(GE, N , ref, ref) \
19
+ _(LE, N , ref, ref) \
20
+ _(GT, N , ref, ref) \
21
+ \
22
+ _(ULT, N , ref, ref) \
23
+ _(UGE, N , ref, ref) \
24
+ _(ULE, N , ref, ref) \
25
+ _(UGT, N , ref, ref) \
26
+ \
27
+ _(EQ, C , ref, ref) \
28
+ _(NE, C , ref, ref) \
29
+ \
30
+ _(ABC, N , ref, ref) \
31
+ _(RETF, S , ref, ref) \
32
+ \
33
+ /* Miscellaneous ops. */ \
34
+ _(NOP, N , ___, ___) \
35
+ _(BASE, N , lit, lit) \
36
+ _(PVAL, N , lit, ___) \
37
+ _(GCSTEP, S , ___, ___) \
38
+ _(HIOP, S , ref, ref) \
39
+ _(LOOP, S , ___, ___) \
40
+ _(USE, S , ref, ___) \
41
+ _(PHI, S , ref, ref) \
42
+ _(RENAME, S , ref, lit) \
43
+ _(PROF, S , ___, ___) \
44
+ \
45
+ /* Constants. */ \
46
+ _(KPRI, N , ___, ___) \
47
+ _(KINT, N , cst, ___) \
48
+ _(KGC, N , cst, ___) \
49
+ _(KPTR, N , cst, ___) \
50
+ _(KKPTR, N , cst, ___) \
51
+ _(KNULL, N , cst, ___) \
52
+ _(KNUM, N , cst, ___) \
53
+ _(KINT64, N , cst, ___) \
54
+ _(KSLOT, N , ref, lit) \
55
+ \
56
+ /* Bit ops. */ \
57
+ _(BNOT, N , ref, ___) \
58
+ _(BSWAP, N , ref, ___) \
59
+ _(BAND, C , ref, ref) \
60
+ _(BOR, C , ref, ref) \
61
+ _(BXOR, C , ref, ref) \
62
+ _(BSHL, N , ref, ref) \
63
+ _(BSHR, N , ref, ref) \
64
+ _(BSAR, N , ref, ref) \
65
+ _(BROL, N , ref, ref) \
66
+ _(BROR, N , ref, ref) \
67
+ \
68
+ /* Arithmetic ops. ORDER ARITH */ \
69
+ _(ADD, C , ref, ref) \
70
+ _(SUB, N , ref, ref) \
71
+ _(MUL, C , ref, ref) \
72
+ _(DIV, N , ref, ref) \
73
+ _(MOD, N , ref, ref) \
74
+ _(POW, N , ref, ref) \
75
+ _(NEG, N , ref, ref) \
76
+ \
77
+ _(ABS, N , ref, ref) \
78
+ _(ATAN2, N , ref, ref) \
79
+ _(LDEXP, N , ref, ref) \
80
+ _(MIN, C , ref, ref) \
81
+ _(MAX, C , ref, ref) \
82
+ _(FPMATH, N , ref, lit) \
83
+ \
84
+ /* Overflow-checking arithmetic ops. */ \
85
+ _(ADDOV, CW, ref, ref) \
86
+ _(SUBOV, NW, ref, ref) \
87
+ _(MULOV, CW, ref, ref) \
88
+ \
89
+ /* Memory ops. A = array, H = hash, U = upvalue, F = field, S = stack. */ \
90
+ \
91
+ /* Memory references. */ \
92
+ _(AREF, R , ref, ref) \
93
+ _(HREFK, R , ref, ref) \
94
+ _(HREF, L , ref, ref) \
95
+ _(NEWREF, S , ref, ref) \
96
+ _(UREFO, LW, ref, lit) \
97
+ _(UREFC, LW, ref, lit) \
98
+ _(FREF, R , ref, lit) \
99
+ _(STRREF, N , ref, ref) \
100
+ _(LREF, L , ___, ___) \
101
+ \
102
+ /* Loads and Stores. These must be in the same order. */ \
103
+ _(ALOAD, L , ref, ___) \
104
+ _(HLOAD, L , ref, ___) \
105
+ _(ULOAD, L , ref, ___) \
106
+ _(FLOAD, L , ref, lit) \
107
+ _(XLOAD, L , ref, lit) \
108
+ _(SLOAD, L , lit, lit) \
109
+ _(VLOAD, L , ref, ___) \
110
+ \
111
+ _(ASTORE, S , ref, ref) \
112
+ _(HSTORE, S , ref, ref) \
113
+ _(USTORE, S , ref, ref) \
114
+ _(FSTORE, S , ref, ref) \
115
+ _(XSTORE, S , ref, ref) \
116
+ \
117
+ /* Allocations. */ \
118
+ _(SNEW, N , ref, ref) /* CSE is ok, not marked as A. */ \
119
+ _(XSNEW, A , ref, ref) \
120
+ _(TNEW, AW, lit, lit) \
121
+ _(TDUP, AW, ref, ___) \
122
+ _(CNEW, AW, ref, ref) \
123
+ _(CNEWI, NW, ref, ref) /* CSE is ok, not marked as A. */ \
124
+ \
125
+ /* Buffer operations. */ \
126
+ _(BUFHDR, L , ref, lit) \
127
+ _(BUFPUT, L , ref, ref) \
128
+ _(BUFSTR, A , ref, ref) \
129
+ \
130
+ /* Barriers. */ \
131
+ _(TBAR, S , ref, ___) \
132
+ _(OBAR, S , ref, ref) \
133
+ _(XBAR, S , ___, ___) \
134
+ \
135
+ /* Type conversions. */ \
136
+ _(CONV, NW, ref, lit) \
137
+ _(TOBIT, N , ref, ref) \
138
+ _(TOSTR, N , ref, lit) \
139
+ _(STRTO, N , ref, ___) \
140
+ \
141
+ /* Calls. */ \
142
+ _(CALLN, N , ref, lit) \
143
+ _(CALLA, A , ref, lit) \
144
+ _(CALLL, L , ref, lit) \
145
+ _(CALLS, S , ref, lit) \
146
+ _(CALLXS, S , ref, ref) \
147
+ _(CARG, N , ref, ref) \
148
+ \
149
+ /* End of list. */
150
+
151
+ /* IR opcodes (max. 256). */
152
+ typedef enum {
153
+ #define IRENUM(name, m, m1, m2) IR_##name,
154
+ IRDEF(IRENUM)
155
+ #undef IRENUM
156
+ IR__MAX
157
+ } IROp;
158
+
159
+ /* Stored opcode. */
160
+ typedef uint8_t IROp1;
161
+
162
+ LJ_STATIC_ASSERT(((int)IR_EQ^1) == (int)IR_NE);
163
+ LJ_STATIC_ASSERT(((int)IR_LT^1) == (int)IR_GE);
164
+ LJ_STATIC_ASSERT(((int)IR_LE^1) == (int)IR_GT);
165
+ LJ_STATIC_ASSERT(((int)IR_LT^3) == (int)IR_GT);
166
+ LJ_STATIC_ASSERT(((int)IR_LT^4) == (int)IR_ULT);
167
+
168
+ /* Delta between xLOAD and xSTORE. */
169
+ #define IRDELTA_L2S ((int)IR_ASTORE - (int)IR_ALOAD)
170
+
171
+ LJ_STATIC_ASSERT((int)IR_HLOAD + IRDELTA_L2S == (int)IR_HSTORE);
172
+ LJ_STATIC_ASSERT((int)IR_ULOAD + IRDELTA_L2S == (int)IR_USTORE);
173
+ LJ_STATIC_ASSERT((int)IR_FLOAD + IRDELTA_L2S == (int)IR_FSTORE);
174
+ LJ_STATIC_ASSERT((int)IR_XLOAD + IRDELTA_L2S == (int)IR_XSTORE);
175
+
176
+ /* -- Named IR literals --------------------------------------------------- */
177
+
178
+ /* FPMATH sub-functions. ORDER FPM. */
179
+ #define IRFPMDEF(_) \
180
+ _(FLOOR) _(CEIL) _(TRUNC) /* Must be first and in this order. */ \
181
+ _(SQRT) _(EXP) _(EXP2) _(LOG) _(LOG2) _(LOG10) \
182
+ _(SIN) _(COS) _(TAN) \
183
+ _(OTHER)
184
+
185
+ typedef enum {
186
+ #define FPMENUM(name) IRFPM_##name,
187
+ IRFPMDEF(FPMENUM)
188
+ #undef FPMENUM
189
+ IRFPM__MAX
190
+ } IRFPMathOp;
191
+
192
+ /* FLOAD fields. */
193
+ #define IRFLDEF(_) \
194
+ _(STR_LEN, offsetof(GCstr, len)) \
195
+ _(FUNC_ENV, offsetof(GCfunc, l.env)) \
196
+ _(FUNC_PC, offsetof(GCfunc, l.pc)) \
197
+ _(FUNC_FFID, offsetof(GCfunc, l.ffid)) \
198
+ _(THREAD_ENV, offsetof(lua_State, env)) \
199
+ _(TAB_META, offsetof(GCtab, metatable)) \
200
+ _(TAB_ARRAY, offsetof(GCtab, array)) \
201
+ _(TAB_NODE, offsetof(GCtab, node)) \
202
+ _(TAB_ASIZE, offsetof(GCtab, asize)) \
203
+ _(TAB_HMASK, offsetof(GCtab, hmask)) \
204
+ _(TAB_NOMM, offsetof(GCtab, nomm)) \
205
+ _(UDATA_META, offsetof(GCudata, metatable)) \
206
+ _(UDATA_UDTYPE, offsetof(GCudata, udtype)) \
207
+ _(UDATA_FILE, sizeof(GCudata)) \
208
+ _(CDATA_CTYPEID, offsetof(GCcdata, ctypeid)) \
209
+ _(CDATA_PTR, sizeof(GCcdata)) \
210
+ _(CDATA_INT, sizeof(GCcdata)) \
211
+ _(CDATA_INT64, sizeof(GCcdata)) \
212
+ _(CDATA_INT64_4, sizeof(GCcdata) + 4)
213
+
214
+ typedef enum {
215
+ #define FLENUM(name, ofs) IRFL_##name,
216
+ IRFLDEF(FLENUM)
217
+ #undef FLENUM
218
+ IRFL__MAX
219
+ } IRFieldID;
220
+
221
+ /* SLOAD mode bits, stored in op2. */
222
+ #define IRSLOAD_PARENT 0x01 /* Coalesce with parent trace. */
223
+ #define IRSLOAD_FRAME 0x02 /* Load hiword of frame. */
224
+ #define IRSLOAD_TYPECHECK 0x04 /* Needs type check. */
225
+ #define IRSLOAD_CONVERT 0x08 /* Number to integer conversion. */
226
+ #define IRSLOAD_READONLY 0x10 /* Read-only, omit slot store. */
227
+ #define IRSLOAD_INHERIT 0x20 /* Inherited by exits/side traces. */
228
+
229
+ /* XLOAD mode, stored in op2. */
230
+ #define IRXLOAD_READONLY 1 /* Load from read-only data. */
231
+ #define IRXLOAD_VOLATILE 2 /* Load from volatile data. */
232
+ #define IRXLOAD_UNALIGNED 4 /* Unaligned load. */
233
+
234
+ /* BUFHDR mode, stored in op2. */
235
+ #define IRBUFHDR_RESET 0 /* Reset buffer. */
236
+ #define IRBUFHDR_APPEND 1 /* Append to buffer. */
237
+
238
+ /* CONV mode, stored in op2. */
239
+ #define IRCONV_SRCMASK 0x001f /* Source IRType. */
240
+ #define IRCONV_DSTMASK 0x03e0 /* Dest. IRType (also in ir->t). */
241
+ #define IRCONV_DSH 5
242
+ #define IRCONV_NUM_INT ((IRT_NUM<<IRCONV_DSH)|IRT_INT)
243
+ #define IRCONV_INT_NUM ((IRT_INT<<IRCONV_DSH)|IRT_NUM)
244
+ #define IRCONV_SEXT 0x0800 /* Sign-extend integer to integer. */
245
+ #define IRCONV_MODEMASK 0x0fff
246
+ #define IRCONV_CONVMASK 0xf000
247
+ #define IRCONV_CSH 12
248
+ /* Number to integer conversion mode. Ordered by strength of the checks. */
249
+ #define IRCONV_TOBIT (0<<IRCONV_CSH) /* None. Cache only: TOBIT conv. */
250
+ #define IRCONV_ANY (1<<IRCONV_CSH) /* Any FP number is ok. */
251
+ #define IRCONV_INDEX (2<<IRCONV_CSH) /* Check + special backprop rules. */
252
+ #define IRCONV_CHECK (3<<IRCONV_CSH) /* Number checked for integerness. */
253
+
254
+ /* TOSTR mode, stored in op2. */
255
+ #define IRTOSTR_INT 0 /* Convert integer to string. */
256
+ #define IRTOSTR_NUM 1 /* Convert number to string. */
257
+ #define IRTOSTR_CHAR 2 /* Convert char value to string. */
258
+
259
+ /* -- IR operands --------------------------------------------------------- */
260
+
261
+ /* IR operand mode (2 bit). */
262
+ typedef enum {
263
+ IRMref, /* IR reference. */
264
+ IRMlit, /* 16 bit unsigned literal. */
265
+ IRMcst, /* Constant literal: i, gcr or ptr. */
266
+ IRMnone /* Unused operand. */
267
+ } IRMode;
268
+ #define IRM___ IRMnone
269
+
270
+ /* Mode bits: Commutative, {Normal/Ref, Alloc, Load, Store}, Non-weak guard. */
271
+ #define IRM_C 0x10
272
+
273
+ #define IRM_N 0x00
274
+ #define IRM_R IRM_N
275
+ #define IRM_A 0x20
276
+ #define IRM_L 0x40
277
+ #define IRM_S 0x60
278
+
279
+ #define IRM_W 0x80
280
+
281
+ #define IRM_NW (IRM_N|IRM_W)
282
+ #define IRM_CW (IRM_C|IRM_W)
283
+ #define IRM_AW (IRM_A|IRM_W)
284
+ #define IRM_LW (IRM_L|IRM_W)
285
+
286
+ #define irm_op1(m) ((IRMode)((m)&3))
287
+ #define irm_op2(m) ((IRMode)(((m)>>2)&3))
288
+ #define irm_iscomm(m) ((m) & IRM_C)
289
+ #define irm_kind(m) ((m) & IRM_S)
290
+
291
+ #define IRMODE(name, m, m1, m2) (((IRM##m1)|((IRM##m2)<<2)|(IRM_##m))^IRM_W),
292
+
293
+ LJ_DATA const uint8_t lj_ir_mode[IR__MAX+1];
294
+
295
+ /* -- IR instruction types ------------------------------------------------ */
296
+
297
+ /* Map of itypes to non-negative numbers. ORDER LJ_T.
298
+ ** LJ_TUPVAL/LJ_TTRACE never appear in a TValue. Use these itypes for
299
+ ** IRT_P32 and IRT_P64, which never escape the IR.
300
+ ** The various integers are only used in the IR and can only escape to
301
+ ** a TValue after implicit or explicit conversion. Their types must be
302
+ ** contiguous and next to IRT_NUM (see the typerange macros below).
303
+ */
304
+ #define IRTDEF(_) \
305
+ _(NIL, 4) _(FALSE, 4) _(TRUE, 4) _(LIGHTUD, LJ_64 ? 8 : 4) _(STR, 4) \
306
+ _(P32, 4) _(THREAD, 4) _(PROTO, 4) _(FUNC, 4) _(P64, 8) _(CDATA, 4) \
307
+ _(TAB, 4) _(UDATA, 4) \
308
+ _(FLOAT, 4) _(NUM, 8) _(I8, 1) _(U8, 1) _(I16, 2) _(U16, 2) \
309
+ _(INT, 4) _(U32, 4) _(I64, 8) _(U64, 8) \
310
+ _(SOFTFP, 4) /* There is room for 9 more types. */
311
+
312
+ /* IR result type and flags (8 bit). */
313
+ typedef enum {
314
+ #define IRTENUM(name, size) IRT_##name,
315
+ IRTDEF(IRTENUM)
316
+ #undef IRTENUM
317
+ IRT__MAX,
318
+
319
+ /* Native pointer type and the corresponding integer type. */
320
+ IRT_PTR = LJ_64 ? IRT_P64 : IRT_P32,
321
+ IRT_INTP = LJ_64 ? IRT_I64 : IRT_INT,
322
+ IRT_UINTP = LJ_64 ? IRT_U64 : IRT_U32,
323
+ /* TODO_GC64: major changes required for all uses of IRT_P32. */
324
+
325
+ /* Additional flags. */
326
+ IRT_MARK = 0x20, /* Marker for misc. purposes. */
327
+ IRT_ISPHI = 0x40, /* Instruction is left or right PHI operand. */
328
+ IRT_GUARD = 0x80, /* Instruction is a guard. */
329
+
330
+ /* Masks. */
331
+ IRT_TYPE = 0x1f,
332
+ IRT_T = 0xff
333
+ } IRType;
334
+
335
+ #define irtype_ispri(irt) ((uint32_t)(irt) <= IRT_TRUE)
336
+
337
+ /* Stored IRType. */
338
+ typedef struct IRType1 { uint8_t irt; } IRType1;
339
+
340
+ #define IRT(o, t) ((uint32_t)(((o)<<8) | (t)))
341
+ #define IRTI(o) (IRT((o), IRT_INT))
342
+ #define IRTN(o) (IRT((o), IRT_NUM))
343
+ #define IRTG(o, t) (IRT((o), IRT_GUARD|(t)))
344
+ #define IRTGI(o) (IRT((o), IRT_GUARD|IRT_INT))
345
+
346
+ #define irt_t(t) ((IRType)(t).irt)
347
+ #define irt_type(t) ((IRType)((t).irt & IRT_TYPE))
348
+ #define irt_sametype(t1, t2) ((((t1).irt ^ (t2).irt) & IRT_TYPE) == 0)
349
+ #define irt_typerange(t, first, last) \
350
+ ((uint32_t)((t).irt & IRT_TYPE) - (uint32_t)(first) <= (uint32_t)(last-first))
351
+
352
+ #define irt_isnil(t) (irt_type(t) == IRT_NIL)
353
+ #define irt_ispri(t) ((uint32_t)irt_type(t) <= IRT_TRUE)
354
+ #define irt_islightud(t) (irt_type(t) == IRT_LIGHTUD)
355
+ #define irt_isstr(t) (irt_type(t) == IRT_STR)
356
+ #define irt_istab(t) (irt_type(t) == IRT_TAB)
357
+ #define irt_iscdata(t) (irt_type(t) == IRT_CDATA)
358
+ #define irt_isfloat(t) (irt_type(t) == IRT_FLOAT)
359
+ #define irt_isnum(t) (irt_type(t) == IRT_NUM)
360
+ #define irt_isint(t) (irt_type(t) == IRT_INT)
361
+ #define irt_isi8(t) (irt_type(t) == IRT_I8)
362
+ #define irt_isu8(t) (irt_type(t) == IRT_U8)
363
+ #define irt_isi16(t) (irt_type(t) == IRT_I16)
364
+ #define irt_isu16(t) (irt_type(t) == IRT_U16)
365
+ #define irt_isu32(t) (irt_type(t) == IRT_U32)
366
+ #define irt_isi64(t) (irt_type(t) == IRT_I64)
367
+ #define irt_isu64(t) (irt_type(t) == IRT_U64)
368
+
369
+ #define irt_isfp(t) (irt_isnum(t) || irt_isfloat(t))
370
+ #define irt_isinteger(t) (irt_typerange((t), IRT_I8, IRT_INT))
371
+ #define irt_isgcv(t) (irt_typerange((t), IRT_STR, IRT_UDATA))
372
+ #define irt_isaddr(t) (irt_typerange((t), IRT_LIGHTUD, IRT_UDATA))
373
+ #define irt_isint64(t) (irt_typerange((t), IRT_I64, IRT_U64))
374
+
375
+ #if LJ_GC64
376
+ #define IRT_IS64 \
377
+ ((1u<<IRT_NUM)|(1u<<IRT_I64)|(1u<<IRT_U64)|(1u<<IRT_P64)|\
378
+ (1u<<IRT_LIGHTUD)|(1u<<IRT_STR)|(1u<<IRT_THREAD)|(1u<<IRT_PROTO)|\
379
+ (1u<<IRT_FUNC)|(1u<<IRT_CDATA)|(1u<<IRT_TAB)|(1u<<IRT_UDATA))
380
+ #elif LJ_64
381
+ #define IRT_IS64 \
382
+ ((1u<<IRT_NUM)|(1u<<IRT_I64)|(1u<<IRT_U64)|(1u<<IRT_P64)|(1u<<IRT_LIGHTUD))
383
+ #else
384
+ #define IRT_IS64 \
385
+ ((1u<<IRT_NUM)|(1u<<IRT_I64)|(1u<<IRT_U64))
386
+ #endif
387
+
388
+ #define irt_is64(t) ((IRT_IS64 >> irt_type(t)) & 1)
389
+ #define irt_is64orfp(t) (((IRT_IS64|(1u<<IRT_FLOAT))>>irt_type(t)) & 1)
390
+
391
+ #define irt_size(t) (lj_ir_type_size[irt_t((t))])
392
+
393
+ LJ_DATA const uint8_t lj_ir_type_size[];
394
+
395
+ static LJ_AINLINE IRType itype2irt(const TValue *tv)
396
+ {
397
+ if (tvisint(tv))
398
+ return IRT_INT;
399
+ else if (tvisnum(tv))
400
+ return IRT_NUM;
401
+ #if LJ_64 && !LJ_GC64
402
+ else if (tvislightud(tv))
403
+ return IRT_LIGHTUD;
404
+ #endif
405
+ else
406
+ return (IRType)~itype(tv);
407
+ }
408
+
409
+ static LJ_AINLINE uint32_t irt_toitype_(IRType t)
410
+ {
411
+ lua_assert(!LJ_64 || t != IRT_LIGHTUD);
412
+ if (LJ_DUALNUM && t > IRT_NUM) {
413
+ return LJ_TISNUM;
414
+ } else {
415
+ lua_assert(t <= IRT_NUM);
416
+ return ~(uint32_t)t;
417
+ }
418
+ }
419
+
420
+ #define irt_toitype(t) irt_toitype_(irt_type((t)))
421
+
422
+ #define irt_isguard(t) ((t).irt & IRT_GUARD)
423
+ #define irt_ismarked(t) ((t).irt & IRT_MARK)
424
+ #define irt_setmark(t) ((t).irt |= IRT_MARK)
425
+ #define irt_clearmark(t) ((t).irt &= ~IRT_MARK)
426
+ #define irt_isphi(t) ((t).irt & IRT_ISPHI)
427
+ #define irt_setphi(t) ((t).irt |= IRT_ISPHI)
428
+ #define irt_clearphi(t) ((t).irt &= ~IRT_ISPHI)
429
+
430
+ /* Stored combined IR opcode and type. */
431
+ typedef uint16_t IROpT;
432
+
433
+ /* -- IR references ------------------------------------------------------- */
434
+
435
+ /* IR references. */
436
+ typedef uint16_t IRRef1; /* One stored reference. */
437
+ typedef uint32_t IRRef2; /* Two stored references. */
438
+ typedef uint32_t IRRef; /* Used to pass around references. */
439
+
440
+ /* Fixed references. */
441
+ enum {
442
+ REF_BIAS = 0x8000,
443
+ REF_TRUE = REF_BIAS-3,
444
+ REF_FALSE = REF_BIAS-2,
445
+ REF_NIL = REF_BIAS-1, /* \--- Constants grow downwards. */
446
+ REF_BASE = REF_BIAS, /* /--- IR grows upwards. */
447
+ REF_FIRST = REF_BIAS+1,
448
+ REF_DROP = 0xffff
449
+ };
450
+
451
+ /* Note: IRMlit operands must be < REF_BIAS, too!
452
+ ** This allows for fast and uniform manipulation of all operands
453
+ ** without looking up the operand mode in lj_ir_mode:
454
+ ** - CSE calculates the maximum reference of two operands.
455
+ ** This must work with mixed reference/literal operands, too.
456
+ ** - DCE marking only checks for operand >= REF_BIAS.
457
+ ** - LOOP needs to substitute reference operands.
458
+ ** Constant references and literals must not be modified.
459
+ */
460
+
461
+ #define IRREF2(lo, hi) ((IRRef2)(lo) | ((IRRef2)(hi) << 16))
462
+
463
+ #define irref_isk(ref) ((ref) < REF_BIAS)
464
+
465
+ /* Tagged IR references (32 bit).
466
+ **
467
+ ** +-------+-------+---------------+
468
+ ** | irt | flags | ref |
469
+ ** +-------+-------+---------------+
470
+ **
471
+ ** The tag holds a copy of the IRType and speeds up IR type checks.
472
+ */
473
+ typedef uint32_t TRef;
474
+
475
+ #define TREF_REFMASK 0x0000ffff
476
+ #define TREF_FRAME 0x00010000
477
+ #define TREF_CONT 0x00020000
478
+
479
+ #define TREF(ref, t) ((TRef)((ref) + ((t)<<24)))
480
+
481
+ #define tref_ref(tr) ((IRRef1)(tr))
482
+ #define tref_t(tr) ((IRType)((tr)>>24))
483
+ #define tref_type(tr) ((IRType)(((tr)>>24) & IRT_TYPE))
484
+ #define tref_typerange(tr, first, last) \
485
+ ((((tr)>>24) & IRT_TYPE) - (TRef)(first) <= (TRef)(last-first))
486
+
487
+ #define tref_istype(tr, t) (((tr) & (IRT_TYPE<<24)) == ((t)<<24))
488
+ #define tref_isnil(tr) (tref_istype((tr), IRT_NIL))
489
+ #define tref_isfalse(tr) (tref_istype((tr), IRT_FALSE))
490
+ #define tref_istrue(tr) (tref_istype((tr), IRT_TRUE))
491
+ #define tref_islightud(tr) (tref_istype((tr), IRT_LIGHTUD))
492
+ #define tref_isstr(tr) (tref_istype((tr), IRT_STR))
493
+ #define tref_isfunc(tr) (tref_istype((tr), IRT_FUNC))
494
+ #define tref_iscdata(tr) (tref_istype((tr), IRT_CDATA))
495
+ #define tref_istab(tr) (tref_istype((tr), IRT_TAB))
496
+ #define tref_isudata(tr) (tref_istype((tr), IRT_UDATA))
497
+ #define tref_isnum(tr) (tref_istype((tr), IRT_NUM))
498
+ #define tref_isint(tr) (tref_istype((tr), IRT_INT))
499
+
500
+ #define tref_isbool(tr) (tref_typerange((tr), IRT_FALSE, IRT_TRUE))
501
+ #define tref_ispri(tr) (tref_typerange((tr), IRT_NIL, IRT_TRUE))
502
+ #define tref_istruecond(tr) (!tref_typerange((tr), IRT_NIL, IRT_FALSE))
503
+ #define tref_isinteger(tr) (tref_typerange((tr), IRT_I8, IRT_INT))
504
+ #define tref_isnumber(tr) (tref_typerange((tr), IRT_NUM, IRT_INT))
505
+ #define tref_isnumber_str(tr) (tref_isnumber((tr)) || tref_isstr((tr)))
506
+ #define tref_isgcv(tr) (tref_typerange((tr), IRT_STR, IRT_UDATA))
507
+
508
+ #define tref_isk(tr) (irref_isk(tref_ref((tr))))
509
+ #define tref_isk2(tr1, tr2) (irref_isk(tref_ref((tr1) | (tr2))))
510
+
511
+ #define TREF_PRI(t) (TREF(REF_NIL-(t), (t)))
512
+ #define TREF_NIL (TREF_PRI(IRT_NIL))
513
+ #define TREF_FALSE (TREF_PRI(IRT_FALSE))
514
+ #define TREF_TRUE (TREF_PRI(IRT_TRUE))
515
+
516
+ /* -- IR format ----------------------------------------------------------- */
517
+
518
+ /* IR instruction format (64 bit).
519
+ **
520
+ ** 16 16 8 8 8 8
521
+ ** +-------+-------+---+---+---+---+
522
+ ** | op1 | op2 | t | o | r | s |
523
+ ** +-------+-------+---+---+---+---+
524
+ ** | op12/i/gco | ot | prev | (alternative fields in union)
525
+ ** +---------------+-------+-------+
526
+ ** 32 16 16
527
+ **
528
+ ** prev is only valid prior to register allocation and then reused for r + s.
529
+ */
530
+
531
+ typedef union IRIns {
532
+ struct {
533
+ LJ_ENDIAN_LOHI(
534
+ IRRef1 op1; /* IR operand 1. */
535
+ , IRRef1 op2; /* IR operand 2. */
536
+ )
537
+ IROpT ot; /* IR opcode and type (overlaps t and o). */
538
+ IRRef1 prev; /* Previous ins in same chain (overlaps r and s). */
539
+ };
540
+ struct {
541
+ IRRef2 op12; /* IR operand 1 and 2 (overlaps op1 and op2). */
542
+ LJ_ENDIAN_LOHI(
543
+ IRType1 t; /* IR type. */
544
+ , IROp1 o; /* IR opcode. */
545
+ )
546
+ LJ_ENDIAN_LOHI(
547
+ uint8_t r; /* Register allocation (overlaps prev). */
548
+ , uint8_t s; /* Spill slot allocation (overlaps prev). */
549
+ )
550
+ };
551
+ int32_t i; /* 32 bit signed integer literal (overlaps op12). */
552
+ GCRef gcr; /* GCobj constant (overlaps op12). */
553
+ MRef ptr; /* Pointer constant (overlaps op12). */
554
+ } IRIns;
555
+
556
+ /* TODO_GC64: major changes required. */
557
+ #define ir_kgc(ir) check_exp((ir)->o == IR_KGC, gcref((ir)->gcr))
558
+ #define ir_kstr(ir) (gco2str(ir_kgc((ir))))
559
+ #define ir_ktab(ir) (gco2tab(ir_kgc((ir))))
560
+ #define ir_kfunc(ir) (gco2func(ir_kgc((ir))))
561
+ #define ir_kcdata(ir) (gco2cd(ir_kgc((ir))))
562
+ #define ir_knum(ir) check_exp((ir)->o == IR_KNUM, mref((ir)->ptr, cTValue))
563
+ #define ir_kint64(ir) check_exp((ir)->o == IR_KINT64, mref((ir)->ptr,cTValue))
564
+ #define ir_k64(ir) \
565
+ check_exp((ir)->o == IR_KNUM || (ir)->o == IR_KINT64, mref((ir)->ptr,cTValue))
566
+ #define ir_kptr(ir) \
567
+ check_exp((ir)->o == IR_KPTR || (ir)->o == IR_KKPTR, mref((ir)->ptr, void))
568
+
569
+ /* A store or any other op with a non-weak guard has a side-effect. */
570
+ static LJ_AINLINE int ir_sideeff(IRIns *ir)
571
+ {
572
+ return (((ir->t.irt | ~IRT_GUARD) & lj_ir_mode[ir->o]) >= IRM_S);
573
+ }
574
+
575
+ LJ_STATIC_ASSERT((int)IRT_GUARD == (int)IRM_W);
576
+
577
+ #endif