refactor: introduce Interpreter trait and merge RuntimeState/GasometerState #250
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.
In Rust, the current best method of doing interpretation is not available -- to implement things like direct threading (to avoid extra jumps), we'll need either goto, or guaranteed tail optimization. It's therefore best if we make the actual execution code generic so that people can use what's best on their targets (for example, tail optimization works on x86 but not really on wasm). Eventually, we'd also want to have at least two different modes -- a baseline, and an analyzed, where the former try to use as little memory as possible, and the latter are allowed to use more, optimizing for speed.
When handling substate merging, we currently differentiate runtime vs. gasometer, which is unnecessary. So we merge them together -- gasometer is just a state in the machine's runtime.