Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,8 @@ jobs:
- crate: "pulley-interpreter --all-features"
- crate: "wasmtime-internal-error"
- crate: "wasmtime-internal-error --all-features"
- crate: "wasmtime-internal-core"
- crate: "wasmtime-internal-core --all-features"
- script: ./ci/miri-provenance-test.sh
- script: ./ci/miri-wast.sh ./tests/spec_testsuite/table.wast
needs: determine
Expand Down
18 changes: 6 additions & 12 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ wasmtime-versioned-export-macros = { path = "crates/versioned-export-macros", ve
wasmtime-slab = { path = "crates/slab", version = "=42.0.0", package = 'wasmtime-internal-slab' }
wasmtime-jit-icache-coherence = { path = "crates/jit-icache-coherence", version = "=42.0.0", package = 'wasmtime-internal-jit-icache-coherence' }
wasmtime-wit-bindgen = { path = "crates/wit-bindgen", version = "=42.0.0", package = 'wasmtime-internal-wit-bindgen' }
wasmtime-math = { path = "crates/math", version = "=42.0.0", package = 'wasmtime-internal-math' }
wasmtime-unwinder = { path = "crates/unwinder", version = "=42.0.0", package = 'wasmtime-internal-unwinder' }
wasmtime-debugger = { path = "crates/debugger", version = "=42.0.0", package = "wasmtime-internal-debugger" }
wasmtime-wizer = { path = "crates/wizer", version = "42.0.0" }
Expand Down
2 changes: 1 addition & 1 deletion cranelift/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ regalloc2 = { workspace = true, features = ["checker"] }
souper-ir = { version = "2.1.0", optional = true }
sha2 = { version = "0.10.2", optional = true }
rustc-hash = { workspace = true }
wasmtime-math = { workspace = true }
wasmtime-core = { workspace = true }
libm = { workspace = true }
# It is a goal of the cranelift-codegen crate to have minimal external dependencies.
# Please don't add any unless they are essential to the task of creating binary
Expand Down
2 changes: 1 addition & 1 deletion cranelift/codegen/src/isa/riscv64/lower/isle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::{
use alloc::boxed::Box;
use alloc::vec::Vec;
use regalloc2::PReg;
use wasmtime_math::{f32_cvt_to_int_bounds, f64_cvt_to_int_bounds};
use wasmtime_core::math::{f32_cvt_to_int_bounds, f64_cvt_to_int_bounds};

type BoxCallInfo = Box<CallInfo<ExternalName>>;
type BoxCallIndInfo = Box<CallInfo<Reg>>;
Expand Down
2 changes: 2 additions & 0 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ version.workspace = true
# This crate should have *very* minimal dependencies! Don't add new ones
# lightly.
wasmtime-error = { workspace = true }
libm = { workspace = true }

[lints]
workspace = true

[features]
std = []
10 changes: 10 additions & 0 deletions crates/core/src/alloc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,13 @@ impl<T> TryNew for Arc<T> {
return Ok(Arc::new(value));
}
}

#[cfg(test)]
mod test {
use super::{Arc, TryNew};

#[test]
fn try_new() {
<Arc<_> as TryNew>::try_new(4).unwrap();
}
}
5 changes: 5 additions & 0 deletions crates/core/src/alloc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ mod tests {
}
}

#[test]
fn try_new() {
<Box<_> as TryNew>::try_new(4).unwrap();
}

#[test]
fn new_boxed_slice_from_iter_smoke_test() {
let slice = new_boxed_slice_from_iter(3, [42, 36, 1337]).unwrap();
Expand Down
4 changes: 4 additions & 0 deletions crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@

extern crate alloc as std_alloc;

#[cfg(feature = "std")]
extern crate std;

pub mod alloc;
pub mod math;
7 changes: 2 additions & 5 deletions crates/math/src/lib.rs → crates/core/src/math.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! A minimal helper crate for implementing float-related operations for
//! A minimal module for implementing float-related operations for
//! WebAssembly in terms of the native platform primitives.
//!
//! > **⚠️ Warning ⚠️**: this crate is an internal-only crate for the Wasmtime
Expand All @@ -23,10 +23,7 @@
//! needed so they're implemented only in a single location here rather than
//! multiple.

#![no_std]

#[cfg(feature = "std")]
extern crate std;
#![allow(missing_docs, reason = "self-describing methods")]

/// Returns the bounds for guarding a trapping f32-to-int conversion.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/cranelift/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ cfg-if = { workspace = true }
wasmtime-versioned-export-macros = { workspace = true }
itertools = { workspace = true }
pulley-interpreter = { workspace = true, optional = true }
wasmtime-math = { workspace = true }
wasmtime-core = { workspace = true }
wasmtime-unwinder = { workspace = true, features = ["cranelift"] }

[features]
Expand Down
2 changes: 1 addition & 1 deletion crates/cranelift/src/func_environ.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use cranelift_frontend::{FuncInstBuilder, FunctionBuilder};
use smallvec::{SmallVec, smallvec};
use std::mem;
use wasmparser::{FuncValidator, Operator, WasmFeatures, WasmModuleResources};
use wasmtime_core::math::f64_cvt_to_int_bounds;
use wasmtime_environ::{
BuiltinFunctionIndex, DataIndex, DefinedFuncIndex, ElemIndex, EngineOrModuleTypeIndex,
FrameStateSlotBuilder, FrameValType, FuncIndex, FuncKey, GlobalIndex, IndexType, Memory,
Expand All @@ -31,7 +32,6 @@ use wasmtime_environ::{
WasmValType,
};
use wasmtime_environ::{FUNCREF_INIT_BIT, FUNCREF_MASK};
use wasmtime_math::f64_cvt_to_int_bounds;

#[derive(Debug)]
pub(crate) enum Extension {
Expand Down
22 changes: 0 additions & 22 deletions crates/math/Cargo.toml

This file was deleted.

4 changes: 2 additions & 2 deletions crates/wasmtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ wasmtime-component-util = { workspace = true, optional = true }
wasmtime-slab = { workspace = true, optional = true }
wasmtime-versioned-export-macros = { workspace = true }
wasmtime-wmemcheck = { workspace = true, optional = true }
wasmtime-math = { workspace = true }
wasmtime-core = { workspace = true }
pulley-interpreter = { workspace = true }
target-lexicon = { workspace = true }
wasmparser = { workspace = true }
Expand Down Expand Up @@ -347,7 +347,7 @@ std = [
'once_cell',
'wasmtime-fiber?/std',
'pulley-interpreter/std',
'wasmtime-math/std',
'wasmtime-core/std',
'addr2line?/std',
"dep:rustix",
"wasmtime-jit-icache-coherence",
Expand Down
30 changes: 14 additions & 16 deletions crates/wasmtime/src/runtime/vm/libcalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ use core::convert::Infallible;
use core::ptr::NonNull;
#[cfg(feature = "threads")]
use core::time::Duration;
use wasmtime_core::math::WasmFloat;
use wasmtime_environ::{
DataIndex, DefinedMemoryIndex, DefinedTableIndex, ElemIndex, FuncIndex, MemoryIndex,
TableIndex, Trap,
Expand Down Expand Up @@ -1451,35 +1452,35 @@ fn update_mem_size(store: &mut dyn VMStore, instance: InstanceId, num_pages: u32
}

fn floor_f32(_store: &mut dyn VMStore, _instance: InstanceId, val: f32) -> f32 {
wasmtime_math::WasmFloat::wasm_floor(val)
val.wasm_floor()
}

fn floor_f64(_store: &mut dyn VMStore, _instance: InstanceId, val: f64) -> f64 {
wasmtime_math::WasmFloat::wasm_floor(val)
val.wasm_floor()
}

fn ceil_f32(_store: &mut dyn VMStore, _instance: InstanceId, val: f32) -> f32 {
wasmtime_math::WasmFloat::wasm_ceil(val)
val.wasm_ceil()
}

fn ceil_f64(_store: &mut dyn VMStore, _instance: InstanceId, val: f64) -> f64 {
wasmtime_math::WasmFloat::wasm_ceil(val)
val.wasm_ceil()
}

fn trunc_f32(_store: &mut dyn VMStore, _instance: InstanceId, val: f32) -> f32 {
wasmtime_math::WasmFloat::wasm_trunc(val)
val.wasm_trunc()
}

fn trunc_f64(_store: &mut dyn VMStore, _instance: InstanceId, val: f64) -> f64 {
wasmtime_math::WasmFloat::wasm_trunc(val)
val.wasm_trunc()
}

fn nearest_f32(_store: &mut dyn VMStore, _instance: InstanceId, val: f32) -> f32 {
wasmtime_math::WasmFloat::wasm_nearest(val)
val.wasm_nearest()
}

fn nearest_f64(_store: &mut dyn VMStore, _instance: InstanceId, val: f64) -> f64 {
wasmtime_math::WasmFloat::wasm_nearest(val)
val.wasm_nearest()
}

// This intrinsic is only used on x86_64 platforms as an implementation of
Expand Down Expand Up @@ -1617,10 +1618,10 @@ fn fma_f32x4(

U {
mem: [
wasmtime_math::WasmFloat::wasm_mul_add(x[0], y[0], z[0]),
wasmtime_math::WasmFloat::wasm_mul_add(x[1], y[1], z[1]),
wasmtime_math::WasmFloat::wasm_mul_add(x[2], y[2], z[2]),
wasmtime_math::WasmFloat::wasm_mul_add(x[3], y[3], z[3]),
x[0].wasm_mul_add(y[0], z[0]),
x[1].wasm_mul_add(y[1], z[1]),
x[2].wasm_mul_add(y[2], z[2]),
x[3].wasm_mul_add(y[3], z[3]),
],
}
.reg
Expand All @@ -1645,10 +1646,7 @@ fn fma_f64x2(
let z = U { reg: z }.mem;

U {
mem: [
wasmtime_math::WasmFloat::wasm_mul_add(x[0], y[0], z[0]),
wasmtime_math::WasmFloat::wasm_mul_add(x[1], y[1], z[1]),
],
mem: [x[0].wasm_mul_add(y[0], z[0]), x[1].wasm_mul_add(y[1], z[1])],
}
.reg
}
Expand Down
6 changes: 3 additions & 3 deletions pulley/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ workspace = true
arbitrary = { workspace = true, optional = true }
cranelift-bitset = { workspace = true }
log = { workspace = true }
wasmtime-math = { workspace = true, optional = true }
wasmtime-core = { workspace = true, optional = true }
anyhow = { workspace = true, optional = true }
pulley-macros = { workspace = true }

Expand All @@ -27,12 +27,12 @@ clap = { workspace = true }
termcolor = { workspace = true }

[features]
std = ['wasmtime-math?/std']
std = ['wasmtime-core?/std']
arbitrary = ["dep:arbitrary", "arbitrary/derive", "std", "cranelift-bitset/arbitrary"]
encode = []
decode = []
disas = ["decode"]
interp = ["decode", "encode", "dep:wasmtime-math"]
interp = ["decode", "encode", "dep:wasmtime-core"]
profile = ['std', 'dep:anyhow']

[package.metadata.docs.rs]
Expand Down
2 changes: 1 addition & 1 deletion pulley/src/interp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use core::ops::ControlFlow;
use core::ops::{Index, IndexMut};
use core::ptr::NonNull;
use pulley_macros::interp_disable_if_cfg;
use wasmtime_math::{WasmFloat, f32_cvt_to_int_bounds, f64_cvt_to_int_bounds};
use wasmtime_core::math::{WasmFloat, f32_cvt_to_int_bounds, f64_cvt_to_int_bounds};

mod debug;
#[cfg(all(not(pulley_tail_calls), not(pulley_assume_llvm_makes_tail_calls)))]
Expand Down
1 change: 0 additions & 1 deletion scripts/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const CRATES_TO_PUBLISH: &[&str] = &[
"wasmtime-internal-error",
"wasmtime-internal-core",
"cranelift-bitset",
"wasmtime-internal-math",
"pulley-macros",
"pulley-interpreter",
// cranelift
Expand Down
14 changes: 14 additions & 0 deletions supply-chain/audits.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,14 @@ start = "2026-01-07"
end = "2027-01-08"
notes = "The Bytecode Alliance is the author of this crate"

[[wildcard-audits.wasmtime-internal-core]]
who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy"
trusted-publisher = "github:bytecodealliance/wasmtime"
start = "2026-01-07"
end = "2027-01-08"
notes = "The Bytecode Alliance is the author of this crate"

[[wildcard-audits.wasmtime-internal-cranelift]]
who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy"
Expand Down Expand Up @@ -5774,6 +5782,12 @@ criteria = "safe-to-deploy"
delta = "0.243.0 -> 0.244.0"
notes = "The Bytecode Alliance is the author of this crate"

[[audits.wasmtime-internal-core]]
who = "Alex Crichton <alex@alexcrichton.com>"
criteria = "safe-to-deploy"
version = "0.0.0"
notes = "Empty crate"

[[audits.wasmtime-wasi-tls-openssl]]
who = "Dave Bakker <github@davebakker.io>"
criteria = "safe-to-deploy"
Expand Down
Loading