@@ -388,7 +388,7 @@ impl ErrorContext {
388
388
{
389
389
#[ link( wasm_import_module = "$root" ) ]
390
390
extern "C" {
391
- #[ link_name = "[error-context-new;encoding= utf8]" ]
391
+ #[ link_name = "[error-context-new- utf8]" ]
392
392
fn context_new ( _: * const u8 , _: usize ) -> i32 ;
393
393
}
394
394
@@ -427,7 +427,7 @@ impl ErrorContext {
427
427
}
428
428
#[ link( wasm_import_module = "$root" ) ]
429
429
extern "C" {
430
- #[ link_name = "[error-context-debug-message;encoding= utf8;realloc=cabi_realloc ]" ]
430
+ #[ link_name = "[error-context-debug-message- utf8]" ]
431
431
fn error_context_debug_message ( _: u32 , _: & mut RetPtr ) ;
432
432
}
433
433
@@ -484,7 +484,7 @@ pub fn spawn(future: impl Future<Output = ()> + 'static) {
484
484
unsafe { SPAWNED . push ( Box :: pin ( future) ) }
485
485
}
486
486
487
- fn task_wait ( state : & mut FutureState ) {
487
+ fn waitable_set_wait ( state : & mut FutureState ) {
488
488
#[ cfg( not( target_arch = "wasm32" ) ) ]
489
489
{
490
490
_ = state;
@@ -495,21 +495,22 @@ fn task_wait(state: &mut FutureState) {
495
495
{
496
496
#[ link( wasm_import_module = "$root" ) ]
497
497
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 ;
500
500
}
501
501
let mut payload = [ 0i32 ; 2 ] ;
502
502
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 ( ) ) ;
504
505
callback ( state as * mut _ as _ , event0, payload[ 0 ] , payload[ 1 ] ) ;
505
506
}
506
507
}
507
508
}
508
509
509
510
/// Run the specified future to completion, returning the result.
510
511
///
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.
513
514
// TODO: refactor so `'static` bounds aren't necessary
514
515
pub fn block_on < T : ' static > ( future : impl Future < Output = T > + ' static ) -> T {
515
516
let ( tx, mut rx) = oneshot:: channel ( ) ;
@@ -524,12 +525,12 @@ pub fn block_on<T: 'static>(future: impl Future<Output = T> + 'static) -> T {
524
525
loop {
525
526
match unsafe { poll ( state) } {
526
527
Poll :: Ready ( ( ) ) => break rx. try_recv ( ) . unwrap ( ) . unwrap ( ) ,
527
- Poll :: Pending => task_wait ( state) ,
528
+ Poll :: Pending => waitable_set_wait ( state) ,
528
529
}
529
530
}
530
531
}
531
532
532
- /// Call the `task. yield` canonical built-in function.
533
+ /// Call the `yield` canonical built-in function.
533
534
///
534
535
/// This yields control to the host temporarily, allowing other tasks to make
535
536
/// progress. It's a good idea to call this inside a busy loop which does not
@@ -544,7 +545,7 @@ pub fn task_yield() {
544
545
{
545
546
#[ link( wasm_import_module = "$root" ) ]
546
547
extern "C" {
547
- #[ link_name = "[task- yield]" ]
548
+ #[ link_name = "[yield]" ]
548
549
fn yield_ ( ) ;
549
550
}
550
551
unsafe {
@@ -553,12 +554,12 @@ pub fn task_yield() {
553
554
}
554
555
}
555
556
556
- /// Call the `task. backpressure` canonical built-in function.
557
+ /// Call the `backpressure.set ` canonical built-in function.
557
558
///
558
559
/// 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
560
561
/// called again with `enabled` set to `false`).
561
- pub fn task_backpressure ( enabled : bool ) {
562
+ pub fn backpressure_set ( enabled : bool ) {
562
563
#[ cfg( not( target_arch = "wasm32" ) ) ]
563
564
{
564
565
_ = enabled;
@@ -569,11 +570,11 @@ pub fn task_backpressure(enabled: bool) {
569
570
{
570
571
#[ link( wasm_import_module = "$root" ) ]
571
572
extern "C" {
572
- #[ link_name = "[task- backpressure]" ]
573
- fn backpressure ( _: i32 ) ;
573
+ #[ link_name = "[backpressure-set ]" ]
574
+ fn backpressure_set ( _: i32 ) ;
574
575
}
575
576
unsafe {
576
- backpressure ( if enabled { 1 } else { 0 } ) ;
577
+ backpressure_set ( if enabled { 1 } else { 0 } ) ;
577
578
}
578
579
}
579
580
}
0 commit comments