Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Merge with upstream main branch#106

Merged
alexcrichton merged 158 commits into
bytecodealliance:mainfrom
alexcrichton:merg-emain
Apr 4, 2025
Merged

Merge with upstream main branch#106
alexcrichton merged 158 commits into
bytecodealliance:mainfrom
alexcrichton:merg-emain

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

Current merge commit is an attempt, I'm probably going to have to push updates here.

fitzgen and others added 30 commits February 27, 2025 21:56
Debug into doesn't work on Pulley anyway but it's better to return a
first-class error rather than a panic. This commit fills out a simple
missing instruction in the Pulley backend to ensure that compilation
gets far enough to the DWARF transform where there's no pulley support
and an error is returned.
This commit improves the logic of detecting when to rebuild the
`test-programs` artifacts used during test by parsing the `*.d` files
that Cargo emits as part of its compilation and using that as the
`cargo:rerun-if-changed` directive. This not only includes what was
previously depended on but additionally includes features such as `path`
dependencies which might temporarily be used during development.
I always forget this and it always bites us within a few months. Alas.
This commit updates the aarch64 tests to use the new `*-arm` images from
GitHub instead of running through QEMU emulation. This should be a bit
faster but primarily helps build confidence that it runs on real
hardware.

I'll note that release builds aren't updated at this time to run on
native hardware since that's moreso about glibc compatibility and it's a
bit easier to keep the setup we currently have for that. If `*-arm`
machines are noticably faster than the default x64 machines then we
could in theory move everything over to an aarch64-based machine as
opposed to just the aarch64 build.
Signed-off-by: shenpengfeng <xinhangzhou@icloud.com>
Way back in time, this struct originally contained the stack and fuel
limits. Then it also got the epoch deadline. Then it also got the exit FP/PC and
entry FP. Now it is just the place where we put per-store mutable data that is
accessed by JIT code and must be shared between all `VMContext`s. So it is time
to rename it.

This commit is purely mechanical and just renames the type and various methods
and variables that use/access it.
…ace (#10311)

* wasmtime-wit-bindgen: emit a definition for all types in a wit

The calculation of TypeInfo only reaches types which are passed to or
from a function. For types which are not reachable, default to the
defining them according to the ownership setting given to bindgen.

I have my doubts that `with`-reuse of bindgen types actually works
properly when bindgen is set to Ownership::Borrowing but thats out
of scope for this PR, which is to fix #10090

* component-macro: bless bindgen test output
* sse orpd implementation

assembler integration with isle

format

add clippy reason, reorder avx priority in isle

bless tests for orpd

create separate xmm module

validate function rewrite sse condition

add quote from manual for sse prefix

format changes

move Xmm bits under Reg

* use new isle constructors for sse

* remove unused function

* minor changes
parentheses are not balanced here
* winch(aarch64): ABI integration

This commit finalizes the ABI integration between Winch and Cranelift,
notably:

* Updates the Cranelift ABI to ensure that all the Winch register
  clobbers are taken into account.
* Updates the Winch ABI to treat x28 as callee-saved, since it's used as
  the shadow stack pointer.

The alternative to treating x28 as callee-saved is to treat it as
caller-saved and save it when required e.g., at call-sites, even though
this approach works, it's probably more efficient to perform a store/pop
once per function, to minimize the number of move instructions required.

There are still some changes needed in order to fully enable running
spec tests for aarch64, however, this change is one step further. If
interested, you can run the call.wast test via:

cargo run -- wast -Ccompiler=winch tests/spec_testsuite/call_indirect.wast

* Update disas tests
* Use `alloc_zeroed` to allocate dynamic table elements

This allows us to get pre-zeroed memory from the global allocator, rather than
needing to manually zero-initialize the elements.

* Don't ask the global allocator to allocate a block of size zero
Previously we used `AssemblerImm*` and `AssemblerSimm*` throughout the
x64 ISLE to indicate the type of immediate an instruction would receive.
Alex has noted previously that this is unnecessary; it does after all
create more ties between the `cranelift-codegen` ISLE and
`cranelift-assembler-x64` that could possibly break in the future. This
change removes those ties by using Rust types in ISLE (e.g., `u8`, `i8`,
`u16`, etc.) and converting to the expected assembler type in the ISLE
glue layer.
Hello,

A possible typo in this text:

"Forward" Should be "Foreword"

"Forward" means to move ahead, but the correct term for an introduction is "Foreword".

Thanks.
* Expose GC refs to Wasm in `gc_alloc_raw` libcall

As we are returning a GC reference to Wasm, we need to mark that GC reference as
exposed to Wasm.

Fixes bytecodealliance/wasmtime#9669

* miri ignore test that calls wasm and therefore can't run in miri
Co-authored-by: Wasmtime Publish <wasmtime-publish@users.noreply.github.com>
* add component-model-async/{fused|futures|streams}.wast tests

This is another piece of #9582 which I'm splitting out to make review easier.

The fused.wast test exercises fused adapter generation for various flavors of
intercomponent async->async, async->sync, and sync->async calls.

The futures.wast and streams.wast tests exercise the various intrinsics
(e.g. `stream.read`, `future.close_writable`, etc.) involving `future`s and
`stream`s.

The remaining changes fill in some TODOs to make the tests pass, plus plumbing
for a few intrinsics which aren't needed for these tests but which set the
foundation for future tests.

Signed-off-by: Joel Dice <joel.dice@fermyon.com>

* address review feedback

Signed-off-by: Joel Dice <joel.dice@fermyon.com>

---------

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
* Update wasm-tools to the latest revision

* Update component async bits for new intrinsics

* Ignore options for now

* I truly, and fundamentally, do not understand `cargo vet`

* Fix a test
* Winch: Fix extadd implementations

* Add new Wast test to excluded tests
* Remove Function argument from define_function_bytes

define_function_bytes is supposed to be used when the code was not
compiled by Cranelift and thus wouldn't have any associated Function.

* Avoid collecting the relocations into a Vec twice
* Add Engine/Component::deserialize_raw

For targets without virtual memory support, the only mechanism for
load code previously was to copy bytes from a provided slice into
a separate, owned, allocated buffer containing a copy of the serialized
module contents.  This is expensive for constrained targets and
prohibits embedded runtimes like doing things like running code
directly out of memory-mapped devices such as NOR flash.

The tradeoff for directly using the externally owned memory is that
the caller must ensure that the code memory will not be written
to for the lifetime of the CodeMemory.

Loading code from externally owned memory is supported for all
configurations but is expected to fail to deserialize on platforms
that suport virtual memory and are attempting to load modules
or components that require that the memory be made executable
(native code rather than pulley).

bytecodealliance/wasmtime#10245

* Fix tests for s390x

Previously, there was a bad assumption that pulley32/64 were the
only targets but there's also the "be" variants.  Use the
`pulley_host` helper to better get the right pulley target
for the host.
* Remove hotswapping support from cranelift-jit

It was originally introduced for cg_clif. cg_clif recently removed
it's use of hotswapping as the way it is implemented in cranelift-jit
has various issues like leaking memory, panicking when the memory
allocator decided to put two functions more than 2GB away from each
other and only supporting x86_64. Better hotswapping support will likely
require a fundamentally different implementation.

* Fix UB when using zero-sized allocations together with pcrel relocs
…10193)

* CI

* Source

* Remove generic.wasm from source control
* implement andpd sse instruction

implement sse xorpd, addpd, subpd, andpd

implement addps, andps, subps

* impl xorps

* orps instr

* bless clif tests

* remove old isle emission

* reorder instructions in ascending order of size, added comment
…t` (#10349)

Additionally, support alignment 16 for `v128`s inside GC objects.

We previously allowed the alignment and minimum block size to be different
values, *and* did not round allocation sizes up to the minimum block size. This
could lead to bugs like the following sequence of events:

* free list initially has a block 0x10..MAX
* alloc(size=16) -> 0x10
  * free list now has one block: 0x20..MAX
* alloc(size=16) -> 0x20
  * free list now has one block: 0x30..MAX
* dealloc(0x10, size=16)
  * this merges 0x10..0x20 into 0x30..MAX because the gap between 0x20 and 0x30
    is smaller than the minimum block size
* dealloc(0x20, size=16)
  * triggers overlapping blocks assertion failure!

If we ensure that the minimum allocation size is a multiple of our supported
alignment and we clamp requested allocations' sizes to at least the minimum
block size, then we could avoid this.

It is simpler, however, to unify our supported alignment and our minimum block
size into the same value. This PR does that. No more need for multiple concepts
which interact in subtle ways.
Gonzalosilvalde and others added 25 commits April 2, 2025 14:36
* Expose default value constructors for Wasm types in host API

* Added doc comments
`VMRuntimeLimits` was renamed to `VMStoreContext` a little while back.

Split off from bytecodealliance/wasmtime#10503
* Update wasm-tools crates to 1.228.0

* Add missing canonical builtins

* Add new component model feature flags

* Vet wasm-tool dependencies using wildcard

* Fix tests hidden behind new CM features

Several CM-async tests were failing due to upstream changes to the
canonical builtins. Here we add some new Wasmtime flags for enabling
these new features, `wasm_component_model_async_builtins` and
`wasm_component_model_async_stackful`, and propagate that far enough to
enable the features for these tests. This also involved removing all the
error context details from these builtins.

Co-authored-by: Alex Crichton <alex@alexcrichton.com>

* Add some additional plumbing for fuzz configuration

prtest:full

---------

Co-authored-by: Alex Crichton <alex@alexcrichton.com>
…10508)

* Analyze whether a module requires a GC heap during its compilation

And avoid forcing the allocation of a GC heap for modules that will not use it.

Split out from bytecodealliance/wasmtime#9350

* Simplify condition for allocating GC heap
* Guest Profiling suport for component model

This change adds support for using guest profiling with the
component model.  In addition to the core change to support
attributing stack frames to constituient modules within a component,
the cli `run` and `serve` commands are also updated to support
using the `--profile=guest` cli option with components.

bytecodealliance/wasmtime#8773
bytecodealliance/wasmtime#7669

* fixup! Guest Profiling suport for component model
Closes bytecodealliance/wasmtime#10460

This commit ensures stack arguments greater than 8 bytes are correctly aligned.

Prior to this commit this wasn't an issue since for the default calling
convention, all arguments were aligned to a fixed slot size (e.g, 8 bytes).
With the introduction of vector types, namely, v128, we must ensure that
arguments greater than 8 bytes in size are correctly type-sized aligned.
Cranelift's Winch calling convention will never have to deal with
results in more than one register since Winch doesn't make use of the
types that would trigger that case, namely, `types::I128`. In all SIMD
cases types are bound to `types::MxN`, which map to a single float
register.
* Bump MSRV to 1.84.0

Coupled with today's release of 1.86.0

* Fix tests on windows
The current version we have pinned panics on some newer Rust syntax
which was hindering debugging in the wasip3-prototyping fork recently,
so update the version here to its latest.
* Add 2 more columns to the default address width.
* Print newlines between inline symbols which accidentally weren't
  present.
@alexcrichton alexcrichton enabled auto-merge April 4, 2025 21:36
@alexcrichton alexcrichton added this pull request to the merge queue Apr 4, 2025
Merged via the queue into bytecodealliance:main with commit eb12c30 Apr 4, 2025
148 checks passed
@alexcrichton alexcrichton deleted the merg-emain branch April 4, 2025 22:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.