Commit Graph

94 Commits

Author SHA1 Message Date
Sergey Pepyakin 6647bc4090 Use .last / .last_mut in stack 2018-06-29 14:20:55 +03:00
Sergey Pepyakin 26ff4c5982 Fix typo. 2018-06-29 14:20:55 +03:00
Sergey Pepyakin 76f6d0ec94 Remove println! 2018-06-29 14:20:55 +03:00
Sergey Pepyakin c384da2a06 Document stack layout 2018-06-29 14:20:55 +03:00
Sergey Pepyakin 6506705310 Rename/Split Validator into Reader 2018-06-29 14:20:55 +03:00
Sergey Pepyakin 29002153ec Introduce Keep and DropKeep structs in isa 2018-06-29 14:20:55 +03:00
Sergey Pepyakin 0f6da829de Validate the locals count in the begging 2018-06-29 14:20:55 +03:00
Sergey Pepyakin b2b9d62939 do refactoring 2018-06-29 14:20:55 +03:00
Sergey Pepyakin bcc426c6dc Estimate resulting size. 2018-06-29 14:20:55 +03:00
Sergey Pepyakin 3f10ba6666 Use vector to keep unresolved references. 2018-06-29 14:20:55 +03:00
Sergey Pepyakin 4e9f39444c Clean 2018-06-29 14:20:55 +03:00
Sergey Pepyakin b16feab204 Clean 2018-06-29 14:20:55 +03:00
Sergey Pepyakin d8814faad7 Comments. 2018-06-29 14:20:55 +03:00
Sergey Pepyakin a16e757288 Inline always instruction dispatch function. 2018-06-29 14:20:55 +03:00
Sergey Pepyakin bdbf10ba74 Cache memory index. 2018-06-29 14:20:55 +03:00
Sergey Pepyakin 583bb6321e Optimize a bit more. 2018-06-29 14:20:55 +03:00
Sergey Pepyakin c5b859149b Optimize value stack 2018-06-29 14:20:55 +03:00
Sergey Pepyakin 7f07c1cb4f Another round of cleaning. 2018-06-29 14:20:55 +03:00
Sergey Pepyakin 15ec33e0a6 Clean 2018-06-29 14:20:55 +03:00
Sergey Pepyakin 259c59ffa4 Clean 2018-06-29 14:20:55 +03:00
Sergey Pepyakin ae8c834fb1 Calibrate the limits. 2018-06-29 14:20:55 +03:00
Sergey Pepyakin 77a836ff11 Use Vec instead of VecDeque. 2018-06-29 14:20:55 +03:00
Sergey Pepyakin 029b05278b WIP 2018-06-29 14:20:55 +03:00
Sergey Pepyakin 0d59364e7e WIP 2018-06-29 14:20:55 +03:00
Sergey Pepyakin 875f73e747 Bunch of other tests. 2018-06-29 14:20:55 +03:00
Sergey Pepyakin 40d73f218c Working 2018-06-29 14:20:54 +03:00
Sergey Pepyakin 5dd56d6056 Tests 2018-06-29 14:20:32 +03:00
Sergey Pepyakin 81b832fe56 WIP 2 2018-06-29 14:19:56 +03:00
Sergey Pepyakin 48e4704b5f WIP 2018-06-29 14:19:56 +03:00
Sergey Pepyakin 4b7c3c0c94 Define Instruction Set. 2018-06-29 14:19:23 +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
Leonardo Yvens 9db7896e48 implement from and into RuntimeValue for i8, u8, i16 and u16 (#104)
This works under the assumption that these values
are represented as an `I32` in WASM, which seems
reasonable.
2018-06-25 16:59:30 +03:00
Leonardo Yvens 75406dd8ff Use transmute instead of casts In RuntimeValue conversion. (#102)
Casts have arithmetic semantics, and under some build configurations
Rust will panic when encountering an arithmetic overflow.
Use a transmute instead since it's what we mean.
The previous code worked, but still I added a test for good measure.
2018-06-21 15:47:49 +03:00
Sergey Pepyakin 724a32ad60
Provide direct access to the underlying buffer (#91)
This allows zero-copy access to the linear memory.
2018-05-31 16:01:15 +02: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 730c918a80
Don't expand locals. (#86) 2018-04-20 17:55:07 +03:00
Sergey Pepyakin 5cda9a05da Check the signature of host function. (#84) 2018-04-18 17:44:10 +03:00
Jef 22b260a3b9 Optionally deny floating point operations (#83)
* Optionally deny floating point operations

* Deny floating-point parameters and fix docs/indentation

* Test denial of floating-point parameters
2018-04-18 15:09:09 +03:00
Pierre Krieger 4c2995ca98 Fix the name of the 32bits feature (#82)
So that it matches the Cargo.toml
2018-04-04 18:14:43 +03:00
Sergey Pepyakin d12a04f8ff
Publish with externvals (#81)
* Publish with_externvals constructor.
* Add examples to Signature::new.
* Use Iterators for ExternVal imports
2018-03-29 18:43:44 +03:00
Sergey Pepyakin 86bbd96a33
Require func_type (not func) for func import. (#79) 2018-03-22 17:49:30 +03:00
Sergey Pepyakin 522fa20983
Fix br_if and then tee_local validation. (#76) 2018-03-20 13:09:51 +03: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 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
Sergey Pepyakin 0c277abacb
Implement Error for Trap (#73) 2018-03-12 12:37:12 +01:00
Sergey Pepyakin 7c88c6ad65
Fix br_table validation (#67)
Fixes #63

Fix is simple: all labels refered by the br_table instruction must have same value type (or NoResult in case if they don't have result). So we just take the default label and check other labels against it.
2018-02-23 18:00:16 +03:00
Nikolay Volf f1a3f06d5e
remove stray println (#66) 2018-02-21 23:00:31 +03:00
Sergey Pepyakin 9140e869e2 Update spec testsuite; Fix instantiation bug (#61)
The bug was about instantiating a module with elements segment being out-of-bounds, however, it was with zero length. E.g.:

```
(module
  (table 0 anyfunc)
  (elem (i32.const 1))
)
```

In our impl there was no out-of-bounds, because there was no attempt to set any table entry.

This change adds early check for specifically this case.
2018-02-19 18:59:18 +03:00
Sergey Pepyakin 6cf6a31970
Merge signature mismatch traps (#57) 2018-02-14 18:27:22 +03:00
Sergey Pepyakin 07fbe31ec2
Add `instantiate` bin (#53)
This change adds a handy utility to test whether the given module deserializes, validates and instantiates successfully.
2018-02-14 13:36:27 +03:00