Refactor module instance code #3605
Open
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.
Description of Changes
The main thing this does is implement
WasmInstanceforV8Instance, so we can now change all thevm_call*: impl FnOnce()args onInstanceCommonto instead just take&mut impl WasmInstance. (Obviously our javascript instance is not a wasm instance, butwasmtime::module_host_actoris desperately in need of a rebrand in general, so I just leftWasmInstance's as is.)This vastly simplifies the callsites, and also allows @joshua-spacetime to call views from inside of
call_reducer_with_tx, which was the main motivating factor behind this.If the last commit is a bit much, I'm happy to split it off - I just don't get explicitly asked to refactor the rough edges of the codebase very often :3
Expected complexity level and risk
2 - it's a refactor, but overall pretty straightforward, and Rust lets you do fearless refactoring etc etc
Testing
n/a - internal code change