ZAM maintenance for recent changes and some newly exercised corner cases

This commit is contained in:
Vern Paxson 2022-05-01 14:33:58 -07:00
parent aa5a5b2136
commit 7a9c6c476e
6 changed files with 33 additions and 17 deletions

View file

@ -800,6 +800,16 @@ void ZAMCompiler::CheckSlotUse(int slot, const ZInstI* inst)
void ZAMCompiler::ExtendLifetime(int slot, const ZInstI* inst)
{
// When using old-style lambda closure semantics, a function that
// returns a lambda needs to stick around for calls to that lambda.
// We ensure that by extending its lifetime to the end of this
// function.
auto id = frame_denizens[slot];
auto& t = id->GetType();
if ( t->Tag() == TYPE_FUNC && t->Yield() && t->Yield()->Tag() == TYPE_FUNC )
inst = insts1.back();
if ( denizen_ending.count(slot) > 0 )
{
// End of denizen's lifetime already seen. Check for