Commit Graph

24 Commits

Author SHA1 Message Date
NikVolf 6e9d2eb8d2 edition to 2018 2019-04-09 19:10:00 +03:00
Jef 617be0198d Check type when resuming function (#152)
* Check type when resuming function

* Remove pub(crate)

* Update lib.rs
2019-01-02 12:18:24 +01:00
Jef 899cc32e45 rustfmt (#151) 2018-12-11 12:54:06 +01: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
Wei Tang a605175abe Resumable function invocation (#110)
* 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
2018-07-09 19:06:44 +03:00
Sergey Pepyakin 483736b1bd
Memory units (#42)
* 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.
2018-02-09 16:45:21 +03:00
Sergey Pepyakin 367f17989b Refine errors (#36)
* 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
2018-02-06 14:14:57 +03:00
Sergey Pepyakin fa82dee676 Add docs (#32) 2018-02-01 19:46:33 +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 551c992730
4th iteration on documentation (#22)
* Rename LoadedModule to Module

* Hide TryInto

* Fix rustdoc tests.

* Rename from_parity_wasm_module and doc it.

* Document `Module::from_buffer`

* Tidy Module docs

* Some rustdoc headers.

* Document FuncInstance::{alloc_host, signature}

* Document descriptors.

* Doc NotStartedModuleRef

* Fix cargo-deadlinks
2018-01-26 19:24:40 +03:00
Sergey Pepyakin bc89a20b96 Third iteration on documenation. 2018-01-25 18:17:25 +03:00
NikVolf 65f08eb44c allow static signatures 2018-01-24 14:14:24 +03:00
NikVolf 6b7144133f fix examples/tests with proper addressing 2018-01-23 16:40:34 +03:00
NikVolf d340b99016 fix build and address comments 2018-01-23 14:42:20 +03:00
NikVolf 4eb8608c1e rewire everything 2018-01-23 14:26:45 +03:00
Sergey Pepyakin bf2b2acbc5 Reintroduce FuncInstance; Hide internals 2018-01-22 20:07:30 +03:00
Sergey Pepyakin 44f61251c1 Hide FuncInstance 2018-01-22 19:38:57 +03:00
Sergey Pepyakin e26ddb6d12 Hide MemoryType. 2018-01-22 16:34:32 +03:00
Sergey Pepyakin 973d58a643 Hide TableType. 2018-01-22 16:30:13 +03:00
Sergey Pepyakin b323d004fe Hide GlobalType 2018-01-22 16:23:07 +03:00
Sergey Pepyakin aae9a3c129 Hide validation stuff. 2018-01-22 16:11:20 +03:00
Sergey Pepyakin ca6299ba53 Hide ValueType. 2018-01-18 17:13:56 +03:00
Sergey Pepyakin e9470373f7 Migrate on Signature type. 2018-01-18 15:48:43 +03:00
Sergey Pepyakin 49347a63ee Initial commit 2018-01-17 19:54:06 +03:00