Commit Graph

1683 Commits

Author SHA1 Message Date
Alex Crichton
05baddfb2b Add the ability to cache typechecking an instance (#2962)
* Add the ability to cache typechecking an instance

This commit adds the abilty to cache the type-checked imports of an
instance if an instance is going to be instantiated multiple times. This
can also be useful to do a "dry run" of instantiation where no wasm code
is run but it's double-checked that a `Linker` possesses everything
necessary to instantiate the provided module.

This should ideally help cut down repeated instantiation costs slightly
by avoiding type-checking and allocation a `Vec<Extern>` on each
instantiation. It's expected though that the impact on instantiation
time is quite small and likely not super significant. The functionality,
though, of pre-checking can be useful for some embeddings.

* Fix build with async
2021-06-03 17:04:07 -05:00
Olivier Lemasle
9dde98e33c Remove empty crates directories
In commit 33c791e1f5 (PR #2944), I added LICENSE files to all published
crates. However, since then PR #2897 has been merged and remove 3 crates,
resulting in license files in empty directories.
2021-06-03 18:42:07 +02:00
Alex Crichton
7a1b7cdf92 Implement RFC 11: Redesigning Wasmtime's APIs (#2897)
Implement Wasmtime's new API as designed by RFC 11. This is quite a large commit which has had lots of discussion externally, so for more information it's best to read the RFC thread and the PR thread.
2021-06-03 09:10:53 -05:00
Benjamin Bouvier
51edea9e57 cranelift: introduce a new WasmtimeAppleAarch64 calling convention
The previous choice to use the WasmtimeSystemV calling convention for
apple-aarch64 devices was incorrect: padding of arguments was
incorrectly computed. So we have to use some flavor of the apple-aarch64
ABI there.

Since we want to support the wasmtime custom convention for multiple
returns on apple-aarch64 too, a new custom Wasmtime calling convention
was introduced to support this.
2021-06-01 17:29:12 +02:00
Andrew Brown
40d546c420 Upgrade capstone to v0.8 (#2948) 2021-05-28 09:51:14 -05:00
Olivier Lemasle
33c791e1f5 Add license files
This commit adds LICENSE files to all **published** crates which do
not have it already (most of the crates have it).

Providing the license files is a requiment of the Apache 2.0 License.
2021-05-27 11:56:58 -07:00
Alex Crichton
b90d7d6aed Remove long-outdated misc/rust crate (#2942)
I had no idea this was still in the repository, much less building!
There are much different ways to use wasmtime in Rust nowadays, such as
the `wasmtime` crate!
2021-05-27 12:05:35 -05:00
Nick Fitzgerald
18fabd7700 bench-api: Allow multiple instantiations per compilation
We used to allow at most one instantiation per compilation, but there is no
fundamental reason why that should be the case. Allowing multiple instantiations
per compilation allows us to, for example, benchmark repeated instantiation
within Wasmtime's pooling allocator.

This additionally switches to using host functions for WASI and for
`bench_{start,end}` rather than defining them on the linker, this way we can use
a new store for every instantiation and don't need to keep other instances alive
when instantiating new instances.

Finally, we switch all timing to be done through callback functions, rather than
having the bench API caller implicitly start/end timers around bench API
calls. This allows us to more precisely measure phases and exclude things like
file I/O performed when creating a WASI context.
2021-05-24 16:53:22 -07:00
Nick Fitzgerald
ba6635dba0 bench-api: Pass in explicit stdin/stdout/stderr
Instead of inheriting stdio, pass in explicit file paths that are opened for
reading (stdin) or writing (stderr/stdout). This will allow sightglass to assert
that benchmarks produce the expected output.
2021-05-24 15:20:10 -07:00
Nick Fitzgerald
13741284b3 bench-api: Add a feature for the old x86_64 backend
This makes it easier to benchmark old vs new backends.
2021-05-24 15:20:10 -07:00
Chris Fallin
ca39f954da Remove reference to non-existent README.md in wasi-tokio crate 2021-05-21 14:08:28 -07:00
Chris Fallin
95559c01aa Merge pull request from GHSA-hpqh-2wqx-7qp5
Fix spillslot reload of narrow values: zero-extend, don't sign-extend. Release v0.74.0 as security-patch release.
2021-05-21 12:01:55 -07:00
Pat Hickey
0f5bdc6497 only wasi_cap_std_sync and wasi_tokio need to define WasiCtxBuilders (#2917)
* wasmtime-wasi: re-exporting this WasiCtxBuilder was shadowing the right one

wasi-common's WasiCtxBuilder is really only useful wasi_cap_std_sync and
wasi_tokio to implement their own Builder on top of.

This re-export of wasi-common's is 1. not useful and 2. shadow's the
re-export of the right one in sync::*.

* wasi-common: eliminate WasiCtxBuilder, make the builder methods on WasiCtx instead

* delete wasi-common::WasiCtxBuilder altogether

just put those methods directly on &mut WasiCtx.

As a bonus, the sync and tokio WasiCtxBuilder::build functions
are no longer fallible!

* bench fixes

* more test fixes
2021-05-21 12:59:39 -05:00
theduke
817d72a7b7 Implement std::fmt::Debug for InterruptHandle (#2915) 2021-05-21 10:54:47 -05:00
Chris Fallin
88455007b2 Bump Wasmtime to v0.27.0 and Cranelift to v0.74.0. 2021-05-20 14:06:41 -07:00
Till Schneidereit
3b3b126fe2 Refer to BA security policy (#2912) 2021-05-19 18:24:42 +02:00
Peter Huene
18c61cdfa4 Merge pull request #2900 from peterhuene/benchmark-instantiation
Implement simple benchmarks for instantiation.
2021-05-17 16:52:13 -07:00
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
Peter Huene
1b8efa7bbd Implement simple benchmarks for instantiation.
This adds benchmarks around module instantiation using criterion.

Both the default (i.e. on-demand) and pooling allocators are tested
sequentially and in parallel using a thread pool.

Instantiation is tested with an empty module, a module with a single page
linear memory, a larger linear memory with a data initializer, and a "hello
world" Rust WASI program.
2021-05-13 19:27:39 -07: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