diff options
Diffstat (limited to 'src/lj_crecord.c')
-rw-r--r-- | src/lj_crecord.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lj_crecord.c b/src/lj_crecord.c index 74d62d6c..268800e4 100644 --- a/src/lj_crecord.c +++ b/src/lj_crecord.c | |||
@@ -385,7 +385,14 @@ static TRef crec_ct_tv(jit_State *J, CType *d, TRef dp, TRef sp, cTValue *sval) | |||
385 | } else if (tref_isnil(sp)) { | 385 | } else if (tref_isnil(sp)) { |
386 | sp = lj_ir_kptr(J, NULL); | 386 | sp = lj_ir_kptr(J, NULL); |
387 | } else if (tref_isudata(sp)) { | 387 | } else if (tref_isudata(sp)) { |
388 | sp = emitir(IRT(IR_ADD, IRT_P32), sp, lj_ir_kint(J, sizeof(GCudata))); | 388 | GCudata *ud = udataV(sval); |
389 | if (ud->udtype == UDTYPE_IO_FILE) { | ||
390 | TRef tr = emitir(IRT(IR_FLOAD, IRT_U8), sp, IRFL_UDATA_UDTYPE); | ||
391 | emitir(IRTGI(IR_EQ), tr, lj_ir_kint(J, UDTYPE_IO_FILE)); | ||
392 | sp = emitir(IRT(IR_FLOAD, IRT_PTR), sp, IRFL_UDATA_FILE); | ||
393 | } else { | ||
394 | sp = emitir(IRT(IR_ADD, IRT_P32), sp, lj_ir_kint(J, sizeof(GCudata))); | ||
395 | } | ||
389 | } else if (tref_isstr(sp)) { | 396 | } else if (tref_isstr(sp)) { |
390 | if (ctype_isenum(d->info)) { /* Match string against enum constant. */ | 397 | if (ctype_isenum(d->info)) { /* Match string against enum constant. */ |
391 | GCstr *str = strV(sval); | 398 | GCstr *str = strV(sval); |