Commit Graph

8562 Commits

Author SHA1 Message Date
Alex Crichton
c8950cf842 Update nightly toolchains in CI (#3097)
This will hopefully fix CI issues we've been seeing with downloads
2021-07-19 13:20:52 -05:00
Afonso Bordado
3a38400447 aarch64: Refactor lower_icmp to use a single materialize_bool_result 2021-07-19 09:31:14 -07:00
Afonso Bordado
14d1c7ee9f aarch64: Refactor lower_icmp to allow returning a different flag 2021-07-19 09:31:14 -07:00
Afonso Bordado
7526cdc65e cranelift: Use ValueConversionKind in branches 2021-07-19 09:31:14 -07:00
Afonso Bordado
037bd41c67 cranelift: Rename Interpreter overflow method 2021-07-19 09:31:14 -07:00
Afonso Bordado
e628fb376f aarch64: Fix incorrect code generation for overflow icmp in i16 values 2021-07-19 09:31:14 -07:00
Afonso Bordado
04033fe645 cranelift: Implement overflow flags for icmp in interpreter 2021-07-19 09:31:14 -07:00
Afonso Bordado
c42b725ce9 cranelift: Fix br_icmp in interpreter 2021-07-19 09:31:14 -07:00
Afonso Bordado
004af01a88 cranelift: Fix brz,brnz instructions in the interpreter 2021-07-19 09:31:14 -07:00
Pat Hickey
d33f8337b3 Merge pull request #3096 from crab2313/riscv-disassemble
Riscv disassembler support
2021-07-19 09:27:49 -07:00
Qiu Wenbo
eafd10c1e8 Disassembler support for RV32/64 2021-07-19 18:20:20 +08:00
Qiu Wenbo
f628d06118 Upgrade capstone to v0.9 2021-07-19 17:14:28 +08:00
Afonso Bordado
db5566dadb aarch64: Fix lowering amounts for shifts
This commit addresses two issues:
* A panic when shifting any non i128 type by i128 amounts (#3064)
* Wrong results when lowering shifts with small types (i8, i16)

In these types when shifting for amounts larger than the size of the
type, we would not get the wrapping behaviour that we see on i32 and i64.
This is because in these larger types, the wrapping behaviour is automatically
implemented by using the appropriate instruction, however we do not
have i8 and i16 specific instructions, so we have to manually wrap
the shift amount with an AND instruction.

This issue is also found on x86_64 and s390x, and a separate issue will
be filed for those.

Closes #3064
2021-07-16 22:08:02 +01:00
Anton Kirilov
6c3d7092b9 Enable the simd_conversions test for AArch64
Copyright (c) 2021, Arm Limited.
2021-07-16 22:04:45 +01:00
Alex Crichton
ff1ae6e10c Flag another error as ok to hit when fuzzing (#3092)
We've got a lot of fuzz failures right now of modules instantiating
memories of 65536 pages, which we specifically disallow since the
representation of limits within Wasmtime don't support full 4GB
memories. This is ok, however, and it's not a fuzz failure that we're
interested in, so this commit allows strings of that error to pass
through the fuzzer.
2021-07-16 14:37:27 -05:00
Pat Hickey
83f7872ace Merge pull request #3090 from bytecodealliance/pch/wiggle_dummy_executor_crashes
wiggle: dummy executor traps instead of panics, improve testing
2021-07-16 11:34:56 -07:00
Pat Hickey
906182a304 fix wasi-tokio 2021-07-16 10:28:09 -07:00
Pat Hickey
4fa4a72328 wiggle: expand test suite
sync test: show the dummy executor will trap (rather than panic) when a
future inside it pends.

async test: show that the executor is hooked up to a future that pends
for a trivial amount of time.

this adds tokio to the dev-dependencies of wiggle, it shouldn't end up
increasing the build burden for the project as a whole since its already
a dev-dependency.
2021-07-16 09:32:43 -07:00
Alex Crichton
3da677796b Reword env var hint for dwarf debug info (#3081)
* Reword env var hint for dwarf debug info

Try not to declare that more information will indeed be displayed,
instead suggest that the output may improve if the env var is set since
dwarf debug info wasn't parsed.

cc bytecodealliance/wasmtime-go#90

* Fix test assertion
2021-07-15 16:33:47 -05:00
Pat Hickey
6f07c76c84 wiggle: make the dummy executor return a trap rather than panic
when configured improperly
2021-07-15 11:44:58 -07:00
Stephan Renatus
f3b80ece5f c-api: add wasmtime_trap_code (#3086)
Eventually this should be added to the wasmtime-go binding, addressing
https://github.com/bytecodealliance/wasmtime-go/issues/63.

Added a snippet to examples/interrupt.c to verify that this works as
expected in manual testing.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2021-07-15 10:31:03 -05:00
Johnnie Birch
2452a4cd74 Refactor lowering structure for ext_mul on x64 and add comments 2021-07-15 01:07:52 -07:00
Johnnie Birch
e5b6bee968 Add emit tests to ext_mul_* instructions 2021-07-15 01:07:52 -07:00
Johnnie Birch
6fbe0b72bd Add simd_extmul_* support for x64 2021-07-15 01:07:52 -07:00
Dan Gohman
6a5a295019 Port wasi-common from unsafe-io to io-lifetimes (#3049)
* Port wasi-common to io-lifetimes.

This ports wasi-common from unsafe-io to io-lifetimes.

Ambient authority is now indicated via calls to `ambient_authority()`
from the ambient-authority crate, rather than using `unsafe` blocks.

The `GetSetFdFlags::set_fd_flags` function is now split into two phases,
to simplify lifetimes in implementations which need to close and re-open
the underlying file.

* Use posish for errno values instead of libc.

This eliminates one of the few remaining direct libc dependencies.

* Port to posish::io::poll.

Use posish::io::poll instead of calling libc directly. This factors out
more code from Wasmtime, and eliminates the need to manipulate raw file
descriptors directly.

And, this eliminates the last remaining direct dependency on libc in
wasi-common.

* Port wasi-c-api to io-lifetimes.

* Update to posish 0.16.0.

* Embeded NULs in filenames now get `EINVAL` instead of `EILSEQ`.

* Accept either `EILSEQ` or `EINVAL` for embedded NULs.

* Bump the nightly toolchain to 2021-07-12.

This fixes build errors on the semver crate, which as of this writing
builds with latest nightly and stable but not 2021-04-11, the old pinned
version.

* Have cap-std-sync re-export ambient_authority so that users get the same version.
2021-07-14 15:39:09 -07:00
Alex Crichton
13d317a0a8 Fix stack checks of recursive async function calls (#3088)
* Fix stack checks of recursive async function calls

Previously the stack pointer limit wasn't adjusted, even in the face of
stack switching. This commit updates the logic around the stack limit
calculation to configure it on all async function calls, even if they're
recursive. Synchronous function calls, however, continue to only
configure the stack limit at the start, not for recursive calls.

* Update crates/wasmtime/src/func.rs

Co-authored-by: Peter Huene <peter@huene.dev>

Co-authored-by: Peter Huene <peter@huene.dev>
2021-07-14 16:32:30 -05:00
Alex Crichton
73fd702bb7 Don't assume all custom sections are dwarf info (#3083)
This incorrectly assumed that we had unparsed dwarf information,
regardless of custom section name. This commit updates the logic to
calculate that by first checking the section name before we set the flag
indicating that there's unparsed debuginfo.
2021-07-13 15:53:17 -05:00
Alex Crichton
992d85ae8b Add a type parameter to VMOffsets for pointer size (#3020)
* Add a type parameter to `VMOffsets` for pointer size

This commit adds a type parameter to `VMOffsets` representing the
pointer size to improve computations in `wasmtime-runtime` which always
use a constant value of the host's pointer size. The type parameter is
`u8` for `wasmtime-cranelift`'s use case where cross-compilation may be
involved.

* fix lightbeam
2021-07-13 09:52:27 -05:00
Peter Huene
75e5219792 Merge pull request #3034 from alexcrichton/update-config
Update documentation in Config about Send futures
2021-07-12 18:39:04 -07:00
Peter Huene
7f7bee1648 Merge pull request #3078 from CBenoit/wasmtime-store-doc-typo
wasmtime: fix typo in `Store` doc
2021-07-12 18:34:56 -07:00
Benoît CORTIER
cfeaa95b54 wasmtime: fix typo in Store doc 2021-07-12 21:28:15 -04:00
Ulan Degenbaev
f08491eeca Restore POSIX signal handling on MacOS behind a feature flag (#3063)
* Restore POSIX signal handling on MacOS behind a feature flag

As described in Issue #3052, the switch to Mach Exception handling
removed `unix::StoreExt` from the public API of crate on MacOS.
That is a breaking change and makes it difficult for some
application to upgrade to the current stable Wasmtime.

As a workaround this PR introduces a feature flag called
`posix-signals-on-macos` that restores the old behaviour on MacOS.
The flag is disabled by default.

* Fix test guard

* Fix formatting in the test
2021-07-12 16:25:44 -05:00
Alphyr
808582826b Enable nightly doc features on docs.rs (#3076) 2021-07-12 09:24:55 -05:00
Olivier Lemasle
65a902f49d [doc] Update go example (#3065) 2021-07-12 09:01:44 -05:00
Andrew Brown
a83497e0b0 [doc] Add LLDB tips and tricks 2021-07-09 15:45:28 -07:00
Johnnie Birch
d8e813204e Fold fcvt_low_from_uinit into previously existing clif instructions 2021-07-09 10:39:05 -07:00
Johnnie Birch
6dd2df4fb3 Update comment on fcvt_low_from_sint instruction 2021-07-09 10:39:05 -07:00
Johnnie Birch
2d676d838f Implements f64x2.convert_low_i32x4_u for x64 2021-07-09 10:39:05 -07:00
Andrew Brown
16379db174 [doc] Add filler text to examples landing page 2021-07-09 06:22:25 -07:00
Andrew Brown
e5d25bc216 [doc] Add some documentation for debugging
The previous documentation only covers how to enable debug info when
embedding Wasmtime. This change should cover the commonly-asked
question: how do I debug in Wasmtime?
2021-07-09 06:22:25 -07:00
Nick Fitzgerald
1ba6503d5c Merge pull request #3071 from peterhuene/fix-c-api
Add setter for enabling multi-memory to the C API.
2021-07-08 13:53:45 -07:00
Peter Huene
5d92b75b8f Add multimemory example.
Add an example that deals with multiple memories in a single Wasm module.
2021-07-08 11:49:06 -07:00
Peter Huene
08575a8b5e Add setter for enabling multi-memory to the C API.
This commit adds `wasmtime_config_wasm_multi_memory_set` to the C API.

Fixes #3066.
2021-07-08 11:05:51 -07:00
Chris Fallin
040d48128c Merge pull request #3069 from bnjbvr/upgrade-tokio
Upgrade Tokio to 1.8.1
2021-07-08 09:13:42 -07:00
Benjamin Bouvier
b0ce0c8f5d Upgrade Tokio to 1.8.1
This contains a fix for a vulnerability reported as RUSTSEC-2021-0072.
2021-07-08 12:13:53 +02:00
Peter Huene
89ed663058 Merge pull request #3068 from fitzgen/error-msg-off-by-one
Fix error messages reporting number of expected vs actual params
2021-07-07 17:50:13 -07:00
Andrew Brown
43b9337162 Fix typo
Also, the IDE auto-formatted the length of several other comments.
2021-07-07 12:07:04 -07:00
Nick Fitzgerald
be60fec6ba Fix error messages reporting number of expected vs actual params
We previously had some off-by-one errors in our error messages and this led to
very confusing messages like "expected 0 types, found 0" that were quite
annoying to debug as an API consumer.
2021-07-07 11:32:40 -07:00
Chris Fallin
c71ad9490e Merge pull request #3056 from afonso360/aarch64-fix-overflow-imm
aarch64: Fix incorrect encoding of large const values in icmp.
2021-07-03 16:05:49 -07:00
Afonso Bordado
eebae8d4c8 aarch64: Fix incorrect encoding of large const values in icmp.
When encoding constants as immediates into an RSE Imm12 instruction we need to take special care to check if the value that we are trying to input does not overflow its type when viewed as a signed value. (i.e. iconst.i8 200)

We cannot both put an immediate and sign extend it, so we need to lower it into a separate reg, and emit the sign extend into the instruction.

For more details see the [cg_clif bug report](https://github.com/bjorn3/rustc_codegen_cranelift/issues/1184#issuecomment-873214796).
2021-07-03 22:42:15 +01:00