Skip to content

Commit 98b3851

Browse files
authored
Remove backpressure.set (#2397)
* Remove `backpressure.set` The replacements of `backpressure.{inc,dec}` have been around for awhile, no need to keep these any more. * Fix wit-dylib tests
1 parent d054060 commit 98b3851

File tree

47 files changed

+417
-539
lines changed

Some content is hidden

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

47 files changed

+417
-539
lines changed

Cargo.lock

Lines changed: 72 additions & 73 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/wasm-encoder/src/component/builder.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -478,12 +478,6 @@ impl ComponentBuilder {
478478
self.core_funcs.add(Some("thread.available-parallelism"))
479479
}
480480

481-
/// Declares a new `backpressure.set` intrinsic.
482-
pub fn backpressure_set(&mut self) -> u32 {
483-
self.canonical_functions().backpressure_set();
484-
self.core_funcs.add(Some("backpressure.set"))
485-
}
486-
487481
/// Declares a new `backpressure.inc` intrinsic.
488482
pub fn backpressure_inc(&mut self) -> u32 {
489483
self.canonical_functions().backpressure_inc();

crates/wasm-encoder/src/component/canonicals.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,6 @@ impl CanonicalFunctionSection {
196196
self
197197
}
198198

199-
/// Defines a function which tells the host to enable or disable
200-
/// backpressure for the caller's instance. When backpressure is enabled,
201-
/// the host must not start any new calls to that instance until
202-
/// backpressure is disabled.
203-
pub fn backpressure_set(&mut self) -> &mut Self {
204-
self.bytes.push(0x08);
205-
self.num_added += 1;
206-
self
207-
}
208-
209199
/// Defines a function which tells the host to increment the backpressure
210200
/// counter.
211201
pub fn backpressure_inc(&mut self) -> &mut Self {

crates/wasm-encoder/src/reencode/component.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -977,9 +977,6 @@ pub mod component_utils {
977977
wasmparser::CanonicalFunction::ThreadAvailableParallelism => {
978978
section.thread_available_parallelism();
979979
}
980-
wasmparser::CanonicalFunction::BackpressureSet => {
981-
section.backpressure_set();
982-
}
983980
wasmparser::CanonicalFunction::BackpressureInc => {
984981
section.backpressure_inc();
985982
}

crates/wasmparser/src/readers/component/canonicals.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ pub enum CanonicalFunction {
9090
/// A function which returns the number of threads that can be expected to
9191
/// execute concurrently
9292
ThreadAvailableParallelism,
93-
/// A function which tells the host to enable or disable backpressure for
94-
/// the caller's instance.
95-
BackpressureSet,
9693
/// A function which tells the host to enable backpressure by incrementing
9794
/// the component's counter by 1.
9895
BackpressureInc,
@@ -329,7 +326,6 @@ impl<'a> FromReader<'a> for CanonicalFunction {
329326
0x04 => CanonicalFunction::ResourceRep {
330327
resource: reader.read()?,
331328
},
332-
0x08 => CanonicalFunction::BackpressureSet,
333329
0x24 => CanonicalFunction::BackpressureInc,
334330
0x25 => CanonicalFunction::BackpressureDec,
335331
0x09 => CanonicalFunction::TaskReturn {

crates/wasmparser/src/validator/component.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,6 @@ impl ComponentState {
11851185
CanonicalFunction::ThreadAvailableParallelism => {
11861186
self.thread_available_parallelism(types, offset)
11871187
}
1188-
CanonicalFunction::BackpressureSet => self.backpressure_set(types, offset),
11891188
CanonicalFunction::BackpressureInc => self.backpressure_inc(types, offset),
11901189
CanonicalFunction::BackpressureDec => self.backpressure_dec(types, offset),
11911190
CanonicalFunction::TaskReturn { result, options } => {
@@ -1393,19 +1392,6 @@ impl ComponentState {
13931392
Ok(())
13941393
}
13951394

1396-
fn backpressure_set(&mut self, types: &mut TypeAlloc, offset: usize) -> Result<()> {
1397-
if !self.features.cm_async() {
1398-
bail!(
1399-
offset,
1400-
"`backpressure.set` requires the component model async feature"
1401-
)
1402-
}
1403-
1404-
self.core_funcs
1405-
.push(types.intern_func_type(FuncType::new([ValType::I32], []), offset));
1406-
Ok(())
1407-
}
1408-
14091395
fn backpressure_inc(&mut self, types: &mut TypeAlloc, offset: usize) -> Result<()> {
14101396
if !self.features.cm_async() {
14111397
bail!(

crates/wasmprinter/src/component.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -947,9 +947,6 @@ impl Printer<'_, '_> {
947947
Ok(())
948948
})?;
949949
}
950-
CanonicalFunction::BackpressureSet => {
951-
self.print_intrinsic(state, "canon backpressure.set", &|_, _| Ok(()))?;
952-
}
953950
CanonicalFunction::BackpressureInc => {
954951
self.print_intrinsic(state, "canon backpressure.inc", &|_, _| Ok(()))?;
955952
}

crates/wast/src/component/binary.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,6 @@ impl<'a> Encoder<'a> {
370370
self.core_func_names.push(name);
371371
self.funcs.thread_available_parallelism();
372372
}
373-
CoreFuncKind::BackpressureSet => {
374-
self.core_func_names.push(name);
375-
self.funcs.backpressure_set();
376-
}
377373
CoreFuncKind::BackpressureInc => {
378374
self.core_func_names.push(name);
379375
self.funcs.backpressure_inc();

crates/wast/src/component/func.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ pub enum CoreFuncKind<'a> {
5454
ThreadSpawnRef(CanonThreadSpawnRef<'a>),
5555
ThreadSpawnIndirect(CanonThreadSpawnIndirect<'a>),
5656
ThreadAvailableParallelism(CanonThreadAvailableParallelism),
57-
BackpressureSet,
5857
BackpressureInc,
5958
BackpressureDec,
6059
TaskReturn(CanonTaskReturn<'a>),
@@ -126,9 +125,6 @@ impl<'a> CoreFuncKind<'a> {
126125
Ok(CoreFuncKind::ThreadSpawnIndirect(parser.parse()?))
127126
} else if l.peek::<kw::thread_available_parallelism>()? {
128127
Ok(CoreFuncKind::ThreadAvailableParallelism(parser.parse()?))
129-
} else if l.peek::<kw::backpressure_set>()? {
130-
parser.parse::<kw::backpressure_set>()?;
131-
Ok(CoreFuncKind::BackpressureSet)
132128
} else if l.peek::<kw::backpressure_inc>()? {
133129
parser.parse::<kw::backpressure_inc>()?;
134130
Ok(CoreFuncKind::BackpressureInc)

0 commit comments

Comments
 (0)