Commit Graph

17 Commits

Author SHA1 Message Date
Jef 899cc32e45 rustfmt (#151) 2018-12-11 12:54:06 +01:00
Ivan Enderlin da558c7ce7 doc(host) Fix the `Externals` example (#149)
* doc(host) Fix the `Externals` example

The example is missing two things:

  * `index` is computed but not used,
  * `check_signature` is never used.

This patch tries to fix that.

* doc(host) Fix `check_signature` example
2018-11-28 14:03:03 +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
Sergey Pepyakin 6253dd6fdf Args refactor (#71)
* 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.
2018-03-14 01:23:12 +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 cc24d8a77a Fix idents 2018-01-25 19:56:52 +03:00
Sergey Pepyakin 230abc6a91 Second iteration on documenation. 2018-01-24 18:58:22 +03:00
Nikolay Volf 429aaa2a4e
Merge pull request #11 from pepyakin/docs-1
First iteration on documentation.
2018-01-23 20:00:29 +03:00
Sergey Pepyakin 41983cff0a First iteration on documentation. 2018-01-23 19:38:49 +03:00
Sergey Pepyakin c274459bab Make Error: Sync + Send 2018-01-23 16:57:09 +03:00
NikVolf 2133f782a4 fix doc comment 2018-01-23 14:43:09 +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
NikVolf 559d529ece initial layout 2018-01-23 14:05:31 +03:00
Sergey Pepyakin 49347a63ee Initial commit 2018-01-17 19:54:06 +03:00