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
  ** Auxiliary library for the Lua/C 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
  ** Major parts taken verbatim or adapted from the Lua interpreter.
6
6
  ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -107,38 +107,36 @@ LUALIB_API const char *luaL_findtable(lua_State *L, int idx,
107
107
  static int libsize(const luaL_Reg *l)
108
108
  {
109
109
  int size = 0;
110
- for (; l->name; l++) size++;
110
+ for (; l && l->name; l++) size++;
111
111
  return size;
112
112
  }
113
113
 
114
+ LUALIB_API void luaL_pushmodule(lua_State *L, const char *modname, int sizehint)
115
+ {
116
+ luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 16);
117
+ lua_getfield(L, -1, modname);
118
+ if (!lua_istable(L, -1)) {
119
+ lua_pop(L, 1);
120
+ if (luaL_findtable(L, LUA_GLOBALSINDEX, modname, sizehint) != NULL)
121
+ lj_err_callerv(L, LJ_ERR_BADMODN, modname);
122
+ lua_pushvalue(L, -1);
123
+ lua_setfield(L, -3, modname); /* _LOADED[modname] = new table. */
124
+ }
125
+ lua_remove(L, -2); /* Remove _LOADED table. */
126
+ }
127
+
114
128
  LUALIB_API void luaL_openlib(lua_State *L, const char *libname,
115
129
  const luaL_Reg *l, int nup)
116
130
  {
117
131
  lj_lib_checkfpu(L);
118
132
  if (libname) {
119
- int size = libsize(l);
120
- /* check whether lib already exists */
121
- luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 16);
122
- lua_getfield(L, -1, libname); /* get _LOADED[libname] */
123
- if (!lua_istable(L, -1)) { /* not found? */
124
- lua_pop(L, 1); /* remove previous result */
125
- /* try global variable (and create one if it does not exist) */
126
- if (luaL_findtable(L, LUA_GLOBALSINDEX, libname, size) != NULL)
127
- lj_err_callerv(L, LJ_ERR_BADMODN, libname);
128
- lua_pushvalue(L, -1);
129
- lua_setfield(L, -3, libname); /* _LOADED[libname] = new table */
130
- }
131
- lua_remove(L, -2); /* remove _LOADED table */
132
- lua_insert(L, -(nup+1)); /* move library table to below upvalues */
133
- }
134
- for (; l->name; l++) {
135
- int i;
136
- for (i = 0; i < nup; i++) /* copy upvalues to the top */
137
- lua_pushvalue(L, -nup);
138
- lua_pushcclosure(L, l->func, nup);
139
- lua_setfield(L, -(nup+2), l->name);
133
+ luaL_pushmodule(L, libname, libsize(l));
134
+ lua_insert(L, -(nup + 1)); /* Move module table below upvalues. */
140
135
  }
141
- lua_pop(L, nup); /* remove upvalues */
136
+ if (l)
137
+ luaL_setfuncs(L, l, nup);
138
+ else
139
+ lua_pop(L, nup); /* Remove upvalues. */
142
140
  }
143
141
 
144
142
  LUALIB_API void luaL_register(lua_State *L, const char *libname,
@@ -147,6 +145,19 @@ LUALIB_API void luaL_register(lua_State *L, const char *libname,
147
145
  luaL_openlib(L, libname, l, 0);
148
146
  }
149
147
 
148
+ LUALIB_API void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup)
149
+ {
150
+ luaL_checkstack(L, nup, "too many upvalues");
151
+ for (; l->name; l++) {
152
+ int i;
153
+ for (i = 0; i < nup; i++) /* Copy upvalues to the top. */
154
+ lua_pushvalue(L, -nup);
155
+ lua_pushcclosure(L, l->func, nup);
156
+ lua_setfield(L, -(nup + 2), l->name);
157
+ }
158
+ lua_pop(L, nup); /* Remove upvalues. */
159
+ }
160
+
150
161
  LUALIB_API const char *luaL_gsub(lua_State *L, const char *s,
151
162
  const char *p, const char *r)
152
163
  {
@@ -302,7 +313,7 @@ static int panic(lua_State *L)
302
313
 
303
314
  #ifdef LUAJIT_USE_SYSMALLOC
304
315
 
305
- #if LJ_64 && !defined(LUAJIT_USE_VALGRIND)
316
+ #if LJ_64 && !LJ_GC64 && !defined(LUAJIT_USE_VALGRIND)
306
317
  #error "Must use builtin allocator for 64 bit target"
307
318
  #endif
308
319
 
@@ -334,7 +345,7 @@ LUALIB_API lua_State *luaL_newstate(void)
334
345
  lua_State *L;
335
346
  void *ud = lj_alloc_create();
336
347
  if (ud == NULL) return NULL;
337
- #if LJ_64
348
+ #if LJ_64 && !LJ_GC64
338
349
  L = lj_state_newstate(lj_alloc_f, ud);
339
350
  #else
340
351
  L = lua_newstate(lj_alloc_f, ud);
@@ -343,7 +354,7 @@ LUALIB_API lua_State *luaL_newstate(void)
343
354
  return L;
344
355
  }
345
356
 
346
- #if LJ_64
357
+ #if LJ_64 && !LJ_GC64
347
358
  LUA_API lua_State *lua_newstate(lua_Alloc f, void *ud)
348
359
  {
349
360
  UNUSED(f); UNUSED(ud);
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Base and coroutine library.
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-2011 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -23,6 +23,7 @@
23
23
  #include "lj_tab.h"
24
24
  #include "lj_meta.h"
25
25
  #include "lj_state.h"
26
+ #include "lj_frame.h"
26
27
  #if LJ_HASFFI
27
28
  #include "lj_ctype.h"
28
29
  #include "lj_cconv.h"
@@ -345,7 +346,7 @@ LJLIB_ASM_(xpcall) LJLIB_REC(.)
345
346
 
346
347
  static int load_aux(lua_State *L, int status, int envarg)
347
348
  {
348
- if (status == 0) {
349
+ if (status == LUA_OK) {
349
350
  if (tvistab(L->base+envarg-1)) {
350
351
  GCfunc *fn = funcV(L->top-1);
351
352
  GCtab *t = tabV(L->base+envarg-1);
@@ -418,7 +419,7 @@ LJLIB_CF(dofile)
418
419
  GCstr *fname = lj_lib_optstr(L, 1);
419
420
  setnilV(L->top);
420
421
  L->top = L->base+1;
421
- if (luaL_loadfile(L, fname ? strdata(fname) : NULL) != 0)
422
+ if (luaL_loadfile(L, fname ? strdata(fname) : NULL) != LUA_OK)
422
423
  lua_error(L);
423
424
  lua_call(L, 0, LUA_MULTRET);
424
425
  return (int)(L->top - L->base) - 1;
@@ -536,7 +537,7 @@ LJLIB_CF(coroutine_status)
536
537
  co = threadV(L->base);
537
538
  if (co == L) s = "running";
538
539
  else if (co->status == LUA_YIELD) s = "suspended";
539
- else if (co->status != 0) s = "dead";
540
+ else if (co->status != LUA_OK) s = "dead";
540
541
  else if (co->base > tvref(co->stack)+1+LJ_FR2) s = "normal";
541
542
  else if (co->top == co->base) s = "dead";
542
543
  else s = "suspended";
@@ -557,6 +558,12 @@ LJLIB_CF(coroutine_running)
557
558
  #endif
558
559
  }
559
560
 
561
+ LJLIB_CF(coroutine_isyieldable)
562
+ {
563
+ setboolV(L->top++, cframe_canyield(L->cframe));
564
+ return 1;
565
+ }
566
+
560
567
  LJLIB_CF(coroutine_create)
561
568
  {
562
569
  lua_State *L1;
@@ -576,7 +583,7 @@ LJLIB_ASM(coroutine_yield)
576
583
  static int ffh_resume(lua_State *L, lua_State *co, int wrap)
577
584
  {
578
585
  if (co->cframe != NULL || co->status > LUA_YIELD ||
579
- (co->status == 0 && co->top == co->base)) {
586
+ (co->status == LUA_OK && co->top == co->base)) {
580
587
  ErrMsg em = co->cframe ? LJ_ERR_CORUN : LJ_ERR_CODEAD;
581
588
  if (wrap) lj_err_caller(L, em);
582
589
  setboolV(L->base-1-LJ_FR2, 0);
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Bit manipulation library.
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 lib_bit_c
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Debug library.
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
@@ -283,13 +283,13 @@ LJLIB_CF(debug_setuservalue)
283
283
 
284
284
  /* ------------------------------------------------------------------------ */
285
285
 
286
- static const char KEY_HOOK = 'h';
286
+ #define KEY_HOOK ((void *)0x3004)
287
287
 
288
288
  static void hookf(lua_State *L, lua_Debug *ar)
289
289
  {
290
290
  static const char *const hooknames[] =
291
291
  {"call", "return", "line", "count", "tail return"};
292
- lua_pushlightuserdata(L, (void *)&KEY_HOOK);
292
+ lua_pushlightuserdata(L, KEY_HOOK);
293
293
  lua_rawget(L, LUA_REGISTRYINDEX);
294
294
  if (lua_isfunction(L, -1)) {
295
295
  lua_pushstring(L, hooknames[(int)ar->event]);
@@ -334,7 +334,7 @@ LJLIB_CF(debug_sethook)
334
334
  count = luaL_optint(L, arg+3, 0);
335
335
  func = hookf; mask = makemask(smask, count);
336
336
  }
337
- lua_pushlightuserdata(L, (void *)&KEY_HOOK);
337
+ lua_pushlightuserdata(L, KEY_HOOK);
338
338
  lua_pushvalue(L, arg+1);
339
339
  lua_rawset(L, LUA_REGISTRYINDEX);
340
340
  lua_sethook(L, func, mask, count);
@@ -349,7 +349,7 @@ LJLIB_CF(debug_gethook)
349
349
  if (hook != NULL && hook != hookf) { /* external hook? */
350
350
  lua_pushliteral(L, "external hook");
351
351
  } else {
352
- lua_pushlightuserdata(L, (void *)&KEY_HOOK);
352
+ lua_pushlightuserdata(L, KEY_HOOK);
353
353
  lua_rawget(L, LUA_REGISTRYINDEX); /* get hook */
354
354
  }
355
355
  lua_pushstring(L, unmakemask(mask, buff));
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** FFI library.
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 lib_ffi_c
@@ -829,7 +829,7 @@ static GCtab *ffi_finalizer(lua_State *L)
829
829
  settabV(L, L->top++, t);
830
830
  setgcref(t->metatable, obj2gco(t));
831
831
  setstrV(L, lj_tab_setstr(L, t, lj_str_newlit(L, "__mode")),
832
- lj_str_newlit(L, "K"));
832
+ lj_str_newlit(L, "k"));
833
833
  t->nomm = (uint8_t)(~(1u<<MM_mode));
834
834
  return t;
835
835
  }
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Library initialization.
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 parts taken verbatim from the Lua interpreter.
6
6
  ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -20,24 +20,24 @@ This file is commented to prevent duplicated symbols.
20
20
  #include "lj_arch.h"
21
21
 
22
22
  static const luaL_Reg lj_lib_load[] = {
23
- { "", luaopen_base },
24
- { LUA_LOADLIBNAME, luaopen_package },
25
- { LUA_TABLIBNAME, luaopen_table },
26
- { LUA_IOLIBNAME, luaopen_io },
27
- { LUA_OSLIBNAME, luaopen_os },
28
- { LUA_STRLIBNAME, luaopen_string },
29
- { LUA_MATHLIBNAME, luaopen_math },
30
- { LUA_DBLIBNAME, luaopen_debug },
31
- { LUA_BITLIBNAME, luaopen_bit },
32
- { LUA_JITLIBNAME, luaopen_jit },
33
- { NULL, NULL }
23
+ { "", luaopen_base },
24
+ { LUA_LOADLIBNAME, luaopen_package },
25
+ { LUA_TABLIBNAME, luaopen_table },
26
+ { LUA_IOLIBNAME, luaopen_io },
27
+ { LUA_OSLIBNAME, luaopen_os },
28
+ { LUA_STRLIBNAME, luaopen_string },
29
+ { LUA_MATHLIBNAME, luaopen_math },
30
+ { LUA_DBLIBNAME, luaopen_debug },
31
+ { LUA_BITLIBNAME, luaopen_bit },
32
+ { LUA_JITLIBNAME, luaopen_jit },
33
+ { NULL, NULL }
34
34
  };
35
35
 
36
36
  static const luaL_Reg lj_lib_preload[] = {
37
37
  #if LJ_HASFFI
38
- { LUA_FFILIBNAME, luaopen_ffi },
38
+ { LUA_FFILIBNAME, luaopen_ffi },
39
39
  #endif
40
- { NULL, NULL }
40
+ { NULL, NULL }
41
41
  };
42
42
 
43
43
  LUALIB_API void luaL_openlibs(lua_State *L)
@@ -49,11 +49,11 @@ LUALIB_API void luaL_openlibs(lua_State *L)
49
49
  lua_call(L, 1, 0);
50
50
  }
51
51
  luaL_findtable(L, LUA_REGISTRYINDEX, "_PRELOAD",
52
- sizeof(lj_lib_preload)/sizeof(lj_lib_preload[0])-1);
52
+ sizeof(lj_lib_preload)/sizeof(lj_lib_preload[0])-1);
53
53
  for (lib = lj_lib_preload; lib->func; lib++) {
54
54
  lua_pushcfunction(L, lib->func);
55
55
  lua_setfield(L, -2, lib->name);
56
56
  }
57
57
  lua_pop(L, 1);
58
58
  }
59
- */
59
+ */
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** I/O library.
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-2011 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -203,13 +203,12 @@ static int io_file_read(lua_State *L, FILE *fp, int start)
203
203
  for (n = start; nargs-- && ok; n++) {
204
204
  if (tvisstr(L->base+n)) {
205
205
  const char *p = strVdata(L->base+n);
206
- if (p[0] != '*')
207
- lj_err_arg(L, n+1, LJ_ERR_INVOPT);
208
- if (p[1] == 'n')
206
+ if (p[0] == '*') p++;
207
+ if (p[0] == 'n')
209
208
  ok = io_file_readnum(L, fp);
210
- else if ((p[1] & ~0x20) == 'L')
211
- ok = io_file_readline(L, fp, (p[1] == 'l'));
212
- else if (p[1] == 'a')
209
+ else if ((p[0] & ~0x20) == 'L')
210
+ ok = io_file_readline(L, fp, (p[0] == 'l'));
211
+ else if (p[0] == 'a')
213
212
  io_file_readall(L, fp);
214
213
  else
215
214
  lj_err_arg(L, n+1, LJ_ERR_INVFMT);
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** JIT library.
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 lib_jit_c
@@ -204,6 +204,7 @@ LJLIB_CF(jit_util_funcinfo)
204
204
  lua_setfield(L, -2, "source");
205
205
  lj_debug_pushloc(L, pt, pc);
206
206
  lua_setfield(L, -2, "loc");
207
+ setprotoV(L, lj_tab_setstr(L, t, lj_str_newlit(L, "proto")), pt);
207
208
  } else {
208
209
  GCfunc *fn = funcV(L->base);
209
210
  GCtab *t;
@@ -668,6 +669,11 @@ static uint32_t jit_cpudetect(lua_State *L)
668
669
  if (fam >= 0x00000f00) /* K8, K10. */
669
670
  flags |= JIT_F_PREFER_IMUL;
670
671
  }
672
+ if (vendor[0] >= 7) {
673
+ uint32_t xfeatures[4];
674
+ lj_vm_cpuid(7, xfeatures);
675
+ flags |= ((xfeatures[1] >> 8)&1) * JIT_F_BMI2;
676
+ }
671
677
  #endif
672
678
  }
673
679
  /* Check for required instruction set support on x86 (unnecessary on x64). */
@@ -710,15 +716,19 @@ static uint32_t jit_cpudetect(lua_State *L)
710
716
  #if LJ_HASJIT
711
717
  /* Compile-time MIPS CPU detection. */
712
718
  #if LJ_ARCH_VERSION >= 20
713
- flags |= JIT_F_MIPS32R2;
719
+ flags |= JIT_F_MIPSXXR2;
714
720
  #endif
715
721
  /* Runtime MIPS CPU detection. */
716
722
  #if defined(__GNUC__)
717
- if (!(flags & JIT_F_MIPS32R2)) {
723
+ if (!(flags & JIT_F_MIPSXXR2)) {
718
724
  int x;
725
+ #ifdef __mips16
726
+ x = 0; /* Runtime detection is difficult. Ensure optimal -march flags. */
727
+ #else
719
728
  /* On MIPS32R1 rotr is treated as srl. rotr r2,r2,1 -> srl r2,r2,1. */
720
729
  __asm__("li $2, 1\n\t.long 0x00221042\n\tmove %0, $2" : "=r"(x) : : "$2");
721
- if (x) flags |= JIT_F_MIPS32R2; /* Either 0x80000000 (R2) or 0 (R1). */
730
+ #endif
731
+ if (x) flags |= JIT_F_MIPSXXR2; /* Either 0x80000000 (R2) or 0 (R1). */
722
732
  }
723
733
  #endif
724
734
  #endif
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Math library.
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 <math.h>
@@ -221,10 +221,6 @@ LUALIB_API int luaopen_math(lua_State *L)
221
221
  rs = (RandomState *)lua_newuserdata(L, sizeof(RandomState));
222
222
  rs->valid = 0; /* Use lazy initialization to save some time on startup. */
223
223
  LJ_LIB_REG(L, LUA_MATHLIBNAME, math);
224
- #if defined(LUA_COMPAT_MOD) && !LJ_52
225
- lua_getfield(L, -1, "fmod");
226
- lua_setfield(L, -2, "mod");
227
- #endif
228
224
  return 1;
229
225
  }
230
226
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** OS library.
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
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Package library.
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-2012 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -193,8 +193,7 @@ static void **ll_register(lua_State *L, const char *path)
193
193
  lua_pop(L, 1);
194
194
  plib = (void **)lua_newuserdata(L, sizeof(void *));
195
195
  *plib = NULL;
196
- luaL_getmetatable(L, "_LOADLIB");
197
- lua_setmetatable(L, -2);
196
+ luaL_setmetatable(L, "_LOADLIB");
198
197
  lua_pushfstring(L, "LOADLIB: %s", path);
199
198
  lua_pushvalue(L, -2);
200
199
  lua_settable(L, LUA_REGISTRYINDEX);
@@ -399,8 +398,7 @@ static int lj_cf_package_loader_preload(lua_State *L)
399
398
 
400
399
  /* ------------------------------------------------------------------------ */
401
400
 
402
- static const int sentinel_ = 0;
403
- #define sentinel ((void *)&sentinel_)
401
+ #define sentinel ((void *)0x4004)
404
402
 
405
403
  static int lj_cf_package_require(lua_State *L)
406
404
  {
@@ -490,29 +488,19 @@ static void modinit(lua_State *L, const char *modname)
490
488
  static int lj_cf_package_module(lua_State *L)
491
489
  {
492
490
  const char *modname = luaL_checkstring(L, 1);
493
- int loaded = lua_gettop(L) + 1; /* index of _LOADED table */
494
- lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED");
495
- lua_getfield(L, loaded, modname); /* get _LOADED[modname] */
496
- if (!lua_istable(L, -1)) { /* not found? */
497
- lua_pop(L, 1); /* remove previous result */
498
- /* try global variable (and create one if it does not exist) */
499
- if (luaL_findtable(L, LUA_GLOBALSINDEX, modname, 1) != NULL)
500
- lj_err_callerv(L, LJ_ERR_BADMODN, modname);
501
- lua_pushvalue(L, -1);
502
- lua_setfield(L, loaded, modname); /* _LOADED[modname] = new table */
503
- }
504
- /* check whether table already has a _NAME field */
491
+ int lastarg = (int)(L->top - L->base);
492
+ luaL_pushmodule(L, modname, 1);
505
493
  lua_getfield(L, -1, "_NAME");
506
- if (!lua_isnil(L, -1)) { /* is table an initialized module? */
494
+ if (!lua_isnil(L, -1)) { /* Module already initialized? */
507
495
  lua_pop(L, 1);
508
- } else { /* no; initialize it */
496
+ } else {
509
497
  lua_pop(L, 1);
510
498
  modinit(L, modname);
511
499
  }
512
500
  lua_pushvalue(L, -1);
513
501
  setfenv(L);
514
- dooptions(L, loaded - 1);
515
- return 0;
502
+ dooptions(L, lastarg);
503
+ return LJ_52;
516
504
  }
517
505
 
518
506
  static int lj_cf_package_seeall(lua_State *L)
@@ -583,13 +571,16 @@ LUALIB_API int luaopen_package(lua_State *L)
583
571
  lj_lib_pushcf(L, lj_cf_package_unloadlib, 1);
584
572
  lua_setfield(L, -2, "__gc");
585
573
  luaL_register(L, LUA_LOADLIBNAME, package_lib);
586
- lua_pushvalue(L, -1);
587
- lua_replace(L, LUA_ENVIRONINDEX);
574
+ lua_copy(L, -1, LUA_ENVIRONINDEX);
588
575
  lua_createtable(L, sizeof(package_loaders)/sizeof(package_loaders[0])-1, 0);
589
576
  for (i = 0; package_loaders[i] != NULL; i++) {
590
577
  lj_lib_pushcf(L, package_loaders[i], 1);
591
578
  lua_rawseti(L, -2, i+1);
592
579
  }
580
+ #if LJ_52
581
+ lua_pushvalue(L, -1);
582
+ lua_setfield(L, -3, "searchers");
583
+ #endif
593
584
  lua_setfield(L, -2, "loaders");
594
585
  lua_getfield(L, LUA_REGISTRYINDEX, "LUA_NOENV");
595
586
  noenv = lua_toboolean(L, -1);