Commit Graph

1665 Commits

Author SHA1 Message Date
Olivier Lemasle
b5f29bd3b2 Update wasm-tools crates (#2908)
wasmparser 0.78 adds the Unknown name subsection type.
2021-05-17 10:08:17 -05:00
Dan Gohman
05d57d8ded Update to cap-std 0.13.10 and system-interface 0.6.4.
This includes fixes for bytecodealliance/cap-std#169,
bytecodealliance/system-interface#15, and bytecodealliance/system-interface#16.
2021-05-12 13:21:32 -07:00
Benjamin Bouvier
d7053ea9c7 Upgrade to the latest versions of gimli, addr2line, object (#2901)
* Upgrade to the latest versions of gimli, addr2line, object

And adapt to API changes. New gimli supports wasm dwarf, resulting in
some simplifications in the debug crate.

* upgrade gimli usage in linux-specific profiling too

* Add "continue" statement after interpreting a wasm local dwarf opcode
2021-05-12 10:53:17 -05:00
Pat Hickey
c81dbe498f try upping 20ms to 50ms timeouts... 2021-05-11 17:12:48 -07:00
Peter Huene
e36fff894a Merge pull request #2879 from peterhuene/allow-unknown-exports
Implement the `allow-unknown-exports` option for the run command.
2021-05-11 12:45:48 -07:00
Pat Hickey
e66909f710 wasi-tokio: increase timeout in poll_oneoff test here as well 2021-05-11 09:24:15 -07:00
Pat Hickey
7ec93cb977 poll_oneoff_stdio test: increase timeout to 20ms 2021-05-11 09:22:12 -07:00
Pat Hickey
f60ae73d15 Merge pull request #2832 from bytecodealliance/pch/wiggle_sync_shimming
wasi-common support for tokio, & wiggle support for async methods containing sync code
2021-05-07 17:43:42 -07:00
Pat Hickey
bae1a5693d 10ms here, and let it timeout in addition to ready? 2021-05-07 16:20:12 -07:00
Pat Hickey
74e9b385df lets try 10ms, macos ci timed out with 5ms 2021-05-07 16:07:15 -07:00
Pat Hickey
548b6c5311 windows fixes 2021-05-07 15:51:33 -07:00
Pat Hickey
b450094dad debug 2021-05-07 15:19:17 -07:00
Pat Hickey
68fdadde26 tokio poll_oneoff test: CI needs more than 1ms to complete it 2021-05-07 15:19:02 -07:00
Dan Gohman
ec5d8016f7 On Windows, ignore files for which full_metadata fails.
On Windows, `metadata` computes only partial metadata results, which don't
include what WASI needs for the `inode` field in `readdir` results. cap-std
has a `full_metadata` function which is able to include this extra
information, however it has more strict access requirements, so it sometimes
fails even when plain `metadata` would succeed.

Make WASI's `readdir` silently skip over files that can't be accessed by
`full_metadata`. These files wouldn't be openable in any other way by
WASI programs, so the only benefit of listing them would be to
let applications know that they exist. This allows it to avoid failing
and avoid returning bogus results.

This is part of a fix for bytecodealliance/cap-std#169.
2021-05-07 14:47:39 -07:00
Pat Hickey
ee8a8a2a90 poll_oneoff_stdio test: loosen up contract
permit both readable events to be delivered in very short interval,
rather than simultaneously.
2021-05-07 14:27:23 -07:00
Pat Hickey
9b09272936 poll_oneoff: bound tests for time, rather than instant completion 2021-05-07 12:19:51 -07:00
Pat Hickey
b7593cb8fe Merge remote-tracking branch 'origin/main' into pch/wiggle_sync_shimming 2021-05-06 17:54:03 -07:00
Pat Hickey
e9f410d1db run_in_dummy_executor isnt unsafe, its just a bad idea 2021-05-06 16:25:12 -07:00
Pat Hickey
35a9d4e3c9 less general mechanism for examples cargo feature 2021-05-06 16:23:33 -07:00
Pat Hickey
b19d86268c fix test harness stdio 2021-05-06 16:19:33 -07:00
Pat Hickey
add115ba00 fix 2021-05-06 15:53:23 -07:00
Pat Hickey
ff8bdc390b reuse cap-std-syncs windows scheduler without copypaste 2021-05-06 15:45:54 -07:00
Pat Hickey
3d9b98f1df fix example 2021-05-06 14:34:30 -07:00
Peter Huene
91f64d40d4 Implement the allow-unknown-exports option for the run command.
This commit implements the `--allow-unknown-exports` option to the CLI run
command that will ignore unknown exports in a command module rather than
return an error.

Fixes #2587.
2021-05-06 14:23:08 -07:00
Pat Hickey
e50f1b24a9 better name and comment 2021-05-06 11:24:48 -07:00
Pat Hickey
76be1959c4 explain! 2021-05-06 11:20:38 -07:00
Pat Hickey
f3ffd74566 dont depend on wiggle for just the one func 2021-05-06 11:19:25 -07:00
Pat Hickey
208013e34e de-duplicate code 2021-05-06 11:12:53 -07:00
Pat Hickey
f4d851126d tests dont need fuel 2021-05-06 10:53:25 -07:00
Pat Hickey
6616c1eaf1 fix warnings 2021-05-05 13:32:05 -07:00
Pat Hickey
9e04c5333c poll oneoff tests: what if we read a non-empty file? 2021-05-05 13:08:33 -07:00
Pat Hickey
3e8ea090c6 ci debugging 2021-05-05 11:24:27 -07:00
Pat Hickey
0faf3b248e wasmtime-wasi: keep exporting sync at the top level 2021-05-05 11:00:59 -07:00
Pat Hickey
e0f3423161 support windows 2021-05-04 14:28:45 -07:00
Pat Hickey
f76fe8b764 rewrite wasi-tokio as just an task::block_in_place wrapper on cap-std-sync 2021-05-04 14:15:50 -07:00
Pat Hickey
686d8c22f9 fix test harness 2021-05-04 11:18:20 -07:00
bjorn3
84c79982e7 Remove unnecessary dependencies
Found using cargo-udeps
2021-05-04 13:51:26 +02:00
Pat Hickey
5ab8346a05 fix windows sync scheduler 2021-05-03 12:23:24 -07:00
Pat Hickey
3df9cddf10 better unit test 2021-05-03 11:59:30 -07:00
Benjamin Bouvier
8811246a9f debug: Avoid underflow when scanning for landing pad bytes (#2866) 2021-05-03 11:58:40 -05:00
Ulrich Weigand
dfb1bc4d02 Trap handler changes to support s390x (#2871)
On s390x, SIGILL and SIGFPE are delivered with the PSW address
pointing *after* the faulting instruction, while SIGSEGV and
SIGBUS are delivered with the PSW address pointing *to* the
faulting instruction.  In order to support this, the common
code trap handler has to distinguish between those cases.

Also, enable SIGFPE on s390x (just like on x86).
2021-05-03 11:56:18 -05:00
Ulrich Weigand
e1cc1a67d5 Object file support for s390x (#2872)
Add support for s390x binary format object files.  In particular,
add support for s390x ELF relocation types (currently only
S390xPCRel32Dbl).
2021-05-03 11:50:00 -05:00
Ulrich Weigand
7a3791f9e9 Fiber support for s390x (#2870)
Add fiber support for the s390x architecture.
2021-05-03 11:01:10 -05:00
Pat Hickey
62c4f0d1f7 wasi-tokio kinda sorta working 2021-05-01 15:39:09 -07:00
Pat Hickey
7f34ccb909 various fixes to the design of Poll 2021-04-30 15:38:18 -07:00
Pat Hickey
b7efcbe80f jump through enough hoops for the poll lifetime to work out
you program rust for a few years and you think you're done tearing your
hair out over lifetimes, well, you'll find yourself wrong
2021-04-29 16:50:22 -07:00
Pat Hickey
ab4f5bb674 move dummy executor out to wiggle:: for reuse 2021-04-29 16:26:50 -07:00
Andrew Brown
92e0b6b9e8 wasi-nn: turn it on by default (#2859)
* wasi-nn: turn it on by default

This change makes the wasi-nn Cargo feature a default feature. Previously, a wasi-nn user would have to build a separate Wasmtime binary (e.g. `cargo build --features wasi-nn ...`) to use wasi-nn and the resulting binary would require OpenVINO shared libraries to be present in the environment in order to run (otherwise it would fail immediately with linking errors). With recent changes to the `openvino` crate, the wasi-nn implementation can defer the loading of the OpenVINO shared libraries until runtime (i.e., when the user Wasm program calls `wasi_ephemeral_nn::load`) and display a user-level error if anything goes wrong (e.g., the OpenVINO libraries are not present on the system). This runtime-linking addition allows the wasi-nn feature to be turned on by default and shipped with upcoming releases of Wasmtime. This change should be transparent for users who do not use wasi-nn: the `openvino` crate is small and the newly-available wasi-nn imports only affect programs in which they are used.

For those interested in reviewing the runtime linking approach added to the `openvino` crate, see https://github.com/intel/openvino-rs/pull/19.

* wasi-nn spec path: don't use canonicalize

* Allow dependencies using the ISC license

The ISC license should be [just as permissive](https://choosealicense.com/licenses/isc) as MIT, e.g., with no additional limitations.

* Add a `--wasi-modules` flag

This flag controls which WASI modules are made available to the Wasm program. This initial commit enables `wasi-common` by default (equivalent to `--wasi-modules=all`) and allows `wasi-nn` and `wasi-crypto` to be added in either individually (e.g., `--wasi-modules=wasi-nn`) or as a group (e.g., `--wasi-modules=all-experimental`).

* wasi-crypto: fix unused dependency

Co-authored-by: Pat Hickey <pat@moreproductive.org>
2021-04-29 15:03:28 -05:00
Pat Hickey
b3e1ab4553 restructure Poll to hold a Table and fd instead of a RefMut<dyn WasiFile>
unfortunately, the borrow checker defeated me: changing the
RwSubscription file form a Ref to a RefMut turned into borrow checker
errors in the impl of the poll_oneoff trait method.

This implementation makes an end run by having Poll hold onto the table
and fd, and borrow the file at the site of use, rather than try to own
the RefMut. I have no idea why this convinces the borrow checker that
anything is different, but it does and I need to get this PR done and
I don't think comprimising on this internal abstraction is worth
fighting against
2021-04-28 11:56:48 -07:00
Alex Crichton
7ec073cef1 Bring back per-thread lazy initialization (#2863)
* Bring back per-thread lazy initialization

Platforms Wasmtime supports may have per-thread initialization that
needs to run before WebAssembly. For example Unix needs to setup a
sigaltstack and macOS needs to set up mach ports. In #2757 this
per-thread setup was moved out of the invocation of a wasm function,
relying on the lack of Send for Store to initialize the thread at Store
creation time and never worry about it later.

This conflicted with [wasmtime's desired multithreading
story](https://github.com/bytecodealliance/wasmtime/pull/2812) so a new
[`Store::notify_switched_thread` was
added](https://github.com/bytecodealliance/wasmtime/pull/2822) to
explicitly indicate a Store has moved to another thread (if it unsafely
did so).

It turns out though that it's not always easy to determine when a
`Store` moves to a new thread. For example the Go bindings for Wasmtime
are generally unaware when a goroutine switches OS threads. This led to
https://github.com/bytecodealliance/wasmtime-go/issues/74 where a SIGILL
was left uncaught, making it appear that traps aren't working properly.

This commit revisits the decision in #2757 and moves per-thread
initialization back into the path of calling into WebAssembly. This is
differently from before, though, where there's still only one TLS access
on the path of calling into WebAssembly, unlike before where it was a
separate access. This allows us to get the speed benefits of #2757 as
well as the flexibility benefits of not having to explicitly move a
store between threads.

With this new ability this commit deletes the recently added
`Store::notify_switched_thread` method since it's no longer necessary.

* Fix a test compiling
2021-04-28 12:08:27 -05:00