Skip to content

Commit

Permalink
Merge with upstream (bytecodealliance#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhil authored Mar 13, 2024
2 parents 6434027 + d04b51e commit 4f5ccc7
Show file tree
Hide file tree
Showing 68 changed files with 1,505 additions and 290 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ jobs:
submodules: true
- uses: ./.github/actions/install-rust
with:
toolchain: nightly-2024-02-22
toolchain: nightly-2024-03-11

# Build C API documentation
- run: curl -L https://sourceforge.net/projects/doxygen/files/rel-1.9.3/doxygen-1.9.3.linux.bin.tar.gz/download | tar xzf -
Expand Down Expand Up @@ -268,7 +268,6 @@ jobs:
# double-check that Rust code compiles and is likely to work everywhere else.
checks:
needs: determine
if: needs.determine.outputs.run-full
name: Check
runs-on: ubuntu-latest
env:
Expand Down Expand Up @@ -401,7 +400,7 @@ jobs:
# happen upstream. This is periodically updated through a PR.
- uses: ./.github/actions/install-rust
with:
toolchain: nightly-2024-02-22
toolchain: nightly-2024-03-11

# Ensure that fuzzers sitll build.
#
Expand Down Expand Up @@ -733,7 +732,7 @@ jobs:
submodules: true
- uses: ./.github/actions/install-rust
with:
toolchain: nightly-2024-02-22
toolchain: nightly-2024-03-11
- run: rustup component add rust-src miri
- uses: actions/cache@v4
with:
Expand Down
23 changes: 15 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ authors = ["The Wasmtime Project Developers"]
edition = "2021"
# Wasmtime's current policy is that this number can be no larger than the
# current stable release of Rust minus 2.
rust-version = "1.73.0"
rust-version = "1.74.0"

[workspace.lints.rust]
# Turn on some lints which are otherwise allow-by-default in rustc.
Expand Down Expand Up @@ -231,7 +231,7 @@ io-lifetimes = { version = "2.0.3", default-features = false }
io-extras = "0.18.1"
rustix = "0.38.31"
# wit-bindgen:
wit-bindgen = { git = "https://github.com/wasmfx/wit-bindgenfx", tag = "wit-bindgenfx-cli-0.20.0", default-features = false }
wit-bindgen = { git = "https://github.com/wasmfx/wit-bindgenfx", tag = "wit-bindgenfx-cli-0.22.0", default-features = false }

# wasm-tools family:
wasmparser = { git = "https://github.com/wasmfx/wasmfx-tools", tag = "wasmfx-tools-1.201.0+rev.1" }
Expand Down
90 changes: 90 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,98 @@ Unreleased.

### Added

* C API bindings for the sampling-based profiler in Wasmtime have been added.
[#7854](https://github.com/bytecodealliance/wasmtime/pull/7854)

* Add the WasiP1Ctx to ease the use of `wasmtime-wasi` in place of `wasi-common`
[#8053](https://github.com/bytecodealliance/wasmtime/pull/8053)

* The Winch compiler backend is now feature-complete for x64. Note that minor
issues and fuzz bugs are still being addressed, but now's a good time to test
if you're interested.
[#7894](https://github.com/bytecodealliance/wasmtime/pull/7894)
[#7909](https://github.com/bytecodealliance/wasmtime/pull/7909)
[#7927](https://github.com/bytecodealliance/wasmtime/pull/7927)
[#7932](https://github.com/bytecodealliance/wasmtime/pull/7932)
[#7949](https://github.com/bytecodealliance/wasmtime/pull/7949)
[#7974](https://github.com/bytecodealliance/wasmtime/pull/7974)
[#8001](https://github.com/bytecodealliance/wasmtime/pull/8001)

* The typed function references proposal to WebAssembly is now fully
implemented.
[#7943](https://github.com/bytecodealliance/wasmtime/pull/7943)

* The `component::Linker` type is now "semver aware" in that it enables loading
components referring to past or future versions of interfaces so long as the
types are compatible.
[#7994](https://github.com/bytecodealliance/wasmtime/pull/7994)

* Wasmtime can now be built for "custom platforms" which is intended for
bare-metal builds.
[#7995](https://github.com/bytecodealliance/wasmtime/pull/7995)

* The `wasmtime-wasi-nn` crate now has a backend based on WinML.
[#7807](https://github.com/bytecodealliance/wasmtime/pull/7807)

* The `wasmtime` CLI now has flags for configuring limits of the pooling
allocator.
[#8027](https://github.com/bytecodealliance/wasmtime/pull/8027)


### Changed

* The `wasmtime serve` command no longer binds its port with `SO_REUSEADDR`
meaning that if it is invoked twice only one will succeed.
[#7863](https://github.com/bytecodealliance/wasmtime/pull/7863)

* The sampling-based profiler in Wasmtime now takes an explicit argument of
the time delta between samples.
[#7873](https://github.com/bytecodealliance/wasmtime/pull/7873)

* Many accessors for type information now require an `&Engine` argument to be
specified in preparation for an implementation of wasm GC.
[#7892](https://github.com/bytecodealliance/wasmtime/pull/7892)

* The `host` header is now forbidden in wasi-http.
[#7905](https://github.com/bytecodealliance/wasmtime/pull/7905)

* Stronger type-checks are now performed for host-owned resources when
interacting with the component model to help catch mistakes earlier.
[#7902](https://github.com/bytecodealliance/wasmtime/pull/7902)

* Demangling Rust and C/C++ symbols in WebAssembly modules is now done by
default in the C API.
[#7962](https://github.com/bytecodealliance/wasmtime/pull/7962)

* Preview2-based APIs are now located at the root of the `wasmtime_wasi` crate
instead of a submodule.
[#7933](https://github.com/bytecodealliance/wasmtime/pull/7933)

* Components now reserve index 0 for handle tables to match the component model
specification.
[#7661](https://github.com/bytecodealliance/wasmtime/pull/7661)

* Support for `externref` has been moved behind a new `gc` Cargo feature. This
will also gate support for wasm gc in the future.
[#7975](https://github.com/bytecodealliance/wasmtime/pull/7975)

* Require the `WASMTIME_WASI_CONFIG_PREOPEN_SOCKET_ALLOW` environment variable
to bet set to allow the use of `wasi_config_preopen_socket` via the c api, as
it will be deprecated in `20.0.0`.
[#8053](https://github.com/bytecodealliance/wasmtime/pull/8053)

### Fixed

* WIT interface names that are Rust keywords now correctly generate bindings.
[#7790](https://github.com/bytecodealliance/wasmtime/pull/7790)

* PKRU state is now restored across await points.
[#7789](https://github.com/bytecodealliance/wasmtime/pull/7789)

* Wasmtime now correctly supports `global.get` in all constant expressions
within a module.
[#7996](https://github.com/bytecodealliance/wasmtime/pull/7996)

--------------------------------------------------------------------------------

## 18.0.2
Expand Down
2 changes: 1 addition & 1 deletion cranelift/codegen/src/isa/aarch64/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl ABIMachineSpec for AArch64MachineDeps {
where
I: IntoIterator<Item = &'a ir::AbiParam>,
{
if call_conv == isa::CallConv::Tail {
if matches!(call_conv, isa::CallConv::Tail | isa::CallConv::Winch) {
return compute_arg_locs_tail(params, add_ret_area_ptr, args);
}

Expand Down
18 changes: 12 additions & 6 deletions cranelift/codegen/src/isa/aarch64/inst/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,12 +867,18 @@ fn aarch64_get_operands<F: Fn(VReg) -> VReg>(inst: &Inst, collector: &mut Operan
collector.reg_clobbers(info.clobbers);
}
&Inst::CallInd { ref info, .. } => {
if info.callee_callconv == CallConv::Tail {
// TODO(https://github.com/bytecodealliance/regalloc2/issues/145):
// This shouldn't be a fixed register constraint.
collector.reg_fixed_use(info.rn, xreg(1));
} else {
collector.reg_use(info.rn);
match info.callee_callconv {
CallConv::Tail => {
// TODO(https://github.com/bytecodealliance/regalloc2/issues/145):
// This shouldn't be a fixed register constraint.
collector.reg_fixed_use(info.rn, xreg(1))
}
CallConv::Winch => {
// TODO(https://github.com/bytecodealliance/regalloc2/issues/145):
// This shouldn't be a fixed register constraint.
collector.reg_fixed_use(info.rn, xreg(1))
}
_ => collector.reg_use(info.rn),
}
for u in &info.uses {
collector.reg_fixed_use(u.vreg, u.preg);
Expand Down
19 changes: 18 additions & 1 deletion cranelift/codegen/src/isa/x64/inst.isle
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,7 @@
Ucomiss
Ucomisd
Unpcklps
Unpcklpd
Unpckhps
Xorps
Xorpd
Expand Down Expand Up @@ -1279,6 +1280,7 @@
Vpunpckhwd
Vpunpcklwd
Vunpcklps
Vunpcklpd
Vunpckhps
Vandnps
Vandnpd
Expand Down Expand Up @@ -2878,7 +2880,14 @@
(cmove ty cc consequent alternative))

(rule (cmove_from_values (is_xmm_type ty) cc consequent alternative)
(cmove_xmm ty cc consequent alternative))
;; force the `Value`s to `Xmm`s (in-register values) here:
;; `cmove_xmm` can take an `XmmMemAligned`, but we don't want to
;; allow load fusion here because `ty` may not be
;; XMM-register-wide even if it is `is_xmm_type`. (E.g.,
;; consider a cmove of `f64` values.)
(let ((cons Xmm consequent)
(alt Xmm alternative))
(cmove_xmm ty cc cons alt)))

;; Helper for creating `cmove` instructions with the logical OR of multiple
;; flags. Note that these instructions will always result in more than one
Expand Down Expand Up @@ -3296,6 +3305,14 @@
(if-let $true (use_avx))
(xmm_rmir_vex (AvxOpcode.Vunpcklps) src1 src2))

;; Helper for creating `unpcklpd` instructions.
(decl x64_unpcklpd (Xmm XmmMem) Xmm)
(rule 0 (x64_unpcklpd src1 src2)
(xmm_rm_r (SseOpcode.Unpcklpd) src1 src2))
(rule 1 (x64_unpcklpd src1 src2)
(if-let $true (use_avx))
(xmm_rmir_vex (AvxOpcode.Vunpcklpd) src1 src2))

;; Helper for creating `unpckhps` instructions.
(decl x64_unpckhps (Xmm XmmMem) Xmm)
(rule 0 (x64_unpckhps src1 src2)
Expand Down
8 changes: 6 additions & 2 deletions cranelift/codegen/src/isa/x64/inst/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,7 @@ pub enum SseOpcode {
Ucomiss,
Ucomisd,
Unpcklps,
Unpcklpd,
Unpckhps,
Xorps,
Xorpd,
Expand Down Expand Up @@ -1309,7 +1310,8 @@ impl SseOpcode {
| SseOpcode::Punpcklqdq
| SseOpcode::Punpckhqdq
| SseOpcode::Pshuflw
| SseOpcode::Pshufhw => SSE2,
| SseOpcode::Pshufhw
| SseOpcode::Unpcklpd => SSE2,

SseOpcode::Pabsb
| SseOpcode::Pabsw
Expand Down Expand Up @@ -1566,6 +1568,7 @@ impl fmt::Debug for SseOpcode {
SseOpcode::Pshufhw => "pshufhw",
SseOpcode::Pblendw => "pblendw",
SseOpcode::Movddup => "movddup",
SseOpcode::Unpcklpd => "unpcklpd",
};
write!(fmt, "{}", name)
}
Expand Down Expand Up @@ -1767,7 +1770,8 @@ impl AvxOpcode {
| AvxOpcode::Vsqrtss
| AvxOpcode::Vsqrtsd
| AvxOpcode::Vroundss
| AvxOpcode::Vroundsd => {
| AvxOpcode::Vroundsd
| AvxOpcode::Vunpcklpd => {
smallvec![InstructionSet::AVX]
}

Expand Down
2 changes: 2 additions & 0 deletions cranelift/codegen/src/isa/x64/inst/emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2226,6 +2226,7 @@ pub(crate) fn emit(
SseOpcode::Cvtsd2ss => (LegacyPrefixes::_F2, 0x0F5A, 2),
SseOpcode::Sqrtss => (LegacyPrefixes::_F3, 0x0F51, 2),
SseOpcode::Sqrtsd => (LegacyPrefixes::_F2, 0x0F51, 2),
SseOpcode::Unpcklpd => (LegacyPrefixes::_66, 0x0F14, 2),
_ => unimplemented!("Opcode {:?} not implemented", op),
};

Expand Down Expand Up @@ -2451,6 +2452,7 @@ pub(crate) fn emit(
AvxOpcode::Vcvtsd2ss => (LP::_F2, OM::_0F, 0x5A),
AvxOpcode::Vsqrtss => (LP::_F3, OM::_0F, 0x51),
AvxOpcode::Vsqrtsd => (LP::_F2, OM::_0F, 0x51),
AvxOpcode::Vunpcklpd => (LP::_66, OM::_0F, 0x14),
_ => panic!("unexpected rmir vex opcode {op:?}"),
};
VexInstruction::new()
Expand Down
5 changes: 5 additions & 0 deletions cranelift/codegen/src/isa/x64/inst/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2370,6 +2370,11 @@ fn x64_get_operands<F: Fn(VReg) -> VReg>(inst: &Inst, collector: &mut OperandCol
// This shouldn't be a fixed register constraint.
collector.reg_fixed_use(*reg, regs::r15())
}
RegMem::Reg { reg } if info.callee_conv == CallConv::Winch => {
// TODO(https://github.com/bytecodealliance/regalloc2/issues/145):
// This shouldn't be a fixed register constraint.
collector.reg_fixed_use(*reg, regs::r15())
}
_ => dest.get_operands(collector),
}
for u in &info.uses {
Expand Down
12 changes: 12 additions & 0 deletions cranelift/codegen/src/isa/x64/lower.isle
Original file line number Diff line number Diff line change
Expand Up @@ -3403,6 +3403,18 @@
(rule 0 (lower (fcvt_from_sint a @ (value_type $I32X4)))
(x64_cvtdq2ps a))

;; Base case: decompose the i64x2 input into two scalar registers and convert
;; each of those into a float. Afterwards re-pack the two results into the final
;; destination.
(rule 0 (lower (fcvt_from_sint a @ (value_type $I64X2)))
(let (
(a Xmm a)
(zero Xmm (xmm_zero $F64X2))
(f0 Xmm (x64_cvtsi2sd $I64 zero (x64_movq_to_gpr a)))
(f1 Xmm (x64_cvtsi2sd $I64 zero (x64_movq_to_gpr (x64_pshufd a 0b11_10_11_10))))
)
(x64_unpcklpd f0 f1)))

(rule 1 (lower (has_type $F64X2 (fcvt_from_sint (swiden_low a @ (value_type $I32X4)))))
(x64_cvtdq2pd a))

Expand Down
19 changes: 4 additions & 15 deletions cranelift/codegen/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,21 +231,10 @@ fn parse_bool_value(value: &str) -> SetResult<bool> {
fn parse_enum_value(value: &str, choices: &[&str]) -> SetResult<u8> {
match choices.iter().position(|&tag| tag == value) {
Some(idx) => Ok(idx as u8),
None => {
// TODO: Use `join` instead of this code, once
// https://github.com/rust-lang/rust/issues/27747 is resolved.
let mut all_choices = String::new();
let mut first = true;
for choice in choices {
if first {
first = false
} else {
all_choices += ", ";
}
all_choices += choice;
}
Err(SetError::BadValue(format!("any among {}", all_choices)))
}
None => Err(SetError::BadValue(format!(
"any among {}",
choices.join(", ")
))),
}
}

Expand Down
Loading

0 comments on commit 4f5ccc7

Please sign in to comment.