github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/experimental/testdata/snapshot.wat (about) 1 (module 2 (import "example" "snapshot" (func $snapshot (param i32) (result i32))) 3 (import "example" "restore" (func $restore (param i32))) 4 5 (func $helper (result i32) 6 (call $restore (i32.const 0)) 7 ;; Not executed 8 i32.const 10 9 ) 10 11 (func (export "run") (result i32) (local i32) 12 (call $snapshot (i32.const 0)) 13 local.set 0 14 local.get 0 15 (if (result i32) 16 (then ;; restore return, finish with the value returned by it 17 local.get 0 18 ) 19 (else ;; snapshot return, call heloer 20 (call $helper) 21 ) 22 ) 23 ) 24 25 (func (export "snapshot") (param i32) (result i32) 26 (call $snapshot (local.get 0)) 27 ) 28 29 (func (export "restore") (param i32) 30 (call $restore (local.get 0)) 31 ) 32 33 (memory (export "memory") 1 1) 34 )