Skip to content

Commit 1e0b0b4

Browse files
authored
Remove subtask reparenting (#12570)
This commit updates the implementation of component-model-async primitives to remove the manual subtask reparenting process. This is required to fix #12544 at a semantic level because a subtask isn't ever actually reparented, even if its parent exits. The first part of this change is to remove the `GuestTask::subtasks` field and all relevant manipulations of it. This field, however, powered the `TaskExit` abstraction returned from `call_concurrent`. This commit then subsequently deletes `TaskExit` and all related infrastructure as it's no longer directly applicable as-is. The rest of this change is then updating tests/bindings/etc to account for these two changes. The main semantic changes related to tests are: * `wasmtime run`, with and without `--invoke`, no longer waits for all subtasks. This instead only waits for the main task returning before exiting. Whether or not this is the correct behavior is under discussion in WebAssembly/component-model#608 * `wasmtime serve` has been updated to keep the store alive at least until the response body has been fully transmitted. This is also part of WebAssembly/component-model#608. * Some `component-async-tests`-related tests were updated to either avoid blocking the store as it wasn't needed or yield enough times to ensure that the test passes. Closes #12544 prtest:full
1 parent 55207c6 commit 1e0b0b4

45 files changed

Lines changed: 389 additions & 452 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

crates/component-macro/src/bindgen.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ mod kw {
265265
syn::custom_keyword!(trappable);
266266
syn::custom_keyword!(ignore_wit);
267267
syn::custom_keyword!(exact);
268-
syn::custom_keyword!(task_exit);
269268
}
270269

271270
enum Opt {
@@ -540,9 +539,6 @@ fn parse_function_config(input: ParseStream<'_>) -> Result<FunctionConfig> {
540539
} else if l.peek(kw::exact) {
541540
input.parse::<kw::exact>()?;
542541
flags |= FunctionFlags::EXACT;
543-
} else if l.peek(kw::task_exit) {
544-
input.parse::<kw::task_exit>()?;
545-
flags |= FunctionFlags::TASK_EXIT;
546542
} else {
547543
return Err(l.error());
548544
}

crates/component-macro/tests/expanded/char_concurrent.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ pub mod exports {
330330
(),
331331
>::new_unchecked(self.take_char)
332332
};
333-
let ((), _) = callee.call_concurrent(accessor, (arg0,)).await?;
333+
let () = callee.call_concurrent(accessor, (arg0,)).await?;
334334
Ok(())
335335
}
336336
/// A function that returns a character
@@ -348,7 +348,7 @@ pub mod exports {
348348
(char,),
349349
>::new_unchecked(self.return_char)
350350
};
351-
let ((ret0,), _) = callee.call_concurrent(accessor, ()).await?;
351+
let (ret0,) = callee.call_concurrent(accessor, ()).await?;
352352
Ok(ret0)
353353
}
354354
}

crates/component-macro/tests/expanded/conventions_concurrent.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ pub mod exports {
635635
(),
636636
>::new_unchecked(self.kebab_case)
637637
};
638-
let ((), _) = callee.call_concurrent(accessor, ()).await?;
638+
let () = callee.call_concurrent(accessor, ()).await?;
639639
Ok(())
640640
}
641641
pub async fn call_foo<_T, _D>(
@@ -653,7 +653,7 @@ pub mod exports {
653653
(),
654654
>::new_unchecked(self.foo)
655655
};
656-
let ((), _) = callee.call_concurrent(accessor, (arg0,)).await?;
656+
let () = callee.call_concurrent(accessor, (arg0,)).await?;
657657
Ok(())
658658
}
659659
pub async fn call_function_with_dashes<_T, _D>(
@@ -670,7 +670,7 @@ pub mod exports {
670670
(),
671671
>::new_unchecked(self.function_with_dashes)
672672
};
673-
let ((), _) = callee.call_concurrent(accessor, ()).await?;
673+
let () = callee.call_concurrent(accessor, ()).await?;
674674
Ok(())
675675
}
676676
pub async fn call_function_with_no_weird_characters<_T, _D>(
@@ -687,7 +687,7 @@ pub mod exports {
687687
(),
688688
>::new_unchecked(self.function_with_no_weird_characters)
689689
};
690-
let ((), _) = callee.call_concurrent(accessor, ()).await?;
690+
let () = callee.call_concurrent(accessor, ()).await?;
691691
Ok(())
692692
}
693693
pub async fn call_apple<_T, _D>(
@@ -704,7 +704,7 @@ pub mod exports {
704704
(),
705705
>::new_unchecked(self.apple)
706706
};
707-
let ((), _) = callee.call_concurrent(accessor, ()).await?;
707+
let () = callee.call_concurrent(accessor, ()).await?;
708708
Ok(())
709709
}
710710
pub async fn call_apple_pear<_T, _D>(
@@ -721,7 +721,7 @@ pub mod exports {
721721
(),
722722
>::new_unchecked(self.apple_pear)
723723
};
724-
let ((), _) = callee.call_concurrent(accessor, ()).await?;
724+
let () = callee.call_concurrent(accessor, ()).await?;
725725
Ok(())
726726
}
727727
pub async fn call_apple_pear_grape<_T, _D>(
@@ -738,7 +738,7 @@ pub mod exports {
738738
(),
739739
>::new_unchecked(self.apple_pear_grape)
740740
};
741-
let ((), _) = callee.call_concurrent(accessor, ()).await?;
741+
let () = callee.call_concurrent(accessor, ()).await?;
742742
Ok(())
743743
}
744744
pub async fn call_a0<_T, _D>(
@@ -755,7 +755,7 @@ pub mod exports {
755755
(),
756756
>::new_unchecked(self.a0)
757757
};
758-
let ((), _) = callee.call_concurrent(accessor, ()).await?;
758+
let () = callee.call_concurrent(accessor, ()).await?;
759759
Ok(())
760760
}
761761
/// Comment out identifiers that collide when mapped to snake_case, for now; see
@@ -777,7 +777,7 @@ pub mod exports {
777777
(),
778778
>::new_unchecked(self.is_xml)
779779
};
780-
let ((), _) = callee.call_concurrent(accessor, ()).await?;
780+
let () = callee.call_concurrent(accessor, ()).await?;
781781
Ok(())
782782
}
783783
pub async fn call_explicit<_T, _D>(
@@ -794,7 +794,7 @@ pub mod exports {
794794
(),
795795
>::new_unchecked(self.explicit)
796796
};
797-
let ((), _) = callee.call_concurrent(accessor, ()).await?;
797+
let () = callee.call_concurrent(accessor, ()).await?;
798798
Ok(())
799799
}
800800
pub async fn call_explicit_kebab<_T, _D>(
@@ -811,7 +811,7 @@ pub mod exports {
811811
(),
812812
>::new_unchecked(self.explicit_kebab)
813813
};
814-
let ((), _) = callee.call_concurrent(accessor, ()).await?;
814+
let () = callee.call_concurrent(accessor, ()).await?;
815815
Ok(())
816816
}
817817
/// Identifiers with the same name as keywords are quoted.
@@ -829,7 +829,7 @@ pub mod exports {
829829
(),
830830
>::new_unchecked(self.bool)
831831
};
832-
let ((), _) = callee.call_concurrent(accessor, ()).await?;
832+
let () = callee.call_concurrent(accessor, ()).await?;
833833
Ok(())
834834
}
835835
}

crates/component-macro/tests/expanded/flags_concurrent.rs

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -729,9 +729,7 @@ pub mod exports {
729729
(Flag1,),
730730
>::new_unchecked(self.roundtrip_flag1)
731731
};
732-
let ((ret0,), _) = callee
733-
.call_concurrent(accessor, (arg0,))
734-
.await?;
732+
let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
735733
Ok(ret0)
736734
}
737735
pub async fn call_roundtrip_flag2<_T, _D>(
@@ -749,9 +747,7 @@ pub mod exports {
749747
(Flag2,),
750748
>::new_unchecked(self.roundtrip_flag2)
751749
};
752-
let ((ret0,), _) = callee
753-
.call_concurrent(accessor, (arg0,))
754-
.await?;
750+
let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
755751
Ok(ret0)
756752
}
757753
pub async fn call_roundtrip_flag4<_T, _D>(
@@ -769,9 +765,7 @@ pub mod exports {
769765
(Flag4,),
770766
>::new_unchecked(self.roundtrip_flag4)
771767
};
772-
let ((ret0,), _) = callee
773-
.call_concurrent(accessor, (arg0,))
774-
.await?;
768+
let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
775769
Ok(ret0)
776770
}
777771
pub async fn call_roundtrip_flag8<_T, _D>(
@@ -789,9 +783,7 @@ pub mod exports {
789783
(Flag8,),
790784
>::new_unchecked(self.roundtrip_flag8)
791785
};
792-
let ((ret0,), _) = callee
793-
.call_concurrent(accessor, (arg0,))
794-
.await?;
786+
let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
795787
Ok(ret0)
796788
}
797789
pub async fn call_roundtrip_flag16<_T, _D>(
@@ -809,9 +801,7 @@ pub mod exports {
809801
(Flag16,),
810802
>::new_unchecked(self.roundtrip_flag16)
811803
};
812-
let ((ret0,), _) = callee
813-
.call_concurrent(accessor, (arg0,))
814-
.await?;
804+
let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
815805
Ok(ret0)
816806
}
817807
pub async fn call_roundtrip_flag32<_T, _D>(
@@ -829,9 +819,7 @@ pub mod exports {
829819
(Flag32,),
830820
>::new_unchecked(self.roundtrip_flag32)
831821
};
832-
let ((ret0,), _) = callee
833-
.call_concurrent(accessor, (arg0,))
834-
.await?;
822+
let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
835823
Ok(ret0)
836824
}
837825
pub async fn call_roundtrip_flag64<_T, _D>(
@@ -849,9 +837,7 @@ pub mod exports {
849837
(Flag64,),
850838
>::new_unchecked(self.roundtrip_flag64)
851839
};
852-
let ((ret0,), _) = callee
853-
.call_concurrent(accessor, (arg0,))
854-
.await?;
840+
let (ret0,) = callee.call_concurrent(accessor, (arg0,)).await?;
855841
Ok(ret0)
856842
}
857843
}

crates/component-macro/tests/expanded/floats_concurrent.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ pub mod exports {
372372
(),
373373
>::new_unchecked(self.f32_param)
374374
};
375-
let ((), _) = callee.call_concurrent(accessor, (arg0,)).await?;
375+
let () = callee.call_concurrent(accessor, (arg0,)).await?;
376376
Ok(())
377377
}
378378
pub async fn call_f64_param<_T, _D>(
@@ -390,7 +390,7 @@ pub mod exports {
390390
(),
391391
>::new_unchecked(self.f64_param)
392392
};
393-
let ((), _) = callee.call_concurrent(accessor, (arg0,)).await?;
393+
let () = callee.call_concurrent(accessor, (arg0,)).await?;
394394
Ok(())
395395
}
396396
pub async fn call_f32_result<_T, _D>(
@@ -407,7 +407,7 @@ pub mod exports {
407407
(f32,),
408408
>::new_unchecked(self.f32_result)
409409
};
410-
let ((ret0,), _) = callee.call_concurrent(accessor, ()).await?;
410+
let (ret0,) = callee.call_concurrent(accessor, ()).await?;
411411
Ok(ret0)
412412
}
413413
pub async fn call_f64_result<_T, _D>(
@@ -424,7 +424,7 @@ pub mod exports {
424424
(f64,),
425425
>::new_unchecked(self.f64_result)
426426
};
427-
let ((ret0,), _) = callee.call_concurrent(accessor, ()).await?;
427+
let (ret0,) = callee.call_concurrent(accessor, ()).await?;
428428
Ok(ret0)
429429
}
430430
}

crates/component-macro/tests/expanded/function-new_concurrent.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ const _: () = {
191191
let callee = unsafe {
192192
wasmtime::component::TypedFunc::<(), ()>::new_unchecked(self.new)
193193
};
194-
let ((), _) = callee.call_concurrent(accessor, ()).await?;
194+
let () = callee.call_concurrent(accessor, ()).await?;
195195
Ok(())
196196
}
197197
}

0 commit comments

Comments
 (0)