File
Blob: src/workerd/io/wasm/signal-externref-memory.wat
| 1 | ;; Module that imports a global named "memory" typed as externref, NOT as a |
| 2 | ;; linear memory import. The shim's findMemory() checks WebAssembly.Module.imports() |
| 3 | ;; and only considers descriptors whose kind is 'memory'. An externref global |
| 4 | ;; named "memory" will have kind 'global', so the shim must NOT register this |
| 5 | ;; module for shutdown signal handling. |
| 6 | |
| 7 | (module |
| 8 | ;; Import a global named "memory" — but as externref, not as linear memory. |
| 9 | (import "env" "memory" (global $mem externref)) |
| 10 | |
| 11 | ;; The two globals that would normally trigger signal registration. |
| 12 | (global (export "__instance_signal") i32 (i32.const 0)) |
| 13 | (global (export "__instance_terminated") i32 (i32.const 4)) |
| 14 | |
| 15 | ;; No linear memory at all — the module cannot be registered. |
| 16 | ;; Export a simple function so the test can verify instantiation succeeded. |
| 17 | (func (export "get_value") (result i32) |
| 18 | (i32.const 42) |
| 19 | ) |
| 20 | ) |