Commit Graph

8543 Commits

Author SHA1 Message Date
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
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
Chris Fallin
ed20e4070f Merge pull request #3057 from bjorn3/display_setting_value
Implement Display for settings::Value
2021-07-03 12:03:05 -07:00
bjorn3
37115c10e0 Implement Display for settings::Value 2021-07-03 14:34:42 +02:00
Benjamin Bouvier
93b7cdd6a2 Fix a few typos in the architecture doc (#3054) 2021-07-02 13:09:58 -05:00
Chris Fallin
518ce2512d Merge pull request #3055 from bnjbvr/ben-dce
Remove some dead code in Cranelift
2021-07-02 10:07:05 -07:00
Benjamin Bouvier
4c595f4f9d Remove unused store_stackslot/load_stackslot trait methods. 2021-07-02 18:09:33 +02:00
Benjamin Bouvier
91c65d739f Remove unused code in machinst 2021-07-02 18:09:33 +02:00
Alex Crichton
aa5d837428 Start a high-level architecture document for Wasmtime (#3019)
* Start a high-level architecture document for Wasmtime

This commit cleands up some existing documentation by removing a number
of "noop README files" and starting a high-level overview of the
architecture of Wasmtime. I've placed this documentation under the
contributing section of the book since it seems most useful for possible
contributors.

I've surely left some things out in this pass, and am happy to add more!

* Review comments

* More rewording

* typos
2021-07-02 09:02:26 -05:00
Afonso Bordado
ce537cf431 cranelift: Add fuel mechanism to the interpreter 2021-07-02 06:26:16 -07:00
Chris Fallin
f2d2f3a841 Merge pull request #3044 from akirilov-arm/simd_i32x4_trunc_sat_f64x2
Enable the simd_i32x4_trunc_sat_f64x2 test for AArch64
2021-07-01 09:28:39 -07:00
Alex Crichton
b9985fe2e5 Change the injection count of fuel in a store from u32 to u64 (#3048)
* Change the injection count of fuel in a store from u32 to u64

This commit updates the type of the amount of times to inject fuel in
the `out_of_fuel_async_yield` to `u64` instead of `u32`. This should
allow effectively infinite fuel to get injected, even if a small amount
of fuel is injected per iteration.

Closes #2927
Closes #3046

* Fix tokio example
2021-07-01 10:46:21 -05:00
Afonso Bordado
7453bd5f0d Cranelift CLIF-level differential fuzzer (#3038)
* cranelift: Initial fuzzer implementation

* cranelift: Generate multiple test cases in fuzzer

* cranelift: Separate function generator in fuzzer

* cranelift: Insert random instructions in fuzzer

* cranelift: Rename gen_testcase

* cranelift: Implement div for unsigned values in interpreter

* cranelift: Run all test cases in fuzzer

* cranelift: Comment options in function_runner

* cranelift: Improve fuzzgen README.md

* cranelift: Fuzzgen remove unused variable

* cranelift: Fuzzer code style fixes

Thanks! @bjorn3

* cranelift: Fix nits in CLIF fuzzer

Thanks @cfallin!

* cranelift: Implement Arbitrary for TestCase

* cranelift: Remove gen_testcase

* cranelift: Move fuzzers to wasmtime fuzz directory

* cranelift: CLIF-Fuzzer ignore tests that produce traps

* cranelift: CLIF-Fuzzer create new fuzz target to validate generated testcases

* cranelift: Store clif-fuzzer config in a separate struct

* cranelift: Generate variables upfront per function

* cranelift: Prevent publishing of fuzzgen crate
2021-07-01 06:32:01 -07:00
Benjamin Bouvier
a603fc5bd5 Add a way to display only the trap's reason (without the backtrace) (#3033) 2021-06-30 09:34:47 -05:00
Tshepang Lekhonkhobe
a3e08ee535 this option is default since early 2018 (#3042)
WASI was only added in Rust about a year from then
2021-06-30 09:34:34 -05:00
Afonso Bordado
a4770a7e28 cranelift: Prevent overflow errors in interpreter for add,sub,mul 2021-06-30 06:32:16 -07:00
Anton Kirilov
330f02aa09 Enable the simd_i32x4_trunc_sat_f64x2 test for AArch64
Also, reorganize the AArch64-specific VCode instructions for unary
narrowing and widening vector operations, so that they are more
straightforward to use.

Copyright (c) 2021, Arm Limited.
2021-06-30 12:17:53 +01:00
Alex Crichton
c5609bc364 Update documentation of enter/exit hooks (#3041)
Clarify that they're executed not only around imports but also around
function calls. Additionally spell out the semantics around traps a bit
more clearly too.
2021-06-29 12:57:39 -05:00
Johnnie Birch
1acb40b2aa Fix return type of for truc_sat and convert instructions
Type_of says is to determine the return value for a webassembly
operator. Truc_sat and convert simd instructions appear to be misplaced.
2021-06-28 15:20:39 -07:00
Chris Fallin
522cc8aa84 Merge pull request #3035 from akirilov-arm/simd_i16x8_q15mulr_sat_s
Enable the simd_i16x8_q15mulr_sat_s test on AArch64
2021-06-28 09:49:52 -07:00
Anton Kirilov
98f1ac789e Enable the simd_i16x8_q15mulr_sat_s test on AArch64
Copyright (c) 2021, Arm Limited.
2021-06-28 12:24:31 +01:00