32 Commits

Author SHA1 Message Date
Ivan Enderlin
0f1ddce3c9 feat(interface-types) Extract InterfaceType and RecordType into its own types module. 2020-04-09 10:48:50 +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
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
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
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
f342670532 feat(interface-types) Rename call to call-core, and remove call-export. 2020-03-09 14:33:17 +01:00
Ivan Enderlin
330dbac96b doc(interface-types) Fix a typo. 2020-02-26 15:34:04 +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
ea855d29bd doc(interface-types) Add intra links. 2020-02-21 12:23:58 +01:00
Ivan Enderlin
0767560b79 fix(interface-types) Remove #[allow(unused)]. 2020-02-20 15:16:35 +01:00
Ivan Enderlin
9b98a211cd feat(interface-types) Replace nom by wast for decoding WIT's text format. 2020-02-20 14:43:58 +01:00
Ivan Enderlin
b9ce5b7956 feat(interface-types) Start implementing the WAT decoder. 2020-02-19 16:12:06 +01:00
Ivan Enderlin
80f317a1eb feat(interface-types) Ensure ast::Type is always well-formed.
As @MarkMcCaskey noted, `Type` can be corrupted because `field_names`
and `field_types` must have the same length. This patch removes the
public visibility, and adds methods like `new`, `add_field`,
`field_names` and `field_types` to encapsulate `Type` internal data.
2020-02-13 11:24:29 +01:00
Ivan Enderlin
8ec4eb429e doc(interface-types) Improve documentation of the ast module. 2020-02-10 15:44:28 +01:00
Ivan Enderlin
57692f0458 doc(interface-types) Improve documentation of the ast module. 2020-02-10 15:41:41 +01:00
Ivan Enderlin
a8da95b339 doc(interface-types) Improve module descriptions. 2020-02-10 15:27:04 +01:00
Ivan Enderlin
f206ccd55f feat(interface-types) Introduce the wasm::structures::MemoryView trait. 2020-02-10 13:00:29 +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
23d5e7b7b3 feat(interface-types) Draft instruction interpreter. 2019-09-19 00:18:36 +02:00
Ivan Enderlin
68e699e495 feat(interface-types) Add new instructions. 2019-09-18 17:12:42 +02:00
Ivan Enderlin
0352e39741 feat(interface-types) Continue the WAT encoder. 2019-09-18 17:12:42 +02:00
Ivan Enderlin
a017b920c5 fix(interface-types) get-field #1 argument is of type InterfaceType. 2019-09-18 17:12:42 +02:00
Ivan Enderlin
086c3bdb4c feat(interface-types) Move TryFrom from the ast to the binary module. 2019-09-18 17:12:42 +02:00
Ivan Enderlin
b38418fcc3 fix(interface-types) Fix visibility of various symbols. 2019-09-18 17:12:42 +02:00
Ivan Enderlin
2f888757d4 feat(interface-types) Split into multiple files. 2019-09-18 17:12:42 +02:00