(
mut store: impl AsContextMut,
func: Option<NonNull<VMFuncRef>>,
arg: ValRaw,
mut flags: InstanceFlags,
)
| 703 | } |
| 704 | |
| 705 | pub(crate) unsafe fn call_post_return( |
| 706 | mut store: impl AsContextMut, |
| 707 | func: Option<NonNull<VMFuncRef>>, |
| 708 | arg: ValRaw, |
| 709 | mut flags: InstanceFlags, |
| 710 | ) -> Result<()> { |
| 711 | unsafe { |
| 712 | // Post return functions are forbidden from calling imports or |
| 713 | // intrinsics. |
| 714 | flags.set_may_leave(false); |
| 715 | |
| 716 | // If the function actually had a `post-return` configured in its |
| 717 | // canonical options that's executed here. |
| 718 | if let Some(func) = func { |
| 719 | crate::Func::call_unchecked_raw( |
| 720 | &mut store.as_context_mut(), |
| 721 | func, |
| 722 | core::slice::from_ref(&arg).into(), |
| 723 | )?; |
| 724 | } |
| 725 | |
| 726 | // And finally if everything completed successfully then the "may |
| 727 | // leave" flags is set to `true` again here which enables further |
| 728 | // use of the component. |
| 729 | flags.set_may_leave(true); |
| 730 | } |
| 731 | |
| 732 | Ok(()) |
| 733 | } |
no test coverage detected