Commit Graph

18 Commits

Author SHA1 Message Date
Andrew Dirksen 21a8744e94 docs and tests 2018-11-22 13:13:34 -08:00
Andrew Dirksen 47273e15cf use saturating_mul() instead of checked_mul().unwrap_or() 2018-11-22 12:17:35 -08:00
Andrew Dirksen 7819950790 fix doctest 2018-11-21 18:24:01 -08:00
Andrew Dirksen fc677010d1 change pub(crate) to pub where possible 2018-11-21 18:04:04 -08:00
Andrew Dirksen b1d611d89f # Errors -> # Panics 2018-11-21 17:42:57 -08:00
Andrew Dirksen 7306f69271 get_relative_to_top -> nth_from_top 2018-11-21 17:25:26 -08:00
Andrew Dirksen 6f9b0a2b96 optimize push and pop for StackWithLimit 2018-11-19 19:44:13 -08:00
Andrew Dirksen 57c48ecada optimize drop_keep 2018-11-19 13:27:13 -08:00
Andrew Dirksen 76c104ddc0 revert unhelpful #[inline] 2018-11-19 10:15:37 -08:00
Andrew Dirksen 510735f63b remove println 2018-11-19 10:13:47 -08:00
Andrew Dirksen 34f2140cae use StackWithLimit in interpreter 2018-11-16 22:01:28 -08:00
Andrew Dirksen 94b10306b2 typesafe api with tests for StackWithLimit 2018-11-16 19:46:57 -08:00
Andrew Dirksen 47dd23f601 make StackWithLimit pre-allocate 2018-11-16 13:17:59 -08:00
Julius Rakow 20154c5e24 Add no_std support (#122)
* 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
2018-10-29 11:16:55 +01:00
Sergey Pepyakin f6657bace4
Flat Stack (#98)
* 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
2018-07-04 10:08:45 +03:00
Sergey Pepyakin c0ed715b37
Update testsuite (#39)
* ok_or_else in stack + top_mut.

* Model polymorphic stack explicitly

* Upgrade wasm testsuite.

* Update fixtures.

* Validate duplicate exports.

* Fix and clean spec runner.

* with_capcity for HashSet
2018-02-08 17:52:16 +03:00
Sergey Pepyakin c96735d6d6 Wasm function can only trap (#29)
* 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.
2018-02-01 14:59:21 +03:00
Sergey Pepyakin 49347a63ee Initial commit 2018-01-17 19:54:06 +03:00