diff options
Diffstat (limited to 'src/lj_asm.c')
-rw-r--r-- | src/lj_asm.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c index a69f4461..8e7c98ee 100644 --- a/src/lj_asm.c +++ b/src/lj_asm.c | |||
@@ -2558,6 +2558,7 @@ static void asm_cnew(ASMState *as, IRIns *ir) | |||
2558 | lj_ctype_size(cts, typeid) : (CTSize)IR(ir->op2)->i; | 2558 | lj_ctype_size(cts, typeid) : (CTSize)IR(ir->op2)->i; |
2559 | const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_mem_newgco]; | 2559 | const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_mem_newgco]; |
2560 | IRRef args[2]; | 2560 | IRRef args[2]; |
2561 | int gcfin = 0; | ||
2561 | lua_assert(sz != CTSIZE_INVALID); | 2562 | lua_assert(sz != CTSIZE_INVALID); |
2562 | 2563 | ||
2563 | args[0] = ASMREF_L; /* lua_State *L */ | 2564 | args[0] = ASMREF_L; /* lua_State *L */ |
@@ -2604,12 +2605,15 @@ static void asm_cnew(ASMState *as, IRIns *ir) | |||
2604 | } while (1); | 2605 | } while (1); |
2605 | #endif | 2606 | #endif |
2606 | lua_assert(sz == 4 || (sz == 8 && (LJ_64 || LJ_HASFFI))); | 2607 | lua_assert(sz == 4 || (sz == 8 && (LJ_64 || LJ_HASFFI))); |
2608 | } else { | ||
2609 | if (lj_ctype_meta(cts, typeid, MM_gc) != NULL) | ||
2610 | gcfin = LJ_GC_CDATA_FIN; | ||
2607 | } | 2611 | } |
2608 | 2612 | ||
2609 | /* Combine initialization of marked, gct and typeid. */ | 2613 | /* Combine initialization of marked, gct and typeid. */ |
2610 | emit_movtomro(as, RID_ECX, RID_RET, offsetof(GCcdata, marked)); | 2614 | emit_movtomro(as, RID_ECX, RID_RET, offsetof(GCcdata, marked)); |
2611 | emit_gri(as, XG_ARITHi(XOg_OR), RID_ECX, | 2615 | emit_gri(as, XG_ARITHi(XOg_OR), RID_ECX, |
2612 | (int32_t)((~LJ_TCDATA<<8)+(typeid<<16))); | 2616 | (int32_t)((~LJ_TCDATA<<8)+(typeid<<16)+gcfin)); |
2613 | emit_gri(as, XG_ARITHi(XOg_AND), RID_ECX, LJ_GC_WHITES); | 2617 | emit_gri(as, XG_ARITHi(XOg_AND), RID_ECX, LJ_GC_WHITES); |
2614 | emit_opgl(as, XO_MOVZXb, RID_ECX, gc.currentwhite); | 2618 | emit_opgl(as, XO_MOVZXb, RID_ECX, gc.currentwhite); |
2615 | 2619 | ||