examples/terminate: Use wasm_runtime_spawn_exec_env as well (#3049)
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
|
||||
(module
|
||||
(func $fd_read (import "wasi_snapshot_preview1" "fd_read") (param i32 i32 i32 i32) (result i32))
|
||||
(func (export "_start")
|
||||
(func $block_forever (export "block_forever")
|
||||
;; read from FD 0
|
||||
i32.const 100 ;; iov_base
|
||||
i32.const 200 ;; buffer
|
||||
@ -18,5 +18,36 @@
|
||||
call $fd_read
|
||||
unreachable
|
||||
)
|
||||
(func (export "_start")
|
||||
call $block_forever
|
||||
)
|
||||
|
||||
;; a dumb malloc/free implementation
|
||||
(func (export "malloc") (param i32) (result i32)
|
||||
local.get 0
|
||||
i32.const 65535
|
||||
i32.add
|
||||
i32.const 65536
|
||||
i32.div_u
|
||||
memory.grow
|
||||
local.set 0
|
||||
local.get 0
|
||||
i32.const -1
|
||||
i32.eq
|
||||
if
|
||||
i32.const 0
|
||||
return
|
||||
end
|
||||
local.get 0
|
||||
i32.const 65536
|
||||
i32.mul
|
||||
)
|
||||
(func (export "free") (param i32))
|
||||
|
||||
(memory (export "memory") 1)
|
||||
|
||||
;; fake globals to make wasm_set_aux_stack happy
|
||||
(global (export "__heap_base") i32 (i32.const 0x10000))
|
||||
(global (export "__data_end") i32 (i32.const 0x10000))
|
||||
(global (mut i32) (i32.const 0x10000))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user