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
  ** FFI C callback handling.
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_CCALLBACK_H
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** C type conversions.
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
  #include "lj_obj.h"
@@ -448,8 +448,10 @@ int lj_cconv_tv_bf(CTState *cts, CType *s, TValue *o, uint8_t *sp)
448
448
  setintV(o, (int32_t)val);
449
449
  }
450
450
  } else {
451
+ uint32_t b = (val >> pos) & 1;
451
452
  lua_assert(bsz == 1);
452
- setboolV(o, (val >> pos) & 1);
453
+ setboolV(o, b);
454
+ setboolV(&cts->g->tmptv2, b); /* Remember for trace recorder. */
453
455
  }
454
456
  return 0; /* No GC step needed. */
455
457
  }
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** C type conversions.
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_CCONV_H
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** C data management.
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
  #include "lj_obj.h"
@@ -93,11 +93,13 @@ void lj_cdata_setfin(lua_State *L, GCcdata *cd, GCobj *obj, uint32_t it)
93
93
  setcdataV(L, &tmp, cd);
94
94
  lj_gc_anybarriert(L, t);
95
95
  tv = lj_tab_set(L, t, &tmp);
96
- setgcV(L, tv, obj, it);
97
- if (!tvisnil(tv))
98
- cd->marked |= LJ_GC_CDATA_FIN;
99
- else
96
+ if (it == LJ_TNIL) {
97
+ setnilV(tv);
100
98
  cd->marked &= ~LJ_GC_CDATA_FIN;
99
+ } else {
100
+ setgcV(L, tv, obj, it);
101
+ cd->marked |= LJ_GC_CDATA_FIN;
102
+ }
101
103
  }
102
104
  }
103
105
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** C data management.
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_CDATA_H
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** FFI C library loader.
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
  #include "lj_obj.h"
@@ -40,7 +40,7 @@ LJ_NORET LJ_NOINLINE static void clib_error_(lua_State *L)
40
40
 
41
41
  #define clib_error(L, fmt, name) clib_error_(L)
42
42
 
43
- #if defined(__CYGWIN__)
43
+ #if LJ_TARGET_CYGWIN
44
44
  #define CLIB_SOPREFIX "cyg"
45
45
  #else
46
46
  #define CLIB_SOPREFIX "lib"
@@ -48,7 +48,7 @@ LJ_NORET LJ_NOINLINE static void clib_error_(lua_State *L)
48
48
 
49
49
  #if LJ_TARGET_OSX
50
50
  #define CLIB_SOEXT "%s.dylib"
51
- #elif defined(__CYGWIN__)
51
+ #elif LJ_TARGET_CYGWIN
52
52
  #define CLIB_SOEXT "%s.dll"
53
53
  #else
54
54
  #define CLIB_SOEXT "%s.so"
@@ -57,14 +57,14 @@ LJ_NORET LJ_NOINLINE static void clib_error_(lua_State *L)
57
57
  static const char *clib_extname(lua_State *L, const char *name)
58
58
  {
59
59
  if (!strchr(name, '/')
60
- #ifdef __CYGWIN__
60
+ #if LJ_TARGET_CYGWIN
61
61
  && !strchr(name, '\\')
62
62
  #endif
63
63
  ) {
64
64
  if (!strchr(name, '.')) {
65
65
  name = lj_strfmt_pushf(L, CLIB_SOEXT, name);
66
66
  L->top--;
67
- #ifdef __CYGWIN__
67
+ #if LJ_TARGET_CYGWIN
68
68
  } else {
69
69
  return name;
70
70
  #endif
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** FFI C library loader.
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_CLIB_H
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** C declaration parser.
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
  #include "lj_obj.h"
@@ -297,13 +297,17 @@ static CPToken cp_next_(CPState *cp)
297
297
  else return '/';
298
298
  break;
299
299
  case '|':
300
- if (cp_get(cp) != '|') return '|'; cp_get(cp); return CTOK_OROR;
300
+ if (cp_get(cp) != '|') return '|';
301
+ cp_get(cp); return CTOK_OROR;
301
302
  case '&':
302
- if (cp_get(cp) != '&') return '&'; cp_get(cp); return CTOK_ANDAND;
303
+ if (cp_get(cp) != '&') return '&';
304
+ cp_get(cp); return CTOK_ANDAND;
303
305
  case '=':
304
- if (cp_get(cp) != '=') return '='; cp_get(cp); return CTOK_EQ;
306
+ if (cp_get(cp) != '=') return '=';
307
+ cp_get(cp); return CTOK_EQ;
305
308
  case '!':
306
- if (cp_get(cp) != '=') return '!'; cp_get(cp); return CTOK_NE;
309
+ if (cp_get(cp) != '=') return '!';
310
+ cp_get(cp); return CTOK_NE;
307
311
  case '<':
308
312
  if (cp_get(cp) == '=') { cp_get(cp); return CTOK_LE; }
309
313
  else if (cp->c == '<') { cp_get(cp); return CTOK_SHL; }
@@ -313,7 +317,8 @@ static CPToken cp_next_(CPState *cp)
313
317
  else if (cp->c == '>') { cp_get(cp); return CTOK_SHR; }
314
318
  return '>';
315
319
  case '-':
316
- if (cp_get(cp) != '>') return '-'; cp_get(cp); return CTOK_DEREF;
320
+ if (cp_get(cp) != '>') return '-';
321
+ cp_get(cp); return CTOK_DEREF;
317
322
  case '$':
318
323
  return cp_param(cp);
319
324
  case '\0': return CTOK_EOF;
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** C declaration parser.
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_CPARSE_H
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Trace recorder for C data operations.
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_ffrecord_c
@@ -712,6 +712,19 @@ static TRef crec_reassoc_ofs(jit_State *J, TRef tr, ptrdiff_t *ofsp, MSize sz)
712
712
  return tr;
713
713
  }
714
714
 
715
+ /* Tailcall to function. */
716
+ static void crec_tailcall(jit_State *J, RecordFFData *rd, cTValue *tv)
717
+ {
718
+ TRef kfunc = lj_ir_kfunc(J, funcV(tv));
719
+ #if LJ_FR2
720
+ J->base[-2] = kfunc;
721
+ J->base[-1] = TREF_FRAME;
722
+ #else
723
+ J->base[-1] = kfunc | TREF_FRAME;
724
+ #endif
725
+ rd->nres = -1; /* Pending tailcall. */
726
+ }
727
+
715
728
  /* Record ctype __index/__newindex metamethods. */
716
729
  static void crec_index_meta(jit_State *J, CTState *cts, CType *ct,
717
730
  RecordFFData *rd)
@@ -721,8 +734,7 @@ static void crec_index_meta(jit_State *J, CTState *cts, CType *ct,
721
734
  if (!tv)
722
735
  lj_trace_err(J, LJ_TRERR_BADTYPE);
723
736
  if (tvisfunc(tv)) {
724
- J->base[-1] = lj_ir_kfunc(J, funcV(tv)) | TREF_FRAME;
725
- rd->nres = -1; /* Pending tailcall. */
737
+ crec_tailcall(J, rd, tv);
726
738
  } else if (rd->data == 0 && tvistab(tv) && tref_isstr(J->base[1])) {
727
739
  /* Specialize to result of __index lookup. */
728
740
  cTValue *o = lj_tab_get(J->L, tabV(tv), &rd->argv[1]);
@@ -739,6 +751,48 @@ static void crec_index_meta(jit_State *J, CTState *cts, CType *ct,
739
751
  }
740
752
  }
741
753
 
754
+ /* Record bitfield load/store. */
755
+ static void crec_index_bf(jit_State *J, RecordFFData *rd, TRef ptr, CTInfo info)
756
+ {
757
+ IRType t = IRT_I8 + 2*lj_fls(ctype_bitcsz(info)) + ((info&CTF_UNSIGNED)?1:0);
758
+ TRef tr = emitir(IRT(IR_XLOAD, t), ptr, 0);
759
+ CTSize pos = ctype_bitpos(info), bsz = ctype_bitbsz(info), shift = 32 - bsz;
760
+ lua_assert(t <= IRT_U32); /* NYI: 64 bit bitfields. */
761
+ if (rd->data == 0) { /* __index metamethod. */
762
+ if ((info & CTF_BOOL)) {
763
+ tr = emitir(IRTI(IR_BAND), tr, lj_ir_kint(J, (int32_t)((1u << pos))));
764
+ /* Assume not equal to zero. Fixup and emit pending guard later. */
765
+ lj_ir_set(J, IRTGI(IR_NE), tr, lj_ir_kint(J, 0));
766
+ J->postproc = LJ_POST_FIXGUARD;
767
+ tr = TREF_TRUE;
768
+ } else if (!(info & CTF_UNSIGNED)) {
769
+ tr = emitir(IRTI(IR_BSHL), tr, lj_ir_kint(J, shift - pos));
770
+ tr = emitir(IRTI(IR_BSAR), tr, lj_ir_kint(J, shift));
771
+ } else {
772
+ lua_assert(bsz < 32); /* Full-size fields cannot end up here. */
773
+ tr = emitir(IRTI(IR_BSHR), tr, lj_ir_kint(J, pos));
774
+ tr = emitir(IRTI(IR_BAND), tr, lj_ir_kint(J, (int32_t)((1u << bsz)-1)));
775
+ /* We can omit the U32 to NUM conversion, since bsz < 32. */
776
+ }
777
+ J->base[0] = tr;
778
+ } else { /* __newindex metamethod. */
779
+ CTState *cts = ctype_ctsG(J2G(J));
780
+ CType *ct = ctype_get(cts,
781
+ (info & CTF_BOOL) ? CTID_BOOL :
782
+ (info & CTF_UNSIGNED) ? CTID_UINT32 : CTID_INT32);
783
+ int32_t mask = (int32_t)(((1u << bsz)-1) << pos);
784
+ TRef sp = crec_ct_tv(J, ct, 0, J->base[2], &rd->argv[2]);
785
+ sp = emitir(IRTI(IR_BSHL), sp, lj_ir_kint(J, pos));
786
+ /* Use of the target type avoids forwarding conversions. */
787
+ sp = emitir(IRT(IR_BAND, t), sp, lj_ir_kint(J, mask));
788
+ tr = emitir(IRT(IR_BAND, t), tr, lj_ir_kint(J, (int32_t)~mask));
789
+ tr = emitir(IRT(IR_BOR, t), tr, sp);
790
+ emitir(IRT(IR_XSTORE, t), ptr, tr);
791
+ rd->nres = 0;
792
+ J->needsnap = 1;
793
+ }
794
+ }
795
+
742
796
  void LJ_FASTCALL recff_cdata_index(jit_State *J, RecordFFData *rd)
743
797
  {
744
798
  TRef idx, ptr = J->base[0];
@@ -813,6 +867,7 @@ again:
813
867
  CType *fct;
814
868
  fct = lj_ctype_getfield(cts, ct, name, &fofs);
815
869
  if (fct) {
870
+ ofs += (ptrdiff_t)fofs;
816
871
  /* Always specialize to the field name. */
817
872
  emitir(IRTG(IR_EQ, IRT_STR), idx, lj_ir_kstr(J, name));
818
873
  if (ctype_isconstval(fct->info)) {
@@ -824,12 +879,14 @@ again:
824
879
  J->base[0] = lj_ir_kint(J, (int32_t)fct->size);
825
880
  return; /* Interpreter will throw for newindex. */
826
881
  } else if (ctype_isbitfield(fct->info)) {
827
- lj_trace_err(J, LJ_TRERR_NYICONV);
882
+ if (ofs)
883
+ ptr = emitir(IRT(IR_ADD, IRT_PTR), ptr, lj_ir_kintp(J, ofs));
884
+ crec_index_bf(J, rd, ptr, fct->info);
885
+ return;
828
886
  } else {
829
887
  lua_assert(ctype_isfield(fct->info));
830
888
  sid = ctype_cid(fct->info);
831
889
  }
832
- ofs += (ptrdiff_t)fofs;
833
890
  }
834
891
  } else if (ctype_iscomplex(ct->info)) {
835
892
  if (name->len == 2 &&
@@ -1119,20 +1176,20 @@ static void crec_snap_caller(jit_State *J)
1119
1176
  lua_State *L = J->L;
1120
1177
  TValue *base = L->base, *top = L->top;
1121
1178
  const BCIns *pc = J->pc;
1122
- TRef ftr = J->base[-1];
1179
+ TRef ftr = J->base[-1-LJ_FR2];
1123
1180
  ptrdiff_t delta;
1124
1181
  if (!frame_islua(base-1) || J->framedepth <= 0)
1125
1182
  lj_trace_err(J, LJ_TRERR_NYICALL);
1126
1183
  J->pc = frame_pc(base-1); delta = 1+LJ_FR2+bc_a(J->pc[-1]);
1127
1184
  L->top = base; L->base = base - delta;
1128
- J->base[-1] = TREF_FALSE;
1185
+ J->base[-1-LJ_FR2] = TREF_FALSE;
1129
1186
  J->base -= delta; J->baseslot -= (BCReg)delta;
1130
- J->maxslot = (BCReg)delta; J->framedepth--;
1187
+ J->maxslot = (BCReg)delta-LJ_FR2; J->framedepth--;
1131
1188
  lj_snap_add(J);
1132
1189
  L->base = base; L->top = top;
1133
1190
  J->framedepth++; J->maxslot = 1;
1134
1191
  J->base += delta; J->baseslot += (BCReg)delta;
1135
- J->base[-1] = ftr; J->pc = pc;
1192
+ J->base[-1-LJ_FR2] = ftr; J->pc = pc;
1136
1193
  }
1137
1194
 
1138
1195
  /* Record function call. */
@@ -1224,8 +1281,7 @@ void LJ_FASTCALL recff_cdata_call(jit_State *J, RecordFFData *rd)
1224
1281
  tv = lj_ctype_meta(cts, ctype_isptr(ct->info) ? ctype_cid(ct->info) : id, mm);
1225
1282
  if (tv) {
1226
1283
  if (tvisfunc(tv)) {
1227
- J->base[-1] = lj_ir_kfunc(J, funcV(tv)) | TREF_FRAME;
1228
- rd->nres = -1; /* Pending tailcall. */
1284
+ crec_tailcall(J, rd, tv);
1229
1285
  return;
1230
1286
  }
1231
1287
  } else if (mm == MM_new) {
@@ -1238,7 +1294,7 @@ void LJ_FASTCALL recff_cdata_call(jit_State *J, RecordFFData *rd)
1238
1294
 
1239
1295
  static TRef crec_arith_int64(jit_State *J, TRef *sp, CType **s, MMS mm)
1240
1296
  {
1241
- if (ctype_isnum(s[0]->info) && ctype_isnum(s[1]->info)) {
1297
+ if (sp[0] && sp[1] && ctype_isnum(s[0]->info) && ctype_isnum(s[1]->info)) {
1242
1298
  IRType dt;
1243
1299
  CTypeID id;
1244
1300
  TRef tr;
@@ -1296,6 +1352,7 @@ static TRef crec_arith_ptr(jit_State *J, TRef *sp, CType **s, MMS mm)
1296
1352
  {
1297
1353
  CTState *cts = ctype_ctsG(J2G(J));
1298
1354
  CType *ctp = s[0];
1355
+ if (!(sp[0] && sp[1])) return 0;
1299
1356
  if (ctype_isptr(ctp->info) || ctype_isrefarray(ctp->info)) {
1300
1357
  if ((mm == MM_sub || mm == MM_eq || mm == MM_lt || mm == MM_le) &&
1301
1358
  (ctype_isptr(s[1]->info) || ctype_isrefarray(s[1]->info))) {
@@ -1373,8 +1430,7 @@ static TRef crec_arith_meta(jit_State *J, TRef *sp, CType **s, CTState *cts,
1373
1430
  }
1374
1431
  if (tv) {
1375
1432
  if (tvisfunc(tv)) {
1376
- J->base[-1] = lj_ir_kfunc(J, funcV(tv)) | TREF_FRAME;
1377
- rd->nres = -1; /* Pending tailcall. */
1433
+ crec_tailcall(J, rd, tv);
1378
1434
  return 0;
1379
1435
  } /* NYI: non-function metamethods. */
1380
1436
  } else if ((MMS)rd->data == MM_eq) { /* Fallback cdata pointer comparison. */
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Trace recorder for C data operations.
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_CRECORD_H
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** C type management.
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
  #include "lj_obj.h"
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** C type management.
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_CTYPE_H
@@ -42,18 +42,18 @@ LJ_STATIC_ASSERT(((int)CT_STRUCT & (int)CT_ARRAY) == CT_STRUCT);
42
42
  ** ---------- info ------------
43
43
  ** |type flags... A cid | size | sib | next | name |
44
44
  ** +----------------------------+--------+-------+-------+-------+--
45
- ** |NUM BFvcUL.. A | size | | type | |
46
- ** |STRUCT ..vcU..V A | size | field | name? | name? |
47
- ** |PTR ..vcR... A cid | size | | type | |
48
- ** |ARRAY VCvc...V A cid | size | | type | |
49
- ** |VOID ..vc.... A | size | | type | |
45
+ ** |NUM BFcvUL.. A | size | | type | |
46
+ ** |STRUCT ..cvU..V A | size | field | name? | name? |
47
+ ** |PTR ..cvR... A cid | size | | type | |
48
+ ** |ARRAY VCcv...V A cid | size | | type | |
49
+ ** |VOID ..cv.... A | size | | type | |
50
50
  ** |ENUM A cid | size | const | name? | name? |
51
51
  ** |FUNC ....VS.. cc cid | nargs | field | name? | name? |
52
52
  ** |TYPEDEF cid | | | name | name |
53
53
  ** |ATTRIB attrnum cid | attr | sib? | type? | |
54
54
  ** |FIELD cid | offset | field | | name? |
55
- ** |BITFIELD B.vcU csz bsz pos | offset | field | | name? |
56
- ** |CONSTVAL c cid | value | const | name | name |
55
+ ** |BITFIELD B.cvU csz bsz pos | offset | field | | name? |
56
+ ** |CONSTVAL c cid | value | const | name | name |
57
57
  ** |EXTERN cid | | sib? | name | name |
58
58
  ** |KW tok | size | | name | name |
59
59
  ** +----------------------------+--------+-------+-------+-------+--
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Debugging and introspection.
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_debug_c
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Debugging and introspection.
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_DEBUG_H
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** LuaJIT common internal definitions.
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_DEF_H
@@ -95,6 +95,9 @@ typedef unsigned int uintptr_t;
95
95
  #define U64x(hi, lo) (((uint64_t)0x##hi << 32) + (uint64_t)0x##lo)
96
96
  #define i32ptr(p) ((int32_t)(intptr_t)(void *)(p))
97
97
  #define u32ptr(p) ((uint32_t)(intptr_t)(void *)(p))
98
+ #define i64ptr(p) ((int64_t)(intptr_t)(void *)(p))
99
+ #define u64ptr(p) ((uint64_t)(intptr_t)(void *)(p))
100
+ #define igcptr(p) (LJ_GC64 ? i64ptr(p) : i32ptr(p))
98
101
 
99
102
  #define checki8(x) ((x) == (int32_t)(int8_t)(x))
100
103
  #define checku8(x) ((x) == (int32_t)(uint8_t)(x))
@@ -103,14 +106,8 @@ typedef unsigned int uintptr_t;
103
106
  #define checki32(x) ((x) == (int32_t)(x))
104
107
  #define checku32(x) ((x) == (uint32_t)(x))
105
108
  #define checkptr32(x) ((uintptr_t)(x) == (uint32_t)(uintptr_t)(x))
106
- #define checkptr47(x) (((uint64_t)(x) >> 47) == 0)
107
- #if LJ_GC64
108
- #define checkptrGC(x) (checkptr47((x)))
109
- #elif LJ_64
110
- #define checkptrGC(x) (checkptr32((x)))
111
- #else
112
- #define checkptrGC(x) 1
113
- #endif
109
+ #define checkptr47(x) (((uint64_t)(uintptr_t)(x) >> 47) == 0)
110
+ #define checkptrGC(x) (LJ_GC64 ? checkptr47((x)) : LJ_64 ? checkptr32((x)) :1)
114
111
 
115
112
  /* Every half-decent C compiler transforms this into a rotate instruction. */
116
113
  #define lj_rol(x, n) (((x)<<(n)) | ((x)>>(-(int)(n)&(8*sizeof(x)-1))))
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Instruction dispatch handling.
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_dispatch_c
@@ -75,7 +75,7 @@ void lj_dispatch_init(GG_State *GG)
75
75
  for (i = 0; i < GG_NUM_ASMFF; i++)
76
76
  GG->bcff[i] = BCINS_AD(BC__MAX+i, 0, 0);
77
77
  #if LJ_TARGET_MIPS
78
- memcpy(GG->got, dispatch_got, LJ_GOT__MAX*4);
78
+ memcpy(GG->got, dispatch_got, LJ_GOT__MAX*sizeof(ASMFunction *));
79
79
  #endif
80
80
  }
81
81
 
@@ -267,7 +267,7 @@ int luaJIT_setmode(lua_State *L, int idx, int mode)
267
267
  case LUAJIT_MODE_FUNC:
268
268
  case LUAJIT_MODE_ALLFUNC:
269
269
  case LUAJIT_MODE_ALLSUBFUNC: {
270
- cTValue *tv = idx == 0 ? frame_prev(L->base-1) :
270
+ cTValue *tv = idx == 0 ? frame_prev(L->base-1)-LJ_FR2 :
271
271
  idx > 0 ? L->base + (idx-1) : L->top + idx;
272
272
  GCproto *pt;
273
273
  if ((idx == 0 || tvisfunc(tv)) && isluafunc(&gcval(tv)->fn))