From 32eaa48c792f8a03b7144383128a9ee82babab83 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Sat, 19 Feb 2011 23:04:16 +0100 Subject: [PATCH] FFI: Fix recording of ffi.copy() and ffi.fill(). --- src/lj_crecord.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lj_crecord.c b/src/lj_crecord.c index 73575fe2..a24c541e 100644 --- a/src/lj_crecord.c +++ b/src/lj_crecord.c @@ -984,11 +984,12 @@ void LJ_FASTCALL recff_ffi_copy(jit_State *J, RecordFFData *rd) if (trlen) { trlen = crec_toint(J, cts, trlen, &rd->argv[2]); } else { - trlen = emitir(IRTI(IR_FLOAD), trsrc, IRFL_STR_LEN); + trlen = emitir(IRTI(IR_FLOAD), J->base[1], IRFL_STR_LEN); trlen = emitir(IRTI(IR_ADD), trlen, lj_ir_kint(J, 1)); } lj_ir_call(J, IRCALL_memcpy, trdst, trsrc, trlen); emitir(IRT(IR_XBAR, IRT_NIL), 0, 0); + rd->nres = 0; } /* else: interpreter will throw. */ } @@ -1005,6 +1006,7 @@ void LJ_FASTCALL recff_ffi_fill(jit_State *J, RecordFFData *rd) trfill = lj_ir_kint(J, 0); lj_ir_call(J, IRCALL_memset, tr, trfill, trlen); emitir(IRT(IR_XBAR, IRT_NIL), 0, 0); + rd->nres = 0; } /* else: interpreter will throw. */ }