Skip to content

Conversation

@curiousdannii
Copy link
Contributor

@curiousdannii curiousdannii commented Apr 1, 2024

Partially solves emscripten-core/emscripten#17380
This doesn't actually make a tree, but it will at least show when a function calls more than one Asyncified function.

@curiousdannii curiousdannii changed the title Asyncify: show multiple reasons why a function is processed Asyncify-verbose: show multiple reasons why a function is processed Apr 1, 2024
logVisit(map[caller], func);
// If we don't already have the property, and we are not forbidden
// from getting it, then it propagates back to us now.
if (!hasProperty(map[caller]) && canHaveProperty(map[caller])) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of this code makes a lot of map lookups (map[caller]). Worth caching?

Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

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

Good finds!

This looks like the right approach to me, good ideas.

For testing, I opened #6467 now to fix the existing test. Once that lands we can merge it in here and verify it still passes + update as necessary.

@kripken
Copy link
Member

kripken commented Apr 3, 2024

#6467 landed so merging in main here will add it.

@curiousdannii
Copy link
Contributor Author

Great! I edited the test to test a function that calls two asyncified functions, so both callees should now be logged.

Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

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

lgtm with those minor text changes.

@kripken kripken enabled auto-merge (squash) April 5, 2024 22:44
@kripken
Copy link
Member

kripken commented Apr 5, 2024

It looks like a clang formatting error showed up on CI here.

auto-merge was automatically disabled April 6, 2024 01:25

Head branch was pushed to by a user without write access

@kripken kripken merged commit f0dd994 into WebAssembly:main Apr 8, 2024
@tlively
Copy link
Member

tlively commented Apr 9, 2024

The asyncify_verbose.wast test is failing on the Windows builder on the main branch. Did this this commit perhaps introduce some non-determinism in the output?

@curiousdannii
Copy link
Contributor Author

curiousdannii commented Apr 9, 2024

More likely that it exposed some non-determinism that already existed? I don't know how propagateBack determines the order it walks the tree.

I'm pretty sure that this PR doesn't change how the tree is walked, only how it logs as it goes.

But if it was being walked differently on different platforms, I'm a little surprised the non-determinism didn't present earlier, as that should've resulted in a different function being logged when only one function was logged... maybe before now there were no tests that had a diamond call tree? I did add that in this PR.

@kripken
Copy link
Member

kripken commented Apr 9, 2024

@curiousdannii I think that's the explanation, yeah - the new test exposed existing nondeterminism. I opened #6479

kripken added a commit that referenced this pull request Apr 9, 2024
#6457 added a test that exposed existing nondeterminism.
@gkdn gkdn mentioned this pull request Aug 31, 2024
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.

3 participants