void emitUnbox(HTS& env) { auto const exit = makeExit(env); auto const srcBox = popV(env); auto const unboxed = unbox(env, srcBox, exit); pushIncRef(env, unboxed); gen(env, DecRef, srcBox); }
void emitBindG(IRGS& env) { auto const name = topC(env, BCSPOffset{1}); if (!name->isA(TStr)) PUNT(BindG-NameNotStr); auto const box = popV(env); auto const ptr = gen(env, LdGblAddrDef, name); destroyName(env, name); bindMem(env, ptr, box); }
void emitBindS(IRGS& env) { auto const ssaPropName = topC(env, BCSPOffset{2}); if (!ssaPropName->isA(TStr)) { PUNT(BindS-PropNameNotString); } auto const value = popV(env); auto const ssaCls = popA(env); auto const propAddr = ldClsPropAddr(env, ssaCls, ssaPropName, true); destroyName(env, ssaPropName); bindMem(env, propAddr, value); }
void emitBindL(HTS& env, int32_t id) { if (curFunc(env)->isPseudoMain()) { interpOne(env, Type::BoxedInitCell, 1); return; } auto const ldPMExit = makePseudoMainExit(env); auto const newValue = popV(env); // Note that the IncRef must happen first, for correctness in a // pseudo-main: the destructor could decref the value again after // we've stored it into the local. pushIncRef(env, newValue); auto const oldValue = ldLoc(env, id, ldPMExit, DataTypeSpecific); stLocRaw(env, id, fp(env), newValue); gen(env, DecRef, oldValue); }