|
@@ -1125,6 +1125,7 @@ static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd)
|
|
|
if (ctype_isfunc(info)) {
|
|
|
TRef func = emitir(IRT(IR_FLOAD, tp), J->base[0], IRFL_CDATA_PTR);
|
|
|
CType *ctr = ctype_rawchild(cts, ct);
|
|
|
+ CTInfo ctr_info = ctr->info; /* crec_call_args may invalidate ctr. */
|
|
|
IRType t = crec_ct2irt(cts, ctr);
|
|
|
TRef tr;
|
|
|
TValue tv;
|
|
@@ -1133,11 +1134,11 @@ static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd)
|
|
|
cdata_getptr(cdataptr(cd), (LJ_64 && tp == IRT_P64) ? 8 : 4));
|
|
|
if (tvistrue(lj_tab_get(J->L, cts->miscmap, &tv)))
|
|
|
lj_trace_err(J, LJ_TRERR_BLACKL);
|
|
|
- if (ctype_isvoid(ctr->info)) {
|
|
|
+ if (ctype_isvoid(ctr_info)) {
|
|
|
t = IRT_NIL;
|
|
|
rd->nres = 0;
|
|
|
- } else if (!(ctype_isnum(ctr->info) || ctype_isptr(ctr->info) ||
|
|
|
- ctype_isenum(ctr->info)) || t == IRT_CDATA) {
|
|
|
+ } else if (!(ctype_isnum(ctr_info) || ctype_isptr(ctr_info) ||
|
|
|
+ ctype_isenum(ctr_info)) || t == IRT_CDATA) {
|
|
|
lj_trace_err(J, LJ_TRERR_NYICALL);
|
|
|
}
|
|
|
if ((info & CTF_VARARG)
|
|
@@ -1148,7 +1149,7 @@ 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);
|
|
|
- if (ctype_isbool(ctr->info)) {
|
|
|
+ if (ctype_isbool(ctr_info)) {
|
|
|
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;
|
|
@@ -1164,7 +1165,7 @@ static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd)
|
|
|
tr = TREF_TRUE;
|
|
|
}
|
|
|
} else if (t == IRT_PTR || (LJ_64 && t == IRT_P32) ||
|
|
|
- t == IRT_I64 || t == IRT_U64 || ctype_isenum(ctr->info)) {
|
|
|
+ t == IRT_I64 || t == IRT_U64 || ctype_isenum(ctr_info)) {
|
|
|
TRef trid = lj_ir_kint(J, ctype_cid(info));
|
|
|
tr = emitir(IRTG(IR_CNEWI, IRT_CDATA), trid, tr);
|
|
|
if (t == IRT_I64 || t == IRT_U64) lj_needsplit(J);
|