Commit Graph

8 Commits

Author SHA1 Message Date
Alex Crichton
d5a2eb397c Update the *.wast runner to use the wasmtime API (#690)
* Update the `*.wast` runner to use the `wasmtime` API

This commit migrates the `wasmtime-wast` crate, which executes `*.wast`
test suites, to use the `wasmtime` crate exclusively instead of the raw
support provided by the `wasmtime-*` family of crates.

The primary motivation for this change is to use `*.wast` test to test
the support for interface types, but interface types is only being added
in the `wasmtime` crate for now rather than all throughout the core
crates. This means that without this transition it's much more difficult
to write tests for wasm interface types!

A secondary motivation for this is that it's testing the support we
provide to users through the `wasmtime` crate, since that's the
expectation of what most users would use rather than the raw
`wasmtime-*` crates.

* Run rustfmt

* Fix the multi example

* Handle v128 values in the `wasmtime` crate

Ensure that we allocate 128-bit stack slots instead of 64-bit stack
slots.

* Update to master

* Add comment
2019-12-17 13:30:50 -06:00
Alex Crichton
3d69e04659 Tweak the API of the Val type (#679)
* Tweak the API of the `Val` type

A few updates to the API of the `Val` type:

* Added a payload for `V128`.
* Replace existing accessor methods with `Option`-returning versions.
* Add `unwrap_xxx` family of methods to extract a value and panic.
* Remove `Into` conversions which panic, since panicking in `From` or
  `Into` isn't idiomatic in Rust
* Add documentation to all methods/values/enums/etc.
* Rename `Val::default` to `Val::null`

* Run rustfmt

* Review comments
2019-12-06 16:19:37 -06:00
Josh Triplett
7c8ac3d71c Simplify examples: avoid unnecessary HostRef wrap/unwrap
Several of the examples wrap the Instance in a HostRef, only to
immediately borrow it again to get the exports,and then never touch it
again. Simplify this by owning the Instance directly.
2019-11-21 06:57:14 +01:00
Josh Triplett
2635ccb742 Rename the wasmtime_api library to match the containing wasmtime crate (#594)
* Rename the `wasmtime_api` library to match the containing `wasmtime` crate

Commit d9ca508f80 renamed the
`wasmtime-api` crate to `wasmtime`, but left the name of the library it
contains as `wasmtime_api`.

It's fairly unusual for a crate to contain a library with a different
name, and it results in rather confusing error messages for a user; if
you list `wasmtime = "0.7"` in `Cargo.toml`, you can't `use
wasmtime::*`, you have to `use wasmtime_api::*;`.

Rename the `wasmtime_api` library to `wasmtime`.

* Stop renaming wasmtime to api on imports

Various users renamed the crate formerly known as wasmtime_api to api,
and then used api:: prefixes everywhere; change those all to wasmtime::
and drop the renaming.
2019-11-19 14:47:39 -08:00
Alex Crichton
399295a708 Remove all checked in *.wasm files to the repo (#563)
* Tidy up the `hello` example for `wasmtime`

* Remove the `*.wat` and `*.wasm` files and instead just inline the
  `*.wat` into the example.

* Touch up comments so they're not just a repeat of the `println!`
  below.

* Move `*.wat` for `memory` example inline

No need to handle auxiliary files with the ability to parse it inline!

* Move `multi.wasm` inline into `multi.rs` example

* Move `*.wasm` for gcd example inline

* Move `*.wat` inline with `import_calling_export` test

* Remove checked in `lightbeam/test.wasm`

Instead move the `*.wat` into the source and parse it into wasm there.

* Run rustfmt
2019-11-13 13:00:06 -06:00
Nick Fitzgerald
a29303dedd Expand the muli-value example for wasmtime-api to use many return values
This should exercise the Rust-calling-Wasm code path for when there are more
return values than fit into return registers.
2019-11-11 15:39:48 -08:00
Dan Gohman
1a0ed6e388 Use the more-asserts crate in more places.
This provides assert_le, assert_lt, and so on, which can print the
values of the operands.
2019-11-08 15:24:53 -08:00
Dan Gohman
22641de629 Initial reorg.
This is largely the same as #305, but updated for the current tree.
2019-11-08 06:35:40 -08:00