Files
wasmtime/cranelift/filetests/filetests/wasm/control.clif
Dan Gohman fb0b9e3ae6 Change proc_exit to unwind the stack rather than exiting the host process. (#1646)
* Remove Cranelift's OutOfBounds trap, which is no longer used.

* Change proc_exit to unwind instead of exit the host process.

This implements the semantics in https://github.com/WebAssembly/WASI/pull/235.

Fixes #783.
Fixes #993.

* Fix exit-status tests on Windows.

* Revert the wiggle changes and re-introduce the wasi-common implementations.

* Move `wasi_proc_exit` into the wasmtime-wasi crate.

* Revert the spec_testsuite change.

* Remove the old proc_exit implementations.

* Make `TrapReason` an implementation detail.

* Allow exit status 2 on Windows too.

* Fix a documentation link.

* Really fix a documentation link.
2020-05-13 15:59:43 -07:00

66 lines
939 B
Plaintext

; Test basic code generation for control flow WebAssembly instructions.
test compile
target i686 haswell
target x86_64 haswell
function %br_if(i32) -> i32 {
block0(v0: i32):
v1 = iconst.i32 1
brz v0, block1(v1)
jump block2
block1(v2: i32):
return v2
block2:
jump block1(v0)
}
function %br_if_not(i32) -> i32 {
block0(v0: i32):
v1 = iconst.i32 1
brnz v0, block1(v0)
jump block2
block1(v2: i32):
return v2
block2:
jump block1(v0)
}
function %br_if_fallthrough(i32) -> i32 {
block0(v0: i32):
v1 = iconst.i32 1
brz v0, block1(v1)
; This jump gets converted to a fallthrough.
jump block1(v0)
block1(v2: i32):
return v2
}
function %undefined() {
block0:
trap user0
}
function %br_table(i32) {
jt0 = jump_table [block3, block1, block2]
block0(v0: i32):
br_table v0, block4, jt0
block4:
trap heap_oob
block1:
return
block2:
return
block3:
return
}