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
10 changes: 0 additions & 10 deletions crates/cranelift/src/compiler/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,6 @@ impl<'a> TrampolineCompiler<'a> {
Trampoline::ResourceDrop { instance, ty } => {
self.translate_resource_drop(*instance, *ty);
}
Trampoline::BackpressureSet { instance } => {
self.translate_libcall(
host::backpressure_set,
TrapSentinel::Falsy,
WasmArgs::InRegisters,
|me, params| {
params.push(me.index_value(*instance));
},
);
}
Trampoline::BackpressureInc { instance } => {
self.translate_libcall(
host::backpressure_modify,
Expand Down
2 changes: 0 additions & 2 deletions crates/environ/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ macro_rules! foreach_builtin_component_function {
resource_enter_call(vmctx: vmctx);
resource_exit_call(vmctx: vmctx) -> bool;

#[cfg(feature = "component-model-async")]
backpressure_set(vmctx: vmctx, caller_instance: u32, enabled: u32) -> bool;
#[cfg(feature = "component-model-async")]
backpressure_modify(vmctx: vmctx, caller_instance: u32, increment: u8) -> bool;
#[cfg(feature = "component-model-async")]
Expand Down
6 changes: 0 additions & 6 deletions crates/environ/src/component/dfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,6 @@ pub enum Trampoline {
instance: RuntimeComponentInstanceIndex,
ty: TypeResourceTableIndex,
},
BackpressureSet {
instance: RuntimeComponentInstanceIndex,
},
BackpressureInc {
instance: RuntimeComponentInstanceIndex,
},
Expand Down Expand Up @@ -958,9 +955,6 @@ impl LinearizeDfg<'_> {
instance: *instance,
ty: *ty,
},
Trampoline::BackpressureSet { instance } => info::Trampoline::BackpressureSet {
instance: *instance,
},
Trampoline::BackpressureInc { instance } => info::Trampoline::BackpressureInc {
instance: *instance,
},
Expand Down
8 changes: 0 additions & 8 deletions crates/environ/src/component/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -759,13 +759,6 @@ pub enum Trampoline {
ty: TypeResourceTableIndex,
},

/// A `backpressure.set` intrinsic, which tells the host to enable or
/// disable backpressure for the caller's instance.
BackpressureSet {
/// The specific component instance which is calling the intrinsic.
instance: RuntimeComponentInstanceIndex,
},

/// A `backpressure.inc` intrinsic.
BackpressureInc {
/// The specific component instance which is calling the intrinsic.
Expand Down Expand Up @@ -1202,7 +1195,6 @@ impl Trampoline {
ResourceNew { ty, .. } => format!("component-resource-new[{}]", ty.as_u32()),
ResourceRep { ty, .. } => format!("component-resource-rep[{}]", ty.as_u32()),
ResourceDrop { ty, .. } => format!("component-resource-drop[{}]", ty.as_u32()),
BackpressureSet { .. } => format!("backpressure-set"),
BackpressureInc { .. } => format!("backpressure-inc"),
BackpressureDec { .. } => format!("backpressure-dec"),
TaskReturn { .. } => format!("task-return"),
Expand Down
7 changes: 1 addition & 6 deletions crates/environ/src/component/translate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,6 @@ enum LocalInitializer<'data> {
ResourceRep(AliasableResourceId, ModuleInternedTypeIndex),
ResourceDrop(AliasableResourceId, ModuleInternedTypeIndex),

BackpressureSet {
func: ModuleInternedTypeIndex,
},
BackpressureInc {
func: ModuleInternedTypeIndex,
},
Expand Down Expand Up @@ -871,9 +868,7 @@ impl<'a, 'data> Translator<'a, 'data> {
bail!("unsupported intrinsic")
}
wasmparser::CanonicalFunction::BackpressureSet => {
let core_type = self.core_func_signature(core_func_index)?;
core_func_index += 1;
LocalInitializer::BackpressureSet { func: core_type }
bail!("unsupported intrinsic")
}
wasmparser::CanonicalFunction::BackpressureInc => {
let core_type = self.core_func_signature(core_func_index)?;
Expand Down
9 changes: 0 additions & 9 deletions crates/environ/src/component/translate/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,15 +699,6 @@ impl<'a> Inliner<'a> {
));
frame.funcs.push((*ty, dfg::CoreDef::Trampoline(index)));
}
BackpressureSet { func } => {
let index = self.result.trampolines.push((
*func,
dfg::Trampoline::BackpressureSet {
instance: frame.instance,
},
));
frame.funcs.push((*func, dfg::CoreDef::Trampoline(index)));
}
BackpressureInc { func } => {
let index = self.result.trampolines.push((
*func,
Expand Down
7 changes: 5 additions & 2 deletions crates/test-programs/src/bin/async_backpressure_callee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ impl Run for Component {

impl Backpressure for Component {
fn set_backpressure(enabled: bool) {
#[expect(deprecated, reason = "will replace with backpressure.inc/dec soon")]
wit_bindgen::backpressure_set(enabled);
if enabled {
wit_bindgen::backpressure_inc();
} else {
wit_bindgen::backpressure_dec();
}
}
fn inc_backpressure() {
wit_bindgen::backpressure_inc();
Expand Down
7 changes: 5 additions & 2 deletions crates/test-programs/src/bin/async_cancel_callee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,11 @@ enum State {

#[unsafe(export_name = "local:local/backpressure#set-backpressure")]
unsafe extern "C" fn export_set_backpressure(enabled: bool) {
#[expect(deprecated, reason = "will replace with backpressure.inc/dec soon")]
wit_bindgen::backpressure_set(enabled);
if enabled {
wit_bindgen::backpressure_inc();
} else {
wit_bindgen::backpressure_dec();
}
}

#[unsafe(export_name = "local:local/backpressure#inc-backpressure")]
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmtime/src/runtime/component/concurrent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4709,7 +4709,7 @@ impl ConcurrentState {
Ok(())
}

/// Implements the `backpressure.{set,inc,dec}` intrinsics.
/// Implements the `backpressure.{inc,dec}` intrinsics.
pub(crate) fn backpressure_modify(
&mut self,
caller_instance: RuntimeComponentInstanceIndex,
Expand Down
13 changes: 0 additions & 13 deletions crates/wasmtime/src/runtime/vm/component/libcalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,19 +669,6 @@ fn trap(_store: &mut dyn VMStore, _instance: Instance, code: u8) -> Result<()> {
Err(wasmtime_environ::Trap::from_u8(code).unwrap().into())
}

#[cfg(feature = "component-model-async")]
fn backpressure_set(
store: &mut dyn VMStore,
_instance: Instance,
caller_instance: u32,
enabled: u32,
) -> Result<()> {
store.concurrent_state_mut().backpressure_modify(
RuntimeComponentInstanceIndex::from_u32(caller_instance),
|_| Some(if enabled != 0 { 1 } else { 0 }),
)
}

#[cfg(feature = "component-model-async")]
fn backpressure_modify(
store: &mut dyn VMStore,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
;;! component_model_async = true

;; backpressure.set
(component
(core module $m
(import "" "backpressure.set" (func $backpressure-set (param i32)))
)
(core func $backpressure-set (canon backpressure.set))
(core instance $i (instantiate $m (with "" (instance (export "backpressure.set" (func $backpressure-set))))))
)

;; backpressure.inc
(component
(core module $m
Expand Down