mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 22:25:40 +00:00
Merge #921
921: Apply TBAA metadata in the LLVM backend. r=nlewycky a=nlewycky # Description Inform LLVM that the pointers to memory, globals, locals, etc., are distinct. # Review - [x] Add a short description of the the change to the CHANGELOG.md file Co-authored-by: Nick Lewycky <nick@wasmer.io> Co-authored-by: nlewycky <nick@wasmer.io>
This commit is contained in:
commit
b9a9949281
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
## **[Unreleased]**
|
## **[Unreleased]**
|
||||||
|
|
||||||
|
- [#921](https://github.com/wasmerio/wasmer/pull/921) In LLVM backend, annotate all memory accesses with TBAA metadata.
|
||||||
- [#883](https://github.com/wasmerio/wasmer/pull/883) Allow floating point operations to have arbitrary inputs, even including SNaNs.
|
- [#883](https://github.com/wasmerio/wasmer/pull/883) Allow floating point operations to have arbitrary inputs, even including SNaNs.
|
||||||
- [#856](https://github.com/wasmerio/wasmer/pull/856) Expose methods in the runtime C API to get a WASI import object
|
- [#856](https://github.com/wasmerio/wasmer/pull/856) Expose methods in the runtime C API to get a WASI import object
|
||||||
|
|
||||||
|
54
Cargo.lock
generated
54
Cargo.lock
generated
@ -120,7 +120,7 @@ dependencies = [
|
|||||||
"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"toml 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -188,7 +188,7 @@ dependencies = [
|
|||||||
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"target-lexicon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"target-lexicon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ dependencies = [
|
|||||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"crossbeam-utils 0.6.6 (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.4.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)",
|
"memoffset 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -494,7 +494,15 @@ name = "heck"
|
|||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-segmentation 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hermit-abi"
|
||||||
|
version = "0.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -514,7 +522,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "inkwell"
|
name = "inkwell"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/wasmerio/inkwell?branch=llvm8-0#5ae21b51d9dd20a63e4431b06e3beb7a42d6ceb8"
|
source = "git+https://github.com/wasmerio/inkwell?branch=llvm8-0#10d180807ce6e621ae13d74001bf5677b0e1f179"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"enum-methods 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"enum-methods 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -528,7 +536,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "inkwell_internal_macros"
|
name = "inkwell_internal_macros"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/wasmerio/inkwell?branch=llvm8-0#5ae21b51d9dd20a63e4431b06e3beb7a42d6ceb8"
|
source = "git+https://github.com/wasmerio/inkwell?branch=llvm8-0#10d180807ce6e621ae13d74001bf5677b0e1f179"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo_toml 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cargo_toml 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -653,7 +661,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memoffset"
|
name = "memoffset"
|
||||||
version = "0.5.1"
|
version = "0.5.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -686,9 +694,10 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num_cpus"
|
name = "num_cpus"
|
||||||
version = "1.10.1"
|
version = "1.11.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -748,7 +757,7 @@ dependencies = [
|
|||||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
|
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -914,7 +923,7 @@ dependencies = [
|
|||||||
"crossbeam-queue 0.1.2 (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)",
|
"crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.4.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)",
|
"num_cpus 1.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1067,7 +1076,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "0.6.11"
|
version = "0.6.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1223,7 +1232,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml"
|
name = "toml"
|
||||||
version = "0.5.4"
|
version = "0.5.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1258,7 +1267,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-segmentation"
|
name = "unicode-segmentation"
|
||||||
version = "1.3.0"
|
version = "1.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1385,7 +1394,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cranelift-codegen 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cranelift-codegen 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"target-lexicon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"target-lexicon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1458,7 +1467,7 @@ dependencies = [
|
|||||||
"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasmer-runtime-core 0.9.0",
|
"wasmer-runtime-core 0.9.0",
|
||||||
"wasmparser 0.39.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"wasmparser 0.39.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1533,7 +1542,7 @@ dependencies = [
|
|||||||
"serde-bench 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde-bench 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasmparser 0.39.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"wasmparser 0.39.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -1559,7 +1568,7 @@ dependencies = [
|
|||||||
"lazy_static 1.4.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.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"nix 0.15.0 (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.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasmer-runtime-core 0.9.0",
|
"wasmer-runtime-core 0.9.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1716,6 +1725,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
||||||
"checksum goblin 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e3fa261d919c1ae9d1e4533c4a2f99e10938603c4208d56c05bec7a872b661b0"
|
"checksum goblin 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e3fa261d919c1ae9d1e4533c4a2f99e10938603c4208d56c05bec7a872b661b0"
|
||||||
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
|
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
|
||||||
|
"checksum hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "307c3c9f937f38e3534b1d6447ecf090cafcc9744e4a6360e8b037b2cf5af120"
|
||||||
"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
|
"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
|
||||||
"checksum indexmap 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712d7b3ea5827fcb9d4fda14bf4da5f136f0db2ae9c8f4bd4e2d1c6fde4e6db2"
|
"checksum indexmap 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712d7b3ea5827fcb9d4fda14bf4da5f136f0db2ae9c8f4bd4e2d1c6fde4e6db2"
|
||||||
"checksum inkwell 0.1.0 (git+https://github.com/wasmerio/inkwell?branch=llvm8-0)" = "<none>"
|
"checksum inkwell 0.1.0 (git+https://github.com/wasmerio/inkwell?branch=llvm8-0)" = "<none>"
|
||||||
@ -1734,11 +1744,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
|
"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.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 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 memoffset 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a85c1a8c329f11437034d7313dca647c79096523533a1c79e86f1d0f657c7cc"
|
||||||
"checksum nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229"
|
"checksum nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229"
|
||||||
"checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
|
"checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
|
||||||
"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32"
|
"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 num_cpus 1.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "155394f924cdddf08149da25bfb932d226b4a593ca7468b08191ff6335941af5"
|
||||||
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
|
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
|
||||||
"checksum page_size 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f89ef58b3d32420dbd1a43d2f38ae92f6239ef12bb556ab09ca55445f5a67242"
|
"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 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252"
|
||||||
@ -1781,7 +1791,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
"checksum serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "45af0182ff64abaeea290235eb67da3825a576c5d53e642c4d5b652e12e6effc"
|
"checksum serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "45af0182ff64abaeea290235eb67da3825a576c5d53e642c4d5b652e12e6effc"
|
||||||
"checksum serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)" = "ca13fc1a832f793322228923fbb3aba9f3f44444898f835d31ad1b74fa0a2bf8"
|
"checksum serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)" = "ca13fc1a832f793322228923fbb3aba9f3f44444898f835d31ad1b74fa0a2bf8"
|
||||||
"checksum serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2"
|
"checksum serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2"
|
||||||
"checksum smallvec 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cefaa50e76a6f10b86f36e640eb1739eafbd4084865067778463913e43a77ff3"
|
"checksum smallvec 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "533e29e15d0748f28afbaf4ff7cab44d73e483a8e50b38c40bd13b7f3d48f542"
|
||||||
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
|
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
|
||||||
"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||||
"checksum structopt 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4f66a4c0ddf7aee4677995697366de0749b0139057342eccbb609b12d0affc"
|
"checksum structopt 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4f66a4c0ddf7aee4677995697366de0749b0139057342eccbb609b12d0affc"
|
||||||
@ -1799,11 +1809,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
|
"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
|
||||||
"checksum tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4574b75faccaacddb9b284faecdf0b544b80b6b294f3d062d325c5726a209c20"
|
"checksum tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4574b75faccaacddb9b284faecdf0b544b80b6b294f3d062d325c5726a209c20"
|
||||||
"checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f"
|
"checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f"
|
||||||
"checksum toml 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c04dffffeac90885436d23c692517bb5b8b3f8863e4afc15023628d067d667b7"
|
"checksum toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "01d1404644c8b12b16bfcffa4322403a91a451584daaaa7c28d3152e6cbc98cf"
|
||||||
"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9"
|
"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9"
|
||||||
"checksum typetag 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6ebb2c484029d695fb68a06d80e1536c68d491b3e0cf874c66abed255e831cfe"
|
"checksum typetag 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6ebb2c484029d695fb68a06d80e1536c68d491b3e0cf874c66abed255e831cfe"
|
||||||
"checksum typetag-impl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b63fd4799e4d0ec5cf0b055ebb8e2c3a657bbf76a84f6edc77ca60780e000204"
|
"checksum typetag-impl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b63fd4799e4d0ec5cf0b055ebb8e2c3a657bbf76a84f6edc77ca60780e000204"
|
||||||
"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9"
|
"checksum unicode-segmentation 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49f5526225fd8b77342d5986ab5f6055552e9c0776193b5b63fd53b46debfad7"
|
||||||
"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20"
|
"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20"
|
||||||
"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
|
"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
|
||||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||||
|
@ -11,12 +11,14 @@ use inkwell::{
|
|||||||
use libc::c_char;
|
use libc::c_char;
|
||||||
use std::{
|
use std::{
|
||||||
any::Any,
|
any::Any,
|
||||||
|
cell::RefCell,
|
||||||
ffi::{c_void, CString},
|
ffi::{c_void, CString},
|
||||||
fs::File,
|
fs::File,
|
||||||
io::Write,
|
io::Write,
|
||||||
mem,
|
mem,
|
||||||
ops::Deref,
|
ops::Deref,
|
||||||
ptr::{self, NonNull},
|
ptr::{self, NonNull},
|
||||||
|
rc::Rc,
|
||||||
slice, str,
|
slice, str,
|
||||||
sync::{Arc, Once},
|
sync::{Arc, Once},
|
||||||
};
|
};
|
||||||
@ -169,14 +171,14 @@ pub struct LLVMBackend {
|
|||||||
|
|
||||||
impl LLVMBackend {
|
impl LLVMBackend {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
module: Module,
|
module: Rc<RefCell<Module>>,
|
||||||
_intrinsics: Intrinsics,
|
_intrinsics: Intrinsics,
|
||||||
_stackmaps: &StackmapRegistry,
|
_stackmaps: &StackmapRegistry,
|
||||||
_module_info: &ModuleInfo,
|
_module_info: &ModuleInfo,
|
||||||
target_machine: &TargetMachine,
|
target_machine: &TargetMachine,
|
||||||
) -> (Self, LLVMCache) {
|
) -> (Self, LLVMCache) {
|
||||||
let memory_buffer = target_machine
|
let memory_buffer = target_machine
|
||||||
.write_to_memory_buffer(&module, FileType::Object)
|
.write_to_memory_buffer(&module.borrow_mut(), FileType::Object)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let mem_buf_slice = memory_buffer.as_slice();
|
let mem_buf_slice = memory_buffer.as_slice();
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -7,12 +7,15 @@ use inkwell::{
|
|||||||
BasicType, FloatType, FunctionType, IntType, PointerType, StructType, VectorType, VoidType,
|
BasicType, FloatType, FunctionType, IntType, PointerType, StructType, VectorType, VoidType,
|
||||||
},
|
},
|
||||||
values::{
|
values::{
|
||||||
BasicValue, BasicValueEnum, FloatValue, FunctionValue, IntValue, PointerValue, VectorValue,
|
BasicValue, BasicValueEnum, FloatValue, FunctionValue, InstructionValue, IntValue,
|
||||||
|
MetadataValue, PointerValue, VectorValue,
|
||||||
},
|
},
|
||||||
AddressSpace,
|
AddressSpace,
|
||||||
};
|
};
|
||||||
|
use std::cell::RefCell;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
use std::rc::Rc;
|
||||||
use wasmer_runtime_core::{
|
use wasmer_runtime_core::{
|
||||||
memory::MemoryType,
|
memory::MemoryType,
|
||||||
module::ModuleInfo,
|
module::ModuleInfo,
|
||||||
@ -658,7 +661,12 @@ impl<'a> CtxType<'a> {
|
|||||||
ptr
|
ptr
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn memory(&mut self, index: MemoryIndex, intrinsics: &Intrinsics) -> MemoryCache {
|
pub fn memory(
|
||||||
|
&mut self,
|
||||||
|
index: MemoryIndex,
|
||||||
|
intrinsics: &Intrinsics,
|
||||||
|
module: Rc<RefCell<Module>>,
|
||||||
|
) -> MemoryCache {
|
||||||
let (cached_memories, info, ctx_ptr_value, cache_builder) = (
|
let (cached_memories, info, ctx_ptr_value, cache_builder) = (
|
||||||
&mut self.cached_memories,
|
&mut self.cached_memories,
|
||||||
self.info,
|
self.info,
|
||||||
@ -667,7 +675,7 @@ impl<'a> CtxType<'a> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
*cached_memories.entry(index).or_insert_with(|| {
|
*cached_memories.entry(index).or_insert_with(|| {
|
||||||
let (memory_array_ptr_ptr, index, memory_type, minimum, maximum) =
|
let (memory_array_ptr_ptr, index, memory_type, minimum, maximum, field_name) =
|
||||||
match index.local_or_import(info) {
|
match index.local_or_import(info) {
|
||||||
LocalOrImport::Local(local_mem_index) => (
|
LocalOrImport::Local(local_mem_index) => (
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -681,6 +689,7 @@ impl<'a> CtxType<'a> {
|
|||||||
info.memories[local_mem_index].memory_type(),
|
info.memories[local_mem_index].memory_type(),
|
||||||
info.memories[local_mem_index].minimum,
|
info.memories[local_mem_index].minimum,
|
||||||
info.memories[local_mem_index].maximum,
|
info.memories[local_mem_index].maximum,
|
||||||
|
"context_field_ptr_to_local_memory",
|
||||||
),
|
),
|
||||||
LocalOrImport::Import(import_mem_index) => (
|
LocalOrImport::Import(import_mem_index) => (
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -694,12 +703,20 @@ impl<'a> CtxType<'a> {
|
|||||||
info.imported_memories[import_mem_index].1.memory_type(),
|
info.imported_memories[import_mem_index].1.memory_type(),
|
||||||
info.imported_memories[import_mem_index].1.minimum,
|
info.imported_memories[import_mem_index].1.minimum,
|
||||||
info.imported_memories[import_mem_index].1.maximum,
|
info.imported_memories[import_mem_index].1.maximum,
|
||||||
|
"context_field_ptr_to_imported_memory",
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
let memory_array_ptr = cache_builder
|
let memory_array_ptr = cache_builder
|
||||||
.build_load(memory_array_ptr_ptr, "memory_array_ptr")
|
.build_load(memory_array_ptr_ptr, "memory_array_ptr")
|
||||||
.into_pointer_value();
|
.into_pointer_value();
|
||||||
|
tbaa_label(
|
||||||
|
module.clone(),
|
||||||
|
intrinsics,
|
||||||
|
field_name,
|
||||||
|
memory_array_ptr.as_instruction_value().unwrap(),
|
||||||
|
None,
|
||||||
|
);
|
||||||
let const_index = intrinsics.i32_ty.const_int(index, false);
|
let const_index = intrinsics.i32_ty.const_int(index, false);
|
||||||
let memory_ptr_ptr = unsafe {
|
let memory_ptr_ptr = unsafe {
|
||||||
cache_builder.build_in_bounds_gep(
|
cache_builder.build_in_bounds_gep(
|
||||||
@ -711,6 +728,13 @@ impl<'a> CtxType<'a> {
|
|||||||
let memory_ptr = cache_builder
|
let memory_ptr = cache_builder
|
||||||
.build_load(memory_ptr_ptr, "memory_ptr")
|
.build_load(memory_ptr_ptr, "memory_ptr")
|
||||||
.into_pointer_value();
|
.into_pointer_value();
|
||||||
|
tbaa_label(
|
||||||
|
module.clone(),
|
||||||
|
intrinsics,
|
||||||
|
"memory_ptr",
|
||||||
|
memory_ptr.as_instruction_value().unwrap(),
|
||||||
|
Some(index as u32),
|
||||||
|
);
|
||||||
|
|
||||||
let (ptr_to_base_ptr, ptr_to_bounds) = unsafe {
|
let (ptr_to_base_ptr, ptr_to_bounds) = unsafe {
|
||||||
(
|
(
|
||||||
@ -726,16 +750,34 @@ impl<'a> CtxType<'a> {
|
|||||||
minimum,
|
minimum,
|
||||||
maximum,
|
maximum,
|
||||||
},
|
},
|
||||||
MemoryType::Static | MemoryType::SharedStatic => MemoryCache::Static {
|
MemoryType::Static | MemoryType::SharedStatic => {
|
||||||
base_ptr: cache_builder
|
let base_ptr = cache_builder
|
||||||
.build_load(ptr_to_base_ptr, "base")
|
.build_load(ptr_to_base_ptr, "base")
|
||||||
.into_pointer_value(),
|
.into_pointer_value();
|
||||||
bounds: cache_builder
|
let bounds = cache_builder
|
||||||
.build_load(ptr_to_bounds, "bounds")
|
.build_load(ptr_to_bounds, "bounds")
|
||||||
.into_int_value(),
|
.into_int_value();
|
||||||
minimum,
|
tbaa_label(
|
||||||
maximum,
|
module.clone(),
|
||||||
},
|
intrinsics,
|
||||||
|
"static_memory_base",
|
||||||
|
base_ptr.as_instruction_value().unwrap(),
|
||||||
|
Some(index as u32),
|
||||||
|
);
|
||||||
|
tbaa_label(
|
||||||
|
module.clone(),
|
||||||
|
intrinsics,
|
||||||
|
"static_memory_bounds",
|
||||||
|
bounds.as_instruction_value().unwrap(),
|
||||||
|
Some(index as u32),
|
||||||
|
);
|
||||||
|
MemoryCache::Static {
|
||||||
|
base_ptr,
|
||||||
|
bounds,
|
||||||
|
minimum,
|
||||||
|
maximum,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -744,6 +786,7 @@ impl<'a> CtxType<'a> {
|
|||||||
&mut self,
|
&mut self,
|
||||||
index: TableIndex,
|
index: TableIndex,
|
||||||
intrinsics: &Intrinsics,
|
intrinsics: &Intrinsics,
|
||||||
|
module: Rc<RefCell<Module>>,
|
||||||
) -> (PointerValue, PointerValue) {
|
) -> (PointerValue, PointerValue) {
|
||||||
let (cached_tables, info, ctx_ptr_value, cache_builder) = (
|
let (cached_tables, info, ctx_ptr_value, cache_builder) = (
|
||||||
&mut self.cached_tables,
|
&mut self.cached_tables,
|
||||||
@ -756,7 +799,7 @@ impl<'a> CtxType<'a> {
|
|||||||
ptr_to_base_ptr,
|
ptr_to_base_ptr,
|
||||||
ptr_to_bounds,
|
ptr_to_bounds,
|
||||||
} = *cached_tables.entry(index).or_insert_with(|| {
|
} = *cached_tables.entry(index).or_insert_with(|| {
|
||||||
let (table_array_ptr_ptr, index) = match index.local_or_import(info) {
|
let (table_array_ptr_ptr, index, field_name) = match index.local_or_import(info) {
|
||||||
LocalOrImport::Local(local_table_index) => (
|
LocalOrImport::Local(local_table_index) => (
|
||||||
unsafe {
|
unsafe {
|
||||||
cache_builder.build_struct_gep(
|
cache_builder.build_struct_gep(
|
||||||
@ -766,6 +809,7 @@ impl<'a> CtxType<'a> {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
local_table_index.index() as u64,
|
local_table_index.index() as u64,
|
||||||
|
"context_field_ptr_to_local_table",
|
||||||
),
|
),
|
||||||
LocalOrImport::Import(import_table_index) => (
|
LocalOrImport::Import(import_table_index) => (
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -776,12 +820,20 @@ impl<'a> CtxType<'a> {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
import_table_index.index() as u64,
|
import_table_index.index() as u64,
|
||||||
|
"context_field_ptr_to_import_table",
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
let table_array_ptr = cache_builder
|
let table_array_ptr = cache_builder
|
||||||
.build_load(table_array_ptr_ptr, "table_array_ptr")
|
.build_load(table_array_ptr_ptr, "table_array_ptr")
|
||||||
.into_pointer_value();
|
.into_pointer_value();
|
||||||
|
tbaa_label(
|
||||||
|
module.clone(),
|
||||||
|
intrinsics,
|
||||||
|
field_name,
|
||||||
|
table_array_ptr.as_instruction_value().unwrap(),
|
||||||
|
None,
|
||||||
|
);
|
||||||
let const_index = intrinsics.i32_ty.const_int(index, false);
|
let const_index = intrinsics.i32_ty.const_int(index, false);
|
||||||
let table_ptr_ptr = unsafe {
|
let table_ptr_ptr = unsafe {
|
||||||
cache_builder.build_in_bounds_gep(table_array_ptr, &[const_index], "table_ptr_ptr")
|
cache_builder.build_in_bounds_gep(table_array_ptr, &[const_index], "table_ptr_ptr")
|
||||||
@ -789,6 +841,13 @@ impl<'a> CtxType<'a> {
|
|||||||
let table_ptr = cache_builder
|
let table_ptr = cache_builder
|
||||||
.build_load(table_ptr_ptr, "table_ptr")
|
.build_load(table_ptr_ptr, "table_ptr")
|
||||||
.into_pointer_value();
|
.into_pointer_value();
|
||||||
|
tbaa_label(
|
||||||
|
module.clone(),
|
||||||
|
intrinsics,
|
||||||
|
"table_ptr",
|
||||||
|
table_array_ptr.as_instruction_value().unwrap(),
|
||||||
|
Some(index as u32),
|
||||||
|
);
|
||||||
|
|
||||||
let (ptr_to_base_ptr, ptr_to_bounds) = unsafe {
|
let (ptr_to_base_ptr, ptr_to_bounds) = unsafe {
|
||||||
(
|
(
|
||||||
@ -810,15 +869,30 @@ impl<'a> CtxType<'a> {
|
|||||||
&mut self,
|
&mut self,
|
||||||
index: TableIndex,
|
index: TableIndex,
|
||||||
intrinsics: &Intrinsics,
|
intrinsics: &Intrinsics,
|
||||||
|
module: Rc<RefCell<Module>>,
|
||||||
builder: &Builder,
|
builder: &Builder,
|
||||||
) -> (PointerValue, IntValue) {
|
) -> (PointerValue, IntValue) {
|
||||||
let (ptr_to_base_ptr, ptr_to_bounds) = self.table_prepare(index, intrinsics);
|
let (ptr_to_base_ptr, ptr_to_bounds) =
|
||||||
(
|
self.table_prepare(index, intrinsics, module.clone());
|
||||||
builder
|
let base_ptr = builder
|
||||||
.build_load(ptr_to_base_ptr, "base_ptr")
|
.build_load(ptr_to_base_ptr, "base_ptr")
|
||||||
.into_pointer_value(),
|
.into_pointer_value();
|
||||||
builder.build_load(ptr_to_bounds, "bounds").into_int_value(),
|
let bounds = builder.build_load(ptr_to_bounds, "bounds").into_int_value();
|
||||||
)
|
tbaa_label(
|
||||||
|
module.clone(),
|
||||||
|
intrinsics,
|
||||||
|
"table_base_ptr",
|
||||||
|
base_ptr.as_instruction_value().unwrap(),
|
||||||
|
Some(index.index() as u32),
|
||||||
|
);
|
||||||
|
tbaa_label(
|
||||||
|
module.clone(),
|
||||||
|
intrinsics,
|
||||||
|
"table_bounds",
|
||||||
|
bounds.as_instruction_value().unwrap(),
|
||||||
|
Some(index.index() as u32),
|
||||||
|
);
|
||||||
|
(base_ptr, bounds)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn local_func(
|
pub fn local_func(
|
||||||
@ -826,6 +900,7 @@ impl<'a> CtxType<'a> {
|
|||||||
index: LocalFuncIndex,
|
index: LocalFuncIndex,
|
||||||
fn_ty: FunctionType,
|
fn_ty: FunctionType,
|
||||||
intrinsics: &Intrinsics,
|
intrinsics: &Intrinsics,
|
||||||
|
module: Rc<RefCell<Module>>,
|
||||||
builder: &Builder,
|
builder: &Builder,
|
||||||
) -> PointerValue {
|
) -> PointerValue {
|
||||||
let local_func_array_ptr_ptr = unsafe {
|
let local_func_array_ptr_ptr = unsafe {
|
||||||
@ -838,6 +913,13 @@ impl<'a> CtxType<'a> {
|
|||||||
let local_func_array_ptr = builder
|
let local_func_array_ptr = builder
|
||||||
.build_load(local_func_array_ptr_ptr, "local_func_array_ptr")
|
.build_load(local_func_array_ptr_ptr, "local_func_array_ptr")
|
||||||
.into_pointer_value();
|
.into_pointer_value();
|
||||||
|
tbaa_label(
|
||||||
|
module.clone(),
|
||||||
|
intrinsics,
|
||||||
|
"context_field_ptr_to_local_funcs",
|
||||||
|
local_func_array_ptr.as_instruction_value().unwrap(),
|
||||||
|
None,
|
||||||
|
);
|
||||||
let local_func_ptr_ptr = unsafe {
|
let local_func_ptr_ptr = unsafe {
|
||||||
builder.build_in_bounds_gep(
|
builder.build_in_bounds_gep(
|
||||||
local_func_array_ptr,
|
local_func_array_ptr,
|
||||||
@ -848,6 +930,13 @@ impl<'a> CtxType<'a> {
|
|||||||
let local_func_ptr = builder
|
let local_func_ptr = builder
|
||||||
.build_load(local_func_ptr_ptr, "local_func_ptr")
|
.build_load(local_func_ptr_ptr, "local_func_ptr")
|
||||||
.into_pointer_value();
|
.into_pointer_value();
|
||||||
|
tbaa_label(
|
||||||
|
module.clone(),
|
||||||
|
intrinsics,
|
||||||
|
"local_func_ptr",
|
||||||
|
local_func_ptr.as_instruction_value().unwrap(),
|
||||||
|
Some(index.index() as u32),
|
||||||
|
);
|
||||||
builder.build_pointer_cast(
|
builder.build_pointer_cast(
|
||||||
local_func_ptr,
|
local_func_ptr,
|
||||||
fn_ty.ptr_type(AddressSpace::Generic),
|
fn_ty.ptr_type(AddressSpace::Generic),
|
||||||
@ -889,7 +978,12 @@ impl<'a> CtxType<'a> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn global_cache(&mut self, index: GlobalIndex, intrinsics: &Intrinsics) -> GlobalCache {
|
pub fn global_cache(
|
||||||
|
&mut self,
|
||||||
|
index: GlobalIndex,
|
||||||
|
intrinsics: &Intrinsics,
|
||||||
|
module: Rc<RefCell<Module>>,
|
||||||
|
) -> GlobalCache {
|
||||||
let (cached_globals, ctx_ptr_value, info, cache_builder) = (
|
let (cached_globals, ctx_ptr_value, info, cache_builder) = (
|
||||||
&mut self.cached_globals,
|
&mut self.cached_globals,
|
||||||
self.ctx_ptr_value,
|
self.ctx_ptr_value,
|
||||||
@ -898,7 +992,7 @@ impl<'a> CtxType<'a> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
*cached_globals.entry(index).or_insert_with(|| {
|
*cached_globals.entry(index).or_insert_with(|| {
|
||||||
let (globals_array_ptr_ptr, index, mutable, wasmer_ty) =
|
let (globals_array_ptr_ptr, index, mutable, wasmer_ty, field_name) =
|
||||||
match index.local_or_import(info) {
|
match index.local_or_import(info) {
|
||||||
LocalOrImport::Local(local_global_index) => {
|
LocalOrImport::Local(local_global_index) => {
|
||||||
let desc = info.globals[local_global_index].desc;
|
let desc = info.globals[local_global_index].desc;
|
||||||
@ -913,6 +1007,7 @@ impl<'a> CtxType<'a> {
|
|||||||
local_global_index.index() as u64,
|
local_global_index.index() as u64,
|
||||||
desc.mutable,
|
desc.mutable,
|
||||||
desc.ty,
|
desc.ty,
|
||||||
|
"context_field_ptr_to_local_globals",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
LocalOrImport::Import(import_global_index) => {
|
LocalOrImport::Import(import_global_index) => {
|
||||||
@ -928,6 +1023,7 @@ impl<'a> CtxType<'a> {
|
|||||||
import_global_index.index() as u64,
|
import_global_index.index() as u64,
|
||||||
desc.mutable,
|
desc.mutable,
|
||||||
desc.ty,
|
desc.ty,
|
||||||
|
"context_field_ptr_to_imported_globals",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -937,6 +1033,13 @@ impl<'a> CtxType<'a> {
|
|||||||
let global_array_ptr = cache_builder
|
let global_array_ptr = cache_builder
|
||||||
.build_load(globals_array_ptr_ptr, "global_array_ptr")
|
.build_load(globals_array_ptr_ptr, "global_array_ptr")
|
||||||
.into_pointer_value();
|
.into_pointer_value();
|
||||||
|
tbaa_label(
|
||||||
|
module.clone(),
|
||||||
|
intrinsics,
|
||||||
|
field_name,
|
||||||
|
globals_array_ptr_ptr.as_instruction_value().unwrap(),
|
||||||
|
None,
|
||||||
|
);
|
||||||
let const_index = intrinsics.i32_ty.const_int(index, false);
|
let const_index = intrinsics.i32_ty.const_int(index, false);
|
||||||
let global_ptr_ptr = unsafe {
|
let global_ptr_ptr = unsafe {
|
||||||
cache_builder.build_in_bounds_gep(
|
cache_builder.build_in_bounds_gep(
|
||||||
@ -948,6 +1051,13 @@ impl<'a> CtxType<'a> {
|
|||||||
let global_ptr = cache_builder
|
let global_ptr = cache_builder
|
||||||
.build_load(global_ptr_ptr, "global_ptr")
|
.build_load(global_ptr_ptr, "global_ptr")
|
||||||
.into_pointer_value();
|
.into_pointer_value();
|
||||||
|
tbaa_label(
|
||||||
|
module.clone(),
|
||||||
|
intrinsics,
|
||||||
|
"global_ptr",
|
||||||
|
globals_array_ptr_ptr.as_instruction_value().unwrap(),
|
||||||
|
Some(index as u32),
|
||||||
|
);
|
||||||
|
|
||||||
let global_ptr_typed =
|
let global_ptr_typed =
|
||||||
cache_builder.build_pointer_cast(global_ptr, llvm_ptr_ty, "global_ptr_typed");
|
cache_builder.build_pointer_cast(global_ptr, llvm_ptr_ty, "global_ptr_typed");
|
||||||
@ -957,9 +1067,15 @@ impl<'a> CtxType<'a> {
|
|||||||
ptr_to_value: global_ptr_typed,
|
ptr_to_value: global_ptr_typed,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GlobalCache::Const {
|
let value = cache_builder.build_load(global_ptr_typed, "global_value");
|
||||||
value: cache_builder.build_load(global_ptr_typed, "global_value"),
|
tbaa_label(
|
||||||
}
|
module.clone(),
|
||||||
|
intrinsics,
|
||||||
|
"global",
|
||||||
|
value.as_instruction_value().unwrap(),
|
||||||
|
Some(index as u32),
|
||||||
|
);
|
||||||
|
GlobalCache::Const { value }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -968,6 +1084,7 @@ impl<'a> CtxType<'a> {
|
|||||||
&mut self,
|
&mut self,
|
||||||
index: ImportedFuncIndex,
|
index: ImportedFuncIndex,
|
||||||
intrinsics: &Intrinsics,
|
intrinsics: &Intrinsics,
|
||||||
|
module: Rc<RefCell<Module>>,
|
||||||
) -> (PointerValue, PointerValue) {
|
) -> (PointerValue, PointerValue) {
|
||||||
let (cached_imported_functions, ctx_ptr_value, cache_builder) = (
|
let (cached_imported_functions, ctx_ptr_value, cache_builder) = (
|
||||||
&mut self.cached_imported_functions,
|
&mut self.cached_imported_functions,
|
||||||
@ -986,6 +1103,13 @@ impl<'a> CtxType<'a> {
|
|||||||
let func_array_ptr = cache_builder
|
let func_array_ptr = cache_builder
|
||||||
.build_load(func_array_ptr_ptr, "func_array_ptr")
|
.build_load(func_array_ptr_ptr, "func_array_ptr")
|
||||||
.into_pointer_value();
|
.into_pointer_value();
|
||||||
|
tbaa_label(
|
||||||
|
module.clone(),
|
||||||
|
intrinsics,
|
||||||
|
"context_field_ptr_to_imported_funcs",
|
||||||
|
func_array_ptr.as_instruction_value().unwrap(),
|
||||||
|
None,
|
||||||
|
);
|
||||||
let const_index = intrinsics.i32_ty.const_int(index.index() as u64, false);
|
let const_index = intrinsics.i32_ty.const_int(index.index() as u64, false);
|
||||||
let imported_func_ptr = unsafe {
|
let imported_func_ptr = unsafe {
|
||||||
cache_builder.build_in_bounds_gep(
|
cache_builder.build_in_bounds_gep(
|
||||||
@ -1007,6 +1131,20 @@ impl<'a> CtxType<'a> {
|
|||||||
let ctx_ptr = cache_builder
|
let ctx_ptr = cache_builder
|
||||||
.build_load(ctx_ptr_ptr, "ctx_ptr")
|
.build_load(ctx_ptr_ptr, "ctx_ptr")
|
||||||
.into_pointer_value();
|
.into_pointer_value();
|
||||||
|
tbaa_label(
|
||||||
|
module.clone(),
|
||||||
|
intrinsics,
|
||||||
|
"imported_func_ptr",
|
||||||
|
func_ptr.as_instruction_value().unwrap(),
|
||||||
|
Some(index.index() as u32),
|
||||||
|
);
|
||||||
|
tbaa_label(
|
||||||
|
module.clone(),
|
||||||
|
intrinsics,
|
||||||
|
"imported_func_ctx_ptr",
|
||||||
|
ctx_ptr.as_instruction_value().unwrap(),
|
||||||
|
Some(index.index() as u32),
|
||||||
|
);
|
||||||
|
|
||||||
ImportedFuncCache { func_ptr, ctx_ptr }
|
ImportedFuncCache { func_ptr, ctx_ptr }
|
||||||
});
|
});
|
||||||
@ -1018,6 +1156,7 @@ impl<'a> CtxType<'a> {
|
|||||||
&mut self,
|
&mut self,
|
||||||
index: usize,
|
index: usize,
|
||||||
intrinsics: &Intrinsics,
|
intrinsics: &Intrinsics,
|
||||||
|
module: Rc<RefCell<Module>>,
|
||||||
builder: &Builder,
|
builder: &Builder,
|
||||||
) -> PointerValue {
|
) -> PointerValue {
|
||||||
assert!(index < INTERNALS_SIZE);
|
assert!(index < INTERNALS_SIZE);
|
||||||
@ -1032,6 +1171,13 @@ impl<'a> CtxType<'a> {
|
|||||||
let local_internals_ptr = builder
|
let local_internals_ptr = builder
|
||||||
.build_load(local_internals_ptr_ptr, "local_internals_ptr")
|
.build_load(local_internals_ptr_ptr, "local_internals_ptr")
|
||||||
.into_pointer_value();
|
.into_pointer_value();
|
||||||
|
tbaa_label(
|
||||||
|
module.clone(),
|
||||||
|
intrinsics,
|
||||||
|
"context_field_ptr_to_internals",
|
||||||
|
local_internals_ptr_ptr.as_instruction_value().unwrap(),
|
||||||
|
None,
|
||||||
|
);
|
||||||
unsafe {
|
unsafe {
|
||||||
builder.build_in_bounds_gep(
|
builder.build_in_bounds_gep(
|
||||||
local_internals_ptr,
|
local_internals_ptr,
|
||||||
@ -1041,3 +1187,83 @@ impl<'a> CtxType<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Given an instruction that operates on memory, mark the access as not aliasing
|
||||||
|
// other memory accesses which have a different (label, index) pair.
|
||||||
|
pub fn tbaa_label(
|
||||||
|
module: Rc<RefCell<Module>>,
|
||||||
|
intrinsics: &Intrinsics,
|
||||||
|
label: &str,
|
||||||
|
instruction: InstructionValue,
|
||||||
|
index: Option<u32>,
|
||||||
|
) {
|
||||||
|
// To convey to LLVM that two pointers must be pointing to distinct memory,
|
||||||
|
// we use LLVM's Type Based Aliasing Analysis, or TBAA, to mark the memory
|
||||||
|
// operations as having different types whose pointers may not alias.
|
||||||
|
//
|
||||||
|
// See the LLVM documentation at
|
||||||
|
// https://llvm.org/docs/LangRef.html#tbaa-metadata
|
||||||
|
//
|
||||||
|
// LLVM TBAA supports many features, but we use it in a simple way, with
|
||||||
|
// only scalar types that are children of the root node. Every TBAA type we
|
||||||
|
// declare is NoAlias with the others. See NoAlias, PartialAlias,
|
||||||
|
// MayAlias and MustAlias in the LLVM documentation:
|
||||||
|
// https://llvm.org/docs/AliasAnalysis.html#must-may-and-no-alias-responses
|
||||||
|
|
||||||
|
let module = module.borrow_mut();
|
||||||
|
let context = module.get_context();
|
||||||
|
|
||||||
|
// `!wasmer_tbaa_root = {}`, the TBAA root node for wasmer.
|
||||||
|
let tbaa_root = module
|
||||||
|
.get_global_metadata("wasmer_tbaa_root")
|
||||||
|
.pop()
|
||||||
|
.unwrap_or_else(|| {
|
||||||
|
module.add_global_metadata("wasmer_tbaa_root", &MetadataValue::create_node(&[]));
|
||||||
|
module.get_global_metadata("wasmer_tbaa_root")[0]
|
||||||
|
});
|
||||||
|
|
||||||
|
// Construct (or look up) the type descriptor, for example
|
||||||
|
// `!"local 0" = !{!"local 0", !wasmer_tbaa_root}`.
|
||||||
|
let label = if let Some(idx) = index {
|
||||||
|
format!("{}{}", label, idx)
|
||||||
|
} else {
|
||||||
|
label.to_string()
|
||||||
|
};
|
||||||
|
let type_label = context.metadata_string(label.as_str());
|
||||||
|
let type_tbaa = module
|
||||||
|
.get_global_metadata(label.as_str())
|
||||||
|
.pop()
|
||||||
|
.unwrap_or_else(|| {
|
||||||
|
module.add_global_metadata(
|
||||||
|
label.as_str(),
|
||||||
|
&MetadataValue::create_node(&[type_label.into(), tbaa_root.into()]),
|
||||||
|
);
|
||||||
|
module.get_global_metadata(label.as_str())[0]
|
||||||
|
});
|
||||||
|
|
||||||
|
// Construct (or look up) the access tag, which is a struct of the form
|
||||||
|
// (base type, access type, offset).
|
||||||
|
//
|
||||||
|
// "If BaseTy is a scalar type, Offset must be 0 and BaseTy and AccessTy
|
||||||
|
// must be the same".
|
||||||
|
// -- https://llvm.org/docs/LangRef.html#tbaa-metadata
|
||||||
|
let label = label + "_memop";
|
||||||
|
let type_tbaa = module
|
||||||
|
.get_global_metadata(label.as_str())
|
||||||
|
.pop()
|
||||||
|
.unwrap_or_else(|| {
|
||||||
|
module.add_global_metadata(
|
||||||
|
label.as_str(),
|
||||||
|
&MetadataValue::create_node(&[
|
||||||
|
type_tbaa.into(),
|
||||||
|
type_tbaa.into(),
|
||||||
|
intrinsics.i64_zero.into(),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
module.get_global_metadata(label.as_str())[0]
|
||||||
|
});
|
||||||
|
|
||||||
|
// Attach the access tag to the instruction.
|
||||||
|
let tbaa_kind = context.get_kind_id("tbaa");
|
||||||
|
instruction.set_metadata(type_tbaa, tbaa_kind);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user