Commit Graph

8205 Commits

Author SHA1 Message Date
Pat Hickey
b307dce2ab add readable and writable futures to WasiFile trait 2021-04-26 14:43:16 -07:00
Pat Hickey
fa44ec2da2 tokio sched: comment out just to make it compile 2021-04-26 14:42:22 -07:00
Pat Hickey
27464c85f4 cargo.lock 2021-04-19 16:00:56 -07:00
Pat Hickey
3d3a2acc1b wasi-tokio: WIP need to port the sync scheduler into a spawn_blocking 2021-04-19 16:00:38 -07:00
Pat Hickey
8667d8c244 test-programs: test wasi-tokio 2021-04-19 16:00:27 -07:00
Pat Hickey
675b579361 use AsyncSeek 2021-04-19 14:35:46 -07:00
Pat Hickey
d2a98ced53 use some better traits 2021-04-15 16:00:11 -07:00
Pat Hickey
9880d09f1f do some programming 2021-04-15 14:50:17 -07:00
Pat Hickey
33dbd4388c use tokio's File with a cap-std Dir 2021-04-15 11:39:11 -07:00
Pat Hickey
2ddf4c1da9 tokio example requires enabling a cargo feature
and also a dummy C example
2021-04-14 16:54:52 -07:00
Pat Hickey
7202494e9d fix windows sched 2021-04-14 16:17:21 -07:00
Pat Hickey
b883bda022 fix test-programs for sync wasi 2021-04-14 16:06:50 -07:00
Pat Hickey
2f0c7e59e7 wasmtime-wasi: all funcs are async now 2021-04-14 16:04:41 -07:00
Pat Hickey
c0e89b8da8 wasi-cap-std-sync: WasiFile and WasiDir converted to async_traits 2021-04-14 15:43:19 -07:00
Pat Hickey
564e43d1b3 WasiDir: make all operations async 2021-04-14 15:22:25 -07:00
Pat Hickey
00e58567d9 WasiFile: all operations are now async
only fn as_any(&self) -> &dyn Any doesnt get to be async.
2021-04-14 15:17:31 -07:00
Pat Hickey
025a1ecff4 wasi-common: snapshots 0 and 1 traits are all async now 2021-04-14 15:05:38 -07:00
Pat Hickey
228096c840 wiggle: convenient syntax for marking all funcs async 2021-04-14 14:51:24 -07:00
Pat Hickey
0127676621 wasi-cap-std-async is better named wasi-tokio 2021-04-14 14:06:36 -07:00
Pat Hickey
c691d1864e fix 2021-04-14 09:54:27 -07:00
Pat Hickey
247795c7ca fix 2021-04-14 08:37:53 -07:00
Pat Hickey
759019811e add tokio example
Co-authored-by: Alex Crichton <alex@alexcrichton.com>
2021-04-13 17:52:52 -07:00
Pat Hickey
66251c2e78 c-api: always use synchronous wasi-common 2021-04-13 17:51:18 -07:00
Pat Hickey
bac02c50f2 port command and example to use sync wasmtime_wasi 2021-04-13 17:51:18 -07:00
Pat Hickey
2b7a93c403 wasmtime-wasi: two distinct definitions of the Wasi struct, when sync vs async 2021-04-13 17:51:18 -07:00
Pat Hickey
201da20c63 make wasmtime-wasi configurable at macro whether its real async or block_on 2021-04-13 17:51:18 -07:00
Pat Hickey
8f9fb1f4e2 make wasi-cap-std-async work with wasmtime-wasi 2021-04-13 17:51:18 -07:00
Pat Hickey
ac3b456523 wasi-cap-std-async: exactly like wasi-cap-std-sync but with a different WasiSched 2021-04-13 17:51:18 -07:00
Pat Hickey
22d18ffb0d cap-std-sync: async-trait e-paperwork 2021-04-13 17:51:18 -07:00
Pat Hickey
68daec7e7d wasi-common: WasiSched is an async trait now; poll_oneoff and sched_yield are async methods 2021-04-13 17:51:18 -07:00
Pat Hickey
c62d7f9ea1 wasmtime_wiggle: when async feature is disabled, run async on dummy executor 2021-04-13 17:51:18 -07:00
Andrew Brown
45bee40f33 wasi-nn: use the newly-published Rust bindings for wasi-nn
The bindings are now published on [crates.io](https://crates.io/crates/wasi-nn) and have been moved to their [own repository](https://github.com/bytecodealliance/wasi-nn).
2021-04-13 16:00:06 -07:00
Andrew Brown
e9e4afe2c7 wasi-nn: use the MobileNet model instead of AlexNet
The MobileNet model is significantly smaller in size (14MB) than the AlexNet model (233MB); this change should reduce bandwidth used during CI.
2021-04-13 16:00:06 -07:00
Chris Fallin
27b3162f87 Merge pull request #2833 from abrown/2826
x64: fix Inst::store to understand all scalar types
2021-04-13 15:36:41 -07:00
Chris Fallin
8caac9ed79 Merge pull request #2823 from akirilov-arm/callee_saves
Cranelift AArch64: Improve the handling of callee-saved registers
2021-04-13 15:35:46 -07:00
Chris Fallin
f222802b7a Merge pull request #2828 from bjorn3/fix_srem_i8
Fix srem.{i8,i16}
2021-04-13 15:35:40 -07:00
Andrew Brown
6bdef48473 x64: refactor to use Inst::store during lowering
This re-factoring replaces uses of `Inst::mov_r_m` with `Inst::store` to ensure there is only one code location to troubleshoot when generating store instructions for a specific type.
2021-04-13 13:09:07 -07:00
Andrew Brown
9b25b06d86 x64: store to all scalar sizes
Previously, `Inst::store` only understood a subset of the scalar types, which resulted in failures seen in #2826. This change allows `Inst::store` to generate instructions for all scalar widths (`8 | 16 | 32 | 64`) since all of these are supported in the emission code of `Inst::MovRM`.
2021-04-13 12:38:35 -07:00
bjorn3
b272d4b7da Fix srem.{i8,i16} 2021-04-13 21:28:27 +02:00
Anton Kirilov
7248abd591 Cranelift AArch64: Improve the handling of callee-saved registers
SIMD & FP registers are now saved and restored in pairs, similarly
to general-purpose registers. Also, only the bottom 64 bits of the
registers are saved and restored (in case of non-Baldrdash ABIs),
which is the requirement from the Procedure Call Standard for the
Arm 64-bit Architecture.

As for the callee-saved general-purpose registers, if a procedure
needs to save and restore an odd number of them, it no longer uses
store and load pair instructions for the last register.

Copyright (c) 2021, Arm Limited.
2021-04-13 20:23:08 +01:00
Chris Fallin
8387bc0d76 Merge pull request #2830 from cfallin/pin-nightly
CI: pin nightly Rust version to limit breakages to explicit pinning updates.
2021-04-13 12:06:44 -07:00
Chris Fallin
908d47011f CI: pin nightly Rust version to limit breakages to explicit pinning updates. 2021-04-13 11:12:07 -07:00
Chris Fallin
67cc42d4c3 Merge pull request #2750 from bjorn3/anon_allocs
Support declaring anonymous functions and data objects
2021-04-12 12:11:11 -07:00
Nick Fitzgerald
2a32567871 Merge pull request #2821 from alexcrichton/faster-vmoffsets
Precompute fields in `VMOffsets`
2021-04-08 14:17:11 -07:00
Alex Crichton
18dd82ba7d Improve signature lookup happening during instantiation (#2818)
This commit is intended to be a perf improvement for instantiation of
modules with lots of functions. Previously the `lookup_shared_signature`
callback was showing up quite high in profiles as part of instantiation.

As some background, this callback is used to translate from a module's
`SignatureIndex` to a `VMSharedSignatureIndex` which the instance
stores. This callback is called for two reasons, one is to translate all
of the module's own types into `VMSharedSignatureIndex` for the purposes
of `call_indirect` (the translation of that loads from this table to
compare indices). The second reason is that a `VMCallerCheckedAnyfunc`
is prepared for all functions and this embeds a `VMSharedSignatureIndex`
inside of it.

The slow part today is that the lookup callback was called
once-per-function and each lookup involved hashing a full
`WasmFuncType`. Albeit our hash algorithm is still Rust's default
SipHash algorithm which is quite slow, but we also shouldn't need to
re-hash each signature if we see it multiple times anyway.

The fix applied in this commit is to change this lookup callback to an
`enum` where one variant is that there's a table to lookup from. This
table is a `PrimaryMap` which means that lookup is quite fast. The only
thing we need to do is to prepare the table ahead of time. Currently
this happens on the instantiation path because in my measurments the
creation of the table is quite fast compared to the rest of
instantiation. If this becomes an issue, though, we can look into
creating the table as part of `SigRegistry::register_module` and caching
it somewhere (I'm not entirely sure where but I'm sure we can figure it
out).

There's in generally not a ton of efficiency around the `SigRegistry`
type. I'm hoping though that this fixes the next-lowest-hanging-fruit in
terms of performance without complicating the implementation too much. I
tried a few variants and this change seemed like the best balance
between simplicity and still a nice performance gain.

Locally I measured an improvement in instantiation time for a large-ish
module by reducing the time from ~3ms to ~2.6ms per instance.
2021-04-08 15:04:18 -05:00
Alex Crichton
c91e14d83f Precompute fields in VMOffsets
This commit updates the implementation of `VMOffsets` to frontload all
checked arithmetic on construction of the `VMOffsets` which allows
eliding all checked arithmetic when accessing the fields of `VMOffsets`.
For testing and such this adds a new constructor as well from a new
`VMOffsetsFields` structure which is a clone of the old definition.

This should help speed up some profile hot spots I've been seeing where
with all the checked arithmetic on field sizes this was slowing down the
various accessors during instantiation (which uses `VMOffsets` to
initialize various fields of the `VMContext`).
2021-04-08 12:46:17 -07:00
Andrew Brown
8e495ac79d x64: match multiple ISA requirements before emitting
Because there are instructions that are present in more than one ISA feature set, we need to see if any of the ISA requirements match before emitting. This change includes the `VPABSQ` instruction as an example, which is present in both `AVX512F` and `AVX512VL`.
2021-04-08 10:30:39 -07:00
Alex Crichton
c77ea0c5c7 Add some more #[inline] annotations for trivial functions (#2817)
Looking at some profiles these or their related functions were all
showing up, so this commit adds `#[inline]` to allow cross-crate
inlining by default.
2021-04-08 12:23:54 -05:00
Alex Crichton
5c4c03d278 Don't hash for the cache if it's disabled (#2816)
This fixes an issue where even if the wasmtime cache was disabled we're
still calculating the sha256 of modules for the hash key. This hash
was then simply discarded if the cache was disabled!
2021-04-08 11:48:24 -05:00
Alex Crichton
812c8ef368 Update wast to 35.0.2 (#2815)
Fixes a panic or two in translation found by fuzzing.
2021-04-08 11:45:10 -05:00