immunio 1.2.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -5
  3. data/ext/immunio/Rakefile +14 -6
  4. data/lib/immunio/context.rb +2 -0
  5. data/lib/immunio/plugins/action_view.rb +7 -668
  6. data/lib/immunio/plugins/action_view/action_view.rb +22 -0
  7. data/lib/immunio/plugins/action_view/active_support_hash.rb +29 -0
  8. data/lib/immunio/plugins/action_view/cache_store.rb +24 -0
  9. data/lib/immunio/plugins/action_view/erubi.rb +38 -0
  10. data/lib/immunio/plugins/action_view/erubis.rb +39 -0
  11. data/lib/immunio/plugins/action_view/fragment_caching.rb +29 -0
  12. data/lib/immunio/plugins/action_view/haml.rb +46 -0
  13. data/lib/immunio/plugins/action_view/slim.rb +42 -0
  14. data/lib/immunio/plugins/action_view/template.rb +431 -0
  15. data/lib/immunio/plugins/action_view/template_rendering.rb +45 -0
  16. data/lib/immunio/plugins/http_tracker.rb +2 -0
  17. data/lib/immunio/plugins/io.rb +34 -0
  18. data/lib/immunio/version.rb +1 -1
  19. data/lua-hooks/Makefile +36 -9
  20. data/lua-hooks/ext/luajit/COPYRIGHT +1 -1
  21. data/lua-hooks/ext/luajit/Makefile +22 -15
  22. data/lua-hooks/ext/luajit/README +2 -2
  23. data/lua-hooks/ext/luajit/doc/bluequad-print.css +1 -1
  24. data/lua-hooks/ext/luajit/doc/bluequad.css +1 -1
  25. data/lua-hooks/ext/luajit/doc/changes.html +69 -3
  26. data/lua-hooks/ext/luajit/doc/contact.html +10 -3
  27. data/lua-hooks/ext/luajit/doc/ext_c_api.html +2 -2
  28. data/lua-hooks/ext/luajit/doc/ext_ffi.html +2 -2
  29. data/lua-hooks/ext/luajit/doc/ext_ffi_api.html +2 -2
  30. data/lua-hooks/ext/luajit/doc/ext_ffi_semantics.html +3 -4
  31. data/lua-hooks/ext/luajit/doc/ext_ffi_tutorial.html +2 -2
  32. data/lua-hooks/ext/luajit/doc/ext_jit.html +3 -3
  33. data/lua-hooks/ext/luajit/doc/ext_profiler.html +2 -2
  34. data/lua-hooks/ext/luajit/doc/extensions.html +47 -20
  35. data/lua-hooks/ext/luajit/doc/faq.html +2 -2
  36. data/lua-hooks/ext/luajit/doc/install.html +74 -45
  37. data/lua-hooks/ext/luajit/doc/luajit.html +5 -5
  38. data/lua-hooks/ext/luajit/doc/running.html +3 -3
  39. data/lua-hooks/ext/luajit/doc/status.html +13 -8
  40. data/lua-hooks/ext/luajit/dynasm/dasm_arm.h +1 -1
  41. data/lua-hooks/ext/luajit/dynasm/dasm_arm.lua +1 -1
  42. data/lua-hooks/ext/luajit/dynasm/dasm_arm64.h +1 -1
  43. data/lua-hooks/ext/luajit/dynasm/dasm_arm64.lua +1 -1
  44. data/lua-hooks/ext/luajit/dynasm/dasm_mips.h +8 -5
  45. data/lua-hooks/ext/luajit/dynasm/dasm_mips.lua +66 -11
  46. data/lua-hooks/ext/luajit/dynasm/dasm_mips64.lua +12 -0
  47. data/lua-hooks/ext/luajit/dynasm/dasm_ppc.h +1 -1
  48. data/lua-hooks/ext/luajit/dynasm/dasm_ppc.lua +1 -1
  49. data/lua-hooks/ext/luajit/dynasm/dasm_proto.h +1 -1
  50. data/lua-hooks/ext/luajit/dynasm/dasm_x64.lua +1 -1
  51. data/lua-hooks/ext/luajit/dynasm/dasm_x86.h +1 -1
  52. data/lua-hooks/ext/luajit/dynasm/dasm_x86.lua +5 -1
  53. data/lua-hooks/ext/luajit/dynasm/dynasm.lua +2 -2
  54. data/lua-hooks/ext/luajit/etc/luajit.1 +1 -1
  55. data/lua-hooks/ext/luajit/etc/luajit.pc +1 -1
  56. data/lua-hooks/ext/luajit/src/Makefile +15 -11
  57. data/lua-hooks/ext/luajit/src/Makefile.dep +16 -16
  58. data/lua-hooks/ext/luajit/src/host/buildvm.c +2 -2
  59. data/lua-hooks/ext/luajit/src/host/buildvm.h +1 -1
  60. data/lua-hooks/ext/luajit/src/host/buildvm_asm.c +9 -4
  61. data/lua-hooks/ext/luajit/src/host/buildvm_fold.c +2 -2
  62. data/lua-hooks/ext/luajit/src/host/buildvm_lib.c +1 -1
  63. data/lua-hooks/ext/luajit/src/host/buildvm_libbc.h +14 -3
  64. data/lua-hooks/ext/luajit/src/host/buildvm_peobj.c +27 -3
  65. data/lua-hooks/ext/luajit/src/host/genlibbc.lua +1 -1
  66. data/lua-hooks/ext/luajit/src/host/genminilua.lua +6 -5
  67. data/lua-hooks/ext/luajit/src/host/minilua.c +1 -1
  68. data/lua-hooks/ext/luajit/src/jit/bc.lua +1 -1
  69. data/lua-hooks/ext/luajit/src/jit/bcsave.lua +8 -8
  70. data/lua-hooks/ext/luajit/src/jit/dis_arm.lua +2 -2
  71. data/lua-hooks/ext/luajit/src/jit/dis_arm64.lua +1216 -0
  72. data/lua-hooks/ext/luajit/src/jit/dis_arm64be.lua +12 -0
  73. data/lua-hooks/ext/luajit/src/jit/dis_mips.lua +35 -20
  74. data/lua-hooks/ext/luajit/src/jit/dis_mips64.lua +17 -0
  75. data/lua-hooks/ext/luajit/src/jit/dis_mips64el.lua +17 -0
  76. data/lua-hooks/ext/luajit/src/jit/dis_mipsel.lua +1 -1
  77. data/lua-hooks/ext/luajit/src/jit/dis_ppc.lua +2 -2
  78. data/lua-hooks/ext/luajit/src/jit/dis_x64.lua +1 -1
  79. data/lua-hooks/ext/luajit/src/jit/dis_x86.lua +7 -4
  80. data/lua-hooks/ext/luajit/src/jit/dump.lua +17 -12
  81. data/lua-hooks/ext/luajit/src/jit/p.lua +3 -2
  82. data/lua-hooks/ext/luajit/src/jit/v.lua +2 -2
  83. data/lua-hooks/ext/luajit/src/jit/zone.lua +1 -1
  84. data/lua-hooks/ext/luajit/src/lauxlib.h +14 -20
  85. data/lua-hooks/ext/luajit/src/lib_aux.c +38 -27
  86. data/lua-hooks/ext/luajit/src/lib_base.c +12 -5
  87. data/lua-hooks/ext/luajit/src/lib_bit.c +1 -1
  88. data/lua-hooks/ext/luajit/src/lib_debug.c +5 -5
  89. data/lua-hooks/ext/luajit/src/lib_ffi.c +2 -2
  90. data/lua-hooks/ext/luajit/src/lib_init.c +16 -16
  91. data/lua-hooks/ext/luajit/src/lib_io.c +6 -7
  92. data/lua-hooks/ext/luajit/src/lib_jit.c +14 -4
  93. data/lua-hooks/ext/luajit/src/lib_math.c +1 -5
  94. data/lua-hooks/ext/luajit/src/lib_os.c +1 -1
  95. data/lua-hooks/ext/luajit/src/lib_package.c +14 -23
  96. data/lua-hooks/ext/luajit/src/lib_string.c +1 -5
  97. data/lua-hooks/ext/luajit/src/lib_table.c +21 -1
  98. data/lua-hooks/ext/luajit/src/lj.supp +3 -3
  99. data/lua-hooks/ext/luajit/src/lj_alloc.c +174 -83
  100. data/lua-hooks/ext/luajit/src/lj_api.c +97 -18
  101. data/lua-hooks/ext/luajit/src/lj_arch.h +54 -22
  102. data/lua-hooks/ext/luajit/src/lj_asm.c +172 -53
  103. data/lua-hooks/ext/luajit/src/lj_asm.h +1 -1
  104. data/lua-hooks/ext/luajit/src/lj_asm_arm.h +19 -16
  105. data/lua-hooks/ext/luajit/src/lj_asm_arm64.h +2022 -0
  106. data/lua-hooks/ext/luajit/src/lj_asm_mips.h +564 -158
  107. data/lua-hooks/ext/luajit/src/lj_asm_ppc.h +19 -18
  108. data/lua-hooks/ext/luajit/src/lj_asm_x86.h +578 -92
  109. data/lua-hooks/ext/luajit/src/lj_bc.c +1 -1
  110. data/lua-hooks/ext/luajit/src/lj_bc.h +1 -1
  111. data/lua-hooks/ext/luajit/src/lj_bcdump.h +1 -1
  112. data/lua-hooks/ext/luajit/src/lj_bcread.c +1 -1
  113. data/lua-hooks/ext/luajit/src/lj_bcwrite.c +1 -1
  114. data/lua-hooks/ext/luajit/src/lj_buf.c +1 -1
  115. data/lua-hooks/ext/luajit/src/lj_buf.h +1 -1
  116. data/lua-hooks/ext/luajit/src/lj_carith.c +1 -1
  117. data/lua-hooks/ext/luajit/src/lj_carith.h +1 -1
  118. data/lua-hooks/ext/luajit/src/lj_ccall.c +172 -7
  119. data/lua-hooks/ext/luajit/src/lj_ccall.h +21 -5
  120. data/lua-hooks/ext/luajit/src/lj_ccallback.c +71 -17
  121. data/lua-hooks/ext/luajit/src/lj_ccallback.h +1 -1
  122. data/lua-hooks/ext/luajit/src/lj_cconv.c +4 -2
  123. data/lua-hooks/ext/luajit/src/lj_cconv.h +1 -1
  124. data/lua-hooks/ext/luajit/src/lj_cdata.c +7 -5
  125. data/lua-hooks/ext/luajit/src/lj_cdata.h +1 -1
  126. data/lua-hooks/ext/luajit/src/lj_clib.c +5 -5
  127. data/lua-hooks/ext/luajit/src/lj_clib.h +1 -1
  128. data/lua-hooks/ext/luajit/src/lj_cparse.c +11 -6
  129. data/lua-hooks/ext/luajit/src/lj_cparse.h +1 -1
  130. data/lua-hooks/ext/luajit/src/lj_crecord.c +70 -14
  131. data/lua-hooks/ext/luajit/src/lj_crecord.h +1 -1
  132. data/lua-hooks/ext/luajit/src/lj_ctype.c +1 -1
  133. data/lua-hooks/ext/luajit/src/lj_ctype.h +8 -8
  134. data/lua-hooks/ext/luajit/src/lj_debug.c +1 -1
  135. data/lua-hooks/ext/luajit/src/lj_debug.h +1 -1
  136. data/lua-hooks/ext/luajit/src/lj_def.h +6 -9
  137. data/lua-hooks/ext/luajit/src/lj_dispatch.c +3 -3
  138. data/lua-hooks/ext/luajit/src/lj_dispatch.h +2 -1
  139. data/lua-hooks/ext/luajit/src/lj_emit_arm.h +5 -4
  140. data/lua-hooks/ext/luajit/src/lj_emit_arm64.h +419 -0
  141. data/lua-hooks/ext/luajit/src/lj_emit_mips.h +100 -20
  142. data/lua-hooks/ext/luajit/src/lj_emit_ppc.h +4 -4
  143. data/lua-hooks/ext/luajit/src/lj_emit_x86.h +116 -25
  144. data/lua-hooks/ext/luajit/src/lj_err.c +34 -13
  145. data/lua-hooks/ext/luajit/src/lj_err.h +1 -1
  146. data/lua-hooks/ext/luajit/src/lj_errmsg.h +1 -1
  147. data/lua-hooks/ext/luajit/src/lj_ff.h +1 -1
  148. data/lua-hooks/ext/luajit/src/lj_ffrecord.c +58 -49
  149. data/lua-hooks/ext/luajit/src/lj_ffrecord.h +1 -1
  150. data/lua-hooks/ext/luajit/src/lj_frame.h +33 -6
  151. data/lua-hooks/ext/luajit/src/lj_func.c +4 -2
  152. data/lua-hooks/ext/luajit/src/lj_func.h +1 -1
  153. data/lua-hooks/ext/luajit/src/lj_gc.c +16 -7
  154. data/lua-hooks/ext/luajit/src/lj_gc.h +1 -1
  155. data/lua-hooks/ext/luajit/src/lj_gdbjit.c +31 -1
  156. data/lua-hooks/ext/luajit/src/lj_gdbjit.h +1 -1
  157. data/lua-hooks/ext/luajit/src/lj_ir.c +69 -96
  158. data/lua-hooks/ext/luajit/src/lj_ir.h +29 -18
  159. data/lua-hooks/ext/luajit/src/lj_ircall.h +24 -30
  160. data/lua-hooks/ext/luajit/src/lj_iropt.h +9 -9
  161. data/lua-hooks/ext/luajit/src/lj_jit.h +67 -9
  162. data/lua-hooks/ext/luajit/src/lj_lex.c +1 -1
  163. data/lua-hooks/ext/luajit/src/lj_lex.h +1 -1
  164. data/lua-hooks/ext/luajit/src/lj_lib.c +1 -1
  165. data/lua-hooks/ext/luajit/src/lj_lib.h +1 -1
  166. data/lua-hooks/ext/luajit/src/lj_load.c +1 -1
  167. data/lua-hooks/ext/luajit/src/lj_mcode.c +11 -10
  168. data/lua-hooks/ext/luajit/src/lj_mcode.h +1 -1
  169. data/lua-hooks/ext/luajit/src/lj_meta.c +1 -1
  170. data/lua-hooks/ext/luajit/src/lj_meta.h +1 -1
  171. data/lua-hooks/ext/luajit/src/lj_obj.c +1 -1
  172. data/lua-hooks/ext/luajit/src/lj_obj.h +7 -3
  173. data/lua-hooks/ext/luajit/src/lj_opt_dce.c +1 -1
  174. data/lua-hooks/ext/luajit/src/lj_opt_fold.c +84 -17
  175. data/lua-hooks/ext/luajit/src/lj_opt_loop.c +1 -1
  176. data/lua-hooks/ext/luajit/src/lj_opt_mem.c +3 -3
  177. data/lua-hooks/ext/luajit/src/lj_opt_narrow.c +24 -22
  178. data/lua-hooks/ext/luajit/src/lj_opt_sink.c +11 -6
  179. data/lua-hooks/ext/luajit/src/lj_opt_split.c +11 -2
  180. data/lua-hooks/ext/luajit/src/lj_parse.c +9 -7
  181. data/lua-hooks/ext/luajit/src/lj_parse.h +1 -1
  182. data/lua-hooks/ext/luajit/src/lj_profile.c +1 -1
  183. data/lua-hooks/ext/luajit/src/lj_profile.h +1 -1
  184. data/lua-hooks/ext/luajit/src/lj_record.c +201 -117
  185. data/lua-hooks/ext/luajit/src/lj_record.h +1 -1
  186. data/lua-hooks/ext/luajit/src/lj_snap.c +72 -26
  187. data/lua-hooks/ext/luajit/src/lj_snap.h +1 -1
  188. data/lua-hooks/ext/luajit/src/lj_state.c +6 -6
  189. data/lua-hooks/ext/luajit/src/lj_state.h +2 -2
  190. data/lua-hooks/ext/luajit/src/lj_str.c +1 -1
  191. data/lua-hooks/ext/luajit/src/lj_str.h +1 -1
  192. data/lua-hooks/ext/luajit/src/lj_strfmt.c +7 -3
  193. data/lua-hooks/ext/luajit/src/lj_strfmt.h +1 -1
  194. data/lua-hooks/ext/luajit/src/lj_strfmt_num.c +4 -3
  195. data/lua-hooks/ext/luajit/src/lj_strscan.c +1 -1
  196. data/lua-hooks/ext/luajit/src/lj_strscan.h +1 -1
  197. data/lua-hooks/ext/luajit/src/lj_tab.c +1 -2
  198. data/lua-hooks/ext/luajit/src/lj_tab.h +1 -1
  199. data/lua-hooks/ext/luajit/src/lj_target.h +3 -3
  200. data/lua-hooks/ext/luajit/src/lj_target_arm.h +1 -1
  201. data/lua-hooks/ext/luajit/src/lj_target_arm64.h +239 -7
  202. data/lua-hooks/ext/luajit/src/lj_target_mips.h +111 -22
  203. data/lua-hooks/ext/luajit/src/lj_target_ppc.h +1 -1
  204. data/lua-hooks/ext/luajit/src/lj_target_x86.h +21 -4
  205. data/lua-hooks/ext/luajit/src/lj_trace.c +63 -18
  206. data/lua-hooks/ext/luajit/src/lj_trace.h +2 -1
  207. data/lua-hooks/ext/luajit/src/lj_traceerr.h +1 -1
  208. data/lua-hooks/ext/luajit/src/lj_udata.c +1 -1
  209. data/lua-hooks/ext/luajit/src/lj_udata.h +1 -1
  210. data/lua-hooks/ext/luajit/src/lj_vm.h +5 -1
  211. data/lua-hooks/ext/luajit/src/lj_vmevent.c +1 -1
  212. data/lua-hooks/ext/luajit/src/lj_vmevent.h +1 -1
  213. data/lua-hooks/ext/luajit/src/lj_vmmath.c +1 -1
  214. data/lua-hooks/ext/luajit/src/ljamalg.c +1 -1
  215. data/lua-hooks/ext/luajit/src/lua.h +9 -1
  216. data/lua-hooks/ext/luajit/src/luaconf.h +3 -7
  217. data/lua-hooks/ext/luajit/src/luajit.c +69 -54
  218. data/lua-hooks/ext/luajit/src/luajit.h +4 -4
  219. data/lua-hooks/ext/luajit/src/lualib.h +1 -1
  220. data/lua-hooks/ext/luajit/src/msvcbuild.bat +12 -4
  221. data/lua-hooks/ext/luajit/src/vm_arm.dasc +1 -1
  222. data/lua-hooks/ext/luajit/src/vm_arm64.dasc +255 -32
  223. data/lua-hooks/ext/luajit/src/vm_mips.dasc +26 -23
  224. data/lua-hooks/ext/luajit/src/vm_mips64.dasc +5062 -0
  225. data/lua-hooks/ext/luajit/src/vm_ppc.dasc +1 -1
  226. data/lua-hooks/ext/luajit/src/vm_x64.dasc +24 -25
  227. data/lua-hooks/ext/luajit/src/vm_x86.dasc +77 -4
  228. data/lua-hooks/libluahooks.darwin.a +0 -0
  229. data/lua-hooks/libluahooks.linux.a +0 -0
  230. data/lua-hooks/options.mk +1 -1
  231. metadata +37 -77
  232. data/lua-hooks/ext/all.c +0 -69
  233. data/lua-hooks/ext/libinjection/COPYING +0 -37
  234. data/lua-hooks/ext/libinjection/libinjection.h +0 -65
  235. data/lua-hooks/ext/libinjection/libinjection_html5.c +0 -847
  236. data/lua-hooks/ext/libinjection/libinjection_html5.h +0 -54
  237. data/lua-hooks/ext/libinjection/libinjection_sqli.c +0 -2301
  238. data/lua-hooks/ext/libinjection/libinjection_sqli.h +0 -295
  239. data/lua-hooks/ext/libinjection/libinjection_sqli_data.h +0 -9349
  240. data/lua-hooks/ext/libinjection/libinjection_xss.c +0 -531
  241. data/lua-hooks/ext/libinjection/libinjection_xss.h +0 -21
  242. data/lua-hooks/ext/libinjection/lualib.c +0 -145
  243. data/lua-hooks/ext/libinjection/module.mk +0 -5
  244. data/lua-hooks/ext/lpeg/HISTORY +0 -96
  245. data/lua-hooks/ext/lpeg/lpcap.c +0 -537
  246. data/lua-hooks/ext/lpeg/lpcap.h +0 -56
  247. data/lua-hooks/ext/lpeg/lpcode.c +0 -1014
  248. data/lua-hooks/ext/lpeg/lpcode.h +0 -40
  249. data/lua-hooks/ext/lpeg/lpeg-128.gif +0 -0
  250. data/lua-hooks/ext/lpeg/lpeg.html +0 -1445
  251. data/lua-hooks/ext/lpeg/lpprint.c +0 -244
  252. data/lua-hooks/ext/lpeg/lpprint.h +0 -36
  253. data/lua-hooks/ext/lpeg/lptree.c +0 -1303
  254. data/lua-hooks/ext/lpeg/lptree.h +0 -82
  255. data/lua-hooks/ext/lpeg/lptypes.h +0 -149
  256. data/lua-hooks/ext/lpeg/lpvm.c +0 -364
  257. data/lua-hooks/ext/lpeg/lpvm.h +0 -58
  258. data/lua-hooks/ext/lpeg/makefile +0 -55
  259. data/lua-hooks/ext/lpeg/module.mk +0 -6
  260. data/lua-hooks/ext/lpeg/re.html +0 -498
  261. data/lua-hooks/ext/lua-cmsgpack/.gitignore +0 -13
  262. data/lua-hooks/ext/lua-cmsgpack/CMakeLists.txt +0 -45
  263. data/lua-hooks/ext/lua-cmsgpack/README.md +0 -115
  264. data/lua-hooks/ext/lua-cmsgpack/lua_cmsgpack.c +0 -970
  265. data/lua-hooks/ext/lua-cmsgpack/module.mk +0 -2
  266. data/lua-hooks/ext/lua-cmsgpack/test.lua +0 -570
  267. data/lua-hooks/ext/lua-snapshot/LICENSE +0 -7
  268. data/lua-hooks/ext/lua-snapshot/Makefile +0 -12
  269. data/lua-hooks/ext/lua-snapshot/README.md +0 -18
  270. data/lua-hooks/ext/lua-snapshot/dump.lua +0 -15
  271. data/lua-hooks/ext/lua-snapshot/module.mk +0 -2
  272. data/lua-hooks/ext/lua-snapshot/snapshot.c +0 -462
  273. data/lua-hooks/ext/luautf8/README.md +0 -152
  274. data/lua-hooks/ext/luautf8/lutf8lib.c +0 -1274
  275. data/lua-hooks/ext/luautf8/module.mk +0 -2
  276. data/lua-hooks/ext/luautf8/unidata.h +0 -3064
  277. data/lua-hooks/ext/module.mk +0 -15
  278. data/lua-hooks/ext/modules.h +0 -17
  279. data/lua-hooks/ext/perf/luacpu.c +0 -114
  280. data/lua-hooks/ext/perf/lualoadavg.c +0 -40
  281. data/lua-hooks/ext/perf/luameminfo.c +0 -38
  282. data/lua-hooks/ext/perf/luaoslib.c +0 -203
  283. data/lua-hooks/ext/perf/module.mk +0 -5
  284. data/lua-hooks/ext/sha1/luasha1.c +0 -74
  285. data/lua-hooks/ext/sha1/module.mk +0 -5
  286. data/lua-hooks/ext/sha1/sha1.c +0 -145
  287. data/lua-hooks/ext/sha2/luasha256.c +0 -77
  288. data/lua-hooks/ext/sha2/module.mk +0 -5
  289. data/lua-hooks/ext/sha2/sha256.c +0 -196
  290. data/lua-hooks/ext/sysutils/lua_utils.c +0 -56
  291. data/lua-hooks/ext/sysutils/module.mk +0 -2
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Stack frames.
3
- ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #ifndef _LJ_FRAME_H
@@ -116,6 +116,17 @@ enum { LJ_CONT_TAILCALL, LJ_CONT_FFI_CALLBACK }; /* Special continuations. */
116
116
 
117
117
  /* These definitions must match with the arch-specific *.dasc files. */
118
118
  #if LJ_TARGET_X86
119
+ #if LJ_ABI_WIN
120
+ #define CFRAME_OFS_ERRF (19*4)
121
+ #define CFRAME_OFS_NRES (18*4)
122
+ #define CFRAME_OFS_PREV (17*4)
123
+ #define CFRAME_OFS_L (16*4)
124
+ #define CFRAME_OFS_SEH (9*4)
125
+ #define CFRAME_OFS_PC (6*4)
126
+ #define CFRAME_OFS_MULTRES (5*4)
127
+ #define CFRAME_SIZE (16*4)
128
+ #define CFRAME_SHIFT_MULTRES 0
129
+ #else
119
130
  #define CFRAME_OFS_ERRF (15*4)
120
131
  #define CFRAME_OFS_NRES (14*4)
121
132
  #define CFRAME_OFS_PREV (13*4)
@@ -124,6 +135,7 @@ enum { LJ_CONT_TAILCALL, LJ_CONT_FFI_CALLBACK }; /* Special continuations. */
124
135
  #define CFRAME_OFS_MULTRES (5*4)
125
136
  #define CFRAME_SIZE (12*4)
126
137
  #define CFRAME_SHIFT_MULTRES 0
138
+ #endif
127
139
  #elif LJ_TARGET_X64
128
140
  #if LJ_ABI_WIN
129
141
  #define CFRAME_OFS_PREV (13*8)
@@ -217,26 +229,41 @@ enum { LJ_CONT_TAILCALL, LJ_CONT_FFI_CALLBACK }; /* Special continuations. */
217
229
  #define CFRAME_SIZE 272
218
230
  #define CFRAME_SHIFT_MULTRES 3
219
231
  #endif
220
- #elif LJ_TARGET_MIPS
232
+ #elif LJ_TARGET_MIPS32
221
233
  #if LJ_ARCH_HASFPU
222
234
  #define CFRAME_OFS_ERRF 124
223
235
  #define CFRAME_OFS_NRES 120
224
236
  #define CFRAME_OFS_PREV 116
225
237
  #define CFRAME_OFS_L 112
226
- #define CFRAME_OFS_PC 20
227
- #define CFRAME_OFS_MULTRES 16
228
238
  #define CFRAME_SIZE 112
229
- #define CFRAME_SHIFT_MULTRES 3
230
239
  #else
231
240
  #define CFRAME_OFS_ERRF 76
232
241
  #define CFRAME_OFS_NRES 72
233
242
  #define CFRAME_OFS_PREV 68
234
243
  #define CFRAME_OFS_L 64
244
+ #define CFRAME_SIZE 64
245
+ #endif
235
246
  #define CFRAME_OFS_PC 20
236
247
  #define CFRAME_OFS_MULTRES 16
237
- #define CFRAME_SIZE 64
238
248
  #define CFRAME_SHIFT_MULTRES 3
249
+ #elif LJ_TARGET_MIPS64
250
+ #if LJ_ARCH_HASFPU
251
+ #define CFRAME_OFS_ERRF 188
252
+ #define CFRAME_OFS_NRES 184
253
+ #define CFRAME_OFS_PREV 176
254
+ #define CFRAME_OFS_L 168
255
+ #define CFRAME_OFS_PC 160
256
+ #define CFRAME_SIZE 192
257
+ #else
258
+ #define CFRAME_OFS_ERRF 124
259
+ #define CFRAME_OFS_NRES 120
260
+ #define CFRAME_OFS_PREV 112
261
+ #define CFRAME_OFS_L 104
262
+ #define CFRAME_OFS_PC 96
263
+ #define CFRAME_SIZE 128
239
264
  #endif
265
+ #define CFRAME_OFS_MULTRES 0
266
+ #define CFRAME_SHIFT_MULTRES 3
240
267
  #else
241
268
  #error "Missing CFRAME_* definitions for this architecture"
242
269
  #endif
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Function handling (prototypes, functions and upvalues).
3
- ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
4
4
  **
5
5
  ** Portions taken verbatim or adapted from the Lua interpreter.
6
6
  ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -140,7 +140,9 @@ GCfunc *lj_func_newL_empty(lua_State *L, GCproto *pt, GCtab *env)
140
140
  /* NOBARRIER: The GCfunc is new (marked white). */
141
141
  for (i = 0; i < nuv; i++) {
142
142
  GCupval *uv = func_emptyuv(L);
143
- uv->dhash = (uint32_t)(uintptr_t)pt ^ ((uint32_t)proto_uv(pt)[i] << 24);
143
+ int32_t v = proto_uv(pt)[i];
144
+ uv->immutable = ((v / PROTO_UV_IMMUTABLE) & 1);
145
+ uv->dhash = (uint32_t)(uintptr_t)pt ^ (v << 24);
144
146
  setgcref(fn->l.uvptr[i], obj2gco(uv));
145
147
  }
146
148
  fn->l.nupvalues = (uint8_t)nuv;
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Function handling (prototypes, functions and upvalues).
3
- ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #ifndef _LJ_FUNC_H
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Garbage collector.
3
- ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
4
4
  **
5
5
  ** Major portions taken verbatim or adapted from the Lua interpreter.
6
6
  ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -169,12 +169,19 @@ static int gc_traverse_tab(global_State *g, GCtab *t)
169
169
  while ((c = *modestr++)) {
170
170
  if (c == 'k') weak |= LJ_GC_WEAKKEY;
171
171
  else if (c == 'v') weak |= LJ_GC_WEAKVAL;
172
- else if (c == 'K') weak = (int)(~0u & ~LJ_GC_WEAKVAL);
173
172
  }
174
- if (weak > 0) { /* Weak tables are cleared in the atomic phase. */
175
- t->marked = (uint8_t)((t->marked & ~LJ_GC_WEAK) | weak);
176
- setgcrefr(t->gclist, g->gc.weak);
177
- setgcref(g->gc.weak, obj2gco(t));
173
+ if (weak) { /* Weak tables are cleared in the atomic phase. */
174
+ #if LJ_HASFFI
175
+ CTState *cts = ctype_ctsG(g);
176
+ if (cts && cts->finalizer == t) {
177
+ weak = (int)(~0u & ~LJ_GC_WEAKVAL);
178
+ } else
179
+ #endif
180
+ {
181
+ t->marked = (uint8_t)((t->marked & ~LJ_GC_WEAK) | weak);
182
+ setgcrefr(t->gclist, g->gc.weak);
183
+ setgcref(g->gc.weak, obj2gco(t));
184
+ }
178
185
  }
179
186
  }
180
187
  if (weak == LJ_GC_WEAK) /* Nothing to mark if both keys/values are weak. */
@@ -238,6 +245,8 @@ static void gc_traverse_trace(global_State *g, GCtrace *T)
238
245
  IRIns *ir = &T->ir[ref];
239
246
  if (ir->o == IR_KGC)
240
247
  gc_markobj(g, ir_kgc(ir));
248
+ if (irt_is64(ir->t) && ir->o != IR_KNULL)
249
+ ref++;
241
250
  }
242
251
  if (T->link) gc_marktrace(g, T->link);
243
252
  if (T->nextroot) gc_marktrace(g, T->nextroot);
@@ -308,7 +317,7 @@ static size_t propagatemark(global_State *g)
308
317
  if (gc_traverse_tab(g, t) > 0)
309
318
  black2gray(o); /* Keep weak tables gray. */
310
319
  return sizeof(GCtab) + sizeof(TValue) * t->asize +
311
- sizeof(Node) * (t->hmask + 1);
320
+ (t->hmask ? sizeof(Node) * (t->hmask + 1) : 0);
312
321
  } else if (LJ_LIKELY(gct == ~LJ_TFUNC)) {
313
322
  GCfunc *fn = gco2func(o);
314
323
  gc_traverse_func(g, fn);
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Garbage collector.
3
- ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #ifndef _LJ_GC_H
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Client for the GDB JIT API.
3
- ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #define lj_gdbjit_c
@@ -296,6 +296,9 @@ enum {
296
296
  #elif LJ_TARGET_ARM
297
297
  DW_REG_SP = 13,
298
298
  DW_REG_RA = 14,
299
+ #elif LJ_TARGET_ARM64
300
+ DW_REG_SP = 31,
301
+ DW_REG_RA = 30,
299
302
  #elif LJ_TARGET_PPC
300
303
  DW_REG_SP = 1,
301
304
  DW_REG_RA = 65,
@@ -374,6 +377,8 @@ static const ELFheader elfhdr_template = {
374
377
  .machine = 62,
375
378
  #elif LJ_TARGET_ARM
376
379
  .machine = 40,
380
+ #elif LJ_TARGET_ARM64
381
+ .machine = 183,
377
382
  #elif LJ_TARGET_PPC
378
383
  .machine = 20,
379
384
  #elif LJ_TARGET_MIPS
@@ -563,6 +568,13 @@ static void LJ_FASTCALL gdbjit_ehframe(GDBJITctx *ctx)
563
568
  int i;
564
569
  for (i = 11; i >= 4; i--) { DB(DW_CFA_offset|i); DUV(2+(11-i)); }
565
570
  }
571
+ #elif LJ_TARGET_ARM64
572
+ {
573
+ int i;
574
+ DB(DW_CFA_offset|31); DUV(2);
575
+ for (i = 28; i >= 19; i--) { DB(DW_CFA_offset|i); DUV(3+(28-i)); }
576
+ for (i = 15; i >= 8; i--) { DB(DW_CFA_offset|32|i); DUV(28-i); }
577
+ }
566
578
  #elif LJ_TARGET_PPC
567
579
  {
568
580
  int i;
@@ -719,6 +731,20 @@ static void gdbjit_buildobj(GDBJITctx *ctx)
719
731
 
720
732
  /* -- Interface to GDB JIT API -------------------------------------------- */
721
733
 
734
+ static int gdbjit_lock;
735
+
736
+ static void gdbjit_lock_acquire()
737
+ {
738
+ while (__sync_lock_test_and_set(&gdbjit_lock, 1)) {
739
+ /* Just spin; futexes or pthreads aren't worth the portability cost. */
740
+ }
741
+ }
742
+
743
+ static void gdbjit_lock_release()
744
+ {
745
+ __sync_lock_release(&gdbjit_lock);
746
+ }
747
+
722
748
  /* Add new entry to GDB JIT symbol chain. */
723
749
  static void gdbjit_newentry(lua_State *L, GDBJITctx *ctx)
724
750
  {
@@ -730,6 +756,7 @@ static void gdbjit_newentry(lua_State *L, GDBJITctx *ctx)
730
756
  ctx->T->gdbjit_entry = (void *)eo;
731
757
  /* Link new entry to chain and register it. */
732
758
  eo->entry.prev_entry = NULL;
759
+ gdbjit_lock_acquire();
733
760
  eo->entry.next_entry = __jit_debug_descriptor.first_entry;
734
761
  if (eo->entry.next_entry)
735
762
  eo->entry.next_entry->prev_entry = &eo->entry;
@@ -739,6 +766,7 @@ static void gdbjit_newentry(lua_State *L, GDBJITctx *ctx)
739
766
  __jit_debug_descriptor.relevant_entry = &eo->entry;
740
767
  __jit_debug_descriptor.action_flag = GDBJIT_REGISTER;
741
768
  __jit_debug_register_code();
769
+ gdbjit_lock_release();
742
770
  }
743
771
 
744
772
  /* Add debug info for newly compiled trace and notify GDB. */
@@ -770,6 +798,7 @@ void lj_gdbjit_deltrace(jit_State *J, GCtrace *T)
770
798
  {
771
799
  GDBJITentryobj *eo = (GDBJITentryobj *)T->gdbjit_entry;
772
800
  if (eo) {
801
+ gdbjit_lock_acquire();
773
802
  if (eo->entry.prev_entry)
774
803
  eo->entry.prev_entry->next_entry = eo->entry.next_entry;
775
804
  else
@@ -779,6 +808,7 @@ void lj_gdbjit_deltrace(jit_State *J, GCtrace *T)
779
808
  __jit_debug_descriptor.relevant_entry = &eo->entry;
780
809
  __jit_debug_descriptor.action_flag = GDBJIT_UNREGISTER;
781
810
  __jit_debug_register_code();
811
+ gdbjit_lock_release();
782
812
  lj_mem_free(J2G(J), eo, eo->sz);
783
813
  }
784
814
  }
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Client for the GDB JIT API.
3
- ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #ifndef _LJ_GDBJIT_H
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** SSA IR (Intermediate Representation) emitter.
3
- ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #define lj_ir_c
@@ -91,7 +91,7 @@ static void lj_ir_growbot(jit_State *J)
91
91
  IRIns *baseir = J->irbuf + J->irbotlim;
92
92
  MSize szins = J->irtoplim - J->irbotlim;
93
93
  lua_assert(szins != 0);
94
- lua_assert(J->cur.nk == J->irbotlim);
94
+ lua_assert(J->cur.nk == J->irbotlim || J->cur.nk-1 == J->irbotlim);
95
95
  if (J->cur.nins + (szins >> 1) < J->irtoplim) {
96
96
  /* More than half of the buffer is free on top: shift up by a quarter. */
97
97
  MSize ofs = szins >> 2;
@@ -145,6 +145,16 @@ TRef lj_ir_call(jit_State *J, IRCallID id, ...)
145
145
  return emitir(CCI_OPTYPE(ci), tr, id);
146
146
  }
147
147
 
148
+ /* Load field of type t from GG_State + offset. Must be 32 bit aligned. */
149
+ LJ_FUNC TRef lj_ir_ggfload(jit_State *J, IRType t, uintptr_t ofs)
150
+ {
151
+ lua_assert((ofs & 3) == 0);
152
+ ofs >>= 2;
153
+ lua_assert(ofs >= IRFL__MAX && ofs <= 0x3ff); /* 10 bit FOLD key limit. */
154
+ lj_ir_set(J, IRT(IR_FLOAD, t), REF_NIL, ofs);
155
+ return lj_opt_fold(J);
156
+ }
157
+
148
158
  /* -- Interning of constants ---------------------------------------------- */
149
159
 
150
160
  /*
@@ -165,6 +175,24 @@ static LJ_AINLINE IRRef ir_nextk(jit_State *J)
165
175
  return ref;
166
176
  }
167
177
 
178
+ /* Get ref of next 64 bit IR constant and optionally grow IR.
179
+ ** Note: this may invalidate all IRIns *!
180
+ */
181
+ static LJ_AINLINE IRRef ir_nextk64(jit_State *J)
182
+ {
183
+ IRRef ref = J->cur.nk - 2;
184
+ lua_assert(J->state != LJ_TRACE_ASM);
185
+ if (LJ_UNLIKELY(ref < J->irbotlim)) lj_ir_growbot(J);
186
+ J->cur.nk = ref;
187
+ return ref;
188
+ }
189
+
190
+ #if LJ_GC64
191
+ #define ir_nextkgc ir_nextk64
192
+ #else
193
+ #define ir_nextkgc ir_nextk
194
+ #endif
195
+
168
196
  /* Intern int32_t constant. */
169
197
  TRef LJ_FASTCALL lj_ir_kint(jit_State *J, int32_t k)
170
198
  {
@@ -184,95 +212,21 @@ found:
184
212
  return TREF(ref, IRT_INT);
185
213
  }
186
214
 
187
- /* The MRef inside the KNUM/KINT64 IR instructions holds the address of the
188
- ** 64 bit constant. The constants themselves are stored in a chained array
189
- ** and shared across traces.
190
- **
191
- ** Rationale for choosing this data structure:
192
- ** - The address of the constants is embedded in the generated machine code
193
- ** and must never move. A resizable array or hash table wouldn't work.
194
- ** - Most apps need very few non-32 bit integer constants (less than a dozen).
195
- ** - Linear search is hard to beat in terms of speed and low complexity.
196
- */
197
- typedef struct K64Array {
198
- MRef next; /* Pointer to next list. */
199
- MSize numk; /* Number of used elements in this array. */
200
- TValue k[LJ_MIN_K64SZ]; /* Array of constants. */
201
- } K64Array;
202
-
203
- /* Free all chained arrays. */
204
- void lj_ir_k64_freeall(jit_State *J)
205
- {
206
- K64Array *k;
207
- for (k = mref(J->k64, K64Array); k; ) {
208
- K64Array *next = mref(k->next, K64Array);
209
- lj_mem_free(J2G(J), k, sizeof(K64Array));
210
- k = next;
211
- }
212
- setmref(J->k64, NULL);
213
- }
214
-
215
- /* Get new 64 bit constant slot. */
216
- static TValue *ir_k64_add(jit_State *J, K64Array *kp, uint64_t u64)
217
- {
218
- TValue *ntv;
219
- if (!(kp && kp->numk < LJ_MIN_K64SZ)) { /* Allocate a new array. */
220
- K64Array *kn = lj_mem_newt(J->L, sizeof(K64Array), K64Array);
221
- setmref(kn->next, NULL);
222
- kn->numk = 0;
223
- if (kp)
224
- setmref(kp->next, kn); /* Chain to the end of the list. */
225
- else
226
- setmref(J->k64, kn); /* Link first array. */
227
- kp = kn;
228
- }
229
- ntv = &kp->k[kp->numk++]; /* Add to current array. */
230
- ntv->u64 = u64;
231
- return ntv;
232
- }
233
-
234
- /* Find 64 bit constant in chained array or add it. */
235
- cTValue *lj_ir_k64_find(jit_State *J, uint64_t u64)
236
- {
237
- K64Array *k, *kp = NULL;
238
- MSize idx;
239
- /* Search for the constant in the whole chain of arrays. */
240
- for (k = mref(J->k64, K64Array); k; k = mref(k->next, K64Array)) {
241
- kp = k; /* Remember previous element in list. */
242
- for (idx = 0; idx < k->numk; idx++) { /* Search one array. */
243
- TValue *tv = &k->k[idx];
244
- if (tv->u64 == u64) /* Needed for +-0/NaN/absmask. */
245
- return tv;
246
- }
247
- }
248
- /* Otherwise add a new constant. */
249
- return ir_k64_add(J, kp, u64);
250
- }
251
-
252
- TValue *lj_ir_k64_reserve(jit_State *J)
253
- {
254
- K64Array *k, *kp = NULL;
255
- lj_ir_k64_find(J, 0); /* Intern dummy 0 to protect the reserved slot. */
256
- /* Find last K64Array, if any. */
257
- for (k = mref(J->k64, K64Array); k; k = mref(k->next, K64Array)) kp = k;
258
- return ir_k64_add(J, kp, 0); /* Set to 0. Final value is set later. */
259
- }
260
-
261
- /* Intern 64 bit constant, given by its address. */
262
- TRef lj_ir_k64(jit_State *J, IROp op, cTValue *tv)
215
+ /* Intern 64 bit constant, given by its 64 bit pattern. */
216
+ TRef lj_ir_k64(jit_State *J, IROp op, uint64_t u64)
263
217
  {
264
218
  IRIns *ir, *cir = J->cur.ir;
265
219
  IRRef ref;
266
220
  IRType t = op == IR_KNUM ? IRT_NUM : IRT_I64;
267
221
  for (ref = J->chain[op]; ref; ref = cir[ref].prev)
268
- if (ir_k64(&cir[ref]) == tv)
222
+ if (ir_k64(&cir[ref])->u64 == u64)
269
223
  goto found;
270
- ref = ir_nextk(J);
224
+ ref = ir_nextk64(J);
271
225
  ir = IR(ref);
272
- lua_assert(checkptrGC(tv));
273
- setmref(ir->ptr, tv);
226
+ ir[1].tv.u64 = u64;
274
227
  ir->t.irt = t;
275
228
  ir->o = op;
229
+ ir->op12 = 0;
276
230
  ir->prev = J->chain[op];
277
231
  J->chain[op] = (IRRef1)ref;
278
232
  found:
@@ -282,13 +236,13 @@ found:
282
236
  /* Intern FP constant, given by its 64 bit pattern. */
283
237
  TRef lj_ir_knum_u64(jit_State *J, uint64_t u64)
284
238
  {
285
- return lj_ir_k64(J, IR_KNUM, lj_ir_k64_find(J, u64));
239
+ return lj_ir_k64(J, IR_KNUM, u64);
286
240
  }
287
241
 
288
242
  /* Intern 64 bit integer constant. */
289
243
  TRef lj_ir_kint64(jit_State *J, uint64_t u64)
290
244
  {
291
- return lj_ir_k64(J, IR_KINT64, lj_ir_k64_find(J, u64));
245
+ return lj_ir_k64(J, IR_KINT64, u64);
292
246
  }
293
247
 
294
248
  /* Check whether a number is int and return it. -0 is NOT considered an int. */
@@ -323,15 +277,15 @@ TRef lj_ir_kgc(jit_State *J, GCobj *o, IRType t)
323
277
  {
324
278
  IRIns *ir, *cir = J->cur.ir;
325
279
  IRRef ref;
326
- lua_assert(!LJ_GC64); /* TODO_GC64: major changes required. */
327
280
  lua_assert(!isdead(J2G(J), o));
328
281
  for (ref = J->chain[IR_KGC]; ref; ref = cir[ref].prev)
329
282
  if (ir_kgc(&cir[ref]) == o)
330
283
  goto found;
331
- ref = ir_nextk(J);
284
+ ref = ir_nextkgc(J);
332
285
  ir = IR(ref);
333
286
  /* NOBARRIER: Current trace is a GC root. */
334
- setgcref(ir->gcr, o);
287
+ ir->op12 = 0;
288
+ setgcref(ir[LJ_GC64].gcr, o);
335
289
  ir->t.irt = (uint8_t)t;
336
290
  ir->o = IR_KGC;
337
291
  ir->prev = J->chain[IR_KGC];
@@ -340,24 +294,44 @@ found:
340
294
  return TREF(ref, t);
341
295
  }
342
296
 
343
- /* Intern 32 bit pointer constant. */
297
+ /* Allocate GCtrace constant placeholder (no interning). */
298
+ TRef lj_ir_ktrace(jit_State *J)
299
+ {
300
+ IRRef ref = ir_nextkgc(J);
301
+ IRIns *ir = IR(ref);
302
+ lua_assert(irt_toitype_(IRT_P64) == LJ_TTRACE);
303
+ ir->t.irt = IRT_P64;
304
+ ir->o = LJ_GC64 ? IR_KNUM : IR_KNULL; /* Not IR_KGC yet, but same size. */
305
+ ir->op12 = 0;
306
+ ir->prev = 0;
307
+ return TREF(ref, IRT_P64);
308
+ }
309
+
310
+ /* Intern pointer constant. */
344
311
  TRef lj_ir_kptr_(jit_State *J, IROp op, void *ptr)
345
312
  {
346
313
  IRIns *ir, *cir = J->cur.ir;
347
314
  IRRef ref;
348
- lua_assert((void *)(intptr_t)i32ptr(ptr) == ptr);
315
+ #if LJ_64 && !LJ_GC64
316
+ lua_assert((void *)(uintptr_t)u32ptr(ptr) == ptr);
317
+ #endif
349
318
  for (ref = J->chain[op]; ref; ref = cir[ref].prev)
350
- if (mref(cir[ref].ptr, void) == ptr)
319
+ if (ir_kptr(&cir[ref]) == ptr)
351
320
  goto found;
321
+ #if LJ_GC64
322
+ ref = ir_nextk64(J);
323
+ #else
352
324
  ref = ir_nextk(J);
325
+ #endif
353
326
  ir = IR(ref);
354
- setmref(ir->ptr, ptr);
355
- ir->t.irt = IRT_P32;
327
+ ir->op12 = 0;
328
+ setmref(ir[LJ_GC64].ptr, ptr);
329
+ ir->t.irt = IRT_PGC;
356
330
  ir->o = op;
357
331
  ir->prev = J->chain[op];
358
332
  J->chain[op] = (IRRef1)ref;
359
333
  found:
360
- return TREF(ref, IRT_P32);
334
+ return TREF(ref, IRT_PGC);
361
335
  }
362
336
 
363
337
  /* Intern typed NULL constant. */
@@ -412,9 +386,8 @@ void lj_ir_kvalue(lua_State *L, TValue *tv, const IRIns *ir)
412
386
  case IR_KPRI: setpriV(tv, irt_toitype(ir->t)); break;
413
387
  case IR_KINT: setintV(tv, ir->i); break;
414
388
  case IR_KGC: setgcV(L, tv, ir_kgc(ir), irt_toitype(ir->t)); break;
415
- case IR_KPTR: case IR_KKPTR: case IR_KNULL:
416
- setlightudV(tv, mref(ir->ptr, void));
417
- break;
389
+ case IR_KPTR: case IR_KKPTR: setlightudV(tv, ir_kptr(ir)); break;
390
+ case IR_KNULL: setlightudV(tv, NULL); break;
418
391
  case IR_KNUM: setnumV(tv, ir_knum(ir)->n); break;
419
392
  #if LJ_HASFFI
420
393
  case IR_KINT64: {