Runs the VM to completion, invoking every upcall as it is encountered.
(vm: &mut Vm, image: &Image)
| 676 | |
| 677 | /// Runs the VM to completion, invoking every upcall as it is encountered. |
| 678 | async fn run_to_end(vm: &mut Vm, image: &Image) { |
| 679 | loop { |
| 680 | match vm.exec(image) { |
| 681 | StopReason::End(_) => break, |
| 682 | StopReason::Eof => break, |
| 683 | StopReason::Exception(_, msg) => panic!("Unexpected exception: {}", msg), |
| 684 | StopReason::UpcallAsync(handler) => handler.invoke().await.unwrap(), |
| 685 | StopReason::Yield => (), |
| 686 | } |
| 687 | } |
| 688 | } |
| 689 | |
| 690 | #[test] |
| 691 | fn test_exec_without_load_is_eof() { |