* Move call_stack to Interpreter struct
* Accept func and args when creating the Interpreter
* Create a RunState to indicate whether the current interpreter is recoverable
* Add functionality to resume execution in Interpreter level
* Implement resumable execution in func
* Expose FuncInvocation and ResumableError
* Fix missing docs for FuncInvocation
* Add test for resumable invoke and move external parameter passing to start/resume_invocation
* Add comments why assert is always true
* Add note why value stack is always empty after execution
* Use as_func
* Document `resume_execution` on conditions for `is_resumable` and `resumable_value_type`
* Document conditions where NotResumable and AlreadyStarted error is returned
* Warn user that invoke_resumable is experimental
* Define Instruction Set.
* WIP
* WIP 2
* Tests
* Working
* Bunch of other tests.
* WIP
* WIP
* Use Vec instead of VecDeque.
* Calibrate the limits.
* Clean
* Clean
* Another round of cleaning.
* Ignore traces.
* Optimize value stack
* Optimize a bit more.
* Cache memory index.
* Inline always instruction dispatch function.
* Comments.
* Clean
* Clean
* Use vector to keep unresolved references.
* Estimate resulting size.
* do refactoring
* Validate the locals count in the begging
* Introduce Keep and DropKeep structs in isa
* Rename/Split Validator into Reader
* Document stack layout
* Remove println!
* Fix typo.
* Use .last / .last_mut in stack
* Update docs for BrTable.
* Review fixes.
* Merge.
* Add an assert that stack is empty after the exec
Casts have arithmetic semantics, and under some build configurations
Rust will panic when encountering an arithmetic overflow.
Use a transmute instead since it's what we mean.
The previous code worked, but still I added a test for good measure.
* Refactor TryInto → FromRuntimeValue.
Replace `TryInto<T, E>` with `FromRuntimeValue`.
The main difference is that `FromRuntimeValue` is implemented for the concrete type of the value we create, rather than on `RuntimeValue`. This makes more sense to me and seems more clear.
The `try_into` method is now implemented on `RuntimeValue` itself.
And finally, `FromRuntimeValue` has been made public.
* Impl AsRef<[RuntimeValue]> for RuntimeArgs
This impl can be used as an escape hatch if the user wants to use the inner slice.
* Little doc fixes for RuntimeArgs.
Fixes#63
Fix is simple: all labels refered by the br_table instruction must have same value type (or NoResult in case if they don't have result). So we just take the default label and check other labels against it.
The bug was about instantiating a module with elements segment being out-of-bounds, however, it was with zero length. E.g.:
```
(module
(table 0 anyfunc)
(elem (i32.const 1))
)
```
In our impl there was no out-of-bounds, because there was no attempt to set any table entry.
This change adds early check for specifically this case.
Move all spec testsuite into `/tests` directory.
So it means that several changes will happen:
- Compilation will share common dependencies in target directory. This should make CI builds faster. This also should reduce space requirements.
- Common Cargo.lock file
- `cargo test` will include spec tests.
- `cargo check --tests` will also include spec tests.
Remove all old test fixtures that migrated in this repo from the parity-wasm.
Also, use .wast files instead of compiled .wasm. I believe this is more convenient than testing a .wasm file and having a corresponding .wast file, which might go out of sync.