diff options
author | Mike Pall <mike> | 2013-05-08 10:46:43 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2013-05-08 10:46:43 +0200 |
commit | c5d7666ec82380ad1fe7be0511654fc44af496b8 (patch) | |
tree | a163bb8ff46b02470f7566c60a1c674446f2e79e | |
parent | 5d6db413ae9e93b8b6c32802fed82a91427d1966 (diff) | |
download | luajit-c5d7666ec82380ad1fe7be0511654fc44af496b8.tar.gz luajit-c5d7666ec82380ad1fe7be0511654fc44af496b8.tar.bz2 luajit-c5d7666ec82380ad1fe7be0511654fc44af496b8.zip |
Fix optional argument handling while recording builtins.
-rw-r--r-- | src/lj_ffrecord.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c index 4aa4f064..35e2e88e 100644 --- a/src/lj_ffrecord.c +++ b/src/lj_ffrecord.c | |||
@@ -272,7 +272,7 @@ static void LJ_FASTCALL recff_tonumber(jit_State *J, RecordFFData *rd) | |||
272 | { | 272 | { |
273 | TRef tr = J->base[0]; | 273 | TRef tr = J->base[0]; |
274 | TRef base = J->base[1]; | 274 | TRef base = J->base[1]; |
275 | if (tr && base) { | 275 | if (tr && !tref_isnil(base)) { |
276 | base = lj_opt_narrow_toint(J, base); | 276 | base = lj_opt_narrow_toint(J, base); |
277 | if (!tref_isk(base) || IR(tref_ref(base))->i != 10) | 277 | if (!tref_isk(base) || IR(tref_ref(base))->i != 10) |
278 | recff_nyiu(J); | 278 | recff_nyiu(J); |
@@ -657,7 +657,7 @@ static void LJ_FASTCALL recff_string_range(jit_State *J, RecordFFData *rd) | |||
657 | end = argv2int(J, &rd->argv[2]); | 657 | end = argv2int(J, &rd->argv[2]); |
658 | } | 658 | } |
659 | } else { /* string.byte(str, [,start [,end]]) */ | 659 | } else { /* string.byte(str, [,start [,end]]) */ |
660 | if (J->base[1]) { | 660 | if (!tref_isnil(J->base[1])) { |
661 | start = argv2int(J, &rd->argv[1]); | 661 | start = argv2int(J, &rd->argv[1]); |
662 | trstart = lj_opt_narrow_toint(J, J->base[1]); | 662 | trstart = lj_opt_narrow_toint(J, J->base[1]); |
663 | trend = J->base[2]; | 663 | trend = J->base[2]; |
@@ -750,7 +750,7 @@ static void LJ_FASTCALL recff_table_remove(jit_State *J, RecordFFData *rd) | |||
750 | TRef tab = J->base[0]; | 750 | TRef tab = J->base[0]; |
751 | rd->nres = 0; | 751 | rd->nres = 0; |
752 | if (tref_istab(tab)) { | 752 | if (tref_istab(tab)) { |
753 | if (!J->base[1] || tref_isnil(J->base[1])) { /* Simple pop: t[#t] = nil */ | 753 | if (tref_isnil(J->base[1])) { /* Simple pop: t[#t] = nil */ |
754 | TRef trlen = lj_ir_call(J, IRCALL_lj_tab_len, tab); | 754 | TRef trlen = lj_ir_call(J, IRCALL_lj_tab_len, tab); |
755 | GCtab *t = tabV(&rd->argv[0]); | 755 | GCtab *t = tabV(&rd->argv[0]); |
756 | MSize len = lj_tab_len(t); | 756 | MSize len = lj_tab_len(t); |