-
Notifications
You must be signed in to change notification settings - Fork 851
Compute effects for indirect calls in GlobalEffects #8609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
3a25c2e
Cherrypick SCC with indirect effects
stevenfontanella d764f59
PR updates
stevenfontanella ff72d4f
PR updates
stevenfontanella 20fd3cd
Remove dead code
stevenfontanella 6bf6f2a
Add explicit deduction guide to resolve CI error
stevenfontanella 8a0e725
PR updates
stevenfontanella ac59711
Add test for unreachable ref
stevenfontanella 4a440f9
Add comment
stevenfontanella 00407cf
PR updates
stevenfontanella 3192366
PR updates
stevenfontanella 512dad6
PR updates
stevenfontanella 0890c8f
Use type alias
stevenfontanella 4994a9d
Small fix to graph building
stevenfontanella 7e09feb
Optimize logic for walking up supertype heirarchy
stevenfontanella f5d9926
Add more tests demonstrating different effects beings aggregated
stevenfontanella 3567c0e
Try reformatting
stevenfontanella ac58ee6
Reformat again
stevenfontanella 68971e4
Lift out lambda
stevenfontanella ffb73c5
Fix test
stevenfontanella 48a9cab
Add unit test for DFS
stevenfontanella 2630eff
Fix test comment
stevenfontanella 39d2d31
Merge main
stevenfontanella 259b234
Use -all in test
stevenfontanella 392853d
PR updates
stevenfontanella File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| /* | ||
| * Copyright 2026 WebAssembly Community Group participants | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #include <concepts> | ||
| #include <functional> | ||
| #include <iterator> | ||
| #include <unordered_set> | ||
|
|
||
| namespace wasm { | ||
|
|
||
| // SuccessorFunction should be an invocable that takes a 'push' function (which | ||
| // is an invocable that takes a `const T&`), and a `const T&`. i.e. | ||
| // SuccessorFunction should call `push` for each neighbor of the T that it's | ||
| // called with. | ||
| // TODO: We don't have a good way to write this with concepts today. | ||
| // Something like this should do it, but we hit an ICE on dwarf symbols in debug | ||
| // builds: requires requires(const SuccessorFunction& successors, const T& t) { | ||
| // successors([](const T&) { }, t); } | ||
| template<typename T, typename SuccessorFunction> class Graph { | ||
| public: | ||
| template<std::input_iterator It, std::sentinel_for<It> Sen> | ||
| requires std::convertible_to<std::iter_reference_t<It>, T> | ||
| Graph(It rootsBegin, Sen rootsEnd, SuccessorFunction successors) | ||
| : roots(rootsBegin, rootsEnd), successors(std::move(successors)) {} | ||
|
|
||
| // Traverse the graph depth-first, calling `successors` exactly once for each | ||
| // node (unless the node appears multiple times in `roots`). Return the set of | ||
| // nodes visited. | ||
| std::unordered_set<T> traverseDepthFirst() const { | ||
| std::vector<T> stack(roots.begin(), roots.end()); | ||
| std::unordered_set<T> visited(roots.begin(), roots.end()); | ||
|
|
||
| auto maybePush = [&](const T& t) { | ||
| auto [_, inserted] = visited.insert(t); | ||
| if (inserted) { | ||
| stack.push_back(t); | ||
| } | ||
| }; | ||
|
|
||
| while (!stack.empty()) { | ||
| auto curr = std::move(stack.back()); | ||
| stack.pop_back(); | ||
|
|
||
| successors(maybePush, curr); | ||
| } | ||
|
|
||
| return visited; | ||
| } | ||
|
|
||
| private: | ||
| std::vector<T> roots; | ||
| SuccessorFunction successors; | ||
| }; | ||
|
|
||
| template<std::input_iterator It, | ||
| std::sentinel_for<It> Sen, | ||
| typename SuccessorFunction> | ||
| Graph(It, Sen, SuccessorFunction) | ||
| -> Graph<std::iter_value_t<It>, std::decay_t<SuccessorFunction>>; | ||
|
|
||
| } // namespace wasm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.