| 1 |
(module |
| 2 |
(import "old" "get_sum" (func (result i32))) |
| 3 |
;; Minimal realloc which only accepts new, page-sized allocations: |
| 4 |
(func $cabi_realloc (param i32 i32 i32 i32) (result i32) |
| 5 |
(local i32) |
| 6 |
i32.const 0 |
| 7 |
local.get 0 |
| 8 |
i32.ne |
| 9 |
if |
| 10 |
unreachable |
| 11 |
end |
| 12 |
i32.const 0 |
| 13 |
local.get 1 |
| 14 |
i32.ne |
| 15 |
if |
| 16 |
unreachable |
| 17 |
end |
| 18 |
i32.const 65536 |
| 19 |
local.get 3 |
| 20 |
i32.ne |
| 21 |
if |
| 22 |
unreachable |
| 23 |
end |
| 24 |
i32.const 1 |
| 25 |
memory.grow |
| 26 |
local.tee 4 |
| 27 |
i32.const -1 |
| 28 |
i32.eq |
| 29 |
if |
| 30 |
unreachable |
| 31 |
end |
| 32 |
local.get 4 |
| 33 |
i32.const 16 |
| 34 |
i32.shl |
| 35 |
) |
| 36 |
(memory (export "memory") 1) |
| 37 |
(export "cabi_realloc" (func $cabi_realloc)) |
| 38 |
) |