diff --git a/src/lj_cconv.c b/src/lj_cconv.c index 1f14adad..ac6374ed 100644 --- a/src/lj_cconv.c +++ b/src/lj_cconv.c @@ -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)) { diff --git a/src/lj_crecord.c b/src/lj_crecord.c index d4dc9ef9..e2b3e8af 100644 --- a/src/lj_crecord.c +++ b/src/lj_crecord.c @@ -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)) {