Skip to content

Reuse Wasm locals in functions with exception handlers - #171

Closed
vishvananda wants to merge 1 commit into
fix/wasi-heap-growthfrom
fix/wasm-eh-local-reuse
Closed

vishvananda wants to merge 1 commit into
fix/wasi-heap-growthfrom
fix/wasm-eh-local-reuse

Conversation

@vishvananda

Copy link
Copy Markdown
Owner

Functions containing try_table skipped Wasm local reuse. Exception-enabled programs therefore kept many more locals than needed. Track catch targets and add exceptional control-flow edges at throwing instructions, so local reuse also handles these functions safely.

The frozen cppgm Wasm compiler drops from 349,888 to 110,213 declared locals. The largest function drops from 2,177 to 695 locals. A local WebKit A/B/B/A comparison improved OpenLara compilation from 9.29–10.32 seconds to 6.88–7.86 seconds. Every project object was identical. The Mac Safari comparison had large host-load changes and lost its final browser session, so it does not establish a reliable Mac speedup. Physical iPhone cold-run validation is still needed.

Add a PA37 fixture that checks normal returns, throws from two call sites, values kept across landing paths, and RAII cleanup. Its local-count limit fails before this fix (425 locals at O1).

Validation: PA37 224/224; strict report 11,313/11,313; debug-info tests; self-host through PA5; native inception; PA36 smoke; architecture, formatting, file and placement audits. WASI self-build matched all 467 objects and the final compiler. All 934 native/WASI x86 comparisons passed. All 290 OpenLara object hashes were unchanged. Harness and student-export validation are running. Native cycle measurements are inconclusive because A/A noise exceeds the 0.5% budget.

This PR is stacked on #170. Browser process reuse and heap growth are separate changes in that PR and the demo site.

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.

1 participant