mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 15:14:08 +00:00
FFI: Fix recording of test for bool result of call.
This commit is contained in:
parent
7d3954036c
commit
6e5c872eb7
@ -902,14 +902,16 @@ static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd)
|
||||
func = emitir(IRT(IR_CARG, IRT_NIL), func,
|
||||
lj_ir_kint(J, ctype_typeid(cts, ct)));
|
||||
tr = emitir(IRT(IR_CALLXS, t), crec_call_args(J, rd, cts, ct), func);
|
||||
J->needsnap = 1;
|
||||
if (ctype_isbool(ctr->info)) {
|
||||
if (frame_islua(J->L->base-1) && bc_b(frame_pc(J->L->base-1)[-1]) == 1)
|
||||
return 1; /* Don't check result if ignored. */
|
||||
crec_snap_caller(J);
|
||||
lj_ir_set(J, IRTGI(IR_NE), tr, lj_ir_kint(J, 0));
|
||||
J->postproc = LJ_POST_FIXGUARDSNAP;
|
||||
tr = TREF_TRUE;
|
||||
if (frame_islua(J->L->base-1) && bc_b(frame_pc(J->L->base-1)[-1]) == 1) {
|
||||
/* Don't check result if ignored. */
|
||||
tr = TREF_NIL;
|
||||
} else {
|
||||
crec_snap_caller(J);
|
||||
lj_ir_set(J, IRTGI(IR_NE), tr, lj_ir_kint(J, 0));
|
||||
J->postproc = LJ_POST_FIXGUARDSNAP;
|
||||
tr = TREF_TRUE;
|
||||
}
|
||||
} else if (t == IRT_FLOAT || t == IRT_U32) {
|
||||
tr = emitconv(tr, IRT_NUM, t, 0);
|
||||
} else if (t == IRT_I8 || t == IRT_I16) {
|
||||
@ -923,6 +925,7 @@ static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd)
|
||||
if (t == IRT_I64 || t == IRT_U64) lj_needsplit(J);
|
||||
}
|
||||
J->base[0] = tr;
|
||||
J->needsnap = 1;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user