Browse Source

Merge pull request #2574 from fitzgen/randomize-location-of-heap-objects

wasmtime-bench-api: Randomize the locations of heap objects
pull/2579/head
Nick Fitzgerald 4 years ago
committed by GitHub
parent
commit
90b80a2d3c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      Cargo.lock
  2. 5
      crates/bench-api/Cargo.toml
  3. 8
      crates/bench-api/src/lib.rs

13
Cargo.lock

@ -1964,6 +1964,18 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
[[package]]
name = "shuffling-allocator"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "848c0a454373d16ebfaa740c99d4faebe25ea752a35e0c6e341168fe67f987f8"
dependencies = [
"cfg-if 1.0.0",
"libc",
"rand",
"winapi",
]
[[package]]
name = "smallvec"
version = "1.6.1"
@ -2430,6 +2442,7 @@ name = "wasmtime-bench-api"
version = "0.19.0"
dependencies = [
"anyhow",
"shuffling-allocator",
"wasi-common",
"wasmtime",
"wasmtime-wasi",

5
crates/bench-api/Cargo.toml

@ -16,10 +16,13 @@ crate-type = ["rlib", "cdylib"]
[dependencies]
anyhow = "1.0"
shuffling-allocator = { version = "1.1.1", optional = true }
wasmtime = { path = "../wasmtime", default-features = false }
wasmtime-wasi = { path = "../wasi" }
wasi-common = { path = "../wasi-common" }
[dev-dependencies]
wat = "1.0"
[features]
default = ["shuffling-allocator"]

8
crates/bench-api/src/lib.rs

@ -83,6 +83,14 @@ pub type ExitCode = c_int;
pub const OK: ExitCode = 0;
pub const ERR: ExitCode = -1;
// Randomize the location of heap objects to avoid accidental locality being an
// uncontrolled variable that obscures performance evaluation in our
// experiments.
#[cfg(feature = "shuffling-allocator")]
#[global_allocator]
static ALLOC: shuffling_allocator::ShufflingAllocator<std::alloc::System> =
shuffling_allocator::wrap!(&std::alloc::System);
/// Exposes a C-compatible way of creating the engine from the bytes of a single
/// Wasm module.
///

Loading…
Cancel
Save