Conversation
…ule can be shared by multiple threads
heifner
suggested changes
Jul 19, 2023
| auto icount = variable_size_instr(13, 14); | ||
| auto icount = variable_size_instr(24, 42); // emit_setup_backtrace can be 0 or 9, and emit_restore_backtrace 0 or 9, the total of the rest 24 | ||
| auto& gl = _mod.globals[globalidx]; | ||
| void *ptr = &gl.current.value; |
Contributor
There was a problem hiding this comment.
Is there a reason for using get_global_* and set_global_* instead of just _globals[globalidx].value ?
Contributor
Author
There was a problem hiding this comment.
Is there a reason for using
get_global_*andset_global_*instead of just_globals[globalidx].value?
At the time when emit_get_global and emit_set_global are called, execution_conetxt is not constructed yet; we don't have access to _globals. We also want to decouple the generated instructions from physical address of execution_context.
heifner
reviewed
Jul 19, 2023
heifner
approved these changes
Jul 21, 2023
spoonincode
approved these changes
Jul 26, 2023
2 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves #7.
A part of VaultaFoundation/product#149.
Currently globals are stored in a compiled module. This prevents the module from being shared by multiple execution threads, as multiple threads can modify the same global. To enable the same compiled module to be shared,
globals are moved out of module and into the execution context.
This opens possibilities for further parallelism and memory reduction for cached instantiated modules.
Change Description
API Changes
Documentation Additions