Skip to content

Commit

Permalink
Merge pull request #2574 from fitzgen/randomize-location-of-heap-objects
Browse files Browse the repository at this point in the history
wasmtime-bench-api: Randomize the locations of heap objects
  • Loading branch information
fitzgen authored Jan 13, 2021
2 parents 47ff726 + bc6dc08 commit 90b80a2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion crates/bench-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 8 additions & 0 deletions crates/bench-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down

0 comments on commit 90b80a2

Please sign in to comment.