ZAM fixes for record creation and table indexing potentially having side-effects

This commit is contained in:
Vern Paxson 2023-09-27 11:38:21 -07:00
parent 3addda28d3
commit 8f92e0d39b
4 changed files with 66 additions and 10 deletions

View file

@ -736,6 +736,12 @@ const ZAMStmt ZAMCompiler::CompileIndex(const NameExpr* n1, int n2_slot, const T
z = ZInstI(zop, Frame1Slot(n1, zop), n2_slot, c3);
}
// See the discussion in CSE_ValidityChecker::PreExpr
// regarding always needing to treat this as potentially
// modifying globals.
z.aux = new ZInstAux(0);
z.aux->can_change_non_locals = true;
return AddInst(z);
}
}
@ -1185,6 +1191,9 @@ const ZAMStmt ZAMCompiler::ConstructRecord(const NameExpr* n, const Expr* e)
z.t = e->GetType();
if ( ! rc->GetType<RecordType>()->IdempotentCreation() )
z.aux->can_change_non_locals = true;
return AddInst(z);
}