More instructions & aarch64 trampolines.

This commit is contained in:
losfair 2019-09-15 17:57:40 +08:00
parent ce7c903c23
commit d3227f830c
5 changed files with 426 additions and 137 deletions

85
Cargo.lock generated
View File

@ -90,7 +90,7 @@ dependencies = [
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
@ -120,7 +120,7 @@ name = "bstr"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
@ -136,7 +136,7 @@ name = "c2-chacha"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -260,7 +260,7 @@ name = "colored"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winconsole 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -325,7 +325,7 @@ dependencies = [
"criterion-plot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"csv 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -367,7 +367,7 @@ dependencies = [
"arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -386,7 +386,7 @@ version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -428,26 +428,25 @@ dependencies = [
[[package]]
name = "dynasm"
version = "0.3.2"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "dynasmrt"
version = "0.3.1"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -640,7 +639,7 @@ dependencies = [
"either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"enum-methods 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
"inkwell_internal_macros 0.1.0 (git+https://github.com/wasmerio/inkwell?branch=llvm8-0)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"llvm-sys 80.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -705,7 +704,7 @@ dependencies = [
[[package]]
name = "lazy_static"
version = "1.3.0"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -728,7 +727,7 @@ version = "80.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -758,15 +757,6 @@ dependencies = [
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "memmap"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "memmap"
version = "0.7.0"
@ -836,7 +826,7 @@ dependencies = [
[[package]]
name = "owning_ref"
version = "0.3.3"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1049,7 +1039,7 @@ dependencies = [
"crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1300,11 +1290,6 @@ dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "take_mut"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "target-lexicon"
version = "0.4.0"
@ -1349,7 +1334,7 @@ name = "thread_local"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1399,7 +1384,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"inventory 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
"typetag-impl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1577,7 +1562,7 @@ name = "wasmer-emscripten"
version = "0.6.0"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1615,7 +1600,7 @@ dependencies = [
"cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"goblin 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
"inkwell 0.1.0 (git+https://github.com/wasmerio/inkwell?branch=llvm8-0)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1653,7 +1638,7 @@ name = "wasmer-runtime"
version = "0.6.0"
dependencies = [
"criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"wabt 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1686,7 +1671,7 @@ dependencies = [
"field-offset 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"indexmap 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"page_size 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1707,9 +1692,9 @@ version = "0.6.0"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"colored 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"dynasm 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"dynasmrt 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"dynasm 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"dynasmrt 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
"nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1838,7 +1823,7 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cgmath 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rgb 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1890,8 +1875,8 @@ dependencies = [
"checksum csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9b5cadb6b25c77aeff80ba701712494213f4a8418fcda2ee11b6560c3ad0bf4c"
"checksum ctor 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "5b6b2f4752cc29efbfd03474c532ce8f916f2d44ec5bb8c21f93bc76e5365528"
"checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
"checksum dynasm 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f36d49ab6f8ecc642d2c6ee10fda04ba68003ef0277300866745cdde160e6b40"
"checksum dynasmrt 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a4c408a211e7f5762829f5e46bdff0c14bc3b1517a21a4bb781c716bf88b0c68"
"checksum dynasm 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "56607fba702a46df49ce4f6e1e7b7cc55df2c8c5066630a1b4e91939f8948795"
"checksum dynasmrt 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "81c856c0e3505b907e0f07a70712daf717a204e8195e3f41d20badea3718762c"
"checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b"
"checksum enum-methods 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7798e7da2d4cb0d6d6fc467e8d6b5bf247e9e989f786dde1732d79899c32bb10"
"checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3"
@ -1922,14 +1907,13 @@ dependencies = [
"checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358"
"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba"
"checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
"checksum llvm-sys 80.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2110cd4daf9cd8e39dd3b933b1a2a2ac7315e91f7c92b3a20beab526c63b5978"
"checksum lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f8912e782533a93a167888781b836336a6ca5da6175c05944c86cf28c31104dc"
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
"checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff"
"checksum memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
"checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f"
"checksum nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229"
@ -1938,7 +1922,7 @@ dependencies = [
"checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31"
"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32"
"checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273"
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13"
"checksum page_size 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f89ef58b3d32420dbd1a43d2f38ae92f6239ef12bb556ab09ca55445f5a67242"
"checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252"
"checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b"
@ -1995,7 +1979,6 @@ dependencies = [
"checksum syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "158521e6f544e7e3dcfc370ac180794aa38cb34a1b1e07609376d4adcf429b93"
"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f"
"checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60"
"checksum target-lexicon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1b0ab4982b8945c35cc1c46a83a9094c414f6828a099ce5dcaa8ee2b04642dcb"
"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
"checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e"

20
examples/fib.wat Normal file
View File

@ -0,0 +1,20 @@
(module
(func $main (result i32)
(call $fib (i32.const 40))
)
(func $fib (param $n i32) (result i32)
(if (i32.eq (get_local $n) (i32.const 0))
(then (return (i32.const 1)))
)
(if (i32.eq (get_local $n) (i32.const 1))
(then (return (i32.const 1)))
)
(i32.add
(call $fib (i32.sub (get_local $n) (i32.const 1)))
(call $fib (i32.sub (get_local $n) (i32.const 2)))
)
)
(export "main" (func $main))
)

View File

@ -4,7 +4,11 @@
use crate::emitter_x64::*;
use crate::machine::*;
use crate::protect_unix;
use dynasmrt::{x64::Assembler, AssemblyOffset, DynamicLabel, DynasmApi, DynasmLabelApi};
#[cfg(target_arch = "aarch64")]
use dynasmrt::aarch64::Assembler;
#[cfg(target_arch = "x86_64")]
use dynasmrt::x64::Assembler;
use dynasmrt::{AssemblyOffset, DynamicLabel, DynasmApi, DynasmLabelApi};
use smallvec::SmallVec;
use std::ptr::NonNull;
use std::{
@ -36,6 +40,7 @@ use wasmer_runtime_core::{
};
use wasmparser::{Operator, Type as WpType, TypeOrFuncType as WpTypeOrFuncType};
#[cfg(target_arch = "x86_64")]
lazy_static! {
/// Performs a System V call to `target` with [stack_top..stack_base] as the argument list, from right to left.
static ref CONSTRUCT_STACK_AND_CALL_WASM: unsafe extern "C" fn (stack_top: *const u64, stack_base: *const u64, ctx: *mut vm::Ctx, target: *const vm::Func) -> u64 = {
@ -124,6 +129,69 @@ lazy_static! {
};
}
#[cfg(target_arch = "aarch64")]
lazy_static! {
/// Performs a System V call to `target` with [stack_top..stack_base] as the argument list, from right to left.
static ref CONSTRUCT_STACK_AND_CALL_WASM: unsafe extern "C" fn (stack_top: *const u64, stack_base: *const u64, ctx: *mut vm::Ctx, target: *const vm::Func) -> u64 = {
let mut assembler = Assembler::new().unwrap();
let offset = assembler.offset();
dynasm!(
assembler
; .arch aarch64
; sub sp, sp, 80
; str x19, [sp, 0]
; str x20, [sp, 8]
; str x21, [sp, 16]
; str x22, [sp, 24]
; str x23, [sp, 32]
; str x24, [sp, 40]
; str x25, [sp, 48]
; str x26, [sp, 56]
; str x27, [sp, 64]
; str x28, [sp, 72]
; mov x28, sp // WASM stack pointer
; ldr x9, >v_65536
; sub sp, sp, x9 // Pre-allocate the WASM stack
// return address
; adr x9, >done
; sub x28, x28, 8
; str x9, [x28] // Keep this consistent with RSP mapping in translator_aarch64
// ctx
; mov X(crate::translator_aarch64::map_gpr(GPR::RDI).x()), x2
// TODO: params
// Jump to target function!
; br x3
; done:
; ldr x9, >v_65536
; add sp, sp, x9 // Resume stack pointer
; ldr x19, [sp, 0]
; ldr x20, [sp, 8]
; ldr x21, [sp, 16]
; ldr x22, [sp, 24]
; ldr x23, [sp, 32]
; ldr x24, [sp, 40]
; ldr x25, [sp, 48]
; ldr x26, [sp, 56]
; ldr x27, [sp, 64]
; ldr x28, [sp, 72]
; add sp, sp, 80
; br x30 // LR
; v_65536:
; .qword 65536
);
let buf = assembler.finalize().unwrap();
let ret = unsafe { ::std::mem::transmute(buf.ptr(offset)) };
::std::mem::forget(buf);
ret
};
}
pub struct X64ModuleCodeGenerator {
functions: Vec<X64FunctionCode>,
signatures: Option<Arc<Map<SigIndex, FuncSig>>>,

View File

@ -31,10 +31,10 @@ extern crate byteorder;
extern crate smallvec;
mod codegen_x64;
mod translator_aarch64;
mod emitter_x64;
mod machine;
pub mod protect_unix;
mod translator_aarch64;
pub use codegen_x64::X64FunctionCode as FunctionCodeGenerator;
pub use codegen_x64::X64ModuleCodeGenerator as ModuleCodeGenerator;

View File

@ -1,3 +1,5 @@
#![allow(dead_code)]
use crate::codegen_x64::*;
use crate::emitter_x64::*;
use dynasmrt::{aarch64::Assembler, AssemblyOffset, DynamicLabel, DynasmApi, DynasmLabelApi};
@ -6,14 +8,18 @@ use dynasmrt::{aarch64::Assembler, AssemblyOffset, DynamicLabel, DynasmApi, Dyna
pub struct AX(pub u32);
impl AX {
pub fn x(&self) -> u32 { self.0 }
pub fn x(&self) -> u32 {
self.0
}
}
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
pub struct AV(pub u32);
impl AV {
pub fn v(&self) -> u32 { self.0 }
pub fn v(&self) -> u32 {
self.0
}
}
/*
@ -52,7 +58,7 @@ pub enum XMM {
}
*/
fn map_gpr(gpr: GPR) -> AX {
pub fn map_gpr(gpr: GPR) -> AX {
use GPR::*;
match gpr {
@ -60,7 +66,7 @@ fn map_gpr(gpr: GPR) -> AX {
RCX => AX(1),
RDX => AX(2),
RBX => AX(3),
RSP => AX(4),
RSP => AX(28),
RBP => AX(5),
RSI => AX(6),
RDI => AX(7),
@ -75,7 +81,7 @@ fn map_gpr(gpr: GPR) -> AX {
}
}
fn map_xmm(xmm: XMM) -> AV {
pub fn map_xmm(xmm: XMM) -> AV {
use XMM::*;
match xmm {
@ -312,10 +318,10 @@ impl Emitter for Assembler {
(Size::S64, Location::Imm32(x), Location::GPR(dst)) => {
dynasm!(self ; b >after; data: ; .qword x as i64; after: ; ldr X(map_gpr(dst).x()), <data);
}
_ => unimplemented!()
_ => unimplemented!(),
}
}
fn emit_lea(&mut self, sz: Size, src: Location, dst: Location) {
match (sz, src, dst) {
(Size::S32, Location::Memory(src, disp), Location::GPR(dst)) => {
@ -332,10 +338,10 @@ impl Emitter for Assembler {
Location::GPR(dst) => {
dynasm!(self ; adr X(map_gpr(dst).x()), =>label);
}
_ => unreachable!()
_ => unreachable!(),
}
}
fn emit_cdq(&mut self) {
dynasm!(
self
@ -397,18 +403,18 @@ impl Emitter for Assembler {
Signed => dynasm!(self ; b.vs =>label), // TODO: Review this
}
}
fn emit_jmp_location(&mut self, loc: Location) {
match loc {
Location::GPR(x) => dynasm!(self ; br X(map_gpr(x).x())),
Location::Memory(base, disp) => {
assert!(disp >= 0);
dynasm!(self ; ldr x_tmp1, [ X(map_gpr(base).x()), disp as u32 ]; br x_tmp1);
},
}
_ => unreachable!(),
}
}
fn emit_conditional_trap(&mut self, condition: Condition) {
use Condition::*;
@ -434,7 +440,7 @@ impl Emitter for Assembler {
; ok:
);
}
fn emit_set(&mut self, condition: Condition, dst: GPR) {
use Condition::*;
@ -461,7 +467,7 @@ impl Emitter for Assembler {
; ok:
);
}
fn emit_push(&mut self, sz: Size, src: Location) {
match (sz, src) {
(Size::S64, Location::Imm32(src)) => dynasm!(self
@ -579,7 +585,7 @@ impl Emitter for Assembler {
; ldr x_tmp1, [X(map_gpr(left).x()), disp as u32]
; cmp X(map_gpr(right).x()), x_tmp1
),
_ => unreachable!()
_ => unreachable!(),
}
}
fn emit_add(&mut self, sz: Size, src: Location, dst: Location) {
@ -588,7 +594,7 @@ impl Emitter for Assembler {
fn emit_sub(&mut self, sz: Size, src: Location, dst: Location) {
binop_all_nofp!(sub, self, sz, src, dst, { unreachable!("sub") });
}
fn emit_imul(&mut self, sz: Size, src: Location, dst: Location) {
binop_gpr_gpr!(mul, self, sz, src, dst, {
binop_mem_gpr!(mul, self, sz, src, dst, { unreachable!() })
@ -606,89 +612,299 @@ impl Emitter for Assembler {
);
}
fn emit_div(&mut self, sz: Size, divisor: Location) { unimplemented!("instruction") }
fn emit_idiv(&mut self, sz: Size, divisor: Location) { unimplemented!("instruction") }
fn emit_shl(&mut self, sz: Size, src: Location, dst: Location) { unimplemented!("instruction") }
fn emit_shr(&mut self, sz: Size, src: Location, dst: Location) { unimplemented!("instruction") }
fn emit_sar(&mut self, sz: Size, src: Location, dst: Location) { unimplemented!("instruction") }
fn emit_rol(&mut self, sz: Size, src: Location, dst: Location) { unimplemented!("instruction") }
fn emit_ror(&mut self, sz: Size, src: Location, dst: Location) { unimplemented!("instruction") }
fn emit_and(&mut self, sz: Size, src: Location, dst: Location) { unimplemented!("instruction") }
fn emit_or(&mut self, sz: Size, src: Location, dst: Location) { unimplemented!("instruction") }
fn emit_lzcnt(&mut self, sz: Size, src: Location, dst: Location) { unimplemented!("instruction") }
fn emit_tzcnt(&mut self, sz: Size, src: Location, dst: Location) { unimplemented!("instruction") }
fn emit_popcnt(&mut self, sz: Size, src: Location, dst: Location) { unimplemented!("instruction") }
fn emit_movzx(&mut self, sz_src: Size, src: Location, sz_dst: Size, dst: Location) { unimplemented!("instruction") }
fn emit_movsx(&mut self, sz_src: Size, src: Location, sz_dst: Size, dst: Location) { unimplemented!("instruction") }
fn emit_div(&mut self, sz: Size, divisor: Location) {
unimplemented!("instruction")
}
fn emit_idiv(&mut self, sz: Size, divisor: Location) {
unimplemented!("instruction")
}
fn emit_shl(&mut self, sz: Size, src: Location, dst: Location) {
//binop_all_nofp!(ushl, self, sz, src, dst, { unreachable!("shl") });
unimplemented!("instruction")
}
fn emit_shr(&mut self, sz: Size, src: Location, dst: Location) {
unimplemented!("instruction")
}
fn emit_sar(&mut self, sz: Size, src: Location, dst: Location) {
unimplemented!("instruction")
}
fn emit_rol(&mut self, sz: Size, src: Location, dst: Location) {
unimplemented!("instruction")
}
fn emit_ror(&mut self, sz: Size, src: Location, dst: Location) {
unimplemented!("instruction")
}
fn emit_and(&mut self, sz: Size, src: Location, dst: Location) {
binop_all_nofp!(and, self, sz, src, dst, { unreachable!("and") });
}
fn emit_or(&mut self, sz: Size, src: Location, dst: Location) {
//binop_all_nofp!(or, self, sz, src, dst, { unreachable!("or") });
unimplemented!("instruction");
}
fn emit_lzcnt(&mut self, sz: Size, src: Location, dst: Location) {
match sz {
Size::S32 => {
match src {
Location::Imm32(x) => dynasm!(self
; b >after
; data:
; .dword x as i32
; after:
; ldr w_tmp2, <data
; clz w_tmp1, w_tmp2
),
Location::GPR(x) => dynasm!(self
; clz w_tmp1, W(map_gpr(x).x())
),
Location::Memory(base, disp) => {
assert!(disp >= 0);
dynasm!(self
; ldr w_tmp1, [X(map_gpr(base).x()), disp as u32]
; clz w_tmp1, w_tmp1
);
}
_ => unreachable!(),
}
match dst {
Location::GPR(x) => dynasm!(
self
; mov W(map_gpr(x).x()), w_tmp1
),
Location::Memory(base, disp) => {
assert!(disp >= 0);
dynasm!(
self
; str w_tmp1, [X(map_gpr(base).x()), disp as u32]
)
}
_ => unreachable!(),
}
}
Size::S64 => {
match src {
Location::Imm32(x) => dynasm!(self
; b >after
; data:
; .qword x as i64
; after:
; ldr x_tmp2, <data
; clz x_tmp1, x_tmp2
),
Location::GPR(x) => dynasm!(self
; clz x_tmp1, X(map_gpr(x).x())
),
Location::Memory(base, disp) => {
assert!(disp >= 0);
dynasm!(self
; ldr x_tmp1, [X(map_gpr(base).x()), disp as u32]
; clz x_tmp1, x_tmp1
);
}
_ => unreachable!(),
}
match dst {
Location::GPR(x) => dynasm!(
self
; mov X(map_gpr(x).x()), x_tmp1
),
Location::Memory(base, disp) => {
assert!(disp >= 0);
dynasm!(
self
; str x_tmp1, [X(map_gpr(base).x()), disp as u32]
)
}
_ => unreachable!(),
}
}
_ => unreachable!(),
}
}
fn emit_tzcnt(&mut self, sz: Size, src: Location, dst: Location) {
unimplemented!("instruction")
}
fn emit_popcnt(&mut self, sz: Size, src: Location, dst: Location) {
unimplemented!("instruction")
}
fn emit_movzx(&mut self, sz_src: Size, src: Location, sz_dst: Size, dst: Location) {
unimplemented!("instruction")
}
fn emit_movsx(&mut self, sz_src: Size, src: Location, sz_dst: Size, dst: Location) {
unimplemented!("instruction")
}
fn emit_btc_gpr_imm8_32(&mut self, src: u8, dst: GPR) { unimplemented!("instruction") }
fn emit_btc_gpr_imm8_64(&mut self, src: u8, dst: GPR) { unimplemented!("instruction") }
fn emit_btc_gpr_imm8_32(&mut self, src: u8, dst: GPR) {
unimplemented!("instruction")
}
fn emit_btc_gpr_imm8_64(&mut self, src: u8, dst: GPR) {
unimplemented!("instruction")
}
fn emit_cmovae_gpr_32(&mut self, src: GPR, dst: GPR) { unimplemented!("instruction") }
fn emit_cmovae_gpr_64(&mut self, src: GPR, dst: GPR) { unimplemented!("instruction") }
fn emit_cmovae_gpr_32(&mut self, src: GPR, dst: GPR) {
unimplemented!("instruction")
}
fn emit_cmovae_gpr_64(&mut self, src: GPR, dst: GPR) {
unimplemented!("instruction")
}
fn emit_vaddss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vaddsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vsubss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vsubsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vmulss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vmulsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vdivss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vdivsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vmaxss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vmaxsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vminss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vminsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vaddss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vaddsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vsubss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vsubsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vmulss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vmulsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vdivss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vdivsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vmaxss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vmaxsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vminss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vminsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vcmpeqss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vcmpeqsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vcmpeqss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vcmpeqsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vcmpneqss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vcmpneqsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vcmpneqss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vcmpneqsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vcmpltss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vcmpltsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vcmpltss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vcmpltsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vcmpless(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vcmplesd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vcmpless(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vcmplesd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vcmpgtss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vcmpgtsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vcmpgtss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vcmpgtsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vcmpgess(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vcmpgesd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vcmpgess(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vcmpgesd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vsqrtss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vsqrtsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vsqrtss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vsqrtsd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vroundss_nearest(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vroundss_floor(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vroundss_ceil(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vroundss_trunc(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vroundsd_nearest(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vroundsd_floor(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vroundsd_ceil(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vroundsd_trunc(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vroundss_nearest(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vroundss_floor(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vroundss_ceil(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vroundss_trunc(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vroundsd_nearest(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vroundsd_floor(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vroundsd_ceil(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vroundsd_trunc(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vcvtss2sd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vcvtsd2ss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vcvtss2sd(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vcvtsd2ss(&mut self, src1: XMM, src2: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_ucomiss(&mut self, src: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_ucomisd(&mut self, src: XMMOrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_ucomiss(&mut self, src: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_ucomisd(&mut self, src: XMMOrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_cvttss2si_32(&mut self, src: XMMOrMemory, dst: GPR) { unimplemented!("instruction") }
fn emit_cvttss2si_64(&mut self, src: XMMOrMemory, dst: GPR) { unimplemented!("instruction") }
fn emit_cvttsd2si_32(&mut self, src: XMMOrMemory, dst: GPR) { unimplemented!("instruction") }
fn emit_cvttsd2si_64(&mut self, src: XMMOrMemory, dst: GPR) { unimplemented!("instruction") }
fn emit_cvttss2si_32(&mut self, src: XMMOrMemory, dst: GPR) {
unimplemented!("instruction")
}
fn emit_cvttss2si_64(&mut self, src: XMMOrMemory, dst: GPR) {
unimplemented!("instruction")
}
fn emit_cvttsd2si_32(&mut self, src: XMMOrMemory, dst: GPR) {
unimplemented!("instruction")
}
fn emit_cvttsd2si_64(&mut self, src: XMMOrMemory, dst: GPR) {
unimplemented!("instruction")
}
fn emit_vcvtsi2ss_32(&mut self, src1: XMM, src2: GPROrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vcvtsi2ss_64(&mut self, src1: XMM, src2: GPROrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vcvtsi2sd_32(&mut self, src1: XMM, src2: GPROrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vcvtsi2sd_64(&mut self, src1: XMM, src2: GPROrMemory, dst: XMM) { unimplemented!("instruction") }
fn emit_vcvtsi2ss_32(&mut self, src1: XMM, src2: GPROrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vcvtsi2ss_64(&mut self, src1: XMM, src2: GPROrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vcvtsi2sd_32(&mut self, src1: XMM, src2: GPROrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_vcvtsi2sd_64(&mut self, src1: XMM, src2: GPROrMemory, dst: XMM) {
unimplemented!("instruction")
}
fn emit_test_gpr_64(&mut self, reg: GPR) { unimplemented!("instruction") }
fn emit_test_gpr_64(&mut self, reg: GPR) {
unimplemented!("instruction")
}
fn emit_ud2(&mut self) { dynasm!(self ; brk 2) }
fn emit_ud2(&mut self) {
dynasm!(self ; brk 2)
}
fn emit_ret(&mut self) {
dynasm!(self
; ldr x_tmp1, [x_rsp]
@ -745,10 +961,12 @@ impl Emitter for Assembler {
; br x_tmp1
; done:
);
},
}
_ => unreachable!(),
}
}
fn emit_bkpt(&mut self) { dynasm!(self ; brk 1) }
fn emit_bkpt(&mut self) {
dynasm!(self ; brk 1)
}
}