Skip to content

[GC] Add a TypeRefiningGUFA pass#7433

Merged
kripken merged 20 commits intoWebAssembly:mainfrom
kripken:gufa.type-refining
Apr 3, 2025
Merged

[GC] Add a TypeRefiningGUFA pass#7433
kripken merged 20 commits intoWebAssembly:mainfrom
kripken:gufa.type-refining

Conversation

@kripken
Copy link
Copy Markdown
Member

@kripken kripken commented Apr 2, 2025

This variation of TypeRefining uses GUFA to determine what types to refine
struct fields to. GUFA does a (slow) whole-program analysis which can infer
things the normal pass cannot, e.g. refinements that contain cycles through
things like locals or globals.

This is mainly a proof of concept, as it is pretty slow to compute GUFA just
for this, and while I see improvements on real-world code, they are minor.
If we find that the benefits here are worth it, a larger refactoring could
do this optimization in the existing GUFA pass (which already does the
computation of the graph anyhow).

@kripken kripken requested a review from tlively April 2, 2025 23:36
Copy link
Copy Markdown
Member

@tlively tlively left a comment

Choose a reason for hiding this comment

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

Neat!

@kripken
Copy link
Copy Markdown
Member Author

kripken commented Apr 3, 2025

I took some more measurements on samples from Java, Dart, and Kotlin. The largest effect was a 0.2% code size improvement on Kotlin. Overall this helps every large program I've tested it on, so "cycles" certainly exist in practice, but it seems there are just a handful of them. I guess this validates our approach of focusing initially on modular independent refining passes, since while that doesn't handle cycles, it is faster and it apparently handles 99% of cases.

@kripken kripken merged commit 01e0eea into WebAssembly:main Apr 3, 2025
14 checks passed
@kripken kripken deleted the gufa.type-refining branch April 3, 2025 16:30
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