MCPcopy Index your code
hub / github.com/explodingcamera/tinywasm / exec_with_budget

Function exec_with_budget

crates/cli/src/wast_runner.rs:643–659  ·  view source on GitHub ↗
(
    func: &tinywasm::Function,
    store: &mut Store,
    args: &[WasmValue],
)

Source from the content-addressed store, hash-verified

641}
642
643fn exec_with_budget(
644 func: &tinywasm::Function,
645 store: &mut Store,
646 args: &[WasmValue],
647) -> Result<Vec<WasmValue>, tinywasm::Error> {
648 let mut exec = func.call_resumable(store, args)?;
649 for _ in 0..TEST_MAX_SUSPENSIONS {
650 match exec.resume_with_time_budget(TEST_TIME_SLICE)? {
651 ExecProgress::Completed(values) => return Ok(values),
652 ExecProgress::Suspended => {}
653 }
654 }
655 Err(tinywasm::Error::Other(format!(
656 "testsuite execution timed out after {} time slices of {:?}",
657 TEST_MAX_SUSPENSIONS, TEST_TIME_SLICE
658 )))
659}
660
661fn try_downcast_panic(panic: Box<dyn std::any::Any + Send>) -> String {
662 let info = panic.downcast_ref::<panic::PanicHookInfo>().map(ToString::to_string);

Callers 1

exec_fn_instanceFunction · 0.85

Calls 2

call_resumableMethod · 0.80

Tested by

no test coverage detected