This also allows `Instruction` to be `Copy`, which massively speeds
up `<Instructions as Clone>::clone` since it can now just `memcpy`
the bytes using SIMD instead of having to switch on every single
element. I haven't looked at the disassembly of `InstructionIter::next`
yet, it could be that there are even more improvements yet to be gained
from either:
* Only doing work on `BrTable` (this might already be the case depending
on the whims of the optimiser)
* Using `unsafe` to make it a noop (we really don't want to do this,
obviously, since it means that `Instructions` has to be immovable)
* add default-enabled std feature
* use parity-wasm/std feature only if std is enabled
* drop dependency on std::io
* use hashmap_core instead of std::collections::HashMap
* disable std::error in no_std
* core and alloc all the things
* mention no_std in readme
* add no_std feature and use hashmap_core only on no_std
* rename the no_std feature to core
* drop dependency on byteorder/std
* simplify float impl macro
* remove some trailing whitespace
* use libm for float math in no_std
* add note about no_std panics of libm to readme
* Embed nan-preserving-float crate.
* Add no_std check to the Travis CI config
* add missing dev-dependency
* Hide Instructions implementation behind an iterator
* Hide instruction encoding behind isa::Instructions::push()
* Consistently use u32 for program counter storage
* Refer to instructions by position rather than index
* 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
* 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.
These limits seems to be picked arbitrary, and I just made it arbitrary larger.
We need to reconsider these limits, ideally providing to user a way to customize the limits.
FWIW, When the last time I've tried to run gcc's torture testsuite with wasmi it also bumped into this limit.
Fixes#41.
* Initial implementation
* Not use grow as it is makes debug builds very slow
* Use Pages::BYTE_SIZE for LINEAR_MEMORY_PAGE_SIZE
* Tidy docs.
* Use memory_units from git.
* Get rid of Stack error
* Add UnexpectedSignature error and remove Value err
* Publish FuncInstance::invoke
* Rename Trap to TrapKind
* Replace Trap with struct. Enum is now TrapKind
* Fixes
* Update value.rs
* Avoid reversing parameter types iter.
* Add impl From<TrapKind> for Trap
* Remove redundant clone in prepare_function_args.
* Use .into() to convert TrapKind into Trap
* Introduce Trap struct.
* get_local can't fail.
* Add MemoryOutOfBounds trap.
* from_little_endian use slice instead of vec.
* MemoryAccessOutOfBounds for mem get and set.
* from_little_endian conversion can't fail.
* call_indirect traps.
* DivisionByZero and InvalidConversionToInt
* Use traps in value to convey an error
* select: int condition on stack top
* if: int condition on stack top
* Assert pops.
* Another protions of assert pops
* Introduce ValueStack
Also, hide FunctionContext and remove some stale code
* Traps in execution
* Make it compile.
* Check args before invoke.
* Document RuntimeArgs.
* Update host.rs
* Add rustdoc for Trap.