Skip to content

Commit a7d3300

Browse files
authored
Revert "Stack switching: Infrastructure and runtime support (#10388)" (#10938)
This reverts commit 63d482c.
1 parent 63d482c commit a7d3300

File tree

50 files changed

+124
-2666
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+124
-2666
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,6 @@ jobs:
371371
-p wasmtime --no-default-features --features threads
372372
-p wasmtime --no-default-features --features runtime,threads
373373
-p wasmtime --no-default-features --features cranelift,threads
374-
-p wasmtime --no-default-features --features stack-switching
375-
-p wasmtime --no-default-features --features cranelift,stack-switching
376-
-p wasmtime --no-default-features --features runtime,stack-switching
377374
-p wasmtime --features incremental-cache
378375
-p wasmtime --features profile-pulley
379376
-p wasmtime --all-features

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,6 @@ default = [
431431
"gc",
432432
"gc-drc",
433433
"gc-null",
434-
"stack-switching",
435434
"winch",
436435
"pulley",
437436

@@ -490,7 +489,6 @@ gc = ["wasmtime-cli-flags/gc", "wasmtime/gc"]
490489
gc-drc = ["gc", "wasmtime/gc-drc", "wasmtime-cli-flags/gc-drc"]
491490
gc-null = ["gc", "wasmtime/gc-null", "wasmtime-cli-flags/gc-null"]
492491
pulley = ["wasmtime-cli-flags/pulley"]
493-
stack-switching = ["wasmtime/stack-switching", "wasmtime-cli-flags/stack-switching"]
494492

495493
# CLI subcommands for the `wasmtime` executable. See `wasmtime $cmd --help`
496494
# for more information on each subcommand.

crates/c-api/include/wasmtime/config.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,6 @@ WASMTIME_CONFIG_PROP(void, wasm_wide_arithmetic, bool)
250250

251251
#ifdef WASMTIME_FEATURE_COMPILER
252252

253-
/**
254-
* \brief Configures whether the WebAssembly stack switching
255-
* proposal is enabled.
256-
*
257-
* This setting is `false` by default.
258-
*/
259-
WASMTIME_CONFIG_PROP(void, wasm_stack_switching, bool)
260-
261253
/**
262254
* \brief Configures how JIT code will be compiled.
263255
*

crates/c-api/src/config.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,6 @@ pub extern "C" fn wasmtime_config_wasm_memory64_set(c: &mut wasm_config_t, enabl
140140
c.config.wasm_memory64(enable);
141141
}
142142

143-
#[unsafe(no_mangle)]
144-
pub extern "C" fn wasmtime_config_wasm_stack_switching_set(c: &mut wasm_config_t, enable: bool) {
145-
c.config.wasm_stack_switching(enable);
146-
}
147-
148143
#[unsafe(no_mangle)]
149144
#[cfg(any(feature = "cranelift", feature = "winch"))]
150145
pub extern "C" fn wasmtime_config_strategy_set(

crates/cli-flags/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,3 @@ gc-null = ["gc", "wasmtime/gc-null"]
3939
threads = ["wasmtime/threads"]
4040
memory-protection-keys = ["wasmtime/memory-protection-keys"]
4141
pulley = ["wasmtime/pulley"]
42-
stack-switching = ["wasmtime/stack-switching"]

crates/cli-flags/src/lib.rs

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,6 @@ wasmtime_option_group! {
377377
pub component_model_error_context: Option<bool>,
378378
/// Configure support for the function-references proposal.
379379
pub function_references: Option<bool>,
380-
/// Configure support for the stack-switching proposal.
381-
pub stack_switching: Option<bool>,
382380
/// Configure support for the GC proposal.
383381
pub gc: Option<bool>,
384382
/// Configure support for the custom-page-sizes proposal.
@@ -820,23 +818,6 @@ impl CommonOptions {
820818
config.native_unwind_info(enable);
821819
}
822820

823-
// async_stack_size enabled by either async or stack-switching, so
824-
// cannot directly use match_feature!
825-
#[cfg(any(feature = "async", feature = "stack-switching"))]
826-
{
827-
if let Some(size) = self.wasm.async_stack_size {
828-
config.async_stack_size(size);
829-
}
830-
}
831-
#[cfg(not(any(feature = "async", feature = "stack-switching")))]
832-
{
833-
if let Some(_size) = self.wasm.async_stack_size {
834-
anyhow::bail!(concat!(
835-
"support for async/stack-switching disabled at compile time"
836-
));
837-
}
838-
}
839-
840821
match_feature! {
841822
["pooling-allocator" : self.opts.pooling_allocator.or(pooling_allocator_default)]
842823
enable => {
@@ -942,6 +923,11 @@ impl CommonOptions {
942923
);
943924
}
944925

926+
match_feature! {
927+
["async" : self.wasm.async_stack_size]
928+
size => config.async_stack_size(size),
929+
_ => err,
930+
}
945931
match_feature! {
946932
["async" : self.wasm.async_stack_zeroing]
947933
enable => config.async_stack_zeroing(enable),
@@ -954,7 +940,7 @@ impl CommonOptions {
954940
// If `-Wasync-stack-size` isn't passed then automatically adjust it
955941
// to the wasm stack size provided here too. That prevents the need
956942
// to pass both when one can generally be inferred from the other.
957-
#[cfg(any(feature = "async", feature = "stack-switching"))]
943+
#[cfg(feature = "async")]
958944
if self.wasm.async_stack_size.is_none() {
959945
const DEFAULT_HOST_STACK: usize = 512 << 10;
960946
config.async_stack_size(max + DEFAULT_HOST_STACK);
@@ -997,9 +983,6 @@ impl CommonOptions {
997983
if let Some(enable) = self.wasm.memory64.or(all) {
998984
config.wasm_memory64(enable);
999985
}
1000-
if let Some(enable) = self.wasm.stack_switching {
1001-
config.wasm_stack_switching(enable);
1002-
}
1003986
if let Some(enable) = self.wasm.custom_page_sizes.or(all) {
1004987
config.wasm_custom_page_sizes(enable);
1005988
}
@@ -1040,7 +1023,6 @@ impl CommonOptions {
10401023
("gc", gc, wasm_gc)
10411024
("gc", reference_types, wasm_reference_types)
10421025
("gc", function_references, wasm_function_references)
1043-
("stack-switching", stack_switching, wasm_stack_switching)
10441026
}
10451027
Ok(())
10461028
}

crates/cranelift/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,4 @@ wmemcheck = ["wasmtime-environ/wmemcheck"]
4646
gc = ["wasmtime-environ/gc"]
4747
gc-drc = ["gc", "wasmtime-environ/gc-drc"]
4848
gc-null = ["gc", "wasmtime-environ/gc-null"]
49-
stack-switching = []
5049
threads = ["wasmtime-environ/threads"]

crates/cranelift/src/func_environ.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3793,17 +3793,3 @@ fn index_type_to_ir_type(index_type: IndexType) -> ir::Type {
37933793
IndexType::I64 => I64,
37943794
}
37953795
}
3796-
3797-
/// TODO(10248) This is removed in the next stack switching PR. It stops the
3798-
/// compiler from complaining about the stack switching libcalls being dead
3799-
/// code.
3800-
#[cfg(feature = "stack-switching")]
3801-
#[allow(
3802-
dead_code,
3803-
reason = "Dummy function to supress more dead code warnings"
3804-
)]
3805-
pub fn use_stack_switching_libcalls() {
3806-
let _ = BuiltinFunctions::cont_new;
3807-
let _ = BuiltinFunctions::table_grow_cont_obj;
3808-
let _ = BuiltinFunctions::table_fill_cont_obj;
3809-
}

crates/cranelift/src/func_environ/gc/enabled.rs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,7 @@ fn read_field_at_addr(
153153
.call(get_interned_func_ref, &[vmctx, func_ref_id, expected_ty]);
154154
builder.func.dfg.first_result(call_inst)
155155
}
156-
WasmHeapTopType::Cont => {
157-
// TODO(#10248) GC integration for stack switching
158-
return Err(wasmtime_environ::WasmError::Unsupported(
159-
"Stack switching feature not compatbile with GC, yet".to_string(),
160-
));
161-
}
156+
WasmHeapTopType::Cont => todo!(), // FIXME: #10248 stack switching support.
162157
},
163158
},
164159
};
@@ -1037,8 +1032,6 @@ pub fn translate_ref_test(
10371032
| WasmHeapType::NoExtern
10381033
| WasmHeapType::Func
10391034
| WasmHeapType::NoFunc
1040-
| WasmHeapType::Cont
1041-
| WasmHeapType::NoCont
10421035
| WasmHeapType::I31 => unreachable!("handled top, bottom, and i31 types above"),
10431036

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

10941087
func_env.is_subtype(builder, actual_shared_ty, expected_shared_ty)
10951088
}
1096-
WasmHeapType::ConcreteCont(_) => {
1097-
// TODO(#10248) GC integration for stack switching
1098-
return Err(wasmtime_environ::WasmError::Unsupported(
1099-
"Stack switching feature not compatbile with GC, yet".to_string(),
1100-
));
1101-
}
1089+
1090+
WasmHeapType::Cont | WasmHeapType::ConcreteCont(_) | WasmHeapType::NoCont => todo!(), // FIXME: #10248 stack switching support.
11021091
};
11031092
builder.ins().jump(continue_block, &[result.into()]);
11041093

@@ -1420,9 +1409,8 @@ impl FuncEnvironment<'_> {
14201409
WasmHeapType::Func | WasmHeapType::ConcreteFunc(_) | WasmHeapType::NoFunc => {
14211410
unreachable!()
14221411
}
1423-
WasmHeapType::Cont | WasmHeapType::ConcreteCont(_) | WasmHeapType::NoCont => {
1424-
unreachable!()
1425-
}
1412+
1413+
WasmHeapType::Cont | WasmHeapType::ConcreteCont(_) | WasmHeapType::NoCont => todo!(), // FIXME: #10248 stack switching support.
14261414
};
14271415

14281416
match (ty.nullable, might_be_i31) {

crates/cranelift/src/lib.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ pub const TRAP_HEAP_MISALIGNED: TrapCode =
6161
TrapCode::unwrap_user(Trap::HeapMisaligned as u8 + TRAP_OFFSET);
6262
pub const TRAP_TABLE_OUT_OF_BOUNDS: TrapCode =
6363
TrapCode::unwrap_user(Trap::TableOutOfBounds as u8 + TRAP_OFFSET);
64-
pub const TRAP_UNHANDLED_TAG: TrapCode =
65-
TrapCode::unwrap_user(Trap::UnhandledTag as u8 + TRAP_OFFSET);
66-
pub const TRAP_CONTINUATION_ALREADY_CONSUMED: TrapCode =
67-
TrapCode::unwrap_user(Trap::ContinuationAlreadyConsumed as u8 + TRAP_OFFSET);
6864
pub const TRAP_CAST_FAILURE: TrapCode =
6965
TrapCode::unwrap_user(Trap::CastFailure as u8 + TRAP_OFFSET);
7066

@@ -206,11 +202,7 @@ fn reference_type(wasm_ht: WasmHeapType, pointer_type: ir::Type) -> ir::Type {
206202
match wasm_ht.top() {
207203
WasmHeapTopType::Func => pointer_type,
208204
WasmHeapTopType::Any | WasmHeapTopType::Extern => ir::types::I32,
209-
WasmHeapTopType::Cont =>
210-
// TODO(10248) This is added in a follow-up PR
211-
{
212-
unimplemented!("codegen for stack switching types not implemented, yet")
213-
}
205+
WasmHeapTopType::Cont => todo!(), // FIXME: #10248 stack switching support.
214206
}
215207
}
216208

0 commit comments

Comments
 (0)