Commit Graph

210 Commits

Author SHA1 Message Date
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
Ivan Enderlin
8b9d33c14c
Merge pull request #2 from Hywan/test-ci
test(ci) Fix Rust installation
2020-05-15 10:35:37 +02:00
Ivan Enderlin
187ee09805 test(ci) Fix Rust installation. 2020-05-15 10:30:34 +02:00
Ivan Enderlin
8b49c8477b
Merge pull request #1 from Hywan/test-ci
test(ci) Set up Github Actions
2020-05-15 10:28:58 +02:00
Ivan Enderlin
44bc86e7f1 test(ci) Set up Github Actions. 2020-05-15 10:27:49 +02: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
7efd48dc44 doc(interface-types) Update the module documentation. 2020-04-09 12:16:57 +02:00
Ivan Enderlin
c79669c4d1 feat(interface-types) InterfaceValue::Record now takes a Vec1.
It matches the definition of `InterfaceType::Record`.
2020-04-09 12:10:48 +02:00
Ivan Enderlin
81bb278b4c feat(interface-types) Move the values and serde modules to the root of the crate. 2020-04-09 11:23:26 +02:00
Ivan Enderlin
de1d3c7766 feat(interface-types) Remove the re-export of InterfaceType in values. 2020-04-09 10:54:09 +02: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
bors[bot]
7f43c2ec49 Merge #1363
1363: fix(interface-types) Don't duplicate code in the binary encoder. r=MarkMcCaskey a=Hywan

Use the `ToBytes` implementation of `RecordType` to encode the inner
record type of a type, so that it avoids code duplication.

Co-authored-by: Ivan Enderlin <ivan@mnt.io>
2020-04-08 18:48:49 +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
5cb07c9d69 feat(interface-types) string.size pops the string.
Previously, `string.size` was just peeking the string.
2020-04-07 12:40:14 +02:00
Ivan Enderlin
2f17a52373 test(interface-types) Update the test_executable_instruction macro.
It provides a better failure message.
2020-04-07 12:34:30 +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
b80ddc2a9c doc(interface-types) Add record instructions. 2020-04-07 11:58:13 +02:00
Ivan Enderlin
d4b762e505 doc(interface-types) Update from_interface_values's doc.
Using `InterfaceValue::Record` explicitely doesn't change anything
since values are flatten, but it's better for a usual reading to avoid
confusion.
2020-04-06 08:13:10 +02:00
Ivan Enderlin
1f814a445a doc(interface-types) Rewrite record_lift_ documentation. 2020-04-06 08:09:10 +02:00
Ivan Enderlin
1db6712ae3 feat(interface-types) Use VecDeque to remove unsafe code. 2020-04-06 07:55:56 +02:00
Ivan Enderlin
2992a2d21f feat(interface-types) Avoid clones by using owned items in an iterator.
`into_iter` owned the item, so no need to clone when moving them in
the stack.
2020-04-06 07:54:51 +02:00
Ivan Enderlin
136518e77e doc(interface-types) Explain a part of an algorithm. 2020-04-04 08:10:38 +02:00
Ivan Enderlin
b9b5a32154 feat(interface-types) Simplify FlattenInterfaceValueIterator with last_mut. 2020-04-03 16:22:26 +02:00
Ivan Enderlin
d184ddbe37 feat(interface-types) Use Vec::last_mut to simplify code. 2020-04-03 16:20:22 +02:00
Ivan Enderlin
3426921a8b fix(interface-types) Also apply another lazy evaluation in the deserializer. 2020-04-03 16:19:07 +02:00
Ivan Enderlin
099bf70712 fix(interface-types) Use lazy evaluation in the deserializer. 2020-04-03 16:18:24 +02:00
Ivan Enderlin
b9f54fb5c4 doc(interface-types) Fix a typo. 2020-04-03 16:16:53 +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
643659801c doc(interface-types) Fix typos. 2020-04-03 14:46:59 +02:00
Ivan Enderlin
858233a66d chore(interface-types) Split the serde module…
… into `serde/ser.rs` and `serde/de.rs`. I like smaller files.
2020-04-02 16:46:23 +02:00
Ivan Enderlin
18414ea305 doc(interface-types) Improve serde module documentation. 2020-04-02 16:41:03 +02:00
Ivan Enderlin
88ad448486 feat(interface-types) Make unwraps safe by introducing more errors. 2020-04-02 16:38:40 +02:00
Ivan Enderlin
c8e0220d29 doc(interface-types) Update an example. 2020-04-02 16:29:52 +02:00
Ivan Enderlin
4690893ec1 feat(interface-types) Restrict supported type in the Deserializer.
`seq`, `map` and `tuple` for instance are not supported officially. It
was fun to play with it at the beginning, but it is time to remove it
to match the `Serializer` implementation.
2020-04-02 16:26:24 +02:00
Ivan Enderlin
41f5e5b2a0 doc(interface-types) Describe to_interface_value. 2020-04-02 15:59:07 +02:00
Ivan Enderlin
8a6b29257e feat(interface-types) Implement a serializer for WIT values. 2020-04-02 15:54:39 +02:00
Ivan Enderlin
93abfd3d55 feat(interface-types) Rename from_values to from_interface_values. 2020-04-02 13:56:20 +02:00
Ivan Enderlin
d8c4d8fa83 feat(interface-types) Make serde optional behind a feature flag. 2020-04-02 13:53:10 +02:00
Ivan Enderlin
dc87c44d52 fix(interface-types) Fix a git-merge issue. 2020-04-02 12:16:30 +02:00
Ivan Enderlin
cd90973e72 Merge branch 'master' into feat-interface-types-record-instructions 2020-04-02 12:10:01 +02:00
Ivan Enderlin
af465870db chore(interface-types) Improve code readabilit of the record.lift instruction. 2020-04-02 12:06:54 +02:00
Ivan Enderlin
260585726c feat(interface-types) Implement the record.lower instruction. 2020-04-02 12:06:27 +02:00
Ivan Enderlin
c7bb9904f7 feat(interface-types) Encodes/decodes the record.lower instruction. 2020-04-02 12:05:22 +02:00
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