Skip to content
File

Blob: src/workerd/io/wasm/signal-terminated-only.wat

720 bytes
1;; Module that exports only __instance_terminated but NOT __instance_signal.
2;; The shim should register this module — __instance_signal is optional. The module
3;; will receive the terminated flag when the isolate is killed, but will not receive
4;; the SIGXCPU warning signal.
5 
6(module
7 (memory (export "memory") 1)
8 
9 ;; terminated at byte 0.
10 (global (export "__instance_terminated") i32 (i32.const 0))
11 
12 (func (export "get_terminated") (result i32)
13 (i32.load (global.get 0))
14 )
15 
16 ;; Write a non-zero value to the terminated field, signalling that this instance
17 ;; has exited and the runtime may reclaim the linear memory.
18 (func (export "mark_exited")
19 (i32.store (global.get 0) (i32.const 1))
20 )
21)