Commit Graph

499 Commits

Author SHA1 Message Date
Mark McCaskey
6d01b7f891 Prepare for 0.17.0 release 2020-05-11 13:48:41 -07:00
Syrus Akbary
a4ab71ed0b
Merge pull request #1407 from wasmerio/dependabot/cargo/time-0.1.43
chore(deps): bump time from 0.1.42 to 0.1.43
2020-04-27 12:19:33 -07:00
Syrus Akbary
94ccbd1ad0
Merge pull request #1406 from wasmerio/dependabot/cargo/smallvec-1.4.0
chore(deps): bump smallvec from 1.3.0 to 1.4.0
2020-04-27 12:19:10 -07:00
Syrus Akbary
0ba255303f
Merge pull request #1405 from wasmerio/dependabot/cargo/cc-1.0.52
chore(deps): bump cc from 1.0.50 to 1.0.52
2020-04-27 12:18:55 -07:00
Syrus Akbary
61091cc9cf
Merge pull request #1404 from wasmerio/dependabot/cargo/criterion-0.3.2
chore(deps): bump criterion from 0.3.1 to 0.3.2
2020-04-27 12:18:44 -07:00
dependabot-preview[bot]
d32ce63110
chore(deps): bump time from 0.1.42 to 0.1.43
Bumps [time](https://github.com/time-rs/time) from 0.1.42 to 0.1.43.
- [Release notes](https://github.com/time-rs/time/releases)
- [Changelog](https://github.com/time-rs/time/blob/master/CHANGELOG.md)
- [Commits](https://github.com/time-rs/time/commits/v0.1.43)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-27 09:27:34 +00:00
dependabot-preview[bot]
9f5ce400ed
chore(deps): bump smallvec from 1.3.0 to 1.4.0
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.3.0...v1.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-27 09:26:48 +00:00
dependabot-preview[bot]
b788e39d7b
chore(deps): bump cc from 1.0.50 to 1.0.52
Bumps [cc](https://github.com/alexcrichton/cc-rs) from 1.0.50 to 1.0.52.
- [Release notes](https://github.com/alexcrichton/cc-rs/releases)
- [Commits](https://github.com/alexcrichton/cc-rs/compare/1.0.50...1.0.52)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-27 09:26:00 +00:00
dependabot-preview[bot]
7cd2cf20eb
chore(deps): bump criterion from 0.3.1 to 0.3.2
Bumps [criterion](https://github.com/bheisler/criterion.rs) from 0.3.1 to 0.3.2.
- [Release notes](https://github.com/bheisler/criterion.rs/releases)
- [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bheisler/criterion.rs/compare/0.3.1...0.3.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-27 09:25:23 +00:00
dependabot-preview[bot]
ab9b882069
chore(deps): bump structopt from 0.3.13 to 0.3.14
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.13 to 0.3.14.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/compare/v0.3.13...v0.3.14)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-27 09:24:46 +00:00
bors[bot]
ab106af422
Merge #1358
1358: Update C API to use new API r=MarkMcCaskey a=MarkMcCaskey



# Review

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


Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <5770194+MarkMcCaskey@users.noreply.github.com>
2020-04-21 20:12:46 +00:00
dependabot-preview[bot]
2035082a4e
chore(deps): bump smallvec from 1.2.0 to 1.3.0
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.2.0...v1.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-21 00:18:17 +00:00
dependabot-preview[bot]
51c504cba4
Bump libc from 0.2.68 to 0.2.69
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.68 to 0.2.69.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.68...0.2.69)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-20 23:19:20 +00:00
dependabot-preview[bot]
79b05773be
chore(deps): bump parking_lot from 0.10.0 to 0.10.2
Bumps [parking_lot](https://github.com/Amanieu/parking_lot) from 0.10.0 to 0.10.2.
- [Release notes](https://github.com/Amanieu/parking_lot/releases)
- [Changelog](https://github.com/Amanieu/parking_lot/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Amanieu/parking_lot/compare/0.10.0...0.10.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-20 22:44:21 +00:00
dependabot-preview[bot]
5ab96ab0e3
chore(deps): bump structopt from 0.3.12 to 0.3.13
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.12 to 0.3.13.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-20 21:06:03 +00:00
dependabot-preview[bot]
f5930750ed
Bump blake3 from 0.3.1 to 0.3.2
Bumps [blake3](https://github.com/BLAKE3-team/BLAKE3) from 0.3.1 to 0.3.2.
- [Release notes](https://github.com/BLAKE3-team/BLAKE3/releases)
- [Commits](https://github.com/BLAKE3-team/BLAKE3/compare/0.3.1...0.3.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-20 20:03:39 +00:00
dependabot-preview[bot]
861201e8a2
Bump serde_json from 1.0.48 to 1.0.51
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.48 to 1.0.51.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.48...v1.0.51)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-20 19:37:38 +00:00
dependabot-preview[bot]
16bccea284
Bump regex from 1.3.6 to 1.3.7
Bumps [regex](https://github.com/rust-lang/regex) from 1.3.6 to 1.3.7.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.3.6...regex-1.3.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-20 18:51:09 +00:00
dependabot-preview[bot]
090eaa451d
Bump anyhow from 1.0.26 to 1.0.28
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.26 to 1.0.28.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.26...1.0.28)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-20 08:56:42 +00:00
Syrus
ce14c6c079 Second part of the refactor 2020-04-15 16:31:05 -07:00
Syrus
a7dba54b7f Improved test generation 2020-04-14 11:41:12 -07:00
Mark McCaskey
bf09dc5e67
Merge branch 'master' into feature/update-capi-to-use-new-api 2020-04-09 17:40:29 -07:00
Mark McCaskey
c9460e3a03 Migrate tests away from using runtime and runtime_core 2020-04-09 14:37:21 -07:00
Mark McCaskey
3d4ed92466 Move dev-utils crate into tests 2020-04-08 11:59:47 -07:00
Mark McCaskey
83f0a043e7 Update C API to use new API 2020-04-06 17:09:50 -07:00
Mark McCaskey
4c29cd4af3 Merge branch 'master' into feature/reorganized-tests 2020-04-06 12:04:36 -07:00
bors[bot]
4d33020b35
Merge #1331
1331: feat(interface-types) Implement the `record` instructions r=Hywan a=Hywan

### Description

This PR implements the `record` WIT type, along with the `record.lift` and `record.lower` instructions.

With my current understanding of the draft/specification, here is how it works. Let's say we want to represent a Rust struct like the following:

```rust
struct S {
    x: String,
    y: i32
}
```

First declare a WIT type, such as:

```wat
(@interface type (record (field string) (field i32)))
```

The `record` type is supported by the binary encoder, the WAT encoder, the binary decoder, and the WAT decoder. A new `TypeKind` node has been introduced in the AST to differentiate a function type (`(@interface type (func (param …) (result …)))`) of a record type (see above).

Second, the `record.lower` transforms a host value (here Rust value, `S`) into a WIT value. In our implementation, a record value is defined as:

```rust
InterfaceValue::Record(Vec<InterfaceValue>)
```

Multiple mechanisms are used to type check a record value based on a record type. The code of the `record.lower` is pretty straightforward.

Because transforming a host value into a WIT value isn't obvious, a `Serializer` has been implemented, based on [`serde`](https://serde.rs/). This feature is behind the `serde` flag, which is turned on by default.

Serde is only used to cross the host/Wasm boundary, but it's not used to represent the value in memory or anything. It's only a shortcut to transform a host value into a WIT value, and vice versa.

Use the following code to transform `S` into a WIT value:

```rust
#[derive(Serialize, Deserialize, Debug, PartialEq)]
struct S {
    x: String,
    y: i32,
}

let host_value = S { x: "hello".to_string(), y: 42 };
let wit_value = to_interface_value(&host_value).unwrap();

assert_eq!(
    wit_value,
    InterfaceValue::Record(vec![
        InterfaceValue::String("hello".to_string()),
        InterfaceValue::I32(42),
    ])
);
```

Third, the `record.lift`  instruction does the opposite of `record.lower`: It transforms WIT values into a host value. To also facilitate the user experience, this PR contains a `Deserializer` implementation, still based on `serde`, with the `from_interface_values` function. It looks like this:

```rust
let wit_values = vec![
    InterfaceValue::Record(vec![
        InterfaceValue::String("hello".to_string()),
        InterfaceValue::I32(42),
    ])
];
let host_value = from_interface_values::<S>(&wit_values).unwrap();

assert_eq!(
    host_value,
    S { x: "hello".to_string(), y: 42 },
);
```

With the `Serializer` and `Deserializer`, it's super easy for the user to send or receive values from WIT.

The `record.lift` and `record.lower` instructions are kind of basic. The `record.lift` instruction has a little trick to reduce vector allocations, but there is a documentation for that.

#### Opened questions

Records of dimension 1 do not raise any issue. With `record.lift`, all values on the stack (the WIT interpreter stack) are popped, and are used as record field values. Something like:

```
[stack]
i32(1)
i64(2),
string("hello")
record.lift <record_type>
```

generates

```
[stack]
record { i32(1), i64(2), string("hello") }
```

But it's not clear what happens with record of dimension > 1, for instance for a type like `record (field i32) (record (field i32) (field i32)) (field string)`, it is assumed (in this PR) that the stack must be like this:

```
[stack]
i32(1)
i32(2)
i32(3)
string("hello")
record.lift <record_type>
```

to generate:

```
[stack]
record { i32(1), record { i32(2), i32(3) }, string("hello") }
```

If we want the stack to contain an intermediate record, we should have something like this:

```
[stack]
i32(1)
i32(2)
i32(3)
record.lift <record_type_2>
string("hello")
record.lift <record_type_1>
```

But it would imply that `record_type_1` is defined as `record (field i32) (record (type record_type_2)) (field i32)`.

A sub-record defined by another record type isn't support, as it is not specified in the draft. I believe my assumption is fine enough for a first implementation of records in WIT.

### To do

- [x] Encode and decode record type (`(@interface type (record string i32))`):
  - [x] Binary encoder/decoder
  - [x] WAT encoder/decoder
- [x] Implement the `record.lift` instruction
- [x] Implement the `record.lower` instruction
- [x] Test
- [x] Documentation
- [x] Surprise!
  - [x] Serialize a Rust value to WIT values (useful for `record`s)
  - [x] Deserialize WIT values to a Rust value (useful for `record`s)

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
2020-04-06 06:17:45 +00:00
Mark McCaskey
dfa6247075 Move spectests, wrap up test restructure 2020-04-03 14:24:40 -07:00
Mark McCaskey
513e6acbc1 Move emscripten-tests to tests dir + misc fixes 2020-04-02 16:51:58 -07:00
bors[bot]
1833af7eba
Merge #1350
1350: update blake3 to 0.3.1 r=syrusakbary a=oconnor663

Version 0.3.0 caused problems because it required a C compiler with
AVX-512 support, which broke Android x86 cross-compilation. Version
0.3.1 automatically falls back to a pure Rust build when the C compiler
either doesn't exist or doesn't support the flags we need.

Co-authored-by: Jack O'Connor <oconnor663@gmail.com>
2020-04-02 15:11:41 +00:00
Jack O'Connor
aca0bd11c0 update blake3 to 0.3.1
Version 0.3.0 caused problems because it required a C compiler with
AVX-512 support, which broke Android x86 cross-compilation. Version
0.3.1 automatically falls back to a pure Rust build when the C compiler
either doesn't exist or doesn't support the flags we need.
2020-04-02 11:02:49 -04:00
Ivan Enderlin
010b10d7b0 chore(cargo) Update Cargo.lock. 2020-04-02 16:39:40 +02:00
Mark McCaskey
976bf9b6a3 Move integration tests to tests dir in workspace root 2020-04-01 17:09:51 -07:00
bors[bot]
ecafa7564d
Merge #1313
1313: Add types and methods to provide updated API r=MarkMcCaskey a=MarkMcCaskey

Improving the API in a number of ways.

<details><summary>Current status </summary>

- [x] Get exports from Instance
  - [x] Func
     - [x] Documented
     - [x] Tested
  - [x] DynFunc
    - [x] Documented
    - [x] Tested
  - [x] Memory
    - [x] Documented
    - [x] Tested
  - [x] Table
    - [x] Documented
    - [ ] Tested ; fully testing this now will be difficult, blocked on Table API being completed
  - [x] Global
    - [x] Documented
    - [x] Tested
  - [x] Field syntax (fairly non-trivial)
- [x] Get imports from Module
  - [ ] Maybe update this to be an iterator instead of a Vec (side note, we may want to have a way to access specific types of imports too)
  - [x] Documented
  - [x] Tested
- [x] Get exports from Module
  - [x] Documented
  - [x] Tested
- [x] Get custom section from Module
  - [x] Figure out correct solution
  - [x] Ship separate PR that updates custom section code
  - [x] Documented
  - [x] Tested
- [ ] Updated Memory API
  - [x] Added conversion methods to bytes/pages with From
  - [ ] Documented
  - [ ] Tested
- [ ] Table APIs ; blocked on `wrap` being not linear time update (this update should also make it possible to retrieve a `Func` from `vm::Anyfunc`)
  - [ ] Table set (implemented needs to be checked)
    - [ ] Documented with examples
    - [x] Implemented
  - [ ] Table grow (implemented needs to be checked)
    - [ ] Documented with examples
    - [x] Implemented
  - [ ] Table get
    - [x] Structure implemented
    - [ ] Documented
    - [ ] Tested
- [ ] Module APIs (probably separate)
- [x] Update import object macro to handle a lack of trailing commas as well
  - [x] Add line in changelog about it
  - [x] Tested

</details>

# Review

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


Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <5770194+MarkMcCaskey@users.noreply.github.com>
2020-03-31 23:25:28 +00:00
Syrus Akbary
0623fa0549
Merge pull request #1325 from wasmerio/dependabot/cargo/structopt-0.3.12
Bump structopt from 0.3.11 to 0.3.12
2020-03-30 17:58:03 -07:00
Syrus Akbary
5e05ea26c6
Merge pull request #1326 from wasmerio/dependabot/cargo/serde-1.0.105
Bump serde from 1.0.104 to 1.0.105
2020-03-30 17:57:49 -07:00
Syrus Akbary
7dc26cf867
Merge pull request #1336 from wasmerio/dependabot/cargo/regex-1.3.6
Bump regex from 1.3.4 to 1.3.6
2020-03-30 17:57:39 -07:00
Mark McCaskey
403d4b4c8b
Merge branch 'master' into feature/update-api 2020-03-30 17:40:18 -07:00
dependabot-preview[bot]
778b686e82
Bump structopt from 0.3.11 to 0.3.12
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.11 to 0.3.12.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/compare/v0.3.11...v0.3.12)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-31 00:16:44 +00:00
dependabot-preview[bot]
959a1937a0
Bump errno from 0.2.4 to 0.2.5
Bumps [errno](https://github.com/lambda-fairy/rust-errno) from 0.2.4 to 0.2.5.
- [Release notes](https://github.com/lambda-fairy/rust-errno/releases)
- [Commits](https://github.com/lambda-fairy/rust-errno/compare/v0.2.4...v0.2.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-31 00:16:43 +00:00
dependabot-preview[bot]
b5b5232a2b
Bump serde from 1.0.104 to 1.0.105
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.104 to 1.0.105.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.104...v1.0.105)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-31 00:16:42 +00:00
dependabot-preview[bot]
5d87810892
Bump regex from 1.3.4 to 1.3.6
Bumps [regex](https://github.com/rust-lang/regex) from 1.3.4 to 1.3.6.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.3.4...1.3.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-31 00:16:41 +00:00
Nick Lewycky
5b7a06c07b Use the inkwell package on crates.io!! 2020-03-27 15:47:50 -07:00
Nick Lewycky
5bd6b161d5 Create a valid target triple in the LLVM Module. 2020-03-27 13:54:18 -07:00
Mark McCaskey
cc13e45215 Add skeleton of external API and tests 2020-03-24 18:59:09 -07:00
Mark McCaskey
d8bd258ef2 Add skeleton of exported api 2020-03-23 17:53:01 -07:00
Mark McCaskey
9cdb49d22c
Merge branch 'master' into android 2020-03-23 13:29:18 -07:00
bors[bot]
e695ecbfd8
Merge #1288
1288: Update some dependencies manually, removing duplicate deps r=MarkMcCaskey a=MarkMcCaskey

Removes all duplicate deps (as seen by `cargo +stable tree -d`).  Primarily by updating `wasm-debug` but also by through updating some other dependencies.

Co-authored-by: Mark McCaskey <mark@wasmer.io>
2020-03-23 18:58:51 +00:00
YAMAMOTO Yuji
93f6a9b91b
enable testing on Android x86_64
Currently, at the time of 2020/03/11, testing on AArch64 is not supported in the upstream repository
2020-03-23 11:55:32 +09:00
YAMAMOTO Yuji
96a0f851c2
Update libc
The new version of libc contains changes necessary to build
wasmer-runtime-core for Android.

See https://github.com/rust-lang/libc/pull/1622 for details.
2020-03-23 11:55:32 +09:00