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
8 changes: 8 additions & 0 deletions crates/environ/src/fact/trampoline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,14 @@ impl<'a, 'b> Compiler<'a, 'b> {

old_task_may_block
} else if self.emit_resource_call {
assert!(!self.types[adapter.lift.ty].async_);
self.instruction(I32Const(
i32::try_from(adapter.lower.instance.as_u32()).unwrap(),
));
self.instruction(I32Const(0));
self.instruction(I32Const(
i32::try_from(adapter.lift.instance.as_u32()).unwrap(),
));
let enter_sync_call = self.module.import_enter_sync_call();
self.instruction(Call(enter_sync_call.as_u32()));
None
Expand Down
33 changes: 33 additions & 0 deletions tests/all/component_model/aot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,36 @@ fn implements_shows_up() -> Result<()> {

Ok(())
}

#[test]
#[cfg_attr(miri, ignore)]
fn issue_13540_resources_in_adapter_no_concurrency() -> Result<()> {
let mut config = Config::new();
config.concurrency_support(false);
let engine = Engine::new(&config)?;
engine.precompile_component(
br#"
(component
(component $A
(type $t' (resource (rep i32)))
(export $t "t" (type $t'))

(core module $m (func (export "r") (param i32)))
(core instance $i (instantiate $m))
(func (export "r") (param "a" (borrow $t)) (canon lift (core func $i "r")))
)
(component $B
(import "a" (instance $a
(export "t" (type $t (sub resource)))
(export "r" (func (param "a" (borrow $t))))
))

(core func $r (canon lower (func $a "r")))
)
(instance $a (instantiate $A))
(instance $b (instantiate $B (with "a" (instance $a))))
)
"#,
)?;
Ok(())
}
Loading