fitzgen requested cfallin for a review on PR #12590.
fitzgen opened PR #12590 from fitzgen:make-scc-reusable to bytecodealliance:main:
This moves our existing SCC computation and DFS graph traversals out of
wasmtime::compileand intowasmtime_environ::graphs, where they can be reused elsewhere in the workspace. These functions and types were already generally generic over an iterator of nodes and/or an edge function to get a particular node's successors, but I've gone one step further and packaged up those two things together into aGraphtrait.In the process, I also moved the
NonMaxU32type towasmtime_internal_coreand made it so we have other non-max integer types as well.This will let us reuse SCC computation in our GC ops fuzzer, where we need SCCs to figure out how to merge fuzzer-generated rec groups, if necessary, since cyclic type references are constrained to within the same rec group. The GC ops fuzzer can also reuse the DFS traversal code in its topological sorting of supertypes and subtypes as well.
This is mostly, but not quite completely, code motion and fixups of paths and such.
@cfallin, I'm flagging you for review on this one because you reviewed the initial PRs that landed this code.
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
fitzgen requested wasmtime-core-reviewers for a review on PR #12590.
fitzgen updated PR #12590.
cfallin submitted PR review:
Seems reasonable!
I was idly wondering whether it would make more sense to put the graph-related bits in
crates/core/since that is becoming a home for data structures in general, but I guess the focus there is more on foundational containers (with explicit OOM handling) than algorithms, and also the bits here are not adapted for OOM so we'd be mixing universes if we did that? I'm fine either way honestly.
github-actions[bot] added the label wasmtime:api on PR #12590.
fitzgen updated PR #12590.
fitzgen commented on PR #12590:
I was idly wondering whether it would make more sense to put the graph-related bits in
crates/core/since that is becoming a home for data structures in general, but I guess the focus there is more on foundational containers (with explicit OOM handling) than algorithms, and also the bits here are not adapted for OOM so we'd be mixing universes if we did that? I'm fine either way honestly.Yeah I think probably in an ideal world it would be like
wasmtime-internal-graphor something but too many crates has annoying administrative overheads. At this point, whether something goes incrates/coreorcrates/environis like 75% whether anything in Cranelift's dep graph needs it or not in my mind.Anyways, we can always move things around if we find that we need to down the line.
fitzgen added PR #12590 Make SCCs and graph traversals reusable to the merge queue.
github-merge-queue[bot] removed PR #12590 Make SCCs and graph traversals reusable from the merge queue.
fitzgen updated PR #12590.
fitzgen has enabled auto merge for PR #12590.
fitzgen added PR #12590 Make SCCs and graph traversals reusable to the merge queue.
fitzgen merged PR #12590.
fitzgen removed PR #12590 Make SCCs and graph traversals reusable from the merge queue.
Last updated: Feb 24 2026 at 04:36 UTC