Commit Graph

418 Commits

Author SHA1 Message Date
dependabot-preview[bot]
183611d796 Update rand requirement from 0.6 to 0.7
Updates the requirements on [rand](https://github.com/rust-random/rand) to permit the latest version.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/0.6.0...0.7.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-03 07:53:58 +00:00
dependabot-preview[bot]
825ed4f4d4 Update cranelift-entity requirement from 0.41.0 to 0.44.0
Updates the requirements on [cranelift-entity](https://github.com/CraneStation/cranelift) to permit the latest version.
- [Release notes](https://github.com/CraneStation/cranelift/releases)
- [Commits](https://github.com/CraneStation/cranelift/compare/v0.41.0...v0.44.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-03 09:52:12 +02:00
Dan Gohman
d4353f03cb Don't check assert_trap tests when Lightbeam is enabled.
Lightbeam doesn't yet produce trap metadata, so it can't yet match the
expected `assert_trap` messages. Disable them for now.
2019-10-02 13:42:26 -07:00
Andrew Brown
290b51a5f6 Update wabt and spec test suite
Update wabt (see issue in https://github.com/pepyakin/wabt-rs/pull/56). Due to changes in wabt, the spec tests are updated as well.
2019-09-26 15:46:18 -07:00
Dan Gohman
10845134f7 Update to latest walrus, wasmparser, and wasm-webidl-bindings. 2019-09-26 12:34:58 -07:00
Artur Jamro
134bf467e7 Update cranelift to 0.44.0 2019-09-25 13:04:10 -07:00
Nick Fitzgerald
1848cc0868 deps: Update cranelift-* to 0.43.1 2019-09-25 13:04:10 -07:00
Mark Bestavros
bd613ecafd Utilize cranelift-codegen's new all-arch feature to maintain architecture support 2019-09-19 10:39:41 -07:00
Jakub Konka
fec5b7ab0a Refactor mgmt of misc testsuite (#101)
Changes:
* use [tempfile] crate for auto mgmt of temp dirs
* use concrete types in place of generics in `utils` module

[tempfile]: https://github.com/Stebalien/tempfile
2019-09-16 15:35:14 -07:00
Jakub Konka
dfeae067cc Sync with wasmtime and update public interface
Internal modules `memory` and `host` can indeed be internal hidden
behind public-private visibility as `wasmtime-wasi` has already
been updated not to use the said modules (see
CraneStation/wasmtime#298).
2019-09-16 15:30:20 -07:00
Artur Jamro
fad70eb8bb Refactor usage of SecondaryMap impls (serde, PartialEq) 2019-09-05 17:14:32 -07:00
Marcin Mielniczuk
8db57bd6c6 Check if testsuite exists, set target dir 2019-08-23 20:36:11 -07:00
Marcin Mielniczuk
9f840ff6f1 Quick & dirty misc_testsuite 2019-08-23 20:36:11 -07:00
Sendil Kumar
69d60c4711 update nix version 2019-08-23 09:24:38 +02:00
Yury Delendik
f88e92a57c Better Wasmtime API for embedder (#287)
* Migrate wasm-rust-api code to wasmtime.
2019-08-21 00:35:26 -07:00
Dan Gohman
d7883dd60a Don't publish misc_testsuite/*.wasm. 2019-08-21 00:04:00 -07:00
Dan Gohman
19055d0178 Add description fields. 2019-08-21 00:04:00 -07:00
Dan Gohman
8ea883a603 Workaround a rounding difference in the strtof function in Centos 6. (#290)
* Workaround a rounding difference in the strtof function in Centos 6.

This difference causes the spec test const.wast to fail, so disable the
test on platforms where we detect the rounding difference occurs.
2019-08-20 23:29:19 -07:00
Dan Gohman
f37b672c8d Update the pinned wasmtime revision.
This resynchronizes the versions of cranelift used in wasi-common
and wasmtime to 0.40.
2019-08-21 07:46:18 +02:00
Dan Gohman
500bf83082 Update to latest cranelift and target-lexicon. 2019-08-20 16:17:36 -07:00
Dan Gohman
44367ba99a Bump version to 0.2.0 2019-08-20 16:07:57 -07:00
dependabot-preview[bot]
7dc81cbbc0 Update wabt requirement from 0.8 to 0.9
Updates the requirements on [wabt](https://github.com/pepyakin/wabt-rs) to permit the latest version.
- [Release notes](https://github.com/pepyakin/wabt-rs/releases)
- [Commits](https://github.com/pepyakin/wabt-rs/compare/0.8.0...0.9.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-08-19 11:23:49 -07:00
Alex Crichton
d1b1500d19 Add an example #[wasmtime] Rust macro (#283)
This commit adds a `wasmtime-rust` crate to the `misc` folder next to
the previously added Python extension. The intention is that this
showcases loading a WebAssembly file natively in Rust and how with an
attribute macro it can feel lightweight in terms of boilerplate.

The macro itself is pretty non-featureful today beyond the bare bones to
get anything working, but there's all sorts of possibilities like
JIT-compiled entry stubs we could eventually do with all the type
information!
2019-08-19 19:45:42 +02:00
Dan Gohman
54dd085e27 Add a default-run, so that "cargo run" doesn't need a --bin option.
default-run is a new feature in Rust 1.37.
2019-08-19 05:55:27 -07:00
Alex Crichton
af2b4e4946 Add initial support for WebAssembly Interface Types (#282)
This commit adds initial support for [WebAssembly Interface
Types][proposal] to wasmtime. This is all intended to be quite
experimental, so experimental in fact that even the name of the
[proposal] is still in flux. (this has otherwise been known as "host
bindings" or "webidl bindings" or "wasm bindings").

The goal of this commit is to start adding support the wasmtime set of
crates for WebAssembly Interface Types. A new `wasmtime-interface-types`
crate has been added with very basic support for dynamically invoking
and inspecting the various bindings of a module. This is in turn powered
by the `wasm-webidl-bindings` crate which is shared with the
`wasm-bindgen` CLI tool as a producer of this section.

Currently the only integration in `wasmtime`-the-binary itself is that
when passed the `--invoke` argument the CLI will now attempt to invoke
the target function with arguments as parsed from the command line
itself. For example if you export a function like:

    fn render(&str) -> String

Then passing `--invoke render` will require one argument on the command
line, which is the first argument as a string, and the return value is
printed to the console. This differs from today's interpretation of
`--invoke` where it is a failure if the invoked function takes more than
one argument and the return values are currently ignored.

This is intended to also be the basis of embedding wasmtime in other
contexts which also want to consume WebAssembly interface types. A
Python extension is also added to this repository which implements the
`wasmtime` package on PyPI. This Python extension is intended to make it
as easy as `pip3 install wasmtime` to load a WebAssembly file with
WebAssembly Interface Types into Python. Extensions for other languages
is of course possible as well!

One of the major missing pieces from this is handling imported functions
with interface bindings. Currently the embedding support doesn't have
much ability to support handling imports ergonomically, so it's intended
that this will be included in a follow-up patch.

[proposal]: https://github.com/webassembly/webidl-bindings

Co-authored-by: Yury Delendik <ydelendik@mozilla.com>
2019-08-19 13:32:13 +02:00
Alex Crichton
5fe550f533 Conform to Cargo's conventional file layout
Move `src/*.rs` to `src/bin/*.rs` which are automatically inferred as
binaries and move `src/utils.rs` to `src/lib.rs` which is compiled as a
reusable library for each of the binaries we're building.
2019-08-13 12:51:51 -07:00
Marcin Mielniczuk
550cfb90e7 Bump filetime to 0.2.7 2019-08-13 21:34:35 +02:00
Marcin Mielniczuk
2f1afc4846 Implement fd_filestat_set_times using the filetime crate. 2019-08-13 21:34:35 +02:00
Yury Delendik
4f04d7d873 Transform ranges and simple expressions (#63) 2019-08-08 20:44:45 -07:00
Jakub Konka
085d700cdc Bump wasi-common rev 2019-08-08 11:06:27 +02:00
Yury Delendik
5fc2d827b7 Update cranelift requirement from 0.37.0 to 0.38.0 (#254)
closes #248, closes #249, closes #250, closes #251, closes #252
2019-08-06 14:49:28 -05:00
Till Schneidereit
41f88745c4 Update log and libc crates (#240)
* Update log crate

* Update libc crate
2019-08-06 09:01:52 -05:00
Yury Delendik
0bc9d1fe6f Update cranelift to 0.37.0 (#236)
Closed #228, #227, #226, #225, #224
2019-08-01 20:46:34 -05:00
Jakub Konka
e759e3c2a4 Update dependencies and lock wasmtime-* on a specific rev 2019-07-26 14:16:24 +02:00
Artur Jamro
165dc4944d Simple module compilation cache (#203)
* Simple module compilation cache

* Fix base64 encoding bug

* Use warn! everywhere in cache system

* Remove unused import

* Temporary workaround for long path on Windows

* Remove unused import for non-windows builds

* Add command line argument to enable cache system + apply minor review feedback
2019-07-25 16:16:10 -07:00
Dan Gohman
17e4528648 Downgrade wabt from 0.8 to 0.7. (#219)
Even though this somehow passed on Travis on [the
PR](https://github.com/CraneStation/wasmtime/pull/209), it fails on
Travis on master, and I can reproduce the failure.

The failure is on spec_testsuite/names.wast:

```
$ RUST_BACKTRACE=1 target/debug/wast spec_testsuite/names.wast
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: FromUtf8Error { bytes: [255], error: Utf8Error { valid_up_to: 0, error_len: Some(1) } }', src/libcore/result.rs:999:5
stack backtrace:
[...]
   9: core::result::Result<T,E>::unwrap
             at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c/src/libcore/result.rs:800
  10: wabt::script::jstring_to_rstring
             at [...]/.cargo/registry/src/github.com-1ecc6299db9ec823/wabt-0.8.0/src/script/mod.rs:261
  11: wabt::script::parse_action
             at [...]/.cargo/registry/src/github.com-1ecc6299db9ec823/wabt-0.8.0/src/script/mod.rs:274
  12: wabt::script::ScriptParser<F32,F64>::next
             at [...]/.cargo/registry/src/github.com-1ecc6299db9ec823/wabt-0.8.0/src/script/mod.rs:504
  13: wasmtime_wast::wast::WastContext::run_buffer
             at wasmtime-wast/src/wast.rs:202
  14: wasmtime_wast::wast::WastContext::run_file
             at wasmtime-wast/src/wast.rs:472
  15: wast::main
             at src/wast.rs:107
[...]
```
2019-07-24 14:49:04 -07:00
Artur Jamro
794841b366 Properly initialize file_per_thread_logger for rayon thread pool (#211)
* Properly initialize file_per_thread_logger for rayon thread pool
2019-07-23 14:53:48 -07:00
Stefan Junker
1aff03a5b4 dependencies: pin wasi-common to specific rev
This removes the reliance on having a correct version of wasi-common in
the cache by chance ;-)
2019-07-23 13:24:32 -07:00
dependabot-preview[bot]
f5746290cb Update wabt requirement from 0.7 to 0.8
Updates the requirements on [wabt](https://github.com/pepyakin/wabt-rs) to permit the latest version.
- [Release notes](https://github.com/pepyakin/wabt-rs/releases)
- [Commits](https://github.com/pepyakin/wabt-rs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-07-23 11:04:26 -07:00
Jakub Konka
667f272edd Rewrite majority of impl reusing libstd (#34)
* Rewrite FdEntry reusing as much libstd as possible

* Use the new FdEntry, FdObject, Descriptor struct in *nix impl

* Adapt Windows impl

* Remove unnecessary check in fd_read

Check `host_nread == 0` caused premature FdEntry closure and removal
which ultimately was resulting in an attempt at "double closing" of
the same file descriptor at the end of the Wasm program:
...
fd_close(fd=4)
    -> errno=WASI_ESUCCESS
fd_close(fd=4)
    -> errno=WASI_EBADF

* Use libstd vectored IO

* Use std:🧵:yield_now to implement sched_yield

* Add logging to integration tests

* Add preliminary support for host-specific errors

* Operate on std::fs::File in path_get on *nix

* Add cross-platform RawString type encapsulating OsStrExt

* Fix Windows build

* Update Travis and README to Rust v1.36

* Remove unused winx::handle::close helper

* Refactor Descriptor into raw handles/fds

* Strip readlinkat in prep for path_get host-independent

* Strip openat in prep for path_get host-independent

* Move ManuallyDrop up one level from Descriptor to FdObject

* Make (c)iovec host fns unsafe

* Swap unwraps/expects for Results in fdentry_impl on nix

* Rewrite fd_pread/write and implement for Win

* Use File::sync_all to impl fd_sync

* Use File::sync_data to impl fd_datasync

* Rewind file cursor after fd_p{read, write} on Windows

* Add fd_p{read, write} tests

* Handle errors instead of panicking in path_get

* Use File::set_len to impl fd_allocate

* Add test for fd_allocate

* Replace all panics with Results

* Document the point of RawString
2019-07-15 15:34:28 -07:00
Jakub Konka
93e1657bae Update cranelift 2019-07-05 16:51:54 +02:00
Dan Gohman
1a10f4a002 Update to Cranelift 1.33 and require Rust 1.35.
Cranelift requires Rust 1.35; update accordingly.
2019-07-03 11:16:55 -07:00
Yury Delendik
fb9d6061e4 Update cranelift, faerie, target-lexicon and wasmparser deps 2019-07-02 14:07:30 -07:00
Jakub Konka
7287767a3f Add enough Windows functionality to run WASI tutorial (#22)
* Add partial impl of determine_type_rights fn

* Add draft of fd_fdstat_get hostcall

* Add writev wrapper for writing IoVec in RawHandle

* Move IoVec and writev to separate helper crate

* Add Win error handling

Clean up closing and duplicating RawHandle

* Wrap Win file type result

* Add draft impl of fd_close and fd_read

* Refactor getting file access rights

* Remove winapi from the main Cargo.toml

* Add very rough draft of open_path (very incomplete)

* Clean up WinError with macro

* Ignore dir handle in openat if path absolute

* Decode oflags and advance open_path hostcall

* Clean up AccessRight and FlagsAndAttributes flags

* Implement path_get (without symlink expansion yet!)

* Add ShareMode and fix path_get for nested paths

* Add some error mappings between Win and WASI

* Clean up fdflags conversions

* Fix sharing violation when calling openat at '.'

* Apply Alex's fix of using ManuallyDrop instead forget

* Clean up

* Explicitly specify workspace to avoid comp errors at tests
2019-06-27 17:10:15 -07:00
Jakub Konka
22c69f46f9 Use build.rs to generate test cases automatically
Now, test binaries are bundled with the repo, and
just like in CraneStation/wasmtime, the test cases
are generated automatically using build.rs. So all
it takes is to drop a new test binary in the
testsuite dir to get the test case for it generated
(with some caveats to do with handling preopens).
2019-06-26 15:24:21 -07:00
Jakub Konka
656112d00b Patch wasmtime-wasi to use this wasi-common version 2019-06-26 15:24:21 -07:00
Jakub Konka
982dbab1f2 Add misc-tests as a submodule dep 2019-06-26 15:24:21 -07:00
Jakub Konka
6ca01ce546 Add wasmtime as default runtime for integration tests 2019-06-26 15:24:21 -07:00
Dan Gohman
c0ba4753eb Enable wasi-common by default (#177)
This removes the --wasi-common, as it's now on by default, and adds a
--wasi-c option to enable the wasi-c implementation.
2019-06-25 02:05:49 -07:00
Jakub Konka
513429f1b8 Port trace log from wasmtime-wasi-c crate 2019-06-24 22:47:41 +02:00