Skip to content

Backend: avoid recursion; use explicit stack with iteration instead. - #23

Merged
cfallin merged 1 commit into
mainfrom
cfallin/explicit-recursion
Oct 1, 2026
Merged

cfallin merged 1 commit into
mainfrom
cfallin/explicit-recursion

Conversation

@cfallin

@cfallin cfallin commented Oct 1, 2026

Copy link
Copy Markdown
Member

This was overflowing the native stack on some very (very) large function bodies.

Note that the main lowering loop needs to be made explicitly iterative as well; the auto-derived Drop impl was too recursive as well (!).

This was overflowing the native stack on some very (very) large function
bodies.

Note that the main lowering loop needs to be made explicitly iterative
as well; the auto-derived `Drop` impl was too recursive as well (!).
@cfallin
cfallin requested a review from fitzgen October 1, 2026 04:30
@cfallin cfallin mentioned this pull request Oct 1, 2026

@fitzgen fitzgen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of my favorite little problems to solve

@cfallin
cfallin merged commit 141a009 into main Oct 1, 2026
3 checks passed
@cfallin
cfallin deleted the cfallin/explicit-recursion branch October 1, 2026 17:11
gkgoat1 pushed a commit to gkgoat1/waffle that referenced this pull request Oct 3, 2026
Includes:

- bytecodealliance#22: completeness fix for `resolve_aliases` pass.
- bytecodealliance#23: scalability improvement in backend for very large functions
  (which result in very deeply-nested Wasm structured control flow
  trees).
- bytecodealliance#24: make the empty-blocks pass public.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants