Skip to content

Commit

Permalink
Merge with upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
dhil committed Dec 5, 2023
2 parents 95aa433 + 11586fb commit 5c44520
Show file tree
Hide file tree
Showing 84 changed files with 1,689 additions and 987 deletions.
114 changes: 57 additions & 57 deletions Cargo.lock

Large diffs are not rendered by default.

98 changes: 49 additions & 49 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ rustix = { workspace = true, features = ["mm", "param"] }

[dev-dependencies]
# depend again on wasmtime to activate its default features for tests
wasmtime = { workspace = true, features = ['component-model', 'async', 'default', 'winch'] }
wasmtime = { workspace = true, features = ['component-model', 'async', 'default', 'winch', 'debug-builtins'] }
env_logger = { workspace = true }
log = { workspace = true }
filecheck = { workspace = true }
Expand Down Expand Up @@ -130,7 +130,7 @@ exclude = [
]

[workspace.package]
version = "16.0.0"
version = "17.0.0"
authors = ["The Wasmtime Project Developers"]
edition = "2021"
# Wasmtime's current policy is that this number can be no larger than the
Expand All @@ -152,61 +152,61 @@ all = 'allow'

[workspace.dependencies]
arbitrary = { version = "1.3.1" }
wasmtime-wmemcheck = { path = "crates/wmemcheck", version = "=16.0.0" }
wasmtime = { path = "crates/wasmtime", version = "16.0.0", default-features = false }
wasmtime-cache = { path = "crates/cache", version = "=16.0.0" }
wasmtime-cli-flags = { path = "crates/cli-flags", version = "=16.0.0" }
wasmtime-continuations = { path = "crates/continuations", version = "=16.0.0" }
wasmtime-cranelift = { path = "crates/cranelift", version = "=16.0.0" }
wasmtime-cranelift-shared = { path = "crates/cranelift-shared", version = "=16.0.0" }
wasmtime-winch = { path = "crates/winch", version = "=16.0.0" }
wasmtime-environ = { path = "crates/environ", version = "=16.0.0" }
wasmtime-explorer = { path = "crates/explorer", version = "=16.0.0" }
wasmtime-fiber = { path = "crates/fiber", version = "=16.0.0" }
wasmtime-fibre = { path = "crates/fibre", version = "=16.0.0" }
wasmtime-types = { path = "crates/types", version = "16.0.0" }
wasmtime-jit = { path = "crates/jit", version = "=16.0.0" }
wasmtime-jit-debug = { path = "crates/jit-debug", version = "=16.0.0" }
wasmtime-runtime = { path = "crates/runtime", version = "=16.0.0" }
wasmtime-wast = { path = "crates/wast", version = "=16.0.0" }
wasmtime-wasi = { path = "crates/wasi", version = "16.0.0", default-features = false }
wasmtime-wasi-http = { path = "crates/wasi-http", version = "=16.0.0", default-features = false }
wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "16.0.0" }
wasmtime-wasi-threads = { path = "crates/wasi-threads", version = "16.0.0" }
wasmtime-component-util = { path = "crates/component-util", version = "=16.0.0" }
wasmtime-component-macro = { path = "crates/component-macro", version = "=16.0.0" }
wasmtime-asm-macros = { path = "crates/asm-macros", version = "=16.0.0" }
wasmtime-versioned-export-macros = { path = "crates/versioned-export-macros", version = "=16.0.0" }
wasmtime-wmemcheck = { path = "crates/wmemcheck", version = "=17.0.0" }
wasmtime = { path = "crates/wasmtime", version = "17.0.0", default-features = false }
wasmtime-cache = { path = "crates/cache", version = "=17.0.0" }
wasmtime-cli-flags = { path = "crates/cli-flags", version = "=17.0.0" }
wasmtime-cranelift = { path = "crates/cranelift", version = "=17.0.0" }
wasmtime-cranelift-shared = { path = "crates/cranelift-shared", version = "=17.0.0" }
wasmtime-continuations = { path = "crates/continuations", version = "=17.0.0" }
wasmtime-winch = { path = "crates/winch", version = "=17.0.0" }
wasmtime-environ = { path = "crates/environ", version = "=17.0.0" }
wasmtime-explorer = { path = "crates/explorer", version = "=17.0.0" }
wasmtime-fiber = { path = "crates/fiber", version = "=17.0.0" }
wasmtime-fibre = { path = "crates/fibre", version = "=17.0.0" }
wasmtime-types = { path = "crates/types", version = "17.0.0" }
wasmtime-jit = { path = "crates/jit", version = "=17.0.0" }
wasmtime-jit-debug = { path = "crates/jit-debug", version = "=17.0.0" }
wasmtime-runtime = { path = "crates/runtime", version = "=17.0.0" }
wasmtime-wast = { path = "crates/wast", version = "=17.0.0" }
wasmtime-wasi = { path = "crates/wasi", version = "17.0.0", default-features = false }
wasmtime-wasi-http = { path = "crates/wasi-http", version = "=17.0.0", default-features = false }
wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "17.0.0" }
wasmtime-wasi-threads = { path = "crates/wasi-threads", version = "17.0.0" }
wasmtime-component-util = { path = "crates/component-util", version = "=17.0.0" }
wasmtime-component-macro = { path = "crates/component-macro", version = "=17.0.0" }
wasmtime-asm-macros = { path = "crates/asm-macros", version = "=17.0.0" }
wasmtime-versioned-export-macros = { path = "crates/versioned-export-macros", version = "=17.0.0" }
component-test-util = { path = "crates/misc/component-test-util" }
component-fuzz-util = { path = "crates/misc/component-fuzz-util" }
wiggle = { path = "crates/wiggle", version = "=16.0.0", default-features = false }
wiggle-macro = { path = "crates/wiggle/macro", version = "=16.0.0" }
wiggle-generate = { path = "crates/wiggle/generate", version = "=16.0.0" }
wasi-common = { path = "crates/wasi-common", version = "=16.0.0" }
wasi-tokio = { path = "crates/wasi-common/tokio", version = "=16.0.0" }
wasi-cap-std-sync = { path = "crates/wasi-common/cap-std-sync", version = "=16.0.0" }
wiggle = { path = "crates/wiggle", version = "=17.0.0", default-features = false }
wiggle-macro = { path = "crates/wiggle/macro", version = "=17.0.0" }
wiggle-generate = { path = "crates/wiggle/generate", version = "=17.0.0" }
wasi-common = { path = "crates/wasi-common", version = "=17.0.0" }
wasi-tokio = { path = "crates/wasi-common/tokio", version = "=17.0.0" }
wasi-cap-std-sync = { path = "crates/wasi-common/cap-std-sync", version = "=17.0.0" }
wasmtime-fuzzing = { path = "crates/fuzzing" }
wasmtime-jit-icache-coherence = { path = "crates/jit-icache-coherence", version = "=16.0.0" }
wasmtime-wit-bindgen = { path = "crates/wit-bindgen", version = "=16.0.0" }
wasmtime-jit-icache-coherence = { path = "crates/jit-icache-coherence", version = "=17.0.0" }
wasmtime-wit-bindgen = { path = "crates/wit-bindgen", version = "=17.0.0" }
test-programs-artifacts = { path = 'crates/test-programs/artifacts' }

cranelift-wasm = { path = "cranelift/wasm", version = "0.103.0" }
cranelift-codegen = { path = "cranelift/codegen", version = "0.103.0", default-features = false, features = ["std", "unwind"] }
cranelift-frontend = { path = "cranelift/frontend", version = "0.103.0" }
cranelift-entity = { path = "cranelift/entity", version = "0.103.0" }
cranelift-native = { path = "cranelift/native", version = "0.103.0" }
cranelift-module = { path = "cranelift/module", version = "0.103.0" }
cranelift-interpreter = { path = "cranelift/interpreter", version = "0.103.0" }
cranelift-reader = { path = "cranelift/reader", version = "0.103.0" }
cranelift-wasm = { path = "cranelift/wasm", version = "0.104.0" }
cranelift-codegen = { path = "cranelift/codegen", version = "0.104.0", default-features = false, features = ["std", "unwind"] }
cranelift-frontend = { path = "cranelift/frontend", version = "0.104.0" }
cranelift-entity = { path = "cranelift/entity", version = "0.104.0" }
cranelift-native = { path = "cranelift/native", version = "0.104.0" }
cranelift-module = { path = "cranelift/module", version = "0.104.0" }
cranelift-interpreter = { path = "cranelift/interpreter", version = "0.104.0" }
cranelift-reader = { path = "cranelift/reader", version = "0.104.0" }
cranelift-filetests = { path = "cranelift/filetests" }
cranelift-object = { path = "cranelift/object", version = "0.103.0" }
cranelift-jit = { path = "cranelift/jit", version = "0.103.0" }
cranelift-object = { path = "cranelift/object", version = "0.104.0" }
cranelift-jit = { path = "cranelift/jit", version = "0.104.0" }
cranelift-fuzzgen = { path = "cranelift/fuzzgen" }
cranelift-bforest = { path = "cranelift/bforest", version = "0.103.0" }
cranelift-control = { path = "cranelift/control", version = "0.103.0" }
cranelift = { path = "cranelift/umbrella", version = "0.103.0" }
cranelift-bforest = { path = "cranelift/bforest", version = "0.104.0" }
cranelift-control = { path = "cranelift/control", version = "0.104.0" }
cranelift = { path = "cranelift/umbrella", version = "0.104.0" }

winch-codegen = { path = "winch/codegen", version = "=0.14.0" }
winch-codegen = { path = "winch/codegen", version = "=0.15.0" }
winch-filetests = { path = "winch/filetests" }
winch-test-macros = { path = "winch/test-macros" }

Expand Down
10 changes: 10 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
--------------------------------------------------------------------------------

## 17.0.0

Unreleased.

### Added

### Changed

--------------------------------------------------------------------------------

## 16.0.0

Unreleased.
Expand Down
2 changes: 1 addition & 1 deletion cranelift/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ harness = false

[dependencies]
cfg-if = { workspace = true }
cranelift-codegen = { workspace = true, features = ["disas", "trace-log"] }
cranelift-codegen = { workspace = true, features = ["disas", "trace-log", "timing"] }
cranelift-entity = { workspace = true }
cranelift-interpreter = { workspace = true }
cranelift-reader = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion cranelift/bforest/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["The Cranelift Project Developers"]
name = "cranelift-bforest"
version = "0.103.0"
version = "0.104.0"
description = "A forest of B+-trees"
license = "Apache-2.0 WITH LLVM-exception"
documentation = "https://docs.rs/cranelift-bforest"
Expand Down
15 changes: 10 additions & 5 deletions cranelift/codegen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["The Cranelift Project Developers"]
name = "cranelift-codegen"
version = "0.103.0"
version = "0.104.0"
description = "Low-level code generator library"
license = "Apache-2.0 WITH LLVM-exception"
documentation = "https://docs.rs/cranelift-codegen"
Expand All @@ -19,7 +19,7 @@ workspace = true
anyhow = { workspace = true, optional = true }
bumpalo = "3"
capstone = { workspace = true, optional = true }
cranelift-codegen-shared = { path = "./shared", version = "0.103.0" }
cranelift-codegen-shared = { path = "./shared", version = "0.104.0" }
cranelift-entity = { workspace = true }
cranelift-bforest = { workspace = true }
cranelift-control = { workspace = true }
Expand All @@ -44,11 +44,11 @@ criterion = { version = "0.5.0", features = ["html_reports"] }
similar = "2.1.0"

[build-dependencies]
cranelift-codegen-meta = { path = "meta", version = "0.103.0" }
cranelift-isle = { path = "../isle/isle", version = "=0.103.0" }
cranelift-codegen-meta = { path = "meta", version = "0.104.0" }
cranelift-isle = { path = "../isle/isle", version = "=0.104.0" }

[features]
default = ["std", "unwind", "host-arch"]
default = ["std", "unwind", "host-arch", "timing"]

# The "std" feature enables use of libstd. The "core" feature enables use
# of some minimal std-like replacement libraries. At least one of these two
Expand Down Expand Up @@ -114,6 +114,11 @@ isle-errors = ["cranelift-isle/fancy-errors"]
# inspection, rather than inside of target/.
isle-in-source-tree = []

# Enable tracking how long passes take in Cranelift.
#
# Enabled by default.
timing = []

[[bench]]
name = "x64-evex-encoding"
harness = false
4 changes: 2 additions & 2 deletions cranelift/codegen/meta/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "cranelift-codegen-meta"
authors = ["The Cranelift Project Developers"]
version = "0.103.0"
version = "0.104.0"
description = "Metaprogram for cranelift-codegen code generator library"
license = "Apache-2.0 WITH LLVM-exception"
repository = "https://github.com/bytecodealliance/wasmtime"
Expand All @@ -15,4 +15,4 @@ workspace = true
rustdoc-args = [ "--document-private-items" ]

[dependencies]
cranelift-codegen-shared = { path = "../shared", version = "0.103.0" }
cranelift-codegen-shared = { path = "../shared", version = "0.104.0" }
2 changes: 1 addition & 1 deletion cranelift/codegen/shared/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["The Cranelift Project Developers"]
name = "cranelift-codegen-shared"
version = "0.103.0"
version = "0.104.0"
description = "For code shared between cranelift-codegen-meta and cranelift-codegen"
license = "Apache-2.0 WITH LLVM-exception"
repository = "https://github.com/bytecodealliance/wasmtime"
Expand Down
122 changes: 74 additions & 48 deletions cranelift/codegen/src/timing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
use core::fmt;
use std::any::Any;
use std::boxed::Box;
use std::cell::{Cell, RefCell};
use std::cell::RefCell;
use std::mem;
use std::time::{Duration, Instant};
use std::time::Duration;

// Each pass that can be timed is predefined with the `define_passes!` macro. Each pass has a
// snake_case name and a plain text description used when printing out the timing report.
Expand Down Expand Up @@ -130,22 +130,6 @@ fn start_pass(pass: Pass) -> Box<dyn Any> {
PROFILER.with(|profiler| profiler.borrow().start_pass(pass))
}

/// A timing token is responsible for timing the currently running pass. Timing starts when it
/// is created and ends when it is dropped.
///
/// Multiple passes can be active at the same time, but they must be started and stopped in a
/// LIFO fashion.
struct DefaultTimingToken {
/// Start time for this pass.
start: Instant,

// Pass being timed by this token.
pass: Pass,

// The previously active pass which will be restored when this token is dropped.
prev: Pass,
}

/// Accumulated timing information for a single pass.
#[derive(Default, Copy, Clone)]
struct PassTime {
Expand Down Expand Up @@ -215,49 +199,91 @@ impl fmt::Display for PassTimes {

// Information about passes in a single thread.
thread_local! {
static CURRENT_PASS: Cell<Pass> = const { Cell::new(Pass::None) };
static PASS_TIME: RefCell<PassTimes> = RefCell::new(Default::default());
}

/// The default profiler. You can get the results using [`take_current`].
pub struct DefaultProfiler;

impl Profiler for DefaultProfiler {
fn start_pass(&self, pass: Pass) -> Box<dyn Any> {
let prev = CURRENT_PASS.with(|p| p.replace(pass));
log::debug!("timing: Starting {}, (during {})", pass, prev);
Box::new(DefaultTimingToken {
start: Instant::now(),
pass,
prev,
})
}
}

/// Dropping a timing token indicated the end of the pass.
impl Drop for DefaultTimingToken {
fn drop(&mut self) {
let duration = self.start.elapsed();
log::debug!("timing: Ending {}: {}ms", self.pass, duration.as_millis());
let old_cur = CURRENT_PASS.with(|p| p.replace(self.prev));
debug_assert_eq!(self.pass, old_cur, "Timing tokens dropped out of order");
PASS_TIME.with(|rc| {
let mut table = rc.borrow_mut();
table.pass[self.pass.idx()].total += duration;
if let Some(parent) = table.pass.get_mut(self.prev.idx()) {
parent.child += duration;
}
})
}
}

/// Take the current accumulated pass timings and reset the timings for the current thread.
///
/// Only applies when [`DefaultProfiler`] is used.
pub fn take_current() -> PassTimes {
PASS_TIME.with(|rc| mem::take(&mut *rc.borrow_mut()))
}

#[cfg(feature = "timing")]
mod enabled {
use super::{DefaultProfiler, Pass, Profiler, PASS_TIME};
use std::any::Any;
use std::boxed::Box;
use std::cell::Cell;
use std::time::Instant;

// Information about passes in a single thread.
thread_local! {
static CURRENT_PASS: Cell<Pass> = const { Cell::new(Pass::None) };
}

impl Profiler for DefaultProfiler {
fn start_pass(&self, pass: Pass) -> Box<dyn Any> {
let prev = CURRENT_PASS.with(|p| p.replace(pass));
log::debug!("timing: Starting {}, (during {})", pass, prev);
Box::new(DefaultTimingToken {
start: Instant::now(),
pass,
prev,
})
}
}

/// A timing token is responsible for timing the currently running pass. Timing starts when it
/// is created and ends when it is dropped.
///
/// Multiple passes can be active at the same time, but they must be started and stopped in a
/// LIFO fashion.
struct DefaultTimingToken {
/// Start time for this pass.
start: Instant,

// Pass being timed by this token.
pass: Pass,

// The previously active pass which will be restored when this token is dropped.
prev: Pass,
}

/// Dropping a timing token indicated the end of the pass.
impl Drop for DefaultTimingToken {
fn drop(&mut self) {
let duration = self.start.elapsed();
log::debug!("timing: Ending {}: {}ms", self.pass, duration.as_millis());
let old_cur = CURRENT_PASS.with(|p| p.replace(self.prev));
debug_assert_eq!(self.pass, old_cur, "Timing tokens dropped out of order");
PASS_TIME.with(|rc| {
let mut table = rc.borrow_mut();
table.pass[self.pass.idx()].total += duration;
if let Some(parent) = table.pass.get_mut(self.prev.idx()) {
parent.child += duration;
}
})
}
}
}

#[cfg(not(feature = "timing"))]
mod disabled {
use super::{DefaultProfiler, Pass, Profiler};
use std::any::Any;
use std::boxed::Box;

impl Profiler for DefaultProfiler {
fn start_pass(&self, _pass: Pass) -> Box<dyn Any> {
Box::new(())
}
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
2 changes: 1 addition & 1 deletion cranelift/control/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["The Cranelift Project Developers"]
name = "cranelift-control"
version = "0.103.0"
version = "0.104.0"
description = "White-box fuzz testing framework"
license = "Apache-2.0 WITH LLVM-exception"
repository = "https://github.com/bytecodealliance/wasmtime"
Expand Down
Loading

0 comments on commit 5c44520

Please sign in to comment.