some fixes for ZAM memory management

This commit is contained in:
Vern Paxson 2024-01-10 18:39:39 -08:00 committed by Arne Welzel
parent 896238c173
commit eac764595c
2 changed files with 3 additions and 6 deletions

View file

@ -27,7 +27,7 @@ public:
// Start looping over the elements of the given table. "_aux"
// provides information about the index variables, their types,
// and the type of the value variable (if any).
void BeginLoop(const TableVal* _tv, ZInstAux* _aux) {
void BeginLoop(TableValPtr _tv, ZInstAux* _aux) {
tv = _tv;
aux = _aux;
auto tvd = tv->AsTable();
@ -76,10 +76,7 @@ public:
}
private:
// The table we're looping over. If we want to allow for the table
// going away before we're able to clear our iterators then we
// could change this to non-const and use Ref/Unref.
const TableVal* tv = nullptr;
TableValPtr tv = nullptr;
// Associated auxiliary information.
ZInstAux* aux = nullptr;

View file

@ -1859,7 +1859,7 @@ internal-op Init-Table-Loop
type VV
op1-read
eval auto& ti = (*tiv_ptr)[z.v2];
ti.BeginLoop(frame[z.v1].table_val, z.aux);
ti.BeginLoop({NewRef{}, frame[z.v1].table_val}, z.aux);
internal-op Next-Table-Iter
op1-read