Commit Graph

42 Commits

Author SHA1 Message Date
adam-rhebo 7fe6ef4e35 Add ARMv7 as CI test target (#186)
* Add ARMv7 as CI test target

* Avoid UB in conversions from floating point

When truncating floating point values to integer values, we need to
avoid undefined behavior if the argument does not fit into the target
type which is currently impossible using casts of primitive types.

Hence, this reimplements those conversions using arbitrary precision
integers and rationals from the num crate.
2019-06-18 15:06:16 +02:00
adam-rhebo 8dac328ea7 Remove hashbrown and use BTree{Map,Set} from the alloc crate (#187)
* Remove hashbrown and use BTree{Map,Set} from the alloc crate

wasmi-validation must handle untrusted input and hence we switch from
Hash{Set,Map} (whether std's or hashbrown's) to BTree{Set,Map} to avoid
algorithmic complexity attacks while retaining no_std support.

Closes #183

* Improve memory locality of checking for duplicate exports

Using a sorted slice gives us the same O(N log N) worst case execution
time as using a BTreeMap, but using a single allocation as with HashMap,
so that we should see better memory locality and hence better constant
factors when checking for duplicate exports.
2019-06-12 11:30:10 +02:00
Sergei Pepyakin 2960f1b4ec
Exclude benches from workspaces (#180) 2019-05-06 16:24:07 +02:00
Sergey Pepyakin b73996a794 wasmi-validation version 0.1 2019-05-06 14:47:51 +02:00
Sergei Pepyakin a3aad8a549
Extract validation into a separate crate (#176)
* Add some docs.

* return_type isn't failable

* Add comment about safety of top_label

* Attempt number 10

* Rework.

Now we will a compiler which wraps and uses info from a evaluation simulator.

* Get rid of outcome

* Introduce StartedWith

* Actually use started_with.

* Mirror label_stack.

* Avoid using frame_type.

* Finally get rid from frame_type.

* Extract compilation

* Refactoring cleaning

* Validation separated from compilation.

* Move sink to FunctionReader

* Rename to compiler.

* fmt

* Move push_label under validation context.

* Add Validation traits

* Express the compiler using validation trait

* Move code under prepare

* Comments.

* WIP

* The great move of validation

* Make validation compile

* Make it compile.

* Format it.

* Fix warnings.

* Clean.

* Make it work under no_std

* Move deny_floating_point to wasmi

* Rename validate_module2 → validate_module

* Make validation tests work

* Make wasmi compilation tests work

* Renamings.

* Get rid of memory_units dependency in validation

* Rename.

* Clean.

* Estimate capacity.

* fmt.

* Clean and detail End opcode.

* Add comment about top_label safety

* Remove another TODO

* Comment access to require_target

* Remove redundant PartialEq

* Print value that can't be coerced to u32

* s/with_instruction_capacity/with_capacity

* fmt.

* fmt

* Proofs

* Add better proof

* Get rid of unreachable in StackValueType

* Propagate error if frame stack overflown on create

* use checked sub instead of -

* Keep::count
2019-04-19 16:05:09 +02:00
Sergey Pepyakin 0267b20e6e Bump version to 0.4.4 2019-03-15 12:13:10 +01:00
Elichai Turkel b90fcaf2dd Added the nightly feature to hashbrown (#174) 2019-03-15 12:08:25 +01:00
Elichai Turkel e88d5d32e5 Removed Byteorder now that rust supports it natively (#171)
* Removed byteorder now that from_le_bytes is stabilized

* Rust fmt
2019-02-26 11:37:14 +01:00
Elichai Turkel 23b054c0e5 Replaced hashmap_core with hashbrown (#161) 2019-01-20 17:59:26 +01:00
Sergey Pepyakin 7740f6b690 Bump wasmi to 0.4.3 2019-01-03 12:40:20 +01:00
Sergey Pepyakin 7191998216
Bump version to 0.4.2 (#144) 2018-11-15 13:19:53 +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
Sergey Pepyakin 9170303aad Bump wasmi to 0.4.1 2018-10-02 11:36:23 +01:00
Sergey Pepyakin 0a34f1d0f6
Bump version to 0.4.0 (#116) 2018-07-31 17:05:21 +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
Sergey Pepyakin df0e3ddd46
Bump version to 0.3.0 (#107) 2018-07-04 12:22:08 +03:00
Sergey Pepyakin 3a96a8399f
Bump version to 0.2.1 (#106) 2018-07-02 13:17:36 +03:00
Wei Tang f91dc92119 Update parity-wasm dependency to 0.31 (#105)
* Update parity-wasm dependency to 0.31
* Fix tests
2018-06-29 14:10:04 +03:00
Sergey Pepyakin 6cf0ebc79e
Add a simple bench (#90)
* Add first bench

* Refactor travis.yml

* Use assert_matches!

* sha3_256 → keccak256
2018-05-24 16:31:15 +03:00
Sergey Pepyakin d926993c6c Bump wabt version to 0.3 2018-04-25 18:00:11 +03:00
Sergey Pepyakin 89c3a9286f Bump version 0.2.0 2018-04-25 10:25:33 +03:00
Jef 3890dd379f Preserve signalling bit in NaNs (#87)
* Preserve signalling bit in NaNs

* Fix warnings
2018-04-25 10:18:14 +03:00
Sergey Pepyakin b95e11c414 Bump version to 0.1.3. 2018-04-20 17:59:16 +03:00
Sergey Pepyakin 730c918a80
Don't expand locals. (#86) 2018-04-20 17:55:07 +03:00
Sergey Pepyakin 7aecc55173 Bump version to 0.1.2 2018-04-05 13:12:39 +03:00
NikVolf a6b5574704 bump version 2018-03-24 17:57:28 +03:00
Sergey Pepyakin 654426b147 Rename feature opt-in-32bit 2018-03-21 11:01:13 +03:00
Sergey Pepyakin 527b9e0cbc Prepare for 0.1.0 (#77) 2018-03-21 10:51:51 +03:00
Sergey Pepyakin 9fa933ccd6
Use f32/f64::from_bits. (#72)
And also enable:

- "conversions",
- "float_exprs",
- "float_literals",
- "float_memory",

tests.
2018-03-12 12:37:43 +01:00
Nikolay Volf 5bb5b6809c Exclude test directory for package (#65)
* Exclude test directory for package

* Update Cargo.toml

* Also exclude fuzz and deexclude non-existant spec
2018-02-23 00:45:27 +03:00
Nikolay Volf 6b6961bcb6
Bump parity-wasm version (#64) 2018-02-21 18:00:32 +03:00
Sergey Pepyakin 73c1451a84 Bump parity-wasm version to 0.25 (#62) 2018-02-19 19:32:38 +03:00
Sergey Pepyakin d11dffcf51 Use memory_units from crates.io. 2018-02-14 18:44:11 +03:00
Sergey Pepyakin 863f2247a3
Move spec testsuite into tests. (#56)
Move all spec testsuite into `/tests` directory.

So it means that several changes will happen:

- Compilation will share common dependencies in target directory. This should make CI builds faster. This also should reduce space requirements.
- Common Cargo.lock file
- `cargo test` will include spec tests.
- `cargo check --tests` will also include spec tests.
2018-02-14 18:03:39 +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 6e4bbb7490 Opt in for 32bit platforms (#44) 2018-02-09 11:20:21 +03:00
Nikolay Volf aa4c8fe3bb Update to most recent parity-wasm (#21)
* Update to most recent parity-wasm

* fix validation
2018-01-26 18:35:12 +03:00
Sergey Pepyakin 500538099d Change version to 0.0.0 2018-01-26 11:57:32 +03:00
Sergey Pepyakin af92d8ced8 Rename parity-wasm-interp to wasmi. 2018-01-22 17:58:14 +03:00
Sergey Pepyakin fa1cba92c9 Update Cargo.toml 2018-01-18 15:22:46 +03:00
Sergey Pepyakin 49347a63ee Initial commit 2018-01-17 19:54:06 +03:00