immunio 1.1.2 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. checksums.yaml +4 -4
  2. data/lib/immunio/version.rb +1 -1
  3. data/lua-hooks/Makefile +56 -109
  4. data/lua-hooks/ext/all.c +3 -14
  5. data/lua-hooks/ext/libinjection/module.mk +5 -0
  6. data/lua-hooks/ext/lpeg/module.mk +6 -0
  7. data/lua-hooks/ext/lua-cmsgpack/module.mk +2 -0
  8. data/lua-hooks/ext/lua-snapshot/module.mk +2 -0
  9. data/lua-hooks/ext/luajit/COPYRIGHT +1 -1
  10. data/lua-hooks/ext/luajit/Makefile +2 -2
  11. data/lua-hooks/ext/luajit/README +2 -2
  12. data/lua-hooks/ext/luajit/doc/bluequad-print.css +1 -1
  13. data/lua-hooks/ext/luajit/doc/bluequad.css +1 -1
  14. data/lua-hooks/ext/luajit/doc/changes.html +15 -2
  15. data/lua-hooks/ext/luajit/doc/contact.html +3 -3
  16. data/lua-hooks/ext/luajit/doc/ext_c_api.html +2 -2
  17. data/lua-hooks/ext/luajit/doc/ext_ffi.html +2 -2
  18. data/lua-hooks/ext/luajit/doc/ext_ffi_api.html +2 -2
  19. data/lua-hooks/ext/luajit/doc/ext_ffi_semantics.html +4 -2
  20. data/lua-hooks/ext/luajit/doc/ext_ffi_tutorial.html +2 -2
  21. data/lua-hooks/ext/luajit/doc/ext_jit.html +2 -2
  22. data/lua-hooks/ext/luajit/doc/ext_profiler.html +2 -2
  23. data/lua-hooks/ext/luajit/doc/extensions.html +9 -2
  24. data/lua-hooks/ext/luajit/doc/faq.html +2 -2
  25. data/lua-hooks/ext/luajit/doc/install.html +22 -18
  26. data/lua-hooks/ext/luajit/doc/luajit.html +3 -3
  27. data/lua-hooks/ext/luajit/doc/running.html +2 -2
  28. data/lua-hooks/ext/luajit/doc/status.html +2 -2
  29. data/lua-hooks/ext/luajit/dynasm/dasm_arm.h +1 -1
  30. data/lua-hooks/ext/luajit/dynasm/dasm_arm.lua +4 -4
  31. data/lua-hooks/ext/luajit/dynasm/dasm_arm64.h +1 -1
  32. data/lua-hooks/ext/luajit/dynasm/dasm_arm64.lua +4 -4
  33. data/lua-hooks/ext/luajit/dynasm/dasm_mips.h +1 -1
  34. data/lua-hooks/ext/luajit/dynasm/dasm_mips.lua +4 -4
  35. data/lua-hooks/ext/luajit/dynasm/dasm_ppc.h +1 -1
  36. data/lua-hooks/ext/luajit/dynasm/dasm_ppc.lua +4 -4
  37. data/lua-hooks/ext/luajit/dynasm/dasm_proto.h +3 -3
  38. data/lua-hooks/ext/luajit/dynasm/dasm_x64.lua +1 -1
  39. data/lua-hooks/ext/luajit/dynasm/dasm_x86.h +34 -7
  40. data/lua-hooks/ext/luajit/dynasm/dasm_x86.lua +427 -102
  41. data/lua-hooks/ext/luajit/dynasm/dynasm.lua +5 -5
  42. data/lua-hooks/ext/luajit/etc/luajit.1 +1 -1
  43. data/lua-hooks/ext/luajit/etc/luajit.pc +1 -1
  44. data/lua-hooks/ext/luajit/src/Makefile +36 -21
  45. data/lua-hooks/ext/luajit/src/Makefile.dep +3 -1
  46. data/lua-hooks/ext/luajit/src/host/buildvm.c +1 -1
  47. data/lua-hooks/ext/luajit/src/host/buildvm.h +1 -1
  48. data/lua-hooks/ext/luajit/src/host/buildvm_asm.c +10 -1
  49. data/lua-hooks/ext/luajit/src/host/buildvm_fold.c +1 -1
  50. data/lua-hooks/ext/luajit/src/host/buildvm_lib.c +1 -1
  51. data/lua-hooks/ext/luajit/src/host/buildvm_peobj.c +1 -1
  52. data/lua-hooks/ext/luajit/src/host/genlibbc.lua +1 -1
  53. data/lua-hooks/ext/luajit/src/host/genminilua.lua +1 -1
  54. data/lua-hooks/ext/luajit/src/jit/bc.lua +1 -1
  55. data/lua-hooks/ext/luajit/src/jit/bcsave.lua +2 -2
  56. data/lua-hooks/ext/luajit/src/jit/dis_arm.lua +1 -1
  57. data/lua-hooks/ext/luajit/src/jit/dis_mips.lua +1 -1
  58. data/lua-hooks/ext/luajit/src/jit/dis_mipsel.lua +1 -1
  59. data/lua-hooks/ext/luajit/src/jit/dis_ppc.lua +1 -1
  60. data/lua-hooks/ext/luajit/src/jit/dis_x64.lua +1 -1
  61. data/lua-hooks/ext/luajit/src/jit/dis_x86.lua +163 -73
  62. data/lua-hooks/ext/luajit/src/jit/dump.lua +2 -1
  63. data/lua-hooks/ext/luajit/src/jit/p.lua +1 -1
  64. data/lua-hooks/ext/luajit/src/jit/v.lua +1 -1
  65. data/lua-hooks/ext/luajit/src/jit/zone.lua +1 -1
  66. data/lua-hooks/ext/luajit/src/lib_aux.c +1 -1
  67. data/lua-hooks/ext/luajit/src/lib_base.c +4 -5
  68. data/lua-hooks/ext/luajit/src/lib_bit.c +1 -1
  69. data/lua-hooks/ext/luajit/src/lib_debug.c +1 -1
  70. data/lua-hooks/ext/luajit/src/lib_ffi.c +2 -5
  71. data/lua-hooks/ext/luajit/src/lib_init.c +1 -1
  72. data/lua-hooks/ext/luajit/src/lib_io.c +2 -3
  73. data/lua-hooks/ext/luajit/src/lib_jit.c +1 -1
  74. data/lua-hooks/ext/luajit/src/lib_math.c +1 -1
  75. data/lua-hooks/ext/luajit/src/lib_os.c +2 -2
  76. data/lua-hooks/ext/luajit/src/lib_package.c +1 -1
  77. data/lua-hooks/ext/luajit/src/lib_string.c +1 -1
  78. data/lua-hooks/ext/luajit/src/lib_table.c +1 -1
  79. data/lua-hooks/ext/luajit/src/lj.supp +15 -0
  80. data/lua-hooks/ext/luajit/src/lj_alloc.c +1 -1
  81. data/lua-hooks/ext/luajit/src/lj_api.c +4 -1
  82. data/lua-hooks/ext/luajit/src/lj_arch.h +33 -7
  83. data/lua-hooks/ext/luajit/src/lj_asm.c +12 -5
  84. data/lua-hooks/ext/luajit/src/lj_asm.h +1 -1
  85. data/lua-hooks/ext/luajit/src/lj_asm_arm.h +3 -13
  86. data/lua-hooks/ext/luajit/src/lj_asm_mips.h +337 -71
  87. data/lua-hooks/ext/luajit/src/lj_asm_ppc.h +2 -2
  88. data/lua-hooks/ext/luajit/src/lj_asm_x86.h +2 -2
  89. data/lua-hooks/ext/luajit/src/lj_bc.c +1 -1
  90. data/lua-hooks/ext/luajit/src/lj_bc.h +1 -1
  91. data/lua-hooks/ext/luajit/src/lj_bcdump.h +1 -1
  92. data/lua-hooks/ext/luajit/src/lj_bcread.c +1 -1
  93. data/lua-hooks/ext/luajit/src/lj_bcwrite.c +1 -1
  94. data/lua-hooks/ext/luajit/src/lj_buf.c +2 -4
  95. data/lua-hooks/ext/luajit/src/lj_buf.h +1 -3
  96. data/lua-hooks/ext/luajit/src/lj_carith.c +1 -1
  97. data/lua-hooks/ext/luajit/src/lj_carith.h +1 -1
  98. data/lua-hooks/ext/luajit/src/lj_ccall.c +37 -14
  99. data/lua-hooks/ext/luajit/src/lj_ccall.h +3 -3
  100. data/lua-hooks/ext/luajit/src/lj_ccallback.c +16 -7
  101. data/lua-hooks/ext/luajit/src/lj_ccallback.h +1 -1
  102. data/lua-hooks/ext/luajit/src/lj_cconv.c +1 -1
  103. data/lua-hooks/ext/luajit/src/lj_cconv.h +1 -1
  104. data/lua-hooks/ext/luajit/src/lj_cdata.c +10 -1
  105. data/lua-hooks/ext/luajit/src/lj_cdata.h +3 -1
  106. data/lua-hooks/ext/luajit/src/lj_clib.c +1 -1
  107. data/lua-hooks/ext/luajit/src/lj_clib.h +1 -1
  108. data/lua-hooks/ext/luajit/src/lj_cparse.c +27 -6
  109. data/lua-hooks/ext/luajit/src/lj_cparse.h +1 -1
  110. data/lua-hooks/ext/luajit/src/lj_crecord.c +1 -1
  111. data/lua-hooks/ext/luajit/src/lj_crecord.h +1 -1
  112. data/lua-hooks/ext/luajit/src/lj_ctype.c +10 -8
  113. data/lua-hooks/ext/luajit/src/lj_ctype.h +1 -1
  114. data/lua-hooks/ext/luajit/src/lj_debug.c +1 -1
  115. data/lua-hooks/ext/luajit/src/lj_debug.h +1 -1
  116. data/lua-hooks/ext/luajit/src/lj_def.h +1 -1
  117. data/lua-hooks/ext/luajit/src/lj_dispatch.c +1 -1
  118. data/lua-hooks/ext/luajit/src/lj_dispatch.h +21 -4
  119. data/lua-hooks/ext/luajit/src/lj_emit_arm.h +1 -1
  120. data/lua-hooks/ext/luajit/src/lj_emit_mips.h +7 -5
  121. data/lua-hooks/ext/luajit/src/lj_emit_ppc.h +1 -1
  122. data/lua-hooks/ext/luajit/src/lj_emit_x86.h +1 -1
  123. data/lua-hooks/ext/luajit/src/lj_err.c +69 -31
  124. data/lua-hooks/ext/luajit/src/lj_err.h +1 -1
  125. data/lua-hooks/ext/luajit/src/lj_errmsg.h +1 -1
  126. data/lua-hooks/ext/luajit/src/lj_ff.h +1 -1
  127. data/lua-hooks/ext/luajit/src/lj_ffrecord.c +10 -40
  128. data/lua-hooks/ext/luajit/src/lj_ffrecord.h +1 -1
  129. data/lua-hooks/ext/luajit/src/lj_frame.h +12 -1
  130. data/lua-hooks/ext/luajit/src/lj_func.c +1 -1
  131. data/lua-hooks/ext/luajit/src/lj_func.h +1 -1
  132. data/lua-hooks/ext/luajit/src/lj_gc.c +2 -2
  133. data/lua-hooks/ext/luajit/src/lj_gc.h +1 -1
  134. data/lua-hooks/ext/luajit/src/lj_gdbjit.c +1 -1
  135. data/lua-hooks/ext/luajit/src/lj_gdbjit.h +1 -1
  136. data/lua-hooks/ext/luajit/src/lj_ir.c +31 -15
  137. data/lua-hooks/ext/luajit/src/lj_ir.h +1 -1
  138. data/lua-hooks/ext/luajit/src/lj_ircall.h +29 -1
  139. data/lua-hooks/ext/luajit/src/lj_iropt.h +2 -1
  140. data/lua-hooks/ext/luajit/src/lj_jit.h +2 -1
  141. data/lua-hooks/ext/luajit/src/lj_lex.c +28 -1
  142. data/lua-hooks/ext/luajit/src/lj_lex.h +1 -1
  143. data/lua-hooks/ext/luajit/src/lj_lib.c +1 -1
  144. data/lua-hooks/ext/luajit/src/lj_lib.h +1 -1
  145. data/lua-hooks/ext/luajit/src/lj_load.c +1 -1
  146. data/lua-hooks/ext/luajit/src/lj_mcode.c +1 -1
  147. data/lua-hooks/ext/luajit/src/lj_mcode.h +1 -1
  148. data/lua-hooks/ext/luajit/src/lj_meta.c +8 -8
  149. data/lua-hooks/ext/luajit/src/lj_meta.h +1 -1
  150. data/lua-hooks/ext/luajit/src/lj_obj.c +1 -1
  151. data/lua-hooks/ext/luajit/src/lj_obj.h +1 -1
  152. data/lua-hooks/ext/luajit/src/lj_opt_dce.c +1 -1
  153. data/lua-hooks/ext/luajit/src/lj_opt_fold.c +1 -1
  154. data/lua-hooks/ext/luajit/src/lj_opt_loop.c +1 -1
  155. data/lua-hooks/ext/luajit/src/lj_opt_mem.c +1 -1
  156. data/lua-hooks/ext/luajit/src/lj_opt_narrow.c +1 -1
  157. data/lua-hooks/ext/luajit/src/lj_opt_sink.c +1 -1
  158. data/lua-hooks/ext/luajit/src/lj_opt_split.c +10 -5
  159. data/lua-hooks/ext/luajit/src/lj_parse.c +1 -1
  160. data/lua-hooks/ext/luajit/src/lj_parse.h +1 -1
  161. data/lua-hooks/ext/luajit/src/lj_profile.c +1 -1
  162. data/lua-hooks/ext/luajit/src/lj_profile.h +1 -1
  163. data/lua-hooks/ext/luajit/src/lj_record.c +13 -5
  164. data/lua-hooks/ext/luajit/src/lj_record.h +1 -1
  165. data/lua-hooks/ext/luajit/src/lj_snap.c +20 -23
  166. data/lua-hooks/ext/luajit/src/lj_snap.h +1 -1
  167. data/lua-hooks/ext/luajit/src/lj_state.c +1 -1
  168. data/lua-hooks/ext/luajit/src/lj_state.h +1 -1
  169. data/lua-hooks/ext/luajit/src/lj_str.c +1 -1
  170. data/lua-hooks/ext/luajit/src/lj_str.h +1 -1
  171. data/lua-hooks/ext/luajit/src/lj_strfmt.c +12 -98
  172. data/lua-hooks/ext/luajit/src/lj_strfmt.h +4 -4
  173. data/lua-hooks/ext/luajit/src/lj_strfmt_num.c +591 -0
  174. data/lua-hooks/ext/luajit/src/lj_strscan.c +1 -1
  175. data/lua-hooks/ext/luajit/src/lj_strscan.h +1 -1
  176. data/lua-hooks/ext/luajit/src/lj_tab.c +1 -1
  177. data/lua-hooks/ext/luajit/src/lj_tab.h +1 -1
  178. data/lua-hooks/ext/luajit/src/lj_target.h +1 -1
  179. data/lua-hooks/ext/luajit/src/lj_target_arm.h +1 -1
  180. data/lua-hooks/ext/luajit/src/lj_target_arm64.h +1 -1
  181. data/lua-hooks/ext/luajit/src/lj_target_mips.h +30 -2
  182. data/lua-hooks/ext/luajit/src/lj_target_ppc.h +1 -1
  183. data/lua-hooks/ext/luajit/src/lj_target_x86.h +1 -1
  184. data/lua-hooks/ext/luajit/src/lj_trace.c +7 -2
  185. data/lua-hooks/ext/luajit/src/lj_trace.h +1 -1
  186. data/lua-hooks/ext/luajit/src/lj_traceerr.h +1 -3
  187. data/lua-hooks/ext/luajit/src/lj_udata.c +1 -1
  188. data/lua-hooks/ext/luajit/src/lj_udata.h +1 -1
  189. data/lua-hooks/ext/luajit/src/lj_vm.h +5 -3
  190. data/lua-hooks/ext/luajit/src/lj_vmevent.c +1 -1
  191. data/lua-hooks/ext/luajit/src/lj_vmevent.h +1 -1
  192. data/lua-hooks/ext/luajit/src/lj_vmmath.c +15 -15
  193. data/lua-hooks/ext/luajit/src/ljamalg.c +2 -1
  194. data/lua-hooks/ext/luajit/src/lua.h +1 -0
  195. data/lua-hooks/ext/luajit/src/luaconf.h +2 -2
  196. data/lua-hooks/ext/luajit/src/luajit.c +1 -1
  197. data/lua-hooks/ext/luajit/src/luajit.h +4 -4
  198. data/lua-hooks/ext/luajit/src/lualib.h +1 -1
  199. data/lua-hooks/ext/luajit/src/msvcbuild.bat +1 -1
  200. data/lua-hooks/ext/luajit/src/ps4build.bat +26 -6
  201. data/lua-hooks/ext/luajit/src/vm_arm.dasc +17 -9
  202. data/lua-hooks/ext/luajit/src/vm_arm64.dasc +1 -1
  203. data/lua-hooks/ext/luajit/src/vm_mips.dasc +1562 -656
  204. data/lua-hooks/ext/luajit/src/vm_ppc.dasc +3 -7
  205. data/lua-hooks/ext/luajit/src/vm_x64.dasc +10 -2
  206. data/lua-hooks/ext/luajit/src/vm_x86.dasc +5 -8
  207. data/lua-hooks/ext/luautf8/module.mk +2 -0
  208. data/lua-hooks/ext/module.mk +15 -0
  209. data/lua-hooks/ext/modules.h +17 -0
  210. data/lua-hooks/ext/perf/luacpu.c +1 -1
  211. data/lua-hooks/ext/perf/lualoadavg.c +1 -1
  212. data/lua-hooks/ext/perf/luameminfo.c +1 -1
  213. data/lua-hooks/ext/perf/luaoslib.c +124 -2
  214. data/lua-hooks/ext/perf/module.mk +5 -0
  215. data/lua-hooks/ext/sha1/luasha1.c +4 -2
  216. data/lua-hooks/ext/sha1/module.mk +5 -0
  217. data/lua-hooks/ext/sha2/luasha256.c +4 -2
  218. data/lua-hooks/ext/sha2/module.mk +5 -0
  219. data/lua-hooks/ext/sysutils/lua_utils.c +56 -0
  220. data/lua-hooks/ext/sysutils/module.mk +2 -0
  221. data/lua-hooks/lib/boot.lua +2 -1
  222. data/lua-hooks/lib/hooks/module.mk +31 -0
  223. data/lua-hooks/lib/hooks/xss/module.mk +4 -0
  224. data/lua-hooks/lib/lexers/module.mk +10 -0
  225. data/lua-hooks/lib/module.mk +38 -0
  226. data/lua-hooks/lib/schema/module.mk +3 -0
  227. data/lua-hooks/options.mk +59 -0
  228. metadata +21 -2
@@ -2,7 +2,7 @@
2
2
  ** FOLD: Constant Folding, Algebraic Simplifications and Reassociation.
3
3
  ** ABCelim: Array Bounds Check Elimination.
4
4
  ** CSE: Common-Subexpression Elimination.
5
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
5
+ ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
6
6
  */
7
7
 
8
8
  #define lj_opt_fold_c
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** LOOP: Loop Optimizations.
3
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #define lj_opt_loop_c
@@ -3,7 +3,7 @@
3
3
  ** AA: Alias Analysis using high-level semantic disambiguation.
4
4
  ** FWD: Load Forwarding (L2L) + Store Forwarding (S2L).
5
5
  ** DSE: Dead-Store Elimination.
6
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
6
+ ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
7
7
  */
8
8
 
9
9
  #define lj_opt_mem_c
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  ** NARROW: Narrowing of numbers to integers (double to int32_t).
3
3
  ** STRIPOV: Stripping of overflow checks.
4
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
4
+ ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
5
5
  */
6
6
 
7
7
  #define lj_opt_narrow_c
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** SINK: Allocation Sinking and Store Sinking.
3
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #define lj_opt_sink_c
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** SPLIT: Split 64 bit IR instructions into 32 bit IR instructions.
3
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #define lj_opt_split_c
@@ -192,7 +192,7 @@ static IRRef split_ptr(jit_State *J, IRIns *oir, IRRef ref)
192
192
  nref = ir->op1;
193
193
  if (ofs == 0) return nref;
194
194
  }
195
- return split_emit(J, IRTI(IR_ADD), nref, lj_ir_kint(J, ofs));
195
+ return split_emit(J, IRT(IR_ADD, IRT_PTR), nref, lj_ir_kint(J, ofs));
196
196
  }
197
197
 
198
198
  #if LJ_HASFFI
@@ -452,11 +452,15 @@ static void split_ir(jit_State *J)
452
452
  IRIns inslo = *nir; /* Save/undo the emit of the lo XLOAD. */
453
453
  J->cur.nins--;
454
454
  hi = split_ptr(J, oir, ir->op1); /* Insert the hiref ADD. */
455
+ #if LJ_BE
456
+ hi = split_emit(J, IRT(IR_XLOAD, IRT_INT), hi, ir->op2);
457
+ inslo.t.irt = IRT_SOFTFP | (inslo.t.irt & IRT_GUARD);
458
+ #endif
455
459
  nref = lj_ir_nextins(J);
456
460
  nir = IR(nref);
457
- *nir = inslo; /* Re-emit lo XLOAD immediately before hi XLOAD. */
458
- hi = split_emit(J, IRT(IR_XLOAD, IRT_SOFTFP), hi, ir->op2);
461
+ *nir = inslo; /* Re-emit lo XLOAD. */
459
462
  #if LJ_LE
463
+ hi = split_emit(J, IRT(IR_XLOAD, IRT_SOFTFP), hi, ir->op2);
460
464
  ir->prev = nref;
461
465
  #else
462
466
  ir->prev = hi; hi = nref;
@@ -596,7 +600,8 @@ static void split_ir(jit_State *J)
596
600
  }
597
601
  #endif
598
602
  else if (st == IRT_I64 || st == IRT_U64) { /* 64/64 bit cast. */
599
- /* Drop cast, since assembler doesn't care. */
603
+ /* Drop cast, since assembler doesn't care. But fwd both parts. */
604
+ hi = hiref;
600
605
  goto fwdlo;
601
606
  } else if ((ir->op2 & IRCONV_SEXT)) { /* Sign-extend to 64 bit. */
602
607
  IRRef k31 = lj_ir_kint(J, 31);
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Lua parser (source code -> bytecode).
3
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2016 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
  ** Lua parser (source code -> bytecode).
3
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #ifndef _LJ_PARSE_H
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Low-overhead profiling.
3
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #define lj_profile_c
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Low-overhead profiling.
3
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #ifndef _LJ_PROFILE_H
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Trace recorder (bytecode -> SSA IR).
3
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #define lj_record_c
@@ -1236,12 +1236,14 @@ static void rec_idx_abc(jit_State *J, TRef asizeref, TRef ikey, uint32_t asize)
1236
1236
  }
1237
1237
 
1238
1238
  /* Record indexed key lookup. */
1239
- static TRef rec_idx_key(jit_State *J, RecordIndex *ix, IRRef *rbref)
1239
+ static TRef rec_idx_key(jit_State *J, RecordIndex *ix, IRRef *rbref,
1240
+ IRType1 *rbguard)
1240
1241
  {
1241
1242
  TRef key;
1242
1243
  GCtab *t = tabV(&ix->tabv);
1243
1244
  ix->oldv = lj_tab_get(J->L, t, &ix->keyv); /* Lookup previous value. */
1244
1245
  *rbref = 0;
1246
+ rbguard->irt = 0;
1245
1247
 
1246
1248
  /* Integer keys are looked up in the array part first. */
1247
1249
  key = ix->key;
@@ -1293,6 +1295,7 @@ static TRef rec_idx_key(jit_State *J, RecordIndex *ix, IRRef *rbref)
1293
1295
  hslot <= 65535*(MSize)sizeof(Node)) {
1294
1296
  TRef node, kslot, hm;
1295
1297
  *rbref = J->cur.nins; /* Mark possible rollback point. */
1298
+ *rbguard = J->guardemit;
1296
1299
  hm = emitir(IRTI(IR_FLOAD), ix->tab, IRFL_TAB_HMASK);
1297
1300
  emitir(IRTGI(IR_EQ), hm, lj_ir_kint(J, (int32_t)t->hmask));
1298
1301
  node = emitir(IRT(IR_FLOAD, IRT_P32), ix->tab, IRFL_TAB_NODE);
@@ -1327,6 +1330,7 @@ TRef lj_record_idx(jit_State *J, RecordIndex *ix)
1327
1330
  TRef xref;
1328
1331
  IROp xrefop, loadop;
1329
1332
  IRRef rbref;
1333
+ IRType1 rbguard;
1330
1334
  cTValue *oldv;
1331
1335
 
1332
1336
  while (!tref_istab(ix->tab)) { /* Handle non-table lookup. */
@@ -1373,7 +1377,7 @@ TRef lj_record_idx(jit_State *J, RecordIndex *ix)
1373
1377
  }
1374
1378
 
1375
1379
  /* Record the key lookup. */
1376
- xref = rec_idx_key(J, ix, &rbref);
1380
+ xref = rec_idx_key(J, ix, &rbref, &rbguard);
1377
1381
  xrefop = IR(tref_ref(xref))->o;
1378
1382
  loadop = xrefop == IR_AREF ? IR_ALOAD : IR_HLOAD;
1379
1383
  /* The lj_meta_tset() inconsistency is gone, but better play safe. */
@@ -1388,8 +1392,10 @@ TRef lj_record_idx(jit_State *J, RecordIndex *ix)
1388
1392
  } else {
1389
1393
  res = emitir(IRTG(loadop, t), xref, 0);
1390
1394
  }
1391
- if (tref_ref(res) < rbref) /* HREFK + load forwarded? */
1395
+ if (tref_ref(res) < rbref) { /* HREFK + load forwarded? */
1392
1396
  lj_ir_rollback(J, rbref); /* Rollback to eliminate hmask guard. */
1397
+ J->guardemit = rbguard;
1398
+ }
1393
1399
  if (t == IRT_NIL && ix->idxchain && lj_record_mm_lookup(J, ix, MM_index))
1394
1400
  goto handlemm;
1395
1401
  if (irtype_ispri(t)) res = TREF_PRI(t); /* Canonicalize primitives. */
@@ -1397,8 +1403,10 @@ TRef lj_record_idx(jit_State *J, RecordIndex *ix)
1397
1403
  } else { /* Indexed store. */
1398
1404
  GCtab *mt = tabref(tabV(&ix->tabv)->metatable);
1399
1405
  int keybarrier = tref_isgcv(ix->key) && !tref_isnil(ix->val);
1400
- if (tref_ref(xref) < rbref) /* HREFK forwarded? */
1406
+ if (tref_ref(xref) < rbref) { /* HREFK forwarded? */
1401
1407
  lj_ir_rollback(J, rbref); /* Rollback to eliminate hmask guard. */
1408
+ J->guardemit = rbguard;
1409
+ }
1402
1410
  if (tvisnil(oldv)) { /* Previous value was nil? */
1403
1411
  /* Need to duplicate the hasmm check for the early guards. */
1404
1412
  int hasmm = 0;
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Trace recorder (bytecode -> SSA IR).
3
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #ifndef _LJ_RECORD_H
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Snapshot handling.
3
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #define lj_snap_c
@@ -26,9 +26,6 @@
26
26
  #include "lj_cdata.h"
27
27
  #endif
28
28
 
29
- /* Some local macros to save typing. Undef'd at the end. */
30
- #define IR(ref) (&J->cur.ir[(ref)])
31
-
32
29
  /* Pass IR on to next optimization in chain (FOLD). */
33
30
  #define emitir(ot, a, b) (lj_ir_set(J, (ot), (a), (b)), lj_opt_fold(J))
34
31
 
@@ -73,7 +70,7 @@ static MSize snapshot_slots(jit_State *J, SnapEntry *map, BCReg nslots)
73
70
  IRRef ref = tref_ref(tr);
74
71
  if (ref) {
75
72
  SnapEntry sn = SNAP_TR(s, tr);
76
- IRIns *ir = IR(ref);
73
+ IRIns *ir = &J->cur.ir[ref];
77
74
  if (!(sn & (SNAP_CONT|SNAP_FRAME)) &&
78
75
  ir->o == IR_SLOAD && ir->op1 == s && ref > retf) {
79
76
  /* No need to snapshot unmodified non-inherited slots. */
@@ -148,8 +145,8 @@ void lj_snap_add(jit_State *J)
148
145
  MSize nsnap = J->cur.nsnap;
149
146
  MSize nsnapmap = J->cur.nsnapmap;
150
147
  /* Merge if no ins. inbetween or if requested and no guard inbetween. */
151
- if (J->mergesnap ? !irt_isguard(J->guardemit) :
152
- (nsnap > 0 && J->cur.snap[nsnap-1].ref == J->cur.nins)) {
148
+ if ((nsnap > 0 && J->cur.snap[nsnap-1].ref == J->cur.nins) ||
149
+ (J->mergesnap && !irt_isguard(J->guardemit))) {
153
150
  if (nsnap == 1) { /* But preserve snap #0 PC. */
154
151
  emitir_raw(IRT(IR_NOP, IRT_NIL), 0, 0);
155
152
  goto nomerge;
@@ -407,24 +404,24 @@ static TRef snap_pref(jit_State *J, GCtrace *T, SnapEntry *map, MSize nmax,
407
404
  }
408
405
 
409
406
  /* Check whether a sunk store corresponds to an allocation. Slow path. */
410
- static int snap_sunk_store2(jit_State *J, IRIns *ira, IRIns *irs)
407
+ static int snap_sunk_store2(GCtrace *T, IRIns *ira, IRIns *irs)
411
408
  {
412
409
  if (irs->o == IR_ASTORE || irs->o == IR_HSTORE ||
413
410
  irs->o == IR_FSTORE || irs->o == IR_XSTORE) {
414
- IRIns *irk = IR(irs->op1);
411
+ IRIns *irk = &T->ir[irs->op1];
415
412
  if (irk->o == IR_AREF || irk->o == IR_HREFK)
416
- irk = IR(irk->op1);
417
- return (IR(irk->op1) == ira);
413
+ irk = &T->ir[irk->op1];
414
+ return (&T->ir[irk->op1] == ira);
418
415
  }
419
416
  return 0;
420
417
  }
421
418
 
422
419
  /* Check whether a sunk store corresponds to an allocation. Fast path. */
423
- static LJ_AINLINE int snap_sunk_store(jit_State *J, IRIns *ira, IRIns *irs)
420
+ static LJ_AINLINE int snap_sunk_store(GCtrace *T, IRIns *ira, IRIns *irs)
424
421
  {
425
422
  if (irs->s != 255)
426
423
  return (ira + irs->s == irs); /* Fast check. */
427
- return snap_sunk_store2(J, ira, irs);
424
+ return snap_sunk_store2(T, ira, irs);
428
425
  }
429
426
 
430
427
  /* Replay snapshot state to setup side trace. */
@@ -487,7 +484,7 @@ void lj_snap_replay(jit_State *J, GCtrace *T)
487
484
  } else {
488
485
  IRIns *irs;
489
486
  for (irs = ir+1; irs < irlast; irs++)
490
- if (irs->r == RID_SINK && snap_sunk_store(J, ir, irs)) {
487
+ if (irs->r == RID_SINK && snap_sunk_store(T, ir, irs)) {
491
488
  if (snap_pref(J, T, map, nent, seen, irs->op2) == 0)
492
489
  snap_pref(J, T, map, nent, seen, T->ir[irs->op2].op1);
493
490
  else if ((LJ_SOFTFP || (LJ_32 && LJ_HASFFI)) &&
@@ -521,13 +518,13 @@ void lj_snap_replay(jit_State *J, GCtrace *T)
521
518
  op2 = emitir_raw(IRT(IR_HIOP, IRT_I64), op2,
522
519
  snap_pref(J, T, map, nent, seen, (ir+1)->op2));
523
520
  }
524
- J->slot[snap_slot(sn)] = emitir(ir->ot, op1, op2);
521
+ J->slot[snap_slot(sn)] = emitir(ir->ot & ~(IRT_MARK|IRT_ISPHI), op1, op2);
525
522
  } else {
526
523
  IRIns *irs;
527
524
  TRef tr = emitir(ir->ot, op1, op2);
528
525
  J->slot[snap_slot(sn)] = tr;
529
526
  for (irs = ir+1; irs < irlast; irs++)
530
- if (irs->r == RID_SINK && snap_sunk_store(J, ir, irs)) {
527
+ if (irs->r == RID_SINK && snap_sunk_store(T, ir, irs)) {
531
528
  IRIns *irr = &T->ir[irs->op1];
532
529
  TRef val, key = irr->op2, tmp = tr;
533
530
  if (irr->o != IR_FREF) {
@@ -631,8 +628,8 @@ static void snap_restoreval(jit_State *J, GCtrace *T, ExitState *ex,
631
628
  } else if (irt_isnum(t)) {
632
629
  setnumV(o, ex->fpr[r-RID_MIN_FPR]);
633
630
  #endif
634
- } else if (LJ_64 && irt_islightud(t)) {
635
- /* 64 bit lightuserdata which may escape already has the tag bits. */
631
+ } else if (LJ_64 && irt_is64(t)) {
632
+ /* 64 bit values that already have the tag bits. */
636
633
  o->u64 = ex->gpr[r-RID_MIN_GPR];
637
634
  } else if (irt_ispri(t)) {
638
635
  setpriV(o, irt_toitype(t));
@@ -714,8 +711,9 @@ static void snap_unsink(jit_State *J, GCtrace *T, ExitState *ex,
714
711
  if (ir->o == IR_CNEW || ir->o == IR_CNEWI) {
715
712
  CTState *cts = ctype_cts(J->L);
716
713
  CTypeID id = (CTypeID)T->ir[ir->op1].i;
717
- CTSize sz = lj_ctype_size(cts, id);
718
- GCcdata *cd = lj_cdata_new(cts, id, sz);
714
+ CTSize sz;
715
+ CTInfo info = lj_ctype_info(cts, id, &sz);
716
+ GCcdata *cd = lj_cdata_newx(cts, id, sz, info);
719
717
  setcdataV(J->L, o, cd);
720
718
  if (ir->o == IR_CNEWI) {
721
719
  uint8_t *p = (uint8_t *)cdataptr(cd);
@@ -729,7 +727,7 @@ static void snap_unsink(jit_State *J, GCtrace *T, ExitState *ex,
729
727
  } else {
730
728
  IRIns *irs, *irlast = &T->ir[T->snap[snapno].ref];
731
729
  for (irs = ir+1; irs < irlast; irs++)
732
- if (irs->r == RID_SINK && snap_sunk_store(J, ir, irs)) {
730
+ if (irs->r == RID_SINK && snap_sunk_store(T, ir, irs)) {
733
731
  IRIns *iro = &T->ir[T->ir[irs->op1].op2];
734
732
  uint8_t *p = (uint8_t *)cd;
735
733
  CTSize szs;
@@ -762,7 +760,7 @@ static void snap_unsink(jit_State *J, GCtrace *T, ExitState *ex,
762
760
  settabV(J->L, o, t);
763
761
  irlast = &T->ir[T->snap[snapno].ref];
764
762
  for (irs = ir+1; irs < irlast; irs++)
765
- if (irs->r == RID_SINK && snap_sunk_store(J, ir, irs)) {
763
+ if (irs->r == RID_SINK && snap_sunk_store(T, ir, irs)) {
766
764
  IRIns *irk = &T->ir[irs->op1];
767
765
  TValue tmp, *val;
768
766
  lua_assert(irs->o == IR_ASTORE || irs->o == IR_HSTORE ||
@@ -863,7 +861,6 @@ const BCIns *lj_snap_restore(jit_State *J, void *exptr)
863
861
  return pc;
864
862
  }
865
863
 
866
- #undef IR
867
864
  #undef emitir_raw
868
865
  #undef emitir
869
866
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** Snapshot handling.
3
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #ifndef _LJ_SNAP_H
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** State and stack handling.
3
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2016 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
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** State and stack handling.
3
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #ifndef _LJ_STATE_H
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** String handling.
3
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #define lj_str_c
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** String handling.
3
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #ifndef _LJ_STR_H
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** String formatting.
3
- ** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #include <stdio.h>
@@ -18,7 +18,7 @@
18
18
  /* -- Format parser ------------------------------------------------------- */
19
19
 
20
20
  static const uint8_t strfmt_map[('x'-'A')+1] = {
21
- STRFMT_A,0,0,0,STRFMT_E,0,STRFMT_G,0,0,0,0,0,0,
21
+ STRFMT_A,0,0,0,STRFMT_E,STRFMT_F,STRFMT_G,0,0,0,0,0,0,
22
22
  0,0,0,0,0,0,0,0,0,0,STRFMT_X,0,0,
23
23
  0,0,0,0,0,0,
24
24
  STRFMT_A,0,STRFMT_C,STRFMT_D,STRFMT_E,STRFMT_F,STRFMT_G,0,STRFMT_I,0,0,0,0,
@@ -89,24 +89,6 @@ retlit:
89
89
 
90
90
  /* -- Raw conversions ----------------------------------------------------- */
91
91
 
92
- /* Write number to bufer. */
93
- char * LJ_FASTCALL lj_strfmt_wnum(char *p, cTValue *o)
94
- {
95
- if (LJ_LIKELY((o->u32.hi << 1) < 0xffe00000)) { /* Finite? */
96
- #if __BIONIC__
97
- if (tvismzero(o)) { *p++ = '-'; *p++ = '0'; return p; }
98
- #endif
99
- return p + lua_number2str(p, o->n);
100
- } else if (((o->u32.hi & 0x000fffff) | o->u32.lo) != 0) {
101
- *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
102
- } else if ((o->u32.hi & 0x80000000) == 0) {
103
- *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
104
- } else {
105
- *p++ = '-'; *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
106
- }
107
- return p;
108
- }
109
-
110
92
  #define WINT_R(x, sh, sc) \
111
93
  { uint32_t d = (x*(((1<<sh)+sc-1)/sc))>>sh; x -= d*sc; *p++ = (char)('0'+d); }
112
94
 
@@ -168,21 +150,22 @@ char * LJ_FASTCALL lj_strfmt_wuleb128(char *p, uint32_t v)
168
150
  return p;
169
151
  }
170
152
 
171
- /* Return string or write number to buffer and return pointer to start. */
172
- const char *lj_strfmt_wstrnum(char *buf, cTValue *o, MSize *lenp)
153
+ /* Return string or write number to tmp buffer and return pointer to start. */
154
+ const char *lj_strfmt_wstrnum(lua_State *L, cTValue *o, MSize *lenp)
173
155
  {
156
+ SBuf *sb;
174
157
  if (tvisstr(o)) {
175
158
  *lenp = strV(o)->len;
176
159
  return strVdata(o);
177
160
  } else if (tvisint(o)) {
178
- *lenp = (MSize)(lj_strfmt_wint(buf, intV(o)) - buf);
179
- return buf;
161
+ sb = lj_strfmt_putint(lj_buf_tmp_(L), intV(o));
180
162
  } else if (tvisnum(o)) {
181
- *lenp = (MSize)(lj_strfmt_wnum(buf, o) - buf);
182
- return buf;
163
+ sb = lj_strfmt_putfnum(lj_buf_tmp_(L), STRFMT_G14, o->n);
183
164
  } else {
184
165
  return NULL;
185
166
  }
167
+ *lenp = sbuflen(sb);
168
+ return sbufB(sb);
186
169
  }
187
170
 
188
171
  /* -- Unformatted conversions to buffer ----------------------------------- */
@@ -198,8 +181,7 @@ SBuf * LJ_FASTCALL lj_strfmt_putint(SBuf *sb, int32_t k)
198
181
  /* Add number to buffer. */
199
182
  SBuf * LJ_FASTCALL lj_strfmt_putnum(SBuf *sb, cTValue *o)
200
183
  {
201
- setsbufP(sb, lj_strfmt_wnum(lj_buf_more(sb, STRFMT_MAXBUF_NUM), o));
202
- return sb;
184
+ return lj_strfmt_putfnum(sb, STRFMT_G14, o->n);
203
185
  }
204
186
  #endif
205
187
 
@@ -360,63 +342,6 @@ SBuf *lj_strfmt_putfnum_uint(SBuf *sb, SFormat sf, lua_Number n)
360
342
  return lj_strfmt_putfxint(sb, sf, (uint64_t)k);
361
343
  }
362
344
 
363
- /* Max. sprintf buffer size needed. At least #string.format("%.99f", -1e308). */
364
- #define STRFMT_FMTNUMBUF 512
365
-
366
- /* Add formatted floating-point number to buffer. */
367
- SBuf *lj_strfmt_putfnum(SBuf *sb, SFormat sf, lua_Number n)
368
- {
369
- TValue tv;
370
- tv.n = n;
371
- if (LJ_UNLIKELY((tv.u32.hi << 1) >= 0xffe00000)) {
372
- /* Canonicalize output of non-finite values. */
373
- MSize width = STRFMT_WIDTH(sf), len = 3;
374
- int prefix = 0, ch = (sf & STRFMT_F_UPPER) ? 0x202020 : 0;
375
- char *p;
376
- if (((tv.u32.hi & 0x000fffff) | tv.u32.lo) != 0) {
377
- ch ^= ('n' << 16) | ('a' << 8) | 'n';
378
- if ((sf & STRFMT_F_SPACE)) prefix = ' ';
379
- } else {
380
- ch ^= ('i' << 16) | ('n' << 8) | 'f';
381
- if ((tv.u32.hi & 0x80000000)) prefix = '-';
382
- else if ((sf & STRFMT_F_PLUS)) prefix = '+';
383
- else if ((sf & STRFMT_F_SPACE)) prefix = ' ';
384
- }
385
- if (prefix) len = 4;
386
- p = lj_buf_more(sb, width > len ? width : len);
387
- if (!(sf & STRFMT_F_LEFT)) while (width-- > len) *p++ = ' ';
388
- if (prefix) *p++ = prefix;
389
- *p++ = (char)(ch >> 16); *p++ = (char)(ch >> 8); *p++ = (char)ch;
390
- if ((sf & STRFMT_F_LEFT)) while (width-- > len) *p++ = ' ';
391
- setsbufP(sb, p);
392
- } else { /* Delegate to sprintf() for now. */
393
- uint8_t width = (uint8_t)STRFMT_WIDTH(sf), prec = (uint8_t)STRFMT_PREC(sf);
394
- char fmt[1+5+2+3+1+1], *p = fmt;
395
- *p++ = '%';
396
- if ((sf & STRFMT_F_LEFT)) *p++ = '-';
397
- if ((sf & STRFMT_F_PLUS)) *p++ = '+';
398
- if ((sf & STRFMT_F_ZERO)) *p++ = '0';
399
- if ((sf & STRFMT_F_SPACE)) *p++ = ' ';
400
- if ((sf & STRFMT_F_ALT)) *p++ = '#';
401
- if (width) {
402
- uint8_t x = width / 10, y = width % 10;
403
- if (x) *p++ = '0' + x;
404
- *p++ = '0' + y;
405
- }
406
- if (prec != 255) {
407
- uint8_t x = prec / 10, y = prec % 10;
408
- *p++ = '.';
409
- if (x) *p++ = '0' + x;
410
- *p++ = '0' + y;
411
- }
412
- *p++ = (0x67666561 >> (STRFMT_FP(sf)<<3)) ^ ((sf & STRFMT_F_UPPER)?0x20:0);
413
- *p = '\0';
414
- p = lj_buf_more(sb, STRFMT_FMTNUMBUF);
415
- setsbufP(sb, p + sprintf(p, fmt, n));
416
- }
417
- return sb;
418
- }
419
-
420
345
  /* -- Conversions to strings ---------------------------------------------- */
421
346
 
422
347
  /* Convert integer to string. */
@@ -427,14 +352,6 @@ GCstr * LJ_FASTCALL lj_strfmt_int(lua_State *L, int32_t k)
427
352
  return lj_str_new(L, buf, len);
428
353
  }
429
354
 
430
- /* Convert number to string. */
431
- GCstr * LJ_FASTCALL lj_strfmt_num(lua_State *L, cTValue *o)
432
- {
433
- char buf[STRFMT_MAXBUF_NUM];
434
- MSize len = (MSize)(lj_strfmt_wnum(buf, o) - buf);
435
- return lj_str_new(L, buf, len);
436
- }
437
-
438
355
  /* Convert integer or number to string. */
439
356
  GCstr * LJ_FASTCALL lj_strfmt_number(lua_State *L, cTValue *o)
440
357
  {
@@ -510,12 +427,9 @@ const char *lj_strfmt_pushvf(lua_State *L, const char *fmt, va_list argp)
510
427
  case STRFMT_UINT:
511
428
  lj_strfmt_putfxint(sb, sf, va_arg(argp, uint32_t));
512
429
  break;
513
- case STRFMT_NUM: {
514
- TValue tv;
515
- tv.n = va_arg(argp, lua_Number);
516
- setsbufP(sb, lj_strfmt_wnum(lj_buf_more(sb, STRFMT_MAXBUF_NUM), &tv));
430
+ case STRFMT_NUM:
431
+ lj_strfmt_putfnum(sb, STRFMT_G14, va_arg(argp, lua_Number));
517
432
  break;
518
- }
519
433
  case STRFMT_STR: {
520
434
  const char *s = va_arg(argp, char *);
521
435
  if (s == NULL) s = "(null)";