Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 5fb237a

Browse files
committed
fix poll_for_result regression
This regression was actually introduced back when I added waitable set support, but due to how the tests were being run we didn't notice it until my latest refactor. Signed-off-by: Joel Dice <joel.dice@fermyon.com>
1 parent 2a88a42 commit 5fb237a

1 file changed

Lines changed: 3 additions & 12 deletions

File tree

crates/wasmtime/src/runtime/component/concurrent.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,6 @@ struct ResetInstance(Option<SendSyncPtr<ComponentInstance>>);
387387

388388
impl Drop for ResetInstance {
389389
fn drop(&mut self) {
390-
eprintln!("reset to: {:?}", self.0);
391-
392390
INSTANCE.with(|v| v.set(self.0.map(|v| v.as_ptr()).unwrap_or_else(ptr::null_mut)))
393391
}
394392
}
@@ -425,7 +423,6 @@ fn poll_with_state<T, F: Future + ?Sized>(
425423
}))
426424
});
427425
let _reset_state = ResetState(old_state);
428-
eprintln!("set to: {:?}", instance.as_ptr());
429426
let old_instance = INSTANCE.with(|v| v.replace(instance.as_ptr()));
430427
let _reset_instance = ResetInstance(NonNull::new(old_instance).map(SendSyncPtr::new));
431428
(future.poll(cx), STATE.with(|v| v.take()).unwrap().spawned)
@@ -899,12 +896,8 @@ impl ComponentInstance {
899896
self.maybe_resume_next_task(runtime_instance)
900897
}
901898

902-
fn poll_for_result(&mut self) -> Result<()> {
903-
let task = *self.guest_task();
904-
self.poll_loop(move |instance| {
905-
task.map(|task| Ok::<_, anyhow::Error>(instance.get(task)?.result.is_none()))
906-
.unwrap_or(Ok(true))
907-
})
899+
fn poll_for_result(&mut self, task: TableId<GuestTask>) -> Result<()> {
900+
self.poll_loop(move |instance| Ok::<_, anyhow::Error>(instance.get(task)?.result.is_none()))
908901
}
909902

910903
fn handle_ready(&mut self, ready: Vec<HostTaskOutput>) -> Result<()> {
@@ -1626,7 +1619,7 @@ impl ComponentInstance {
16261619
self.get_mut(set)?.waiting.insert(caller);
16271620
Waitable::Guest(guest_task).join(self, Some(set))?;
16281621

1629-
self.poll_for_result()?;
1622+
self.poll_for_result(guest_task)?;
16301623
status = Status::Returned;
16311624
0
16321625
}
@@ -1880,7 +1873,6 @@ impl ComponentInstance {
18801873
store: StoreContextMut<'_, T>,
18811874
future: Pin<Box<dyn Future<Output = R> + Send + '_>>,
18821875
) -> Result<R> {
1883-
eprintln!("set to: {:?}", self as *mut _);
18841876
let old = INSTANCE.with(|v| v.replace(self));
18851877
let _reset_instance = ResetInstance(NonNull::new(old).map(SendSyncPtr::new));
18861878
unsafe {
@@ -3639,7 +3631,6 @@ fn checked<F: Future + Send + 'static>(
36393631

36403632
fn check_recursive_run() {
36413633
INSTANCE.with(|v| {
3642-
eprintln!("v.get(): {:?}", v.get());
36433634
if !v.get().is_null() {
36443635
panic!("Recursive `Instance::run{{_with}}` calls not supported")
36453636
}

0 commit comments

Comments
 (0)