Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
afd4369
Publish dev artifacts from CI
alexcrichton Aug 6, 2025
0c00fd8
Merge pull request #2 from alexcrichton/publish-dev-binaries
alexcrichton Aug 6, 2025
c106978
Test out the merge queue
alexcrichton Aug 6, 2025
140afbf
Merge pull request #3 from alexcrichton/publish-dev-binaries
alexcrichton Aug 6, 2025
71291fe
Squashed RR rebase changes commit with CI support
arjunr2 Jun 4, 2025
e44086b
Merge pull request #4 from bytecodealliance/rr-merge
arjunr2 Aug 8, 2025
808d221
Add a sink support in path for recording benchmarking
arjunr2 Aug 12, 2025
d53de4d
Add builtin record/replay events
arjunr2 Aug 18, 2025
1e9f725
Add support for no-return builtins
arjunr2 Aug 18, 2025
78a9553
[FIX] Missing lower_store record for call host dynamic + Decouple rr …
arjunr2 Sep 2, 2025
5d4940e
Factor out common events between core and component wasm
arjunr2 Sep 3, 2025
0f4d0b4
Switch validation of host functions to use type index
arjunr2 Sep 23, 2025
997406d
Support wasm function call/return for RR (component; typed)
arjunr2 Sep 26, 2025
4a42d21
Added component signature for wasm func call recording
arjunr2 Oct 2, 2025
cb8e0fc
Revamped public API for record; replay still broken
arjunr2 Oct 3, 2025
ebd1b38
Fix: host func return rr placement for call_host_dynamic
arjunr2 Oct 4, 2025
d6adc43
Support new recording API on CLI
arjunr2 Oct 5, 2025
3ba9849
Reorganize RR module with hooks
arjunr2 Oct 5, 2025
bc16bc7
Temporary patch: Replay API in-store; separate into independent drive…
arjunr2 Oct 28, 2025
1606da1
Added flat abi extraction for interface types
arjunr2 Oct 30, 2025
728769d
Added flat type encoding/decoding for events; reformatted validation …
arjunr2 Nov 2, 2025
ccf7d4e
Refactor event errors into trait object
arjunr2 Nov 3, 2025
742436d
Fix flat storage computation case limit; change debugs for builtin ev…
arjunr2 Nov 3, 2025
a69d77e
Optimize fast path for recording by avoiding flat type computation
arjunr2 Nov 3, 2025
1b94378
Fix: Lowering logic rr for overflow of MAX_FLAT_PARAMS
arjunr2 Nov 6, 2025
b15ae6d
Fix: Bug in flat storage variant computation
arjunr2 Nov 7, 2025
952627a
Initial factoring out of replay driver
arjunr2 Nov 11, 2025
c4645ab
Added temporary CLI support (without async)
arjunr2 Nov 11, 2025
ffe22ff
Added support for recording all boundaries of `Func` and `TypedFunc`;…
arjunr2 Nov 13, 2025
99763bb
Clean up of `ReplayError` messages
arjunr2 Nov 13, 2025
54df80b
Add doc example for replay driver
arjunr2 Nov 13, 2025
a5e936c
Rename and condense events for clarity
arjunr2 Nov 13, 2025
d6892f3
Convert all flat type construction to zero-copy iterators
arjunr2 Nov 14, 2025
3fed3d9
Host function record/replay hooks split up
arjunr2 Nov 14, 2025
5258425
Move event errors to respective usage
arjunr2 Nov 14, 2025
79da1aa
Fix: Unsaved file
arjunr2 Nov 14, 2025
41af9bb
Support async for RR
arjunr2 Nov 14, 2025
573e308
Supported run CLI with async
arjunr2 Nov 14, 2025
2e4b712
Remove module checksums on wasm function begin events; only rely on i…
arjunr2 Nov 14, 2025
c89684e
Remove `rr-validate` feature given minimal performance improvements
arjunr2 Nov 14, 2025
796c1ed
Added tests for rr; reduce func size with packed option; commonize ho…
arjunr2 Nov 17, 2025
578c8b8
Merge remote-tracking branch 'upstream/main' into rr-dev
arjunr2 Nov 19, 2025
b9f2652
Fix warnings for CI
arjunr2 Nov 19, 2025
b727256
Fix missing exit call during merge
arjunr2 Nov 19, 2025
89c915f
Fix: shortcut error return for wasm func rr interposition
arjunr2 Nov 19, 2025
a9ff000
Fix doctest and add writer extraction
arjunr2 Nov 19, 2025
18da308
Fix: replay on host functions skipping lift
arjunr2 Nov 19, 2025
875a4b1
Add support for concurrent call recording
arjunr2 Nov 20, 2025
4b32230
Fix warnings and replace call_unchecked_raw to use RR arg
arjunr2 Nov 20, 2025
5d85d48
Added post return event to rr
arjunr2 Nov 24, 2025
6fc37bd
Fix: warnings for replay driver
arjunr2 Nov 24, 2025
5d710ef
Add tests for all of rr; fix post-return not recording on async
arjunr2 Nov 24, 2025
df6d920
Remove explicit `rr-component` feature flag
arjunr2 Nov 25, 2025
ae0905d
Resolve straightforward comments
arjunr2 Nov 25, 2025
192cfd4
Fold component-model feature into rr
arjunr2 Nov 26, 2025
522bb60
Add support for core re-entrancy + test
arjunr2 Nov 28, 2025
a6c9708
Refactor rr configuration for commands
arjunr2 Nov 28, 2025
7f3561e
Fix config settings and assertions
arjunr2 Nov 29, 2025
491a368
Refactor host function rr into separate replay/normal flows
arjunr2 Nov 29, 2025
fd09d72
Add safety contract for uninit valraw byte conversion
arjunr2 Nov 29, 2025
01ce52f
Fixed validation of instantiation before start fn; add component buil…
arjunr2 Dec 1, 2025
d8ad8a6
Split replay/normal runs for invoke host
arjunr2 Dec 1, 2025
ec990da
Remove embedded-io dependency for no_std rr
arjunr2 Dec 1, 2025
0e3d350
Fix warning
arjunr2 Dec 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/publish-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ jobs:
publish:
name: Publish artifacts of build
runs-on: ubuntu-latest
if: github.repository == 'bytecodealliance/wasmtime'
if: github.repository == 'bytecodealliance/wasmtime' || github.repository == 'bytecodealliance/wasmtime-rr-prototyping'

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/fetch-run-id
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ tokio-util = "0.7.16"
arbtest = "0.3.2"
rayon = "1.5.3"
regex = "1.9.1"
sha2 = { version = "0.10.2", default-features = false }

# =============================================================================
#
Expand Down Expand Up @@ -508,6 +509,7 @@ component-model-async = [
"wasmtime-wasi-http?/p3",
"dep:futures",
]
rr = ["wasmtime/rr", "component-model", "wasmtime-cli-flags/rr", "run"]

# This feature, when enabled, will statically compile out all logging statements
# throughout Wasmtime and its dependencies.
Expand Down
6 changes: 5 additions & 1 deletion crates/c-api/include/wasmtime/extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ typedef struct wasmtime_func {
/// this field is otherwise never zero.
uint64_t store_id;
/// Private field for Wasmtime, undefined if `store_id` is zero.
void *__private;
void *__private1;
/// Private field for Wasmtime
uint32_t __private2;
/// Private field for Wasmtime
uint32_t __private3;
} wasmtime_func_t;

/// \brief Representation of a table in Wasmtime.
Expand Down
1 change: 1 addition & 0 deletions crates/cli-flags/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ memory-protection-keys = ["wasmtime/memory-protection-keys"]
pulley = ["wasmtime/pulley"]
stack-switching = ["wasmtime/stack-switching"]
debug = ["wasmtime/debug"]
rr = ["wasmtime/rr", "component-model"]
61 changes: 61 additions & 0 deletions crates/cli-flags/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,25 @@ wasmtime_option_group! {
}
}

wasmtime_option_group! {
#[derive(PartialEq, Clone, Deserialize)]
#[serde(rename_all = "kebab-case", deny_unknown_fields)]
pub struct RecordOptions {
/// Filename for the recorded execution trace (or empty string to skip writing a file).
pub path: Option<String>,
/// Include (optional) signatures to facilitate validation checks during replay
/// (see `wasmtime replay` for details).
pub validation_metadata: Option<bool>,
/// Window size of internal buffering for record events (large windows offer more opportunities
/// for coalescing events at the cost of memory usage).
pub event_window_size: Option<usize>,
}

enum Record {
...
}
}

#[derive(Debug, Clone, PartialEq)]
pub struct WasiNnGraph {
pub format: String,
Expand Down Expand Up @@ -547,6 +566,18 @@ pub struct CommonOptions {
#[serde(skip)]
wasi_raw: Vec<opt::CommaSeparated<Wasi>>,

/// Options to enable and configure execution recording, `-R help` to see all.
///
/// Generates a serialized trace of the Wasm module execution that captures all
/// non-determinism observable by the module. This trace can subsequently be
/// re-executed in a determinstic, embedding-agnostic manner (see the `wasmtime replay` command).
///
/// Note: Minimal configuration options for deterministic Wasm semantics will be
/// enforced during recording by default (NaN canonicalization, deterministic relaxed SIMD).
#[arg(short = 'R', long = "record", value_name = "KEY[=VAL[,..]]")]
#[serde(skip)]
record_raw: Vec<opt::CommaSeparated<Record>>,

// These fields are filled in by the `configure` method below via the
// options parsed from the CLI above. This is what the CLI should use.
#[arg(skip)]
Expand All @@ -573,6 +604,10 @@ pub struct CommonOptions {
#[serde(rename = "wasi", default)]
pub wasi: WasiOptions,

#[arg(skip)]
#[serde(rename = "record", default)]
pub record: RecordOptions,

/// The target triple; default is the host triple
#[arg(long, value_name = "TARGET")]
#[serde(skip)]
Expand Down Expand Up @@ -619,12 +654,14 @@ impl CommonOptions {
debug_raw: Vec::new(),
wasm_raw: Vec::new(),
wasi_raw: Vec::new(),
record_raw: Vec::new(),
configured: true,
opts: Default::default(),
codegen: Default::default(),
debug: Default::default(),
wasm: Default::default(),
wasi: Default::default(),
record: Default::default(),
target: None,
config: None,
}
Expand All @@ -642,12 +679,14 @@ impl CommonOptions {
self.debug = toml_options.debug;
self.wasm = toml_options.wasm;
self.wasi = toml_options.wasi;
self.record = toml_options.record;
}
self.opts.configure_with(&self.opts_raw);
self.codegen.configure_with(&self.codegen_raw);
self.debug.configure_with(&self.debug_raw);
self.wasm.configure_with(&self.wasm_raw);
self.wasi.configure_with(&self.wasi_raw);
self.record.configure_with(&self.record_raw);
Ok(())
}

Expand Down Expand Up @@ -1004,6 +1043,15 @@ impl CommonOptions {
config.gc_support(enable);
}

let record = &self.record;
match_feature! {
["rr" : &record.path]
_path => {
config.rr(wasmtime::RRConfig::Recording);
},
_ => err,
}

Ok(config)
}

Expand Down Expand Up @@ -1113,6 +1161,7 @@ mod tests {
[debug]
[wasm]
[wasi]
[record]
"#;
let mut common_options: CommonOptions = toml::from_str(basic_toml).unwrap();
common_options.config(None).unwrap();
Expand Down Expand Up @@ -1235,6 +1284,8 @@ impl fmt::Display for CommonOptions {
wasm,
wasi_raw,
wasi,
record_raw,
record,
configured,
target,
config,
Expand All @@ -1251,13 +1302,15 @@ impl fmt::Display for CommonOptions {
let wasi_flags;
let wasm_flags;
let debug_flags;
let record_flags;

if *configured {
codegen_flags = codegen.to_options();
debug_flags = debug.to_options();
wasi_flags = wasi.to_options();
wasm_flags = wasm.to_options();
opts_flags = opts.to_options();
record_flags = record.to_options();
} else {
codegen_flags = codegen_raw
.iter()
Expand All @@ -1268,6 +1321,11 @@ impl fmt::Display for CommonOptions {
wasi_flags = wasi_raw.iter().flat_map(|t| t.0.iter()).cloned().collect();
wasm_flags = wasm_raw.iter().flat_map(|t| t.0.iter()).cloned().collect();
opts_flags = opts_raw.iter().flat_map(|t| t.0.iter()).cloned().collect();
record_flags = record_raw
.iter()
.flat_map(|t| t.0.iter())
.cloned()
.collect();
}

for flag in codegen_flags {
Expand All @@ -1285,6 +1343,9 @@ impl fmt::Display for CommonOptions {
for flag in debug_flags {
write!(f, "-D{flag} ")?;
}
for flag in record_flags {
write!(f, "-R{flag} ")?;
}

Ok(())
}
Expand Down
1 change: 1 addition & 0 deletions crates/environ/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ wasmprinter = { workspace = true, optional = true }
wasmtime-component-util = { workspace = true, optional = true }
semver = { workspace = true, optional = true, features = ['serde'] }
smallvec = { workspace = true, features = ['serde'] }
sha2 = { workspace = true }

[dev-dependencies]
clap = { workspace = true, features = ['default'] }
Expand Down
3 changes: 3 additions & 0 deletions crates/environ/src/compile/module_artifacts.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Definitions of runtime structures and metadata which are serialized into ELF
//! with `postcard` as part of a module's compilation process.

use crate::WasmChecksum;
use crate::prelude::*;
use crate::{
CompiledModuleInfo, DebugInfoData, FunctionName, MemoryInitialization, Metadata,
Expand Down Expand Up @@ -118,6 +119,7 @@ impl<'a> ObjectBuilder<'a> {
debuginfo,
has_unparsed_debuginfo,
data,
wasm,
data_align,
passive_data,
..
Expand Down Expand Up @@ -220,6 +222,7 @@ impl<'a> ObjectBuilder<'a> {
has_wasm_debuginfo: self.tunables.parse_wasm_debuginfo,
dwarf,
},
checksum: WasmChecksum::from_binary(wasm),
})
}

Expand Down
47 changes: 47 additions & 0 deletions crates/environ/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,69 @@ pub use self::types_builder::*;

/// Helper macro, like `foreach_transcoder`, to iterate over builtins for
/// components unrelated to transcoding.
///
/// Note: RR is not supported for component model async builtins yet; enabling
/// both will currently throw a compile error.
#[macro_export]
macro_rules! foreach_builtin_component_function {
($mac:ident) => {
$mac! {
#[rr_builtin(
variant = ResourceNew32,
entry = ResourceNew32EntryEvent,
exit = ResourceNew32ReturnEvent,
success_ty = u32
)]
resource_new32(vmctx: vmctx, caller_instance: u32, resource: u32, rep: u32) -> u64;

#[rr_builtin(
variant = ResourceRep32,
entry = ResourceRep32EntryEvent,
exit = ResourceRep32ReturnEvent,
success_ty = u32
)]
resource_rep32(vmctx: vmctx, caller_instance: u32, resource: u32, idx: u32) -> u64;

// Returns an `Option<u32>` where `None` is "no destructor needed"
// and `Some(val)` is "run the destructor on this rep". The option
// is encoded as a 64-bit integer where the low bit is Some/None
// and bits 1-33 are the payload.
#[rr_builtin(
variant = ResourceDrop,
entry = ResourceDropEntryEvent,
exit = ResourceDropReturnEvent,
success_ty = ResourceDropRet
)]
resource_drop(vmctx: vmctx, caller_instance: u32, resource: u32, idx: u32) -> u64;

#[rr_builtin(
variant = ResourceTransferOwn,
entry = ResourceTransferOwnEntryEvent,
exit = ResourceTransferOwnReturnEvent,
success_ty = u32
)]
resource_transfer_own(vmctx: vmctx, src_idx: u32, src_table: u32, dst_table: u32) -> u64;

#[rr_builtin(
variant = ResourceTransferBorrow,
entry = ResourceTransferBorrowEntryEvent,
exit = ResourceTransferBorrowReturnEvent,
success_ty = u32
)]
resource_transfer_borrow(vmctx: vmctx, src_idx: u32, src_table: u32, dst_table: u32) -> u64;

#[rr_builtin(
variant = ResourceEnterCall,
entry = ResourceEnterCallEntryEvent
)]
resource_enter_call(vmctx: vmctx);

#[rr_builtin(
variant = ResourceExitCall,
entry = ResourceExitCallEntryEvent,
exit = ResourceExitCallReturnEvent,
success_ty = ()
)]
resource_exit_call(vmctx: vmctx) -> bool;

#[cfg(feature = "component-model-async")]
Expand Down
4 changes: 3 additions & 1 deletion crates/environ/src/component/artifacts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! which are serialized with `bincode` into output ELF files.

use crate::{
CompiledFunctionsTable, CompiledModuleInfo, PrimaryMap, StaticModuleIndex,
CompiledFunctionsTable, CompiledModuleInfo, PrimaryMap, StaticModuleIndex, WasmChecksum,
component::{Component, ComponentTypes, TypeComponentIndex},
};
use serde_derive::{Deserialize, Serialize};
Expand All @@ -20,6 +20,8 @@ pub struct ComponentArtifacts {
pub types: ComponentTypes,
/// Serialized metadata about all included core wasm modules.
pub static_modules: PrimaryMap<StaticModuleIndex, CompiledModuleInfo>,
/// A checksum of the source Wasm binary from which the component was compiled.
pub checksum: WasmChecksum,
}

/// Runtime state that a component retains to support its operation.
Expand Down
Loading