Make wasm execution explicit and move CPU rate limit and periodic yield to the JS #505
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.
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.