Commit Graph

167 Commits

Author SHA1 Message Date
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 84331a9325 don't make the user reset Interpreter between invocations 2018-11-21 17:12:47 -08:00
Andrew Dirksen f981e525c8 spelling 2018-11-21 17:05:02 -08:00
Andrew Dirksen 07267813db move invoke into Interpreter 2018-11-21 16:58:33 -08:00
Andrew Dirksen 0498125070 add doctest for with_stacks 2018-11-21 09:44:35 -08:00
Andrew Dirksen 94a62c2c20 interpreter constructor with default values 2018-11-21 09:03:24 -08:00
Andrew Dirksen 4b5c2d4a47 revert change to benches/.gitignore 2018-11-21 08:31:16 -08:00
Andrew Dirksen 844fd0c5c9 remove unnessesary argument from start_execution 2018-11-20 10:30:56 -08:00
Andrew Dirksen 6f9b0a2b96 optimize push and pop for StackWithLimit 2018-11-19 19:44:13 -08:00
Andrew Dirksen 1913702a03 benchmark interpreter reuse
name               without-reuse.trace ns/iter  with-reuse.trace ns/iter  diff ns/iter   diff %  speedup
 bench_regex_redux  3,214,008                    3,162,089                      -51,919   -1.62%   x 1.02
 bench_rev_comp     7,356,860                    7,168,441                     -188,419   -2.56%   x 1.03
 bench_tiny_keccak  3,943,358                    3,910,487                      -32,871   -0.83%   x 1.01
 fac_opt            10,959                       2,096                           -8,863  -80.87%   x 5.23
 fac_recursive      13,345                       4,277                           -9,068  -67.95%   x 3.12
 recursive_ok       1,190,562                    1,141,940                      -48,622   -4.08%   x 1.04
 recursive_trap     125,047                      111,962                        -13,085  -10.46%   x 1.12
2018-11-19 16:00:21 -08:00
Andrew Dirksen 2f7f809fd6 make interpreter reusable 2018-11-19 15:59:23 -08:00
Andrew Dirksen 9dd258c2bb invoke_resumable does not need to take &args anymore 2018-11-19 14:02:08 -08:00
Andrew Dirksen df3bce60d3 repair invalid test 2018-11-19 13:39:08 -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 74b32aaebd Merge branch 'master' of github.com:paritytech/wasmi into common-bounded-stack 2018-11-16 20:24:58 -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
Sergey Pepyakin 7191998216
Bump version to 0.4.2 (#144) 2018-11-15 13:19:53 +01:00
Sergey Pepyakin 15e9461bae
Allow failures on nightly (#143) 2018-11-15 13:11:10 +01:00
Jef e11ba15373 Remove `Box<[Target]>` from `Instruction` (#141)
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)
2018-11-15 12:18:47 +01:00
Eric Findlay 7b4c648acb Minor edits to documentation. (#140) 2018-11-09 15:39:40 +01:00
Jef c877d64508 Remove tag from RuntimeValue (#133)
* Remove tag from runtime value

* Add explanation of `RuntimeValueInternal`, move it so I don't need to do `pub(crate)`
2018-10-31 16:01:20 +01:00
Wei Tang 1c04be64f8 Remove redundent check_function_args (#135)
* Remove redundent check_function_args

* Remove unused format convertion in check_function_args

* Remove unnecessary alloc
2018-10-29 18:29:46 +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 2f7505d120
Travis maintenance (#132)
*  Use gcc-8 for builds

* Don't run cargo-deadlinks

* Update wabt to 0.6.
2018-10-26 15:03:01 +02:00
Jef 3854ecdad6 Remove some unsafety (#131)
* Remove unsafety

* Remove transmutes and pointer casts
2018-10-25 14:17:25 +02:00
Sergey Pepyakin ad4236263a
Don't update PC on every instruction (#130) 2018-10-19 16:55:07 +02:00
Will Glynn 7509477a61 Hide instruction storage details (#129)
* 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
2018-10-10 19:02:27 +02:00
Sergey Pepyakin 9170303aad Bump wasmi to 0.4.1 2018-10-02 11:36:23 +01:00
Sergey Pepyakin 36582c32b6
Transfer function (#128) 2018-10-02 11:01:18 +01:00
Sergey Pepyakin 438eab9ada
Don't run cargo deadlinks for nightly (#121) 2018-08-27 11:11:21 +03:00
Tobias Bucher 167e4845ef Proofread the library-level docs (#123)
* Proofread the library-level docs

* Fix extra word, remove mention of linear memory "space"
2018-08-27 11:10:45 +03:00
Guanqun Lu 0409913a26 Typo fixes (#119)
* typo fixes

* more typo fixes
2018-08-03 16:05:10 +03:00
Guanqun Lu 929ac564a5 we don't need this TODO anymore (#120) 2018-08-03 16:04:33 +03:00
Guanqun Lu 8ca6b4b860 Add a section in README to show how to build and test (#117) 2018-08-01 12:21:50 +03:00
Sergey Pepyakin 0a34f1d0f6
Bump version to 0.4.0 (#116) 2018-07-31 17:05:21 +03:00
Arkadiy Paronyan 118396851a Allocate memory on demand (#115)
* Allocate mem on demand

* More control in with_direct_access_mut
2018-07-31 16:25:46 +03:00
Guanqun Lu 5c86c1c753 Bump wabt's version to 0.4 and add two more test cases (#114)
* bump wabt version to 0.4

It has some interface changes.

* bump up testsuite and add two more test cases

* use the same expect string
2018-07-30 19:43:18 +03:00
Guanqun Lu 43b8d52bca typo fixes in lib.rs (#113) 2018-07-30 15:16:17 +03:00
Arkadiy Paronyan 9ed95e49c1 Avoid allocations on memory operations (#112) 2018-07-26 14:50:05 +03: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 df0e3ddd46
Bump version to 0.3.0 (#107) 2018-07-04 12:22:08 +03:00
Sergey Pepyakin dc5052aadb
Export nan_preserving_float (#109) 2018-07-04 12:13:57 +03:00
Sergey Pepyakin 5d99077e17
Bump limits arbitrary (#108) 2018-07-04 11:18:54 +03: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