mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
FFI: Record conversions from bool ctype.
This commit is contained in:
parent
66ba1e68aa
commit
83d8c86bbb
@ -371,7 +371,9 @@ int lj_cconv_tv_ct(CTState *cts, CType *s, CTypeID sid,
|
||||
/* Numbers are NOT canonicalized here! Beware of uninitialized data. */
|
||||
lua_assert(tvisnum(o));
|
||||
} else {
|
||||
setboolV(o, (*sp & 1));
|
||||
uint32_t b = ((*sp) & 1);
|
||||
setboolV(o, b);
|
||||
setboolV(&cts->g->tmptv2, b); /* Remember for trace recorder. */
|
||||
}
|
||||
return 0;
|
||||
} else if (ctype_isrefarray(sinfo) || ctype_isstruct(sinfo)) {
|
||||
|
@ -301,8 +301,6 @@ static TRef crec_tv_ct(jit_State *J, CType *s, CTypeID sid, TRef sp)
|
||||
if (ctype_isnum(sinfo)) {
|
||||
IRType t = crec_ct2irt(s);
|
||||
TRef tr;
|
||||
if ((sinfo & CTF_BOOL))
|
||||
goto err_nyi; /* NYI: specialize to the result. */
|
||||
if (t == IRT_CDATA)
|
||||
goto err_nyi; /* NYI: copyval of >64 bit integers. */
|
||||
tr = emitir(IRT(IR_XLOAD, t), sp, 0);
|
||||
@ -314,6 +312,11 @@ static TRef crec_tv_ct(jit_State *J, CType *s, CTypeID sid, TRef sp)
|
||||
lj_ir_kintp(J, sizeof(GCcdata)));
|
||||
emitir(IRT(IR_XSTORE, t), ptr, tr);
|
||||
return dp;
|
||||
} else if ((sinfo & CTF_BOOL)) {
|
||||
/* Assume not equal to zero. Fixup and emit pending guard later. */
|
||||
lj_ir_set(J, IRTGI(IR_NE), tr, lj_ir_kint(J, 0));
|
||||
J->postproc = LJ_POST_FIXGUARD;
|
||||
tr = TREF_TRUE;
|
||||
}
|
||||
return tr;
|
||||
} else if (ctype_isptr(sinfo)) {
|
||||
|
Loading…
Reference in New Issue
Block a user