void emitIterBreak(IRGS& env, Offset relOffset, const ImmVector& iv) { for (int iterIndex = 0; iterIndex < iv.size(); iterIndex += 2) { IterKind iterKind = (IterKind)iv.vec32()[iterIndex]; Id iterId = iv.vec32()[iterIndex + 1]; switch (iterKind) { case KindOfIter: gen(env, IterFree, IterId(iterId), fp(env)); break; case KindOfMIter: gen(env, MIterFree, IterId(iterId), fp(env)); break; case KindOfCIter: gen(env, CIterFree, IterId(iterId), fp(env)); break; } } jmpImpl(env, bcOff(env) + relOffset); }
void emitIterBreak(IRGS& env, const ImmVector& iv, Offset relOffset) { always_assert(env.currentNormalizedInstruction->endsRegion); for (int iterIndex = 0; iterIndex < iv.size(); iterIndex += 2) { IterKind iterKind = (IterKind)iv.vec32()[iterIndex]; Id iterId = iv.vec32()[iterIndex + 1]; switch (iterKind) { case KindOfIter: gen(env, IterFree, IterId(iterId), fp(env)); break; case KindOfMIter: gen(env, MIterFree, IterId(iterId), fp(env)); break; case KindOfCIter: gen(env, CIterFree, IterId(iterId), fp(env)); break; } } // Would need to change this if we support not ending regions on this: gen(env, Jmp, makeExit(env, bcOff(env) + relOffset)); }
void emitDecodeCufIter(IRGS& env, int32_t iterId, Offset relOffset) { auto const src = popC(env); auto const type = src->type(); if (type.subtypeOfAny(TArr, TStr, TObj)) { auto const res = gen( env, DecodeCufIter, TBool, IterId(iterId), src, fp(env) ); decRef(env, src); implCondJmp(env, bcOff(env) + relOffset, true, res); } else { decRef(env, src); jmpImpl(env, bcOff(env) + relOffset); } }
void emitDecodeCufIter(IRGS& env, int32_t iterId, Offset relOffset) { auto const src = popC(env); auto const type = src->type(); if (type.subtypeOfAny(Type::Arr, Type::Str, Type::Obj)) { auto const res = gen( env, DecodeCufIter, Type::Bool, IterId(iterId), src, fp(env) ); gen(env, DecRef, src); implCondJmp(env, bcOff(env) + relOffset, true, res); } else { gen(env, DecRef, src); jmpImpl(env, bcOff(env) + relOffset, instrJmpFlags(*env.currentNormalizedInstruction)); } }
void emitCIterFree(IRGS& env, int32_t iterId) { gen(env, CIterFree, IterId(iterId), fp(env)); }