Skip to content
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

Call main only once take 3 #3234

Closed
wants to merge 2 commits into from
Closed

Conversation

daxpedda
Copy link
Collaborator

@daxpedda daxpedda commented Jan 13, 2023

As discussed in #3092, this addresses the possible race condition if one doesn't use init when compiling the WASM module.

To make this possible I changed the way the start function was modified in various places.
Currently the start function was always taken from the module and then wrapped into a new function, constructing a pretty nested start function.

With this PR the start function is built on instead of wrapping it over and over again, this allows to use local variables, eg. I stored the current thread counter in a local variable that I can use later to determine if we are in the first thread or not.

Replaces #3062 and #3092.
Fixes #2295.

@daxpedda daxpedda mentioned this pull request Jan 13, 2023
@daxpedda daxpedda changed the title Call main only once take 2 Call main only once take 3 Jan 13, 2023
@daxpedda
Copy link
Collaborator Author

Clearly this experiment didn't work out, I believe some functions need to stay in the module to not be removed during processing. So the tactic of keeping it a FunctionBuilder outside the module didn't really work.

Replaced by #3236.

@daxpedda daxpedda closed this Jan 13, 2023
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.

How to avoid extra calls to main when creating web worker from binary?
1 participant