@@ -388,7 +388,7 @@ impl ErrorContext {
388388 {
389389 #[ link( wasm_import_module = "$root" ) ]
390390 extern "C" {
391- #[ link_name = "[error-context-new;encoding= utf8]" ]
391+ #[ link_name = "[error-context-new- utf8]" ]
392392 fn context_new ( _: * const u8 , _: usize ) -> i32 ;
393393 }
394394
@@ -427,7 +427,7 @@ impl ErrorContext {
427427 }
428428 #[ link( wasm_import_module = "$root" ) ]
429429 extern "C" {
430- #[ link_name = "[error-context-debug-message;encoding= utf8;realloc=cabi_realloc ]" ]
430+ #[ link_name = "[error-context-debug-message- utf8]" ]
431431 fn error_context_debug_message ( _: u32 , _: & mut RetPtr ) ;
432432 }
433433
@@ -484,7 +484,7 @@ pub fn spawn(future: impl Future<Output = ()> + 'static) {
484484 unsafe { SPAWNED . push ( Box :: pin ( future) ) }
485485}
486486
487- fn task_wait ( state : & mut FutureState ) {
487+ fn waitable_set_wait ( state : & mut FutureState ) {
488488 #[ cfg( not( target_arch = "wasm32" ) ) ]
489489 {
490490 _ = state;
@@ -495,21 +495,22 @@ fn task_wait(state: &mut FutureState) {
495495 {
496496 #[ link( wasm_import_module = "$root" ) ]
497497 extern "C" {
498- #[ link_name = "[task -wait]" ]
499- fn wait ( _: * mut i32 ) -> i32 ;
498+ #[ link_name = "[waitable-set -wait]" ]
499+ fn wait ( _: u32 , _ : * mut i32 ) -> i32 ;
500500 }
501501 let mut payload = [ 0i32 ; 2 ] ;
502502 unsafe {
503- let event0 = wait ( payload. as_mut_ptr ( ) ) ;
503+ // TODO: provide a real waitable-set here:
504+ let event0 = wait ( 0 , payload. as_mut_ptr ( ) ) ;
504505 callback ( state as * mut _ as _ , event0, payload[ 0 ] , payload[ 1 ] ) ;
505506 }
506507 }
507508}
508509
509510/// Run the specified future to completion, returning the result.
510511///
511- /// This uses `task .wait` to poll for progress on any in-progress calls to
512- /// async-lowered imports as necessary.
512+ /// This uses `waitable-set .wait` to poll for progress on any in-progress calls
513+ /// to async-lowered imports as necessary.
513514// TODO: refactor so `'static` bounds aren't necessary
514515pub fn block_on < T : ' static > ( future : impl Future < Output = T > + ' static ) -> T {
515516 let ( tx, mut rx) = oneshot:: channel ( ) ;
@@ -524,12 +525,12 @@ pub fn block_on<T: 'static>(future: impl Future<Output = T> + 'static) -> T {
524525 loop {
525526 match unsafe { poll ( state) } {
526527 Poll :: Ready ( ( ) ) => break rx. try_recv ( ) . unwrap ( ) . unwrap ( ) ,
527- Poll :: Pending => task_wait ( state) ,
528+ Poll :: Pending => waitable_set_wait ( state) ,
528529 }
529530 }
530531}
531532
532- /// Call the `task. yield` canonical built-in function.
533+ /// Call the `yield` canonical built-in function.
533534///
534535/// This yields control to the host temporarily, allowing other tasks to make
535536/// progress. It's a good idea to call this inside a busy loop which does not
@@ -544,7 +545,7 @@ pub fn task_yield() {
544545 {
545546 #[ link( wasm_import_module = "$root" ) ]
546547 extern "C" {
547- #[ link_name = "[task- yield]" ]
548+ #[ link_name = "[yield]" ]
548549 fn yield_ ( ) ;
549550 }
550551 unsafe {
@@ -553,12 +554,12 @@ pub fn task_yield() {
553554 }
554555}
555556
556- /// Call the `task. backpressure` canonical built-in function.
557+ /// Call the `backpressure.set ` canonical built-in function.
557558///
558559/// When `enabled` is `true`, this tells the host to defer any new calls to this
559- /// component instance until further notice (i.e. until `task. backpressure` is
560+ /// component instance until further notice (i.e. until `backpressure.set ` is
560561/// called again with `enabled` set to `false`).
561- pub fn task_backpressure ( enabled : bool ) {
562+ pub fn backpressure_set ( enabled : bool ) {
562563 #[ cfg( not( target_arch = "wasm32" ) ) ]
563564 {
564565 _ = enabled;
@@ -569,11 +570,11 @@ pub fn task_backpressure(enabled: bool) {
569570 {
570571 #[ link( wasm_import_module = "$root" ) ]
571572 extern "C" {
572- #[ link_name = "[task- backpressure]" ]
573- fn backpressure ( _: i32 ) ;
573+ #[ link_name = "[backpressure-set ]" ]
574+ fn backpressure_set ( _: i32 ) ;
574575 }
575576 unsafe {
576- backpressure ( if enabled { 1 } else { 0 } ) ;
577+ backpressure_set ( if enabled { 1 } else { 0 } ) ;
577578 }
578579 }
579580}
0 commit comments