aboutsummaryrefslogtreecommitdiff
path: root/src/lj_ffrecord.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_ffrecord.c')
-rw-r--r--src/lj_ffrecord.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c
index 716226bc..1ac0112e 100644
--- a/src/lj_ffrecord.c
+++ b/src/lj_ffrecord.c
@@ -26,6 +26,7 @@
26#include "lj_crecord.h" 26#include "lj_crecord.h"
27#include "lj_dispatch.h" 27#include "lj_dispatch.h"
28#include "lj_vm.h" 28#include "lj_vm.h"
29#include "lj_strscan.h"
29 30
30/* Some local macros to save typing. Undef'd at the end. */ 31/* Some local macros to save typing. Undef'd at the end. */
31#define IR(ref) (&J->cur.ir[(ref)]) 32#define IR(ref) (&J->cur.ir[(ref)])
@@ -64,7 +65,7 @@ typedef void (LJ_FASTCALL *RecordFunc)(jit_State *J, RecordFFData *rd);
64/* Get runtime value of int argument. */ 65/* Get runtime value of int argument. */
65static int32_t argv2int(jit_State *J, TValue *o) 66static int32_t argv2int(jit_State *J, TValue *o)
66{ 67{
67 if (!tvisnumber(o) && !(tvisstr(o) && lj_str_tonumber(strV(o), o))) 68 if (!lj_strscan_numberobj(o))
68 lj_trace_err(J, LJ_TRERR_BADTYPE); 69 lj_trace_err(J, LJ_TRERR_BADTYPE);
69 return tvisint(o) ? intV(o) : lj_num2int(numV(o)); 70 return tvisint(o) ? intV(o) : lj_num2int(numV(o));
70} 71}
@@ -266,7 +267,7 @@ static void LJ_FASTCALL recff_tonumber(jit_State *J, RecordFFData *rd)
266 if (tref_isnumber_str(tr)) { 267 if (tref_isnumber_str(tr)) {
267 if (tref_isstr(tr)) { 268 if (tref_isstr(tr)) {
268 TValue tmp; 269 TValue tmp;
269 if (!lj_str_tonum(strV(&rd->argv[0]), &tmp)) 270 if (!lj_strscan_num(strV(&rd->argv[0]), &tmp))
270 recff_nyiu(J); /* Would need an inverted STRTO for this case. */ 271 recff_nyiu(J); /* Would need an inverted STRTO for this case. */
271 tr = emitir(IRTG(IR_STRTO, IRT_NUM), tr, 0); 272 tr = emitir(IRTG(IR_STRTO, IRT_NUM), tr, 0);
272 } 273 }