Make function definitions allocate the body more lazily. (#2557)

Lazy allocation means that we can use a single node block for _all_ empty node blocks. The change in timing for when the definition node is emitted shouldn't affect semantic correctness; the signature is already present for recursive calls.
This commit is contained in:
Jon Ross-Perkins
2023-01-27 11:46:12 -08:00
committed by GitHub
parent 2ffbe72384
commit 94cbb9d917
23 changed files with 78 additions and 117 deletions
@@ -27,10 +27,6 @@ class SemanticsNodeBlockStack {
// order to support lazy allocation.
auto Push() -> void;
// Pushes a new node block.
// TODO: Try to remove this in favor of the lazy alloc in Push.
auto PushWithUnconditionalAlloc() -> SemanticsNodeBlockId;
// Peeks at the top node block. This does not trigger lazy allocation, so the
// returned node block may be invalid.
auto Peek() -> SemanticsNodeBlockId { return stack_.back(); }