diff options
Diffstat (limited to 'src/lj_ffrecord.c')
-rw-r--r-- | src/lj_ffrecord.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c index d1aa65c0..bebcf08b 100644 --- a/src/lj_ffrecord.c +++ b/src/lj_ffrecord.c | |||
@@ -27,6 +27,7 @@ | |||
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 | #include "lj_strscan.h" |
30 | #include "lj_strfmt.h" | ||
30 | 31 | ||
31 | /* Some local macros to save typing. Undef'd at the end. */ | 32 | /* Some local macros to save typing. Undef'd at the end. */ |
32 | #define IR(ref) (&J->cur.ir[(ref)]) | 33 | #define IR(ref) (&J->cur.ir[(ref)]) |
@@ -333,12 +334,12 @@ static void LJ_FASTCALL recff_tostring(jit_State *J, RecordFFData *rd) | |||
333 | if (tref_isstr(tr)) { | 334 | if (tref_isstr(tr)) { |
334 | /* Ignore __tostring in the string base metatable. */ | 335 | /* Ignore __tostring in the string base metatable. */ |
335 | /* Pass on result in J->base[0]. */ | 336 | /* Pass on result in J->base[0]. */ |
336 | } else if (!recff_metacall(J, rd, MM_tostring)) { | 337 | } else if (tr && !recff_metacall(J, rd, MM_tostring)) { |
337 | if (tref_isnumber(tr)) { | 338 | if (tref_isnumber(tr)) { |
338 | J->base[0] = emitir(IRT(IR_TOSTR, IRT_STR), tr, | 339 | J->base[0] = emitir(IRT(IR_TOSTR, IRT_STR), tr, |
339 | tref_isnum(tr) ? IRTOSTR_NUM : IRTOSTR_INT); | 340 | tref_isnum(tr) ? IRTOSTR_NUM : IRTOSTR_INT); |
340 | } else if (tref_ispri(tr)) { | 341 | } else if (tref_ispri(tr)) { |
341 | J->base[0] = lj_ir_kstr(J, strV(&J->fn->c.upvalue[tref_type(tr)])); | 342 | J->base[0] = lj_ir_kstr(J, lj_strfmt_obj(J->L, &rd->argv[0])); |
342 | } else { | 343 | } else { |
343 | recff_nyiu(J); | 344 | recff_nyiu(J); |
344 | } | 345 | } |