Close the memoize frame on a valueless materialization and trace node exits

This commit is contained in:
Dennis Kobert
2026-08-24 14:11:46 +00:00
parent d718cdb225
commit 2448157af8
2 changed files with 23 additions and 6 deletions
+7 -2
View File
@@ -35,6 +35,7 @@ fn memoize<'e>(
#[data] cache: Arc<Mutex<Option<MemoLevel>>>,
content: impl Node<Context<'_>, Output = RecordValue<'e>>,
) -> GPoll<RecordValue<'e>> {
let entry_sp = core_types::record::stack::sp();
// A scalar wire's value may depend on the consuming lane (index readers),
// so only a leveled wire, whose level covers every lane by construction,
// keys with the lane normalized away.
@@ -99,12 +100,16 @@ fn memoize<'e>(
*cache.lock().unwrap() = Some(entry);
result
}
// A valueless materialization caches nothing, so the frames it left
// behind have no reader and must not be counted against this node.
LevelStatus::Pending => {
claim_frame(content.layout());
// SAFETY: nothing borrows the frames above the entry mark.
unsafe { core_types::record::interrupt_frame(entry_sp, content.layout()) };
GPoll::Pending
}
LevelStatus::Error(error) => {
claim_frame(content.layout());
// SAFETY: nothing borrows the frames above the entry mark.
unsafe { core_types::record::interrupt_frame(entry_sp, content.layout()) };
GPoll::Error(Box::new(error))
}
};