Commit Graph

55 Commits

Author SHA1 Message Date
vms
37458bc559 commute arg name and type to one struct 2020-08-18 04:32:43 +03:00
vms
8a18ba607f Merge branch 'master' into record_refactoring 2020-08-18 01:24:02 +03:00
vms
d4bc6326b9 update 2020-08-14 19:26:20 +03:00
vms
eb11794240 refactor Record type 2020-08-13 21:02:23 +03:00
vms
5446f3e108 add support of structs 2020-07-25 11:02:03 +03:00
vms
b65b34b0f6 improve byte_array parsing 2020-07-17 10:55:35 +03:00
vms
bb9e4dbdfc add byte array handler 2020-07-09 03:06:50 +03:00
vms
52c28b80bc add dup and swap2 instructions 2020-06-01 14:06:00 +03:00
vms
c2f2a23c38 rename signature_type to function_type, fix cargo warnings 2020-05-28 16:05:58 +03:00
bors[bot]
c85541042b Merge #1370
1370: feat(interface-types) Crate reorganization r=Hywan a=Hywan

This PR re-organizes the crate:

* `interpreter/wasm/values.rs` moves to `values.rs`,
* `interpreter/wasm/serde/*` moves to `serde/*`,
* `types.rs` is new, and includes `InterfaceType` and `RecordType`,
* Update the documentation.

Bonus: `InterfaceValue::Record`  now takes a `Vec1` rather than a `Vec` to match `InterfaceType::Record`.

Co-authored-by: Ivan Enderlin <ivan@mnt.io>
2020-04-10 08:24:23 +00:00
Ivan Enderlin
0f1ddce3c9 feat(interface-types) Extract InterfaceType and RecordType into its own types module. 2020-04-09 10:48:50 +02:00
bors[bot]
e078099687 Merge #1362
1362: feat(interface-types) Remove allocator index from `string.lower_memory` r=Hywan a=Hywan

This PR updates `string.lower_memory` to remove the allocator index. Indeed, the string pointer is assumed to be present on the stack.
Also, this PR updates `string.size` to pop, and not to peek, the string to compute the length from.

That way, it matches the WIT proposal.

Co-authored-by: Ivan Enderlin <ivan@mnt.io>
2020-04-09 08:05:50 +00:00
Ivan Enderlin
cb3b8bb911 fix(interface-types) Don't duplicate code in the binary encoder.
Use the `ToBytes` implementation of `RecordType` to encode the inner
record type of a type, so that it avoids code duplication.
2020-04-07 14:29:57 +02:00
Ivan Enderlin
81d65ef41f fix(interface-types) Remove allocator index from string.lower_memory. 2020-04-07 12:34:07 +02:00
Ivan Enderlin
419dcc6415 feat(interface-types) Add the Vec1 type to represent a non-empty vector.
`Vec1` is used by `RecordType` to ensure that a record have at least 1
field. Then an `InterfaceValue::Record` is ensured to get at least one
value with the type-checking pass.
2020-04-03 16:13:44 +02:00
Ivan Enderlin
c7bb9904f7 feat(interface-types) Encodes/decodes the record.lower instruction. 2020-04-02 12:05:22 +02:00
Ivan Enderlin
5249b243ee feat(interface-types) Encodes/decodes the record.lift instruction. 2020-03-31 08:17:52 +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
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
55a5b97443 feat(interface-types) Implement the string.size instruction. 2020-03-24 15:33:42 +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
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
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
Ivan Enderlin
2d6b987791 feat(interface-types) read-utf8 is renamed memory-to-string. 2020-03-09 15:06:35 +01:00
Ivan Enderlin
f342670532 feat(interface-types) Rename call to call-core, and remove call-export. 2020-03-09 14:33:17 +01:00
Ivan Enderlin
78f2fb580c feat(interface-types) Fix clippy errors and warnings. 2020-02-26 17:02:52 +01:00
Ivan Enderlin
55029b7c36 feat(interface-types) Implement lifting and lowering instructions.
List from https://github.com/WebAssembly/interface-types/blob/master/proposals/interface-types/working-notes/instr.md.
2020-02-26 16:20:39 +01:00
Ivan Enderlin
8dacaab080 feat(interface-types) Remove abandonned instructions. 2020-02-26 15:48:00 +01:00
Ivan Enderlin
09498ee286 fix(interface-types) arg.get's index is of type u32. 2020-02-26 15:42:29 +01:00
Ivan Enderlin
d4c01e8ddc test(interface-types) Fix all tests based on previous commits. 2020-02-26 15:32:14 +01:00
Ivan Enderlin
f9ef4a650b feat(interface-types) Re-implement interface kinds.
Adopt a flat structure: Flat resolved imports, flat resolved exports,
flat resolved types etc.

Also, use the latest textual format for adapters & co.
2020-02-24 18:12:01 +01:00
Ivan Enderlin
410d8d4476 feat(interface-types) Re-implement Type.
The semantics of “types” have changed since the previous draft. Now, a
type is like a regular WebAssembly type but with Interface Types.
2020-02-24 16:23:31 +01:00
Ivan Enderlin
165a8ca585 feat(interface-types) Forwarded adapters have been removed. 2020-02-24 15:56:11 +01:00
Ivan Enderlin
1f2a5640a6 feat(interface-types) The “helper adapter” has been removed. 2020-02-24 15:49:03 +01:00
Ivan Enderlin
09e57b7156 feat(interface-types) Update interface types.
According to the last working notes, new interface types are s8, s16,
s32, s64, u8, u16, u32, u64, f32, f64, string, anyref, i32, and i64.

Their binary reprensentations are changing too, from 0x00 to 0x0d.
2020-02-24 15:37:03 +01:00
Ivan Enderlin
fdcc511dd8 test(interface-types) Fix one bug and write the test suite. 2020-02-17 13:55:59 +01:00
Ivan Enderlin
50cbe79151 feat(interface-types) Add the binary encoder. 2020-02-17 13:55:59 +01:00
Ivan Enderlin
8748597483 chore(encoders) Changing unimplemented!() to todo!(). 2020-02-13 14:24:07 +01:00
Ivan Enderlin
ed06fc0482 feat(encoders) Implement ToString instead of From<…> for String. 2020-02-13 14:19:31 +01:00
Ivan Enderlin
ddf6711045 doc(interface-types) Improve documentation of the instruction module.
Also, rename `RepeatWhile` to `RepeatUntil`.
2020-02-12 15:59:41 +01:00
Ivan Enderlin
3aaa6dafda doc(interface-types) Improve documentation of the wat module. 2020-02-10 17:12:32 +01:00
Ivan Enderlin
11729b1d4c feat(interface-types) Rename ImportedFunction to Import.
So that we are consistent with `Export`.
2020-02-10 15:41:10 +01:00
Ivan Enderlin
a8da95b339 doc(interface-types) Improve module descriptions. 2020-02-10 15:27:04 +01:00
Ivan Enderlin
15ac649f4d chore(interface-types) Format code. 2020-02-10 14:41:40 +01:00
Ivan Enderlin
c042050497 feat(interface-types) Split the interpreter into multiple modules/files. 2019-09-26 14:14:46 +02:00
Ivan Enderlin
07055522a1 feat(interface-types) Update Instruction. 2019-09-25 23:29:08 +02:00
Ivan Enderlin
f453af05c6 chore(interface-types) Fix clippy warnings. 2019-09-20 12:02:11 +02:00