Commit Graph

324 Commits

Author SHA1 Message Date
vms
6d42a84ba4 use into_vc instead of public member 2020-07-25 11:07:20 +03:00
vms
5cf972b348 Merge branch 'byte_array' of github.com:fluencelabs/interface-types into struct_support 2020-07-25 11:03:21 +03:00
vms
5446f3e108 add support of structs 2020-07-25 11:02:03 +03:00
folex
4521e79a50 Merge branch 'master' into byte_array 2020-07-20 15:45:06 +03:00
vms
b65b34b0f6 improve byte_array parsing 2020-07-17 10:55:35 +03:00
folex
5517af8b97 Remove Default from Vec1, add into_vec 2020-07-13 16:14:01 +03:00
vms
bb9e4dbdfc add byte array handler 2020-07-09 03:06:50 +03:00
folex
689c6757fb
Merge pull request #1 from fluencelabs/serde 2020-06-25 10:33:29 +03:00
folex
899567042f Add support for map and seq 2020-06-24 18:07:34 +03:00
vms
3f0da9f9bc remove redundant println 2020-06-24 15:06:42 +03:00
folex
a87cf1f528 derive Default for Vec1 2020-06-23 10:42:39 +03:00
folex
add53640f1 Add Serialize/Deserialize for InterfaceType, RecordType and Vec1 2020-06-22 16:46:11 +03:00
vms
567bec274b bound ExecutableInstruction with Send 2020-06-22 16:10:20 +03:00
vms
82986d1035 export wast::error from decoders/wat.rs 2020-06-11 14:06:43 +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
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