forked from bytecodealliance/wasmtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
winch(x64): Add support for return and unreachable
This change adds support for the `return` and `unreachable` instructions. This change builds on top of the control flow building blocks introduced in bytecodealliance#6603
- Loading branch information
1 parent
b05a09c
commit 3135c34
Showing
55 changed files
with
1,195 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
;;! target = "x86_64" | ||
(module | ||
(func $dummy) | ||
(func (export "as-block-first") | ||
(block (return) (call $dummy)) | ||
) | ||
) | ||
|
||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec08 sub rsp, 8 | ||
;; 8: 4c893424 mov qword ptr [rsp], r14 | ||
;; c: 4883c408 add rsp, 8 | ||
;; 10: 5d pop rbp | ||
;; 11: c3 ret | ||
;; | ||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec08 sub rsp, 8 | ||
;; 8: 4c893424 mov qword ptr [rsp], r14 | ||
;; c: 4883c408 add rsp, 8 | ||
;; 10: 5d pop rbp | ||
;; 11: c3 ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
;;! target = "x86_64" | ||
(module | ||
(func $dummy) | ||
(func (export "as-block-last") | ||
(block (nop) (call $dummy) (return)) | ||
) | ||
) | ||
|
||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec08 sub rsp, 8 | ||
;; 8: 4c893424 mov qword ptr [rsp], r14 | ||
;; c: 4883c408 add rsp, 8 | ||
;; 10: 5d pop rbp | ||
;; 11: c3 ret | ||
;; | ||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec08 sub rsp, 8 | ||
;; 8: 4c893424 mov qword ptr [rsp], r14 | ||
;; c: 4883ec08 sub rsp, 8 | ||
;; 10: e800000000 call 0x15 | ||
;; 15: 4883c408 add rsp, 8 | ||
;; 19: 4883c408 add rsp, 8 | ||
;; 1d: 5d pop rbp | ||
;; 1e: c3 ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
;;! target = "x86_64" | ||
(module | ||
(func $dummy) | ||
(func (export "as-block-mid") | ||
(block (call $dummy) (return) (call $dummy)) | ||
) | ||
) | ||
|
||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec08 sub rsp, 8 | ||
;; 8: 4c893424 mov qword ptr [rsp], r14 | ||
;; c: 4883c408 add rsp, 8 | ||
;; 10: 5d pop rbp | ||
;; 11: c3 ret | ||
;; | ||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec08 sub rsp, 8 | ||
;; 8: 4c893424 mov qword ptr [rsp], r14 | ||
;; c: 4883ec08 sub rsp, 8 | ||
;; 10: e800000000 call 0x15 | ||
;; 15: 4883c408 add rsp, 8 | ||
;; 19: 4883c408 add rsp, 8 | ||
;; 1d: 5d pop rbp | ||
;; 1e: c3 ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
;;! target = "x86_64" | ||
(module | ||
(func $dummy) | ||
(func (export "as-block-value") (result i32) | ||
(block (result i32) (nop) (call $dummy) (return (i32.const 2))) | ||
) | ||
) | ||
|
||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec08 sub rsp, 8 | ||
;; 8: 4c893424 mov qword ptr [rsp], r14 | ||
;; c: 4883c408 add rsp, 8 | ||
;; 10: 5d pop rbp | ||
;; 11: c3 ret | ||
;; | ||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec08 sub rsp, 8 | ||
;; 8: 4c893424 mov qword ptr [rsp], r14 | ||
;; c: 4883ec08 sub rsp, 8 | ||
;; 10: e800000000 call 0x15 | ||
;; 15: 4883c408 add rsp, 8 | ||
;; 19: 48c7c002000000 mov rax, 2 | ||
;; 20: 4883c408 add rsp, 8 | ||
;; 24: 5d pop rbp | ||
;; 25: c3 ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
;;! target = "x86_64" | ||
(module | ||
(func $dummy) | ||
(func (export "as-br-if-cond") | ||
(block (br_if 0 (return))) | ||
) | ||
) | ||
|
||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec08 sub rsp, 8 | ||
;; 8: 4c893424 mov qword ptr [rsp], r14 | ||
;; c: 4883c408 add rsp, 8 | ||
;; 10: 5d pop rbp | ||
;; 11: c3 ret | ||
;; | ||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec08 sub rsp, 8 | ||
;; 8: 4c893424 mov qword ptr [rsp], r14 | ||
;; c: 4883c408 add rsp, 8 | ||
;; 10: 5d pop rbp | ||
;; 11: c3 ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
;;! target = "x86_64" | ||
(module | ||
(func $dummy) | ||
(func (export "as-br-value") (result i32) | ||
(block (result i32) (br 0 (return (i32.const 9)))) | ||
) | ||
) | ||
|
||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec08 sub rsp, 8 | ||
;; 8: 4c893424 mov qword ptr [rsp], r14 | ||
;; c: 4883c408 add rsp, 8 | ||
;; 10: 5d pop rbp | ||
;; 11: c3 ret | ||
;; | ||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec08 sub rsp, 8 | ||
;; 8: 4c893424 mov qword ptr [rsp], r14 | ||
;; c: 48c7c009000000 mov rax, 9 | ||
;; 13: 4883c408 add rsp, 8 | ||
;; 17: 5d pop rbp | ||
;; 18: c3 ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
;;! target = "x86_64" | ||
(module | ||
(func $f (param i32 i32 i32) (result i32) (i32.const -1)) | ||
(func (export "as-call-first") (result i32) | ||
(call $f (return (i32.const 12)) (i32.const 2) (i32.const 3)) | ||
) | ||
) | ||
|
||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec18 sub rsp, 0x18 | ||
;; 8: 897c2414 mov dword ptr [rsp + 0x14], edi | ||
;; c: 89742410 mov dword ptr [rsp + 0x10], esi | ||
;; 10: 8954240c mov dword ptr [rsp + 0xc], edx | ||
;; 14: 4c89742404 mov qword ptr [rsp + 4], r14 | ||
;; 19: 48c7c0ffffffff mov rax, 0xffffffffffffffff | ||
;; 20: 4883c418 add rsp, 0x18 | ||
;; 24: 5d pop rbp | ||
;; 25: c3 ret | ||
;; | ||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec08 sub rsp, 8 | ||
;; 8: 4c893424 mov qword ptr [rsp], r14 | ||
;; c: 48c7c00c000000 mov rax, 0xc | ||
;; 13: 4883c408 add rsp, 8 | ||
;; 17: 5d pop rbp | ||
;; 18: c3 ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
;;! target = "x86_64" | ||
(module | ||
(func $f (param i32 i32 i32) (result i32) (i32.const -1)) | ||
(func (export "as-call-last") (result i32) | ||
(call $f (i32.const 1) (i32.const 2) (return (i32.const 14))) | ||
) | ||
) | ||
|
||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec18 sub rsp, 0x18 | ||
;; 8: 897c2414 mov dword ptr [rsp + 0x14], edi | ||
;; c: 89742410 mov dword ptr [rsp + 0x10], esi | ||
;; 10: 8954240c mov dword ptr [rsp + 0xc], edx | ||
;; 14: 4c89742404 mov qword ptr [rsp + 4], r14 | ||
;; 19: 48c7c0ffffffff mov rax, 0xffffffffffffffff | ||
;; 20: 4883c418 add rsp, 0x18 | ||
;; 24: 5d pop rbp | ||
;; 25: c3 ret | ||
;; | ||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec08 sub rsp, 8 | ||
;; 8: 4c893424 mov qword ptr [rsp], r14 | ||
;; c: 48c7c00e000000 mov rax, 0xe | ||
;; 13: 4883c408 add rsp, 8 | ||
;; 17: 5d pop rbp | ||
;; 18: c3 ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
;;! target = "x86_64" | ||
(module | ||
(func $f (param i32 i32 i32) (result i32) (i32.const -1)) | ||
(func (export "as-call-mid") (result i32) | ||
(call $f (i32.const 1) (return (i32.const 13)) (i32.const 3)) | ||
) | ||
) | ||
|
||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec18 sub rsp, 0x18 | ||
;; 8: 897c2414 mov dword ptr [rsp + 0x14], edi | ||
;; c: 89742410 mov dword ptr [rsp + 0x10], esi | ||
;; 10: 8954240c mov dword ptr [rsp + 0xc], edx | ||
;; 14: 4c89742404 mov qword ptr [rsp + 4], r14 | ||
;; 19: 48c7c0ffffffff mov rax, 0xffffffffffffffff | ||
;; 20: 4883c418 add rsp, 0x18 | ||
;; 24: 5d pop rbp | ||
;; 25: c3 ret | ||
;; | ||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec08 sub rsp, 8 | ||
;; 8: 4c893424 mov qword ptr [rsp], r14 | ||
;; c: 48c7c00d000000 mov rax, 0xd | ||
;; 13: 4883c408 add rsp, 8 | ||
;; 17: 5d pop rbp | ||
;; 18: c3 ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
;;! target = "x86_64" | ||
(module | ||
(func $dummy) | ||
(func (export "as-func-first") (result i32) | ||
(return (i32.const 1)) (i32.const 2) | ||
) | ||
) | ||
|
||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec08 sub rsp, 8 | ||
;; 8: 4c893424 mov qword ptr [rsp], r14 | ||
;; c: 4883c408 add rsp, 8 | ||
;; 10: 5d pop rbp | ||
;; 11: c3 ret | ||
;; | ||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec08 sub rsp, 8 | ||
;; 8: 4c893424 mov qword ptr [rsp], r14 | ||
;; c: 48c7c001000000 mov rax, 1 | ||
;; 13: 4883c408 add rsp, 8 | ||
;; 17: 5d pop rbp | ||
;; 18: c3 ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
;;! target = "x86_64" | ||
(module | ||
(func $dummy) | ||
) | ||
|
||
;; 0: 55 push rbp | ||
;; 1: 4889e5 mov rbp, rsp | ||
;; 4: 4883ec08 sub rsp, 8 | ||
;; 8: 4c893424 mov qword ptr [rsp], r14 | ||
;; c: 4883c408 add rsp, 8 | ||
;; 10: 5d pop rbp | ||
;; 11: c3 ret |
Oops, something went wrong.