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
6 changes: 0 additions & 6 deletions crates/wasm-encoder/src/component/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,12 +454,6 @@ impl ComponentBuilder {
self.core_funcs.add(Some("resource.drop"))
}

/// Declares a new `resource.drop` intrinsic.
pub fn resource_drop_async(&mut self, ty: u32) -> u32 {
self.canonical_functions().resource_drop_async(ty);
self.core_funcs.add(Some("resource.drop async"))
}

/// Declares a new `resource.new` intrinsic.
pub fn resource_new(&mut self, ty: u32) -> u32 {
self.canonical_functions().resource_new(ty);
Expand Down
8 changes: 0 additions & 8 deletions crates/wasm-encoder/src/component/canonicals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,6 @@ impl CanonicalFunctionSection {
self
}

/// Defines a function which will drop the specified type of handle.
pub fn resource_drop_async(&mut self, ty_index: u32) -> &mut Self {
self.bytes.push(0x07);
ty_index.encode(&mut self.bytes);
self.num_added += 1;
self
}

/// Defines a function which will return the representation of the specified
/// resource type.
pub fn resource_rep(&mut self, ty_index: u32) -> &mut Self {
Expand Down
4 changes: 0 additions & 4 deletions crates/wasm-encoder/src/reencode/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -957,10 +957,6 @@ pub mod component_utils {
let resource = reencoder.component_type_index(resource);
section.resource_drop(resource);
}
wasmparser::CanonicalFunction::ResourceDropAsync { resource } => {
let resource = reencoder.component_type_index(resource);
section.resource_drop_async(resource);
}
wasmparser::CanonicalFunction::ResourceRep { resource } => {
let resource = reencoder.component_type_index(resource);
section.resource_rep(resource);
Expand Down
8 changes: 0 additions & 8 deletions crates/wasmparser/src/readers/component/canonicals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ pub enum CanonicalFunction {
/// The type index of the resource that's being dropped.
resource: u32,
},
/// Same as `ResourceDrop`, but implements the `async` ABI.
ResourceDropAsync {
/// The type index of the resource that's being dropped.
resource: u32,
},
/// A function which returns the underlying i32-based representation of the
/// specified resource.
ResourceRep {
Expand Down Expand Up @@ -340,9 +335,6 @@ impl<'a> FromReader<'a> for CanonicalFunction {
0x03 => CanonicalFunction::ResourceDrop {
resource: reader.read()?,
},
0x07 => CanonicalFunction::ResourceDropAsync {
resource: reader.read()?,
},
0x04 => CanonicalFunction::ResourceRep {
resource: reader.read()?,
},
Expand Down
20 changes: 0 additions & 20 deletions crates/wasmparser/src/validator/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1218,9 +1218,6 @@ impl ComponentState {
CanonicalFunction::ResourceDrop { resource } => {
self.resource_drop(resource, types, offset)
}
CanonicalFunction::ResourceDropAsync { resource } => {
self.resource_drop_async(resource, types, offset)
}
CanonicalFunction::ResourceRep { resource } => {
self.resource_rep(resource, types, offset)
}
Expand Down Expand Up @@ -1420,23 +1417,6 @@ impl ComponentState {
Ok(())
}

fn resource_drop_async(
&mut self,
resource: u32,
types: &mut TypeAlloc,
offset: usize,
) -> Result<()> {
require_feature::cm_more_async_builtins(
self.features,
"`resource.drop` as `async` requires the component model more async builtins feature",
offset,
)?;
self.resource_at(resource, types, offset)?;
let id = types.intern_func_type(FuncType::new([ValType::I32], []), offset);
self.core_funcs.push(id);
Ok(())
}

fn resource_rep(&mut self, resource: u32, types: &mut TypeAlloc, offset: usize) -> Result<()> {
let rep = self.check_local_resource(resource, types, offset)?;
let id = types.intern_func_type(FuncType::new([ValType::I32], [rep]), offset);
Expand Down
6 changes: 0 additions & 6 deletions crates/wasmprinter/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -934,12 +934,6 @@ impl Printer<'_, '_> {
me.print_idx(&state.component.type_names, resource)
})?;
}
CanonicalFunction::ResourceDropAsync { resource } => {
self.print_intrinsic(state, "canon resource.drop ", &|me, state| {
me.print_idx(&state.component.type_names, resource)?;
me.print_type_keyword(" async")
})?;
}
CanonicalFunction::ResourceRep { resource } => {
self.print_intrinsic(state, "canon resource.rep ", &|me, state| {
me.print_idx(&state.component.type_names, resource)
Expand Down
6 changes: 1 addition & 5 deletions crates/wast/src/component/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,7 @@ impl<'a> Encoder<'a> {
}
CoreFuncKind::ResourceDrop(info) => {
self.core_func_names.push(name);
if info.async_ {
self.funcs.resource_drop_async(info.ty.into());
} else {
self.funcs.resource_drop(info.ty.into());
}
self.funcs.resource_drop(info.ty.into());
}
CoreFuncKind::ResourceRep(info) => {
self.core_func_names.push(name);
Expand Down
3 changes: 0 additions & 3 deletions crates/wast/src/component/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,6 @@ impl<'a> Parse<'a> for CanonResourceNew<'a> {
pub struct CanonResourceDrop<'a> {
/// The resource type that this intrinsic is dropping.
pub ty: Index<'a>,
/// Whether or not this function is async
pub async_: bool,
}

impl<'a> Parse<'a> for CanonResourceDrop<'a> {
Expand All @@ -486,7 +484,6 @@ impl<'a> Parse<'a> for CanonResourceDrop<'a> {

Ok(Self {
ty: parser.parse()?,
async_: parser.parse::<Option<kw::r#async>>()?.is_some(),
})
}
}
Expand Down
1 change: 0 additions & 1 deletion src/bin/wasm-tools/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,6 @@ impl<'a> Dump<'a> {
CanonicalFunction::Lower { .. }
| CanonicalFunction::ResourceNew { .. }
| CanonicalFunction::ResourceDrop { .. }
| CanonicalFunction::ResourceDropAsync { .. }
| CanonicalFunction::ResourceRep { .. }
| CanonicalFunction::ThreadSpawnRef { .. }
| CanonicalFunction::ThreadSpawnIndirect { .. }
Expand Down
5 changes: 0 additions & 5 deletions tests/cli/component-model/async/async-builtins.wast
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@
(component
(core func (canon subtask.cancel async))
(canon subtask.cancel async (core func))

(type $r (resource (rep i32)))
(core func (canon resource.drop $r async))
(canon resource.drop $r async (core func))

)

;; future.cancel-read
Expand Down
10 changes: 0 additions & 10 deletions tests/cli/missing-features/component-model/async-builtins.wast
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,6 @@
(core func (canon stream.cancel-write $s))
)

;; async resource.drop
(assert_invalid
(component
(type $t (resource (rep i32)))
(core func (canon resource.drop $t async)))
"requires the component model more async builtins feature")
(component
(type $t (resource (rep i32)))
(core func (canon resource.drop $t)))

(assert_invalid
(component
(type $t (stream))
Expand Down
7 changes: 0 additions & 7 deletions tests/cli/missing-features/component-model/async.wast
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,6 @@
(component (type (stream)))
"requires the component model async feature"
)
(assert_invalid
(component
(type $t (resource (rep i32)))
(core func $f (canon resource.drop $t async))
)
"requires the component model more async builtins feature"
)

;; async function types
(assert_invalid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,33 @@
},
{
"type": "module",
"line": 60,
"line": 55,
"filename": "async-builtins.5.wasm",
"module_type": "binary"
},
{
"type": "assert_invalid",
"line": 71,
"line": 66,
"filename": "async-builtins.6.wasm",
"module_type": "binary",
"text": "type mismatch for export `future.cancel-read` of module instantiation argument ``"
},
{
"type": "module",
"line": 83,
"line": 78,
"filename": "async-builtins.7.wasm",
"module_type": "binary"
},
{
"type": "assert_invalid",
"line": 94,
"line": 89,
"filename": "async-builtins.8.wasm",
"module_type": "binary",
"text": "type mismatch for export `future.cancel-write` of module instantiation argument ``"
},
{
"type": "module",
"line": 106,
"line": 101,
"filename": "async-builtins.9.wasm",
"module_type": "binary"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
(component
(core func (;0;) (canon subtask.cancel async))
(core func (;1;) (canon subtask.cancel async))
(type $r (;0;) (resource (rep i32)))
(core func (;2;) (canon resource.drop $r async))
(core func (;3;) (canon resource.drop $r async))
)
Original file line number Diff line number Diff line change
Expand Up @@ -37,42 +37,29 @@
},
{
"type": "assert_invalid",
"line": 37,
"line": 36,
"filename": "async-builtins.5.wasm",
"module_type": "binary",
"text": "requires the component model more async builtins feature"
},
{
"type": "module",
"line": 41,
"filename": "async-builtins.6.wasm",
"module_type": "binary"
},
{
"type": "assert_invalid",
"line": 46,
"filename": "async-builtins.7.wasm",
"module_type": "binary",
"text": "requires the component model more async builtins feature"
},
{
"type": "assert_invalid",
"line": 52,
"filename": "async-builtins.8.wasm",
"line": 42,
"filename": "async-builtins.6.wasm",
"module_type": "binary",
"text": "requires the component model more async builtins feature"
},
{
"type": "assert_invalid",
"line": 58,
"filename": "async-builtins.9.wasm",
"line": 48,
"filename": "async-builtins.7.wasm",
"module_type": "binary",
"text": "requires the component model more async builtins feature"
},
{
"type": "assert_invalid",
"line": 64,
"filename": "async-builtins.10.wasm",
"line": 54,
"filename": "async-builtins.8.wasm",
"module_type": "binary",
"text": "requires the component model more async builtins feature"
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -206,16 +206,9 @@
},
{
"type": "assert_invalid",
"line": 351,
"line": 353,
"filename": "async.29.wasm",
"module_type": "binary",
"text": "requires the component model more async builtins feature"
},
{
"type": "assert_invalid",
"line": 360,
"filename": "async.30.wasm",
"module_type": "binary",
"text": "async component functions require the component model async feature"
}
]
Expand Down
Loading