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
3 changes: 0 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,6 @@ jobs:
-p wasmtime --no-default-features --features threads
-p wasmtime --no-default-features --features runtime,threads
-p wasmtime --no-default-features --features cranelift,threads
-p wasmtime --no-default-features --features stack-switching
-p wasmtime --no-default-features --features cranelift,stack-switching
-p wasmtime --no-default-features --features runtime,stack-switching
-p wasmtime --features incremental-cache
-p wasmtime --features profile-pulley
-p wasmtime --all-features
Expand Down
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,6 @@ default = [
"gc",
"gc-drc",
"gc-null",
"stack-switching",
"winch",
"pulley",

Expand Down Expand Up @@ -490,7 +489,6 @@ gc = ["wasmtime-cli-flags/gc", "wasmtime/gc"]
gc-drc = ["gc", "wasmtime/gc-drc", "wasmtime-cli-flags/gc-drc"]
gc-null = ["gc", "wasmtime/gc-null", "wasmtime-cli-flags/gc-null"]
pulley = ["wasmtime-cli-flags/pulley"]
stack-switching = ["wasmtime/stack-switching", "wasmtime-cli-flags/stack-switching"]

# CLI subcommands for the `wasmtime` executable. See `wasmtime $cmd --help`
# for more information on each subcommand.
Expand Down
8 changes: 0 additions & 8 deletions crates/c-api/include/wasmtime/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,6 @@ WASMTIME_CONFIG_PROP(void, wasm_wide_arithmetic, bool)

#ifdef WASMTIME_FEATURE_COMPILER

/**
* \brief Configures whether the WebAssembly stack switching
* proposal is enabled.
*
* This setting is `false` by default.
*/
WASMTIME_CONFIG_PROP(void, wasm_stack_switching, bool)

/**
* \brief Configures how JIT code will be compiled.
*
Expand Down
5 changes: 0 additions & 5 deletions crates/c-api/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@ pub extern "C" fn wasmtime_config_wasm_memory64_set(c: &mut wasm_config_t, enabl
c.config.wasm_memory64(enable);
}

#[unsafe(no_mangle)]
pub extern "C" fn wasmtime_config_wasm_stack_switching_set(c: &mut wasm_config_t, enable: bool) {
c.config.wasm_stack_switching(enable);
}

#[unsafe(no_mangle)]
#[cfg(any(feature = "cranelift", feature = "winch"))]
pub extern "C" fn wasmtime_config_strategy_set(
Expand Down
1 change: 0 additions & 1 deletion crates/cli-flags/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@ gc-null = ["gc", "wasmtime/gc-null"]
threads = ["wasmtime/threads"]
memory-protection-keys = ["wasmtime/memory-protection-keys"]
pulley = ["wasmtime/pulley"]
stack-switching = ["wasmtime/stack-switching"]
30 changes: 6 additions & 24 deletions crates/cli-flags/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,6 @@ wasmtime_option_group! {
pub component_model_error_context: Option<bool>,
/// Configure support for the function-references proposal.
pub function_references: Option<bool>,
/// Configure support for the stack-switching proposal.
pub stack_switching: Option<bool>,
/// Configure support for the GC proposal.
pub gc: Option<bool>,
/// Configure support for the custom-page-sizes proposal.
Expand Down Expand Up @@ -820,23 +818,6 @@ impl CommonOptions {
config.native_unwind_info(enable);
}

// async_stack_size enabled by either async or stack-switching, so
// cannot directly use match_feature!
#[cfg(any(feature = "async", feature = "stack-switching"))]
{
if let Some(size) = self.wasm.async_stack_size {
config.async_stack_size(size);
}
}
#[cfg(not(any(feature = "async", feature = "stack-switching")))]
{
if let Some(_size) = self.wasm.async_stack_size {
anyhow::bail!(concat!(
"support for async/stack-switching disabled at compile time"
));
}
}

match_feature! {
["pooling-allocator" : self.opts.pooling_allocator.or(pooling_allocator_default)]
enable => {
Expand Down Expand Up @@ -942,6 +923,11 @@ impl CommonOptions {
);
}

match_feature! {
["async" : self.wasm.async_stack_size]
size => config.async_stack_size(size),
_ => err,
}
match_feature! {
["async" : self.wasm.async_stack_zeroing]
enable => config.async_stack_zeroing(enable),
Expand All @@ -954,7 +940,7 @@ impl CommonOptions {
// If `-Wasync-stack-size` isn't passed then automatically adjust it
// to the wasm stack size provided here too. That prevents the need
// to pass both when one can generally be inferred from the other.
#[cfg(any(feature = "async", feature = "stack-switching"))]
#[cfg(feature = "async")]
if self.wasm.async_stack_size.is_none() {
const DEFAULT_HOST_STACK: usize = 512 << 10;
config.async_stack_size(max + DEFAULT_HOST_STACK);
Expand Down Expand Up @@ -997,9 +983,6 @@ impl CommonOptions {
if let Some(enable) = self.wasm.memory64.or(all) {
config.wasm_memory64(enable);
}
if let Some(enable) = self.wasm.stack_switching {
config.wasm_stack_switching(enable);
}
if let Some(enable) = self.wasm.custom_page_sizes.or(all) {
config.wasm_custom_page_sizes(enable);
}
Expand Down Expand Up @@ -1040,7 +1023,6 @@ impl CommonOptions {
("gc", gc, wasm_gc)
("gc", reference_types, wasm_reference_types)
("gc", function_references, wasm_function_references)
("stack-switching", stack_switching, wasm_stack_switching)
}
Ok(())
}
Expand Down
1 change: 0 additions & 1 deletion crates/cranelift/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,4 @@ wmemcheck = ["wasmtime-environ/wmemcheck"]
gc = ["wasmtime-environ/gc"]
gc-drc = ["gc", "wasmtime-environ/gc-drc"]
gc-null = ["gc", "wasmtime-environ/gc-null"]
stack-switching = []
threads = ["wasmtime-environ/threads"]
14 changes: 0 additions & 14 deletions crates/cranelift/src/func_environ.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3793,17 +3793,3 @@ fn index_type_to_ir_type(index_type: IndexType) -> ir::Type {
IndexType::I64 => I64,
}
}

/// TODO(10248) This is removed in the next stack switching PR. It stops the
/// compiler from complaining about the stack switching libcalls being dead
/// code.
#[cfg(feature = "stack-switching")]
#[allow(
dead_code,
reason = "Dummy function to supress more dead code warnings"
)]
pub fn use_stack_switching_libcalls() {
let _ = BuiltinFunctions::cont_new;
let _ = BuiltinFunctions::table_grow_cont_obj;
let _ = BuiltinFunctions::table_fill_cont_obj;
}
22 changes: 5 additions & 17 deletions crates/cranelift/src/func_environ/gc/enabled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,7 @@ fn read_field_at_addr(
.call(get_interned_func_ref, &[vmctx, func_ref_id, expected_ty]);
builder.func.dfg.first_result(call_inst)
}
WasmHeapTopType::Cont => {
// TODO(#10248) GC integration for stack switching
return Err(wasmtime_environ::WasmError::Unsupported(
"Stack switching feature not compatbile with GC, yet".to_string(),
));
}
WasmHeapTopType::Cont => todo!(), // FIXME: #10248 stack switching support.
},
},
};
Expand Down Expand Up @@ -1037,8 +1032,6 @@ pub fn translate_ref_test(
| WasmHeapType::NoExtern
| WasmHeapType::Func
| WasmHeapType::NoFunc
| WasmHeapType::Cont
| WasmHeapType::NoCont
| WasmHeapType::I31 => unreachable!("handled top, bottom, and i31 types above"),

// For these abstract but non-top and non-bottom types, we check the
Expand Down Expand Up @@ -1093,12 +1086,8 @@ pub fn translate_ref_test(

func_env.is_subtype(builder, actual_shared_ty, expected_shared_ty)
}
WasmHeapType::ConcreteCont(_) => {
// TODO(#10248) GC integration for stack switching
return Err(wasmtime_environ::WasmError::Unsupported(
"Stack switching feature not compatbile with GC, yet".to_string(),
));
}

WasmHeapType::Cont | WasmHeapType::ConcreteCont(_) | WasmHeapType::NoCont => todo!(), // FIXME: #10248 stack switching support.
};
builder.ins().jump(continue_block, &[result.into()]);

Expand Down Expand Up @@ -1420,9 +1409,8 @@ impl FuncEnvironment<'_> {
WasmHeapType::Func | WasmHeapType::ConcreteFunc(_) | WasmHeapType::NoFunc => {
unreachable!()
}
WasmHeapType::Cont | WasmHeapType::ConcreteCont(_) | WasmHeapType::NoCont => {
unreachable!()
}

WasmHeapType::Cont | WasmHeapType::ConcreteCont(_) | WasmHeapType::NoCont => todo!(), // FIXME: #10248 stack switching support.
};

match (ty.nullable, might_be_i31) {
Expand Down
10 changes: 1 addition & 9 deletions crates/cranelift/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ pub const TRAP_HEAP_MISALIGNED: TrapCode =
TrapCode::unwrap_user(Trap::HeapMisaligned as u8 + TRAP_OFFSET);
pub const TRAP_TABLE_OUT_OF_BOUNDS: TrapCode =
TrapCode::unwrap_user(Trap::TableOutOfBounds as u8 + TRAP_OFFSET);
pub const TRAP_UNHANDLED_TAG: TrapCode =
TrapCode::unwrap_user(Trap::UnhandledTag as u8 + TRAP_OFFSET);
pub const TRAP_CONTINUATION_ALREADY_CONSUMED: TrapCode =
TrapCode::unwrap_user(Trap::ContinuationAlreadyConsumed as u8 + TRAP_OFFSET);
pub const TRAP_CAST_FAILURE: TrapCode =
TrapCode::unwrap_user(Trap::CastFailure as u8 + TRAP_OFFSET);

Expand Down Expand Up @@ -206,11 +202,7 @@ fn reference_type(wasm_ht: WasmHeapType, pointer_type: ir::Type) -> ir::Type {
match wasm_ht.top() {
WasmHeapTopType::Func => pointer_type,
WasmHeapTopType::Any | WasmHeapTopType::Extern => ir::types::I32,
WasmHeapTopType::Cont =>
// TODO(10248) This is added in a follow-up PR
{
unimplemented!("codegen for stack switching types not implemented, yet")
}
WasmHeapTopType::Cont => todo!(), // FIXME: #10248 stack switching support.
}
}

Expand Down
61 changes: 11 additions & 50 deletions crates/cranelift/src/translate/code_translator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2898,56 +2898,6 @@ pub fn translate_operator(
// representation, so we don't actually need to do anything.
}

Operator::ContNew { cont_type_index: _ } => {
// TODO(10248) This is added in a follow-up PR
return Err(wasmtime_environ::WasmError::Unsupported(
"codegen for stack switching instructions not implemented, yet".to_string(),
));
}
Operator::ContBind {
argument_index: _,
result_index: _,
} => {
// TODO(10248) This is added in a follow-up PR
return Err(wasmtime_environ::WasmError::Unsupported(
"codegen for stack switching instructions not implemented, yet".to_string(),
));
}
Operator::Suspend { tag_index: _ } => {
// TODO(10248) This is added in a follow-up PR
return Err(wasmtime_environ::WasmError::Unsupported(
"codegen for stack switching instructions not implemented, yet".to_string(),
));
}
Operator::Resume {
cont_type_index: _,
resume_table: _,
} => {
// TODO(10248) This is added in a follow-up PR
return Err(wasmtime_environ::WasmError::Unsupported(
"codegen for stack switching instructions not implemented, yet".to_string(),
));
}
Operator::ResumeThrow {
cont_type_index: _,
tag_index: _,
resume_table: _,
} => {
// TODO(10248) This depends on exception handling
return Err(wasmtime_environ::WasmError::Unsupported(
"resume.throw instructions not supported, yet".to_string(),
));
}
Operator::Switch {
cont_type_index: _,
tag_index: _,
} => {
// TODO(10248) This is added in a follow-up PR
return Err(wasmtime_environ::WasmError::Unsupported(
"codegen for stack switching instructions not implemented, yet".to_string(),
));
}

Operator::GlobalAtomicGet { .. }
| Operator::GlobalAtomicSet { .. }
| Operator::GlobalAtomicRmwAdd { .. }
Expand Down Expand Up @@ -2989,6 +2939,17 @@ pub fn translate_operator(
));
}

Operator::ContNew { .. }
| Operator::ContBind { .. }
| Operator::Suspend { .. }
| Operator::Resume { .. }
| Operator::ResumeThrow { .. }
| Operator::Switch { .. } => {
return Err(wasm_unsupported!(
"stack-switching operators are not yet implemented"
));
}

Operator::I64MulWideS => {
let (arg1, arg2) = state.pop2();
let arg1 = builder.ins().sextend(I128, arg1);
Expand Down
1 change: 0 additions & 1 deletion crates/environ/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ compile = [
"dep:wasm-encoder",
"dep:wasmprinter",
]
stack-switching = []
threads = ['std']
wmemcheck = ['std']
std = [
Expand Down
22 changes: 0 additions & 22 deletions crates/environ/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,25 +226,6 @@ macro_rules! foreach_builtin_function {
// Raises an unconditional trap where the trap information must have
// been previously filled in.
raise(vmctx: vmctx);

// Creates a new continuation from a funcref.
#[cfg(feature = "stack-switching")]
cont_new(vmctx: vmctx, r: pointer, param_count: u32, result_count: u32) -> pointer;

// Returns an index for Wasm's `table.grow` instruction
// for `contobj`s. Note that the initial
// Option<VMContObj> (i.e., the value to fill the new
// slots with) is split into two arguments: The underlying
// continuation reference and the revision count. To
// denote the continuation being `None`, `init_contref`
// may be 0.
#[cfg(feature = "stack-switching")]
table_grow_cont_obj(vmctx: vmctx, table: u32, delta: u64, init_contref: pointer, init_revision: u64) -> pointer;

// `value_contref` and `value_revision` together encode
// the Option<VMContObj>, as in previous libcall.
#[cfg(feature = "stack-switching")]
table_fill_cont_obj(vmctx: vmctx, table: u32, dst: u64, value_contref: pointer, value_revision: u64, len: u64) -> bool;
}
};
}
Expand Down Expand Up @@ -386,7 +367,6 @@ impl BuiltinFunctionIndex {
(@get memory32_grow pointer) => (TrapSentinel::NegativeTwo);
(@get table_grow_func_ref pointer) => (TrapSentinel::NegativeTwo);
(@get table_grow_gc_ref pointer) => (TrapSentinel::NegativeTwo);
(@get table_grow_cont_obj pointer) => (TrapSentinel::NegativeTwo);

// Atomics-related functions return a negative value indicating trap
// indicate a trap.
Expand Down Expand Up @@ -426,8 +406,6 @@ impl BuiltinFunctionIndex {
(@get fma_f32x4 f32x4) => (return None);
(@get fma_f64x2 f64x2) => (return None);

(@get cont_new pointer) => (TrapSentinel::Negative);

// Bool-returning functions use `false` as an indicator of a trap.
(@get $name:ident bool) => (TrapSentinel::Falsy);

Expand Down
9 changes: 1 addition & 8 deletions crates/environ/src/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,10 @@ pub const VM_GC_HEADER_TYPE_INDEX_OFFSET: u32 = 4;
/// Get the byte size of the given Wasm type when it is stored inside the GC
/// heap.
pub fn byte_size_of_wasm_ty_in_gc_heap(ty: &WasmStorageType) -> u32 {
use crate::{WasmHeapType::*, WasmRefType};
match ty {
WasmStorageType::I8 => 1,
WasmStorageType::I16 => 2,
WasmStorageType::Val(ty) => match ty {
WasmValType::Ref(WasmRefType {
nullable: _,
heap_type: ConcreteCont(_) | Cont,
}) => unimplemented!("Stack switching feature not compatbile with GC, yet"),
WasmValType::I32 | WasmValType::F32 | WasmValType::Ref(_) => 4,
WasmValType::I64 | WasmValType::F64 => 8,
WasmValType::V128 => 16,
Expand Down Expand Up @@ -183,9 +178,7 @@ pub trait GcTypeLayouts {
WasmCompositeInnerType::Array(ty) => Some(self.array_layout(ty).into()),
WasmCompositeInnerType::Struct(ty) => Some(self.struct_layout(ty).into()),
WasmCompositeInnerType::Func(_) => None,
WasmCompositeInnerType::Cont(_) => {
unimplemented!("Stack switching feature not compatbile with GC, yet")
}
WasmCompositeInnerType::Cont(_) => None,
}
}

Expand Down
2 changes: 0 additions & 2 deletions crates/environ/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ pub mod obj;
mod ref_bits;
mod scopevec;
mod stack_map;
mod stack_switching;
mod trap_encoding;
mod tunables;
mod types;
Expand All @@ -52,7 +51,6 @@ pub use crate::module_types::*;
pub use crate::ref_bits::*;
pub use crate::scopevec::ScopeVec;
pub use crate::stack_map::*;
pub use crate::stack_switching::*;
pub use crate::trap_encoding::*;
pub use crate::tunables::*;
pub use crate::types::*;
Expand Down
Loading
Loading