Commit Graph

5038 Commits

Author SHA1 Message Date
38830ed8e5 Fixed unused cd 2020-02-20 11:56:47 -08:00
02047875c6 Update changelog. 2020-02-21 03:47:26 +08:00
3fa62461e6 Specify excludes separately for linux/macos singlepass. 2020-02-21 03:47:17 +08:00
456d2dc2a8 Match against both target OS and family. 2020-02-21 03:47:01 +08:00
c8df4fb5da Removed empty lines 2020-02-20 11:25:46 -08:00
aa0f33203c Reuse doc file for capi docs 2020-02-20 11:24:54 -08:00
c1f1a82854 Check for unused excludes. 2020-02-21 03:23:44 +08:00
2ef13cdc81 fix(interface-types) Remove #[allow(unused)]. 2020-02-20 15:16:35 +01:00
5e00153d29 feat(interface-types) Decode instructions in WIT's text format. 2020-02-20 15:13:11 +01:00
cda53a57b5 feat(interface-types) Replace nom by wast for decoding WIT's text format. 2020-02-20 14:43:58 +01:00
1d9741b856 Fixed make capi script in windows 2020-02-19 23:14:10 -08:00
f0abcb0a7a Fixing C api creation only for Linux 2020-02-19 21:49:47 -08:00
b31d8d73d8 Fixed windows library 2020-02-19 21:39:47 -08:00
8933f3208e Merge branch 'master' into feature/release-capi 2020-02-19 19:03:57 -08:00
6d0efd274a Updated changelog 2020-02-19 19:03:22 -08:00
edeabd419b Add links for API Docs 2020-02-19 18:58:22 -08:00
0b5064694f Ignore the capi folder 2020-02-19 18:55:18 -08:00
40fb54c58f Improved Wasmer C API artifacts 2020-02-19 18:54:32 -08:00
d93d878aa4 Fixed runtime doc links 2020-02-19 18:53:10 -08:00
00e36508d6 feat(interface-types) Parse Adapter in the WAT decoders. 2020-02-19 17:41:06 +01:00
2e78cf1fc0 feat(interface-types) Parse Import in the WAT decoders. 2020-02-19 17:20:18 +01:00
c97122899d feat(interface-types) Start implementing the WAT decoder. 2020-02-19 16:12:06 +01:00
3d4d6eb366 Merge #1223
1223: feat(runtime-core) Implement `TryFrom<native_type>` for `Value` r=Hywan a=Hywan

Extracted from #1018.

This PR implements `TryFrom` for `Value`. It is required to support dynamically-typed values for polymorphic host functions.

This PR also refactors the code by using a macro (`value_conversions!`) to implement `From` and `TryFrom` in one shot.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
2020-02-18 09:14:40 +00:00
e9333c5790 Merge branch 'master' into feat-runtime-core-value-try-from 2020-02-18 10:01:03 +01:00
a16a220cc0 Merge #1216
1216: feat(interface-types) Add the binary encoder r=Hywan a=Hywan

This PR adds the `encoders::binary` module, which exposes the `ToBytes` trait. It is used to encode the AST into the WIT binary representation.

Check the tests to get examples, but quickly, the roundtrip works:

```rust
fn test_binary_encoding_decoding_roundtrip() {
    // Let `original_ast` be an AST representing a set of WIT interfaces
    let original_ast = Interfaces {
        exports: vec![Export {
            name: "ab",
            input_types: vec![InterfaceType::I32],
            output_types: vec![InterfaceType::I32],
        }],
        types: vec![Type::new(
            "ab",
            vec!["cd", "e"],
            vec![InterfaceType::I32, InterfaceType::I32],
        )],
        imports: vec![Import {
            namespace: "a",
            name: "b",
            input_types: vec![InterfaceType::I32],
            output_types: vec![InterfaceType::I64],
        }],
        adapters: vec![Adapter::Import {
            namespace: "a",
            name: "b",
            input_types: vec![InterfaceType::I32],
            output_types: vec![InterfaceType::I32],
            instructions: vec![Instruction::ArgumentGet { index: 1 }],
        }],
        forwards: vec![Forward { name: "a" }],
    };

    // Let's encode the AST into the WIT binary representation.
    let mut binary = vec![];

    original_ast
        .to_bytes(&mut binary)
        .expect("Failed to encode the AST.");

    // And let's go back to the AST land.
    let (remainder, ast) = parse::<()>(binary.as_slice()).expect("Failed to decode the AST.");

    assert!(remainder.is_empty());

    // They must equal.
    assert_eq!(original_ast, ast);
}
```

The implementation with the `ToBytes` trait and the `io::Write` trait is —I hope— Rust idiomatic. I reckon the code is easy to read and understand.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
2020-02-18 08:57:57 +00:00
cc93f3197b Merge branch 'master' into feat-interface-types-encoders-binary 2020-02-18 09:57:29 +01:00
8c17455456 Merge #1229
1229: Add clippy::missing_safety_doc lint to wasi, misc clean up r=MarkMcCaskey a=MarkMcCaskey

Part of #1219 

# Review

- [ ] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Mark McCaskey <mark@wasmer.io>
2020-02-18 00:32:44 +00:00
5bf6be445a Delete index.html 2020-02-17 16:09:37 -08:00
c005f94a55 Add clippy::missing_safety_doc lint to wasi, misc clean up 2020-02-17 15:15:04 -08:00
bcb1f0421c Merge #1226
1226: chore(runtime-core) Some code clean ups r=syrusakbary a=Hywan

Extracted from #1018. Opinionated patch.

Some code clean ups, mostly renaming `ExternalFunction` to `HostFunction`.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
2020-02-17 21:00:54 +00:00
abd44e9fba Merge branch 'master' into feat-runtime-core-cleanup-typed-func 2020-02-17 13:00:13 -08:00
7cf383032f Merge #1222
1222: feat(runtime-core) Simplify `WasmExternType` implementations with macros r=Hywan a=Hywan

Extracted from #1018.

This PR simplifies the code (understand, remove code duplication) of `WasmExternType` by using a macro.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
2020-02-17 19:57:47 +00:00
8d31f0b7e9 Merge branch 'master' into feat-runtime-core-wasm-extern-type-macros 2020-02-17 20:57:27 +01:00
adc651def6 Merge #1224
1224: fix(runtime-core) Remove warnings r=Hywan a=Hywan

Because we can use the `impl_traits!` macro with only one identifier,
a warning is emitted saying the parenthesis are useless for this
specific usecase. They are required for all the other usecases
though. We can safely ignore this warning.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
Co-authored-by: Ivan Enderlin <ivan.enderlin@wanadoo.fr>
2020-02-17 19:34:57 +00:00
7f0e220f70 Merge branch 'master' into fix-runtime-core-warnings 2020-02-17 20:34:05 +01:00
8d8a5f6d5a Merge branch 'master' into feat-runtime-core-cleanup-typed-func 2020-02-17 20:33:35 +01:00
1158951d5c Merge #1221
1221: doc(interface-types) Add a `README.md` file r=MarkMcCaskey a=Hywan

Just a small `README.md`, so that users aren't totally loss.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
2020-02-17 19:15:58 +00:00
5832b48159 Merge #1228
1228: Singlepass cleanup: Resolve several FIXMEs and remove protect_unix. r=losfair a=losfair



Co-authored-by: losfair <zhy20000919@hotmail.com>
2020-02-17 18:57:30 +00:00
b1e2a7fb4d Update changelog. 2020-02-18 02:38:33 +08:00
ed826cb389 Cleanup various FIXMEs and remove protect_unix. 2020-02-18 02:35:19 +08:00
9013d52ea4 doc(runtime-core) Hide some traits and structs in the documentation.
Those are not necessary for the user. It's only internal
implementation, that must be public because it ends up in public
types, but the compiler infers everything automatically.
2020-02-17 16:03:54 +01:00
ad77803243 fix(runtime-core) Rename ExternalFunction to HostFunction. 2020-02-17 16:02:23 +01:00
533609ff70 chore(runtime-core) Move one statement to be closer to the definition. 2020-02-17 16:01:01 +01:00
2ee1e80f3b feat(runtime-core) Allow dynamic signature for polymorphic host functions.
This patch adds a new field in `Func`: `signature`. It contains the
signature of the host function.

For non-polymorphic host functions, the signature is computed from the
`Args` and `Rets` implementation parameters at compile-time.

For polymorphic host functions though, to be fully dynamic, the
signature given to `new_polymorphic` is used in `Func` as the correct
signature.
2020-02-17 15:50:12 +01:00
ad20a008e0 fix(runtime-core) Use explicit dyn for trait objects. 2020-02-17 15:30:25 +01:00
ff154999f3 fix(runtime-core) Remove warnings.
Because we can use the `impl_traits!` macro with only one identifier,
a warning is emitted saying the parenthesis are useless for this
specific usecase. They are required for all the other usecases
though. We can safely ignore this warning.
2020-02-17 15:20:21 +01:00
1d1ffcc10a feat(runtime-core) Implement TryFrom<native_type> for Value. 2020-02-17 14:56:43 +01:00
9088f6b9e2 feat(runtime-core) Simplify WasmExternType implementations with macros. 2020-02-17 14:53:09 +01:00
d6cd1fa6c4 doc(interface-types) Add a README.md file. 2020-02-17 14:48:58 +01:00
ff2ff0691b doc(changelog) Add #1216. 2020-02-17 14:12:55 +01:00