Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge with upstream #266

Merged
merged 22 commits into from
Dec 5, 2024
Merged

Merge with upstream #266

merged 22 commits into from
Dec 5, 2024

Conversation

dhil
Copy link
Member

@dhil dhil commented Dec 5, 2024

No description provided.

alexcrichton and others added 22 commits December 3, 2024 15:39
* Update QEMU used in CI

I'm getting segfaults on s390x in bytecodealliance#9702 and I can't reproduce them
locally in QEMU. Try updating QEMU to see if it's a transient bug.
Historical updates haven't always gone well, so let's see what CI says.

prtest:full

* Update risc-v qemu arguments
In upcoming work we're going to centralize memory management inside `Mmap`.  In
order to do that, we need memory that logically borrows from the `Mmap` to have
access to it. That turns out to be possible in some situations but very
difficult in others (see bytecodealliance#9681 for an attempt that was a real hassle to get
working).

To prepare for this work, start moving these uses to be behind `Arc`. These
aren't cloned at the moment, but they will be in the future.
…ance#9712)

* Burn down the `allow_attributes_without_reason` backlog

Just a bit, not everything fixed.

* Fix wasi-nn annotations

* Tweak `#[cfg]`
* Rely on `core::error::Error`

With Wasmtime's new MSRV at 1.81 this means that `core::error::Error` is
available which means that in `no_std` mode the `Error` trait can be
used. This has been integrated into `anyhow::Error` already upstream and
means that we can remove our own local hacks such as the `Err2Anyhow` trait.

This commit removes the `Err2Anyhow` trait and all usage, going back to
idiomatic Rust error propagation and conversion even in the `no_std`
world. This should make code more portable by default and remove some
weird idioms we had for supporting this.

prtest:full

* Add some trusted vets

* Audit object crate update

* Disable backtraces on CI
* pulley: Implement `get_frame_pointer`

This commit implements the CLIF `get_frame_pointer` instruction which
will be needed by trampolines in Wasmtime. This is implemented by
generalizing the preexisting `GetSp` `MInst` into a "get special". This
the additionally removes the extended `get_sp` opcode in Pulley as it's
not necessary as `xmov` can operate on this register.

* Review comments
Fill out `get_return_address` lowering in Cranelift.
This fixes the output of the pulley cranelift backend with respect to
virtual stack offsets and adjustments for calls with stack parameters
and results. Previously the virtual stack pointer was updated but the
rest of the backend assumed the real stack pointer was updated. This
updates the pulley backend to match the other backends in this respects
and fixes a test on my "more complete pulley integration" branch.
…yout (bytecodealliance#9697)

* cranelift-entity: Make PackedOption and EntityList have guaranteed layout

* cranelift-entity: Add docs for PackedOption and EntityList layout
For the larger test/build jobs use some variables in the `*.js` files
calculating the matrix to pin the images to fixed versions of GitHub
actions images. For the `main.yml` file instead of changing everything
over to a pin only do the ones that are currently failing on the
`ubuntu-24.04` update. The hope is that there's only a few locations to
update pinned versions in the future, and we'll need to keep an eye on
CI warnings and such to know when to update these pins in the future.
Unsure what will happen, but it probably can't break things too much...
right?

cc bytecodealliance#9698
On s390x, the unwound SP is always at current CFA - 160.  Therefore,
the default rule used on most other platforms (which sets the
unwound SP to the current CFA) is incorrect, so we need to provide
an explicit DWARF CFI rule to unwind SP.

With the platform ABI, the caller's SP is always stored in the
register save area like other call-saved GPRs, so we can simply
use a normal DW_CFA_offset rule.  However, with the new tail-call
ABI, the value saved in that slot is incorrect - it is not
corrected for the incoming tail-call stack arguments that will
have been removed as the tail call returns.

To fix this without introducing unnecessary run-time overhead,
we can simply use a DW_CFA_val_offset rule that will set the
unwound SP to CFA - 160, which is always correct.  However, the
current UnwindInst abstraction does not allow any way to generate
this DWARF CFI instruction.  Therefore, we introduce a new
UnwindInst::RegStackOffset rule for this purpose.

Fixes: bytecodealliance#9719
Manually updating some images after the pinning in bytecodealliance#9717. There's a few
more images after this but this should be the lion's share of the update.

prtest:full
…nce#9709)

This commit is a follow-up to
bytecodealliance#9472.
It ensures that the fuel checking code makes use of `Context::without`
to retrieve the current fuel register.

Even though no issues have been found, it is preferable to use
`Context::without` in scenarios in which we have to introduce special
out-of-band control flow and function calls to ensure that all the
register allocation invariants are respected i.e., avoid holding onto to
registers that: are not  in the stack and that might be needed for
function calls.
Update from Ubuntu 22.04 to Ubuntu 24.04, and update the version of
clang used accordingly.
…liance#9718)

* pulley: Fill out more bits and pieces of stack allocation

* Use `push_frame` and `pop_frame` in the Cranelift backend.
* Use dedicated instructions for modifying the stack pointer
  * decrementing the stack pointer is always checked
  * incrementing the stack pointer is checked in debug mode
* Disregard stack probes and stack_limit checks as they're both
  unnecessary for Pulley (all stack allocations are checked).

* Fix pulley fuzz

* Fix some tests from a rebase

* Fix more tests
…#9721)

* Add basic pulley disassembly support to `clif-util`

Helpful when running `clif-util compile -D --target pulley64` over the
input.

* Fix non-pulley build
This commit addresses issues identified while working on issue bytecodealliance#8091. It
improves the frame handling in Winch to prevent subtle bugs and enhance
the robustness of the code generation process.

Previously, there was no clear mechanism to verify when the frame was
fully set up and safe to access the local slots allocated for register
arguments, including the special slots used for the `VMContext`. As
a result, it was possible to inadvertently read from uninitialized
memory if calls were made before the frame was properly set up and
sealed.

This commit introduces two main changes with the objective to help
reduce the risk of introducing bugs related to the above:

* A `CodeGenPhase` trait, used via the type state pattern to clearly
  gate the operations allowed during each phase of the code generation
  process.

* Improve the semantics of locals, by clearly separating the notion of
  Wasm locals and special locals used by the compiler. This
  specialization allows a more accurate representation of the semantics
  of Wasm locals and their index space.
… Wasmtime. (bytecodealliance#9689)

This PR allows a `no_std` Wasmtime build to be configured with the
`async` feature. (Previously, a minimal `no_std` configuration could
only run with sync entry points, without suspending of stacks.)

The main hurdle to this support was the `wasmtime-fiber` crate.
Fortunately, the "unix" variant of fibers was almost entirely portable
to a `no_std` environment, owing to the fact that it implements
stack-switching manually in assembly itself. I moved the per-ISA
implementations to a shared submodule and built the nostd platform
backend for `wasmtime-fiber` with a stripped-down version of the unix
backend.

The nostd backend does not support mmap'd stacks, does not support
custom stack allocators, and does not propagate panics.

prtest:full
@dhil dhil merged commit 55a486a into wasmfx:main Dec 5, 2024
57 checks passed
@dhil dhil deleted the wasmfx-merge branch December 5, 2024 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants