Commit Graph

315 Commits

Author SHA1 Message Date
Ivan Enderlin
3aeff59b11 test(interface-types) Rename test cases. 2020-04-02 11:59:35 +02:00
Ivan Enderlin
a17eb6004a test(interface-types) Rename a test case. 2020-04-02 11:58:05 +02:00
Ivan Enderlin
3f48740c06 feat(interface-types) Implement From<&Vec<InterfaceValue>> for RecordType. 2020-04-02 11:55:54 +02:00
Ivan Enderlin
576bf74b28 feat(interface-types) Move serde::InterfaceTypeIterator into values::FlattenInterfaceValueIterator. 2020-04-02 11:55:20 +02:00
Ivan Enderlin
0d026171ef chore(interface-types) Improve code readibility of string instructions. 2020-04-02 11:51:34 +02:00
Ivan Enderlin
7a4a16319b test(interface-types) Deserialize WIT record to Rust struct. 2020-03-31 14:44:04 +02:00
Ivan Enderlin
2f0f4b1e84 feat(interface-types) Implement the record.lift instruction. 2020-03-31 12:34:32 +02:00
Ivan Enderlin
5249b243ee feat(interface-types) Encodes/decodes the record.lift instruction. 2020-03-31 08:17:52 +02:00
Ivan Enderlin
3a929ddf73 chore(interface-types) Reorganize the serde module. 2020-03-31 08:02:46 +02:00
Ivan Enderlin
c2933925ad feat(interface-types) Improve the Deserializer API. 2020-03-31 07:47:54 +02:00
Ivan Enderlin
e7ee54cb2e feat(interface-values) Improve the TypeMismatch error. 2020-03-31 07:47:15 +02:00
Ivan Enderlin
886204495d feat(interface-types) Implement Serde deserializing for WIT records to Rust values.
WIT values are native Rust values. But records are represented as a
vector of WIT values. In order to provide a super neat API to the
user, Serde is used to deserialize this vector of WIT values to a
large variety of Rust values.
2020-03-30 15:42:35 +02:00
Ivan Enderlin
7ad156bd6a feat(interface-types) Add the Record WIT value. 2020-03-30 08:32:31 +02:00
Ivan Enderlin
41f9c231c0 feat(interface-types) Introduce RecordType for InterfaceType and Type.
The `Type::Record` variant now is defined by `RecordType`. In
addition, `InterfaceType` has a new variant: `Record`, that is also
defined by `RecordType`. Encoders and decoders are updated to consider
`RecordType`, which removes code duplication and simplify code.
2020-03-26 13:35:24 +01:00
Ivan Enderlin
b528e965c5 chore(interface-types) Move the instruction.rs module in instructions/mod.rs. 2020-03-26 11:24:10 +01:00
Ivan Enderlin
bddb4e90ee test(interface-types) Test Type::Record. 2020-03-26 11:18:24 +01:00
Ivan Enderlin
c3c6fcbfdd feat(interface-types) Introduce the record type.
This patch updates the `Type` type to be an enum with 2 variants:
`Function` and `Record`, resp. to represent:

1. `(@interface type (func (param i32 i32) (result string)))`
2. `(@interface type (record string i32))`

This patch updates the binary encoder and decoder, along with the WAT
encoder and decoder.
2020-03-26 10:54:58 +01:00
Ivan Enderlin
8705de9cc0 feat(interface-types) Simplify code by implementing From<TryFromIntError>. 2020-03-26 10:49:49 +01:00
Ivan Enderlin
5275f3f306 feat(interface-types) Add the NegativeValue instruction error. 2020-03-26 08:31:06 +01:00
Ivan Enderlin
c35996c233 test(interface-types) Test negative pointer or length in string.lift_memory. 2020-03-26 08:30:32 +01:00
Ivan Enderlin
bf7f7cf927 fix(interface-types) Avoid integer overflows in string instructions. 2020-03-26 08:27:51 +01:00
Ivan Enderlin
2074ce8bce fix(interface-types) Instruction::CallCore.function_index is a u32. 2020-03-26 07:53:44 +01:00
Ivan Enderlin
b63ce1be6c fix(interface-types) Cast index to usize to compare index to length.
The index is bound to `u32::max_value()`. The invocation inputs'
length is bound to `usize::max_value()`, which can be
`u64::max_value`. Consequently, casting the invocation inputs' length
to `u32` can lead to an integer overflow. It is better to cast `index`
to `usize` when comparing with the invocation inputs' length.
2020-03-26 07:46:59 +01:00
Ivan Enderlin
63f824a240 doc(interface-types) Add strign.size in the list of supported instructions. 2020-03-24 15:35:01 +01:00
Ivan Enderlin
55a5b97443 feat(interface-types) Implement the string.size instruction. 2020-03-24 15:33:42 +01:00
Ivan Enderlin
50a6d9d92c feat(interface-types) Add the Stackable::peek1 method.
This method allows to peek the last item on the stack (if any) by
reference.
2020-03-24 15:32:54 +01:00
Ivan Enderlin
1475428a54 doc(interface-types) Add string.* instructions. 2020-03-24 13:29:38 +01:00
Ivan Enderlin
7a2db276f3 feat(interface-types) Implement the string.(lift|lower)_memory instructions.
The `string.lift_memory` instruction replaces `memory-to-string`, and
`string.lower_memory` replaces `string-to-memory`.
2020-03-24 13:25:06 +01:00
Ivan Enderlin
0506449aa4 feat(interface-types) Rename lowering_lifting module to numbers. 2020-03-24 13:10:21 +01:00
Ivan Enderlin
0b10f71517 doc(interface-types) Add links to WIT instructions. 2020-03-24 12:48:33 +01:00
Ivan Enderlin
700963474a doc(interface-types) Update supported instructions. 2020-03-24 12:47:39 +01:00
Ivan Enderlin
9af32b273c feat(interface-types) Implement [siu](NN|MM).from_* instructions.
Basically the `x-to-y` instructions have been renamed `y.from_x`. This
patch updates the instruction. The binary representation isn't
specified yet, so it's just arbitrary values.
2020-03-24 12:43:57 +01:00
Ivan Enderlin
6b5975ea47 fix(interface-types) Use same stack order than Wasm invocation rule. 2020-03-23 14:34:57 +01:00
Ivan Enderlin
c66bed67af fix(interface-types) Stack pops items in the same order than Wasm invocation rule. 2020-03-23 14:32:26 +01:00
Syrus Akbary
d12097bb88 Merge pull request #1298 from Hywan/doc-interface-types
doc(interface-types) Update the state of supported instructions
2020-03-12 09:00:53 -07:00
Ivan Enderlin
7afafe5909 Merge branch 'master' into feat-interface-types-better-error 2020-03-12 14:52:15 +01:00
Ivan Enderlin
24a2f41c9f chore(interface-types) Simplify code. 2020-03-12 14:51:18 +01:00
Ivan Enderlin
43fb922de8 feat(interface-types) Implement Error on errors. 2020-03-12 14:49:43 +01:00
Ivan Enderlin
c41979400e feat(interface-types) Use include ranges to read the memory. 2020-03-12 14:39:15 +01:00
Ivan Enderlin
c5db156b25 doc(interface-types) Update the state of supported instructions. 2020-03-12 13:57:57 +01:00
Mark McCaskey
5c70502e23 Prepare for 0.16.2 release 2020-03-11 19:15:31 -07:00
Mark McCaskey
80b59cb7e8 Prepare for 0.16.1 release 2020-03-11 16:00:21 -07:00
Mark McCaskey
157007415f Prepare for 0.16.0 release 2020-03-11 11:15:07 -07:00
Ivan Enderlin
7d473b7bdc feat(interface-types) Reformat the instructions. 2020-03-10 17:49:35 +01:00
Ivan Enderlin
864ac79123 feat(interface-types) Use better errors.
The new `errors` module contains structure to represent errors,
instead of using basic strings. The first usage is in the interpreter
itself.
2020-03-10 17:49:35 +01:00
Ivan Enderlin
8bd3345a79 feat(interface-types) Remove the 'input lifetime on Instruction. 2020-03-10 10:37:09 +01:00
Ivan Enderlin
47b63bc9c6 Merge branch 'master' into feat-interface-types-instructions-string-and-memory 2020-03-10 10:33:56 +01:00
Ivan Enderlin
a93421f6c2 feat(interface-types) Rename write-utf8 to string-to-memory. 2020-03-10 10:25:58 +01:00
bors[bot]
f89e2c1b89 Merge #1281
1281: feat(interface-types) Rename `call` to `call-core`, and remove `call-export` r=syrusakbary a=Hywan

The latest standard removes `call-export` and has a single `call-core` instruction.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
2020-03-09 18:03:28 +00:00
Ivan Enderlin
2d6b987791 feat(interface-types) read-utf8 is renamed memory-to-string. 2020-03-09 15:06:35 +01:00