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

Commit 4cd979b

Browse files
authored
Merge pull request #219 from bytecodealliance/dicej/remove-unused-block-on-param
remove unused parameter from `AsyncCx::block_on`
2 parents d2e3319 + 24fde1c commit 4cd979b

7 files changed

Lines changed: 21 additions & 22 deletions

File tree

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4417,15 +4417,14 @@ impl AsyncCx {
44174417
pub(crate) unsafe fn block_on<U>(
44184418
&self,
44194419
mut future: Pin<&mut (dyn Future<Output = U> + Send)>,
4420-
mut store: Option<*mut dyn VMStore>,
4421-
) -> Result<(U, Option<*mut dyn VMStore>)> {
4420+
) -> Result<U> {
44224421
loop {
44234422
match self.poll(future.as_mut()) {
4424-
Poll::Ready(v) => break Ok((v, store)),
4425-
Poll::Pending => {}
4423+
Poll::Ready(v) => break Ok(v),
4424+
Poll::Pending => {
4425+
self.suspend(None)?;
4426+
}
44264427
}
4427-
4428-
store = self.suspend(store)?;
44294428
}
44304429
}
44314430

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ impl<T: 'static> LinkerInstance<'_, T> {
447447
{
448448
let async_cx = crate::component::concurrent::AsyncCx::new(&mut store.0);
449449
let mut future = Pin::from(f(store.as_context_mut(), params));
450-
unsafe { async_cx.block_on(future.as_mut(), None) }?.0
450+
unsafe { async_cx.block_on(future.as_mut()) }?
451451
}
452452
#[cfg(not(feature = "component-model-async"))]
453453
{
@@ -622,7 +622,7 @@ impl<T: 'static> LinkerInstance<'_, T> {
622622
{
623623
let async_cx = crate::component::concurrent::AsyncCx::new(&mut store.0);
624624
let mut future = Pin::from(f(store.as_context_mut(), params, results));
625-
unsafe { async_cx.block_on(future.as_mut(), None) }?.0
625+
unsafe { async_cx.block_on(future.as_mut()) }?
626626
}
627627
#[cfg(not(feature = "component-model-async"))]
628628
{
@@ -732,7 +732,7 @@ impl<T: 'static> LinkerInstance<'_, T> {
732732
let async_cx =
733733
crate::component::concurrent::AsyncCx::new(&mut cx.as_context_mut().0);
734734
let mut future = Pin::from(dtor(cx.as_context_mut(), param));
735-
unsafe { async_cx.block_on(future.as_mut(), None) }?.0
735+
unsafe { async_cx.block_on(future.as_mut()) }?
736736
}
737737
#[cfg(not(feature = "component-model-async"))]
738738
{

crates/wasmtime/src/runtime/func.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -518,9 +518,9 @@ impl Func {
518518
{
519519
let async_cx = crate::component::concurrent::AsyncCx::new(&mut caller.store.0);
520520
let mut future = Pin::from(func(caller, params, results));
521-
match unsafe { async_cx.block_on(future.as_mut(), None) } {
522-
Ok((Ok(()), _)) => Ok(()),
523-
Ok((Err(trap), _)) | Err(trap) => Err(trap),
521+
match unsafe { async_cx.block_on(future.as_mut()) } {
522+
Ok(Ok(())) => Ok(()),
523+
Ok(Err(trap)) | Err(trap) => Err(trap),
524524
}
525525
}
526526
#[cfg(not(feature = "component-model-async"))]
@@ -857,8 +857,8 @@ impl Func {
857857
let async_cx = crate::component::concurrent::AsyncCx::new(&mut caller.store.0);
858858
let mut future = Pin::from(func(caller, args));
859859

860-
match unsafe { async_cx.block_on(future.as_mut(), None) } {
861-
Ok((ret, _)) => ret.into_fallible(),
860+
match unsafe { async_cx.block_on(future.as_mut()) } {
861+
Ok(ret) => ret.into_fallible(),
862862
Err(e) => R::fallible_from_error(e),
863863
}
864864
}

crates/wasmtime/src/runtime/linker.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,9 @@ impl<T> Linker<T> {
475475
{
476476
let async_cx = crate::component::concurrent::AsyncCx::new(&mut caller.store.0);
477477
let mut future = Pin::from(func(caller, params, results));
478-
match unsafe { async_cx.block_on(future.as_mut(), None) } {
479-
Ok((Ok(()), _)) => Ok(()),
480-
Ok((Err(trap), _)) | Err(trap) => Err(trap),
478+
match unsafe { async_cx.block_on(future.as_mut()) } {
479+
Ok(Ok(())) => Ok(()),
480+
Ok(Err(trap)) | Err(trap) => Err(trap),
481481
}
482482
}
483483
#[cfg(not(feature = "component-model-async"))]
@@ -595,8 +595,8 @@ impl<T> Linker<T> {
595595
let async_cx = crate::component::concurrent::AsyncCx::new(&mut caller.store.0);
596596
let mut future = Pin::from(func(caller, args));
597597

598-
match unsafe { async_cx.block_on(future.as_mut(), None) } {
599-
Ok((ret, _)) => ret.into_fallible(),
598+
match unsafe { async_cx.block_on(future.as_mut()) } {
599+
Ok(ret) => ret.into_fallible(),
600600
Err(e) => Args::fallible_from_error(e),
601601
}
602602
}

crates/wasmtime/src/runtime/store/async_.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl<T> StoreInner<T> {
234234
.context("couldn't create AsyncCx to block on async operation")?;
235235
let future = mk_future(self);
236236
let mut future = core::pin::pin!(future);
237-
unsafe { Ok(async_cx.block_on(future.as_mut(), None)?.0) }
237+
unsafe { Ok(async_cx.block_on(future.as_mut())?) }
238238
}
239239
#[cfg(not(feature = "component-model-async"))]
240240
{

crates/wasmtime/src/runtime/store/gc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl StoreOpaque {
5151
unsafe {
5252
let async_cx = crate::component::concurrent::AsyncCx::new(&mut scope);
5353
let future = scope.grow_or_collect_gc_heap_async(bytes_needed);
54-
async_cx.block_on(Box::pin(future).as_mut(), None)?.0;
54+
async_cx.block_on(Box::pin(future).as_mut())?;
5555
}
5656
}
5757
} else {

crates/wasmtime/src/runtime/vm/stack_switching/stack/unix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ cfg_if::cfg_if! {
353353
if #[cfg(target_arch = "x86_64")] {
354354
mod x86_64;
355355
} else {
356-
// Note that this shoul be unreachable: In stack.rs, we currently select
356+
// Note that this should be unreachable: In stack.rs, we currently select
357357
// the module defined in the current file only if we are on unix AND
358358
// x86_64.
359359
compile_error!("the stack switching feature is not supported on this CPU architecture");

0 commit comments

Comments
 (0)