Skip to content
File

Blob: src/workerd/io/wasm/signal-preinit.wat

598 bytes
1;; Module whose signal address is pre-initialized to a non-zero value (0xDEADBEEF)
2;; via a data segment. The runtime should zero the signal field during registration,
3;; so get_signal() should return 0 after instantiation.
4 
5(module
6 (memory (export "memory") 1)
7 
8 ;; Signal at byte 0, terminated at byte 4.
9 (global (export "__instance_signal") i32 (i32.const 0))
10 (global (export "__instance_terminated") i32 (i32.const 4))
11 
12 ;; Pre-fill signal (bytes 0-3) with 0xDEADBEEF.
13 (data (i32.const 0) "\EF\BE\AD\DE")
14 
15 (func (export "get_signal") (result i32)
16 (i32.load (i32.const 0))
17 )
18)