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

Make wasm execution explicit and move CPU rate limit and periodic yield to the JS #505

Merged
merged 5 commits into from
May 3, 2023

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented May 3, 2023

This PR backports one of the changes of #494

Instead of having advance_execution be called in all the callbacks called by the JS, we now have a separate JS task that is responsible only for executions. This JS task might get waken up by one of the callbacks.

Just like in #494, this allows moving the CPU rate limiting and periodic yield system to the JS code.

Contrary to #494, notifying that the execution is ready is done with a callback, and not by notifying a memory location. Callbacks are completely fine when things are single threaded, they just are inappropriate in case of multiple threads. I would still prefer using waitAsync if possible, but since Firefox doesn't support it we can't.

This PR de-spaghetifies the internals of smoldot. Everything is now in my opinion much more clear.

@tomaka
Copy link
Contributor Author

tomaka commented May 3, 2023

I've just realized a caveat: we no longer yield between two consecutive tasks executions.

@tomaka tomaka enabled auto-merge May 3, 2023 13:17
@tomaka tomaka added this pull request to the merge queue May 3, 2023
Merged via the queue into smol-dot:main with commit 900bc63 May 3, 2023
@tomaka tomaka deleted the explicit-execution branch May 3, 2023 13:39
@tomaka tomaka mentioned this pull request May 3, 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.

1 participant