diff options
| author | Mike Pall <mike> | 2011-01-17 01:21:57 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2011-01-17 01:21:57 +0100 |
| commit | 83d8c86bbb7b6123c88e1cc43f48a077e04b4b1a (patch) | |
| tree | c1a769b079cb386e32593615eb6615e9ce96abb8 | |
| parent | 66ba1e68aab23fa09fcbe84b79d4992c92440b0c (diff) | |
| download | luajit-83d8c86bbb7b6123c88e1cc43f48a077e04b4b1a.tar.gz luajit-83d8c86bbb7b6123c88e1cc43f48a077e04b4b1a.tar.bz2 luajit-83d8c86bbb7b6123c88e1cc43f48a077e04b4b1a.zip | |
FFI: Record conversions from bool ctype.
| -rw-r--r-- | src/lj_cconv.c | 4 | ||||
| -rw-r--r-- | src/lj_crecord.c | 7 |
2 files changed, 8 insertions, 3 deletions
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, | |||
| 371 | /* Numbers are NOT canonicalized here! Beware of uninitialized data. */ | 371 | /* Numbers are NOT canonicalized here! Beware of uninitialized data. */ |
| 372 | lua_assert(tvisnum(o)); | 372 | lua_assert(tvisnum(o)); |
| 373 | } else { | 373 | } else { |
| 374 | setboolV(o, (*sp & 1)); | 374 | uint32_t b = ((*sp) & 1); |
| 375 | setboolV(o, b); | ||
| 376 | setboolV(&cts->g->tmptv2, b); /* Remember for trace recorder. */ | ||
| 375 | } | 377 | } |
| 376 | return 0; | 378 | return 0; |
| 377 | } else if (ctype_isrefarray(sinfo) || ctype_isstruct(sinfo)) { | 379 | } 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) | |||
| 301 | if (ctype_isnum(sinfo)) { | 301 | if (ctype_isnum(sinfo)) { |
| 302 | IRType t = crec_ct2irt(s); | 302 | IRType t = crec_ct2irt(s); |
| 303 | TRef tr; | 303 | TRef tr; |
| 304 | if ((sinfo & CTF_BOOL)) | ||
| 305 | goto err_nyi; /* NYI: specialize to the result. */ | ||
| 306 | if (t == IRT_CDATA) | 304 | if (t == IRT_CDATA) |
| 307 | goto err_nyi; /* NYI: copyval of >64 bit integers. */ | 305 | goto err_nyi; /* NYI: copyval of >64 bit integers. */ |
| 308 | tr = emitir(IRT(IR_XLOAD, t), sp, 0); | 306 | 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) | |||
| 314 | lj_ir_kintp(J, sizeof(GCcdata))); | 312 | lj_ir_kintp(J, sizeof(GCcdata))); |
| 315 | emitir(IRT(IR_XSTORE, t), ptr, tr); | 313 | emitir(IRT(IR_XSTORE, t), ptr, tr); |
| 316 | return dp; | 314 | return dp; |
| 315 | } else if ((sinfo & CTF_BOOL)) { | ||
| 316 | /* Assume not equal to zero. Fixup and emit pending guard later. */ | ||
| 317 | lj_ir_set(J, IRTGI(IR_NE), tr, lj_ir_kint(J, 0)); | ||
| 318 | J->postproc = LJ_POST_FIXGUARD; | ||
| 319 | tr = TREF_TRUE; | ||
| 317 | } | 320 | } |
| 318 | return tr; | 321 | return tr; |
| 319 | } else if (ctype_isptr(sinfo)) { | 322 | } else if (ctype_isptr(sinfo)) { |
