Skip to content

Stack switching cranelift and tests (Pre-Review)#3

Open
posborne wants to merge 35 commits into
mainfrom
stack-switching-cranelift-and-tests
Open

Stack switching cranelift and tests (Pre-Review)#3
posborne wants to merge 35 commits into
mainfrom
stack-switching-cranelift-and-tests

Conversation

@posborne

@posborne posborne commented Jun 9, 2025

Copy link
Copy Markdown
Owner

Throwing this up for review of test failures/etc. prior to upstream PR.

frank-emrich and others added 7 commits June 10, 2025 16:17
This initial commit represents the "pr2" base commit with
minimal merge conflicts resolved.  Due to OOB conflicts, this
commit is not functional as-is, but using it as a base in
order to allow for easier reviewing of the delta from
this commit to what will be used for the PR against upstream.

Co-authored-by: Daniel Hillerström <daniel.hillerstrom@ed.ac.uk>
Co-authored-by: Paul Osborne <paul.osborne@fastly.com>
This first set of changes updates the base pr in order to
compiled and pass basic checks (compile, clippy, fmt) with
the biggest part of the change being to eliminate injection
of tracing/assertions in JIT'ed code.
At this point, the only bit we really branch on is what we
do in order to avoid problems tying into wasmtime_environ.
This is basd on the approach and macro used by the gc code for
converting presence/absence of the cranelift feature flag to
cranelift compile time.  This is a bit of a half-measure for now
as we still compile most stack-switching code in cranelift, but
this does enough to avoid causing problems with missing definitions
in wasmtime_environ.
Replace either with infallible From or fallible, panicing
TryFrom alternatives where required.
After removing emission of runtime trace logging and assertions,
there were several unused parameters.  Remove those from the
ControlEffect signatures completely.
This matches a change to the mirrored runtime type in
the upstream changes.
@posborne
posborne force-pushed the stack-switching-cranelift-and-tests branch from a944408 to 38e35b8 Compare June 10, 2025 16:18
posborne and others added 21 commits June 11, 2025 13:27
Co-authored-by: Daniel Hillerström <daniel.hillerstrom@ed.ac.uk>
The extra parameters here used to be used for emitting runtime
assertions, but with those gone we just had unused params
and lifetimes, clean those out.
There's already a stub elsewhere and this is not called, when
exceptions are added and it is time to revisit, this method
can be restored.
Rename VMHostArray -> VMHostArrayRef
Change impl to compute address with offset upfront rather than
on each load.
This matches the directory structure for gc and aids in visibility
for a few members required by stack-switching code in cranelift.
…nelift

As part of this, updated translate_ref_is_null to
use the wasm type rather than brancing on the ir type
being an i128.
In the course of the various runtime updates, the layout of the
runtime VMContObj got switched around.  This resulted in failures
when doing certain table operations on continuations.

This change fixes that layout problem and adds some tests with
offsets to avoid the problem.  Due to the way that we interact
with the VMContObj in cranelift, we don't use these offsets outside
of the tests.
This method isn't required as sized_stack_slots is already pub.
@posborne
posborne force-pushed the stack-switching-cranelift-and-tests branch from 38e35b8 to e6ab7f2 Compare July 14, 2025 22:33
@posborne
posborne force-pushed the stack-switching-cranelift-and-tests branch 5 times, most recently from 2f736e7 to 692cc9f Compare July 16, 2025 18:36
posborne and others added 6 commits July 21, 2025 18:49
…nelift

Resolved a few conflicts manually, blessed disas tests,
and made a few non-conflicting updates to func_environ.rs
and code_translator.rs (but pretty trivial).
This change migrates VMContObj and its usages in cranelift and runtime
to work with the VMContObj fat pointer as two words in order to better
target different architectures (still gated to x86_64 for now).

To support this, a size type was plumbed into the builtins function
signature types (as is done for component types) that maps to
usize.
(cherry picked from commit 2121568)
Signed-off-by: Paul Osborne <paul.osborne@fastly.com>

stack-switching: update stack-switch dwarf test to work with latest suite framework

Updates to work through test failures

Mostly restricting the cases in which we'll try to run various test
cases to only be x64 linux for now.

fuzzing: Fix plumbing of configuration for stack-switching

Fix VMContObj alignment on 32-bit targets

fmt

Adjust wast tests for stack-switching

Trying a different wast setup for mac x86_64

try unix instead of linux for wast should_fail

fmt
@posborne
posborne force-pushed the stack-switching-cranelift-and-tests branch from 9f3029c to 2bccb93 Compare August 27, 2025 17:15
This type is not fully complete until continuation/gc integration
is revisited (bytecodealliance#10248) but without these changes, test cases are
now failing on panics as we need some representation of
continuation references in the runtime Val enumeration.

Runtime errors with TODO notes are added for the stubbed
code paths to revisit later.
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.

2 participants