Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion Cargo.lock

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

3 changes: 1 addition & 2 deletions crates/wasmtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ hashbrown = { workspace = true, features = ["default-hasher"] }
bitflags = { workspace = true }
futures = { workspace = true, features = ["alloc"], optional = true }
bytes = { workspace = true, optional = true }
embedded-io = { version = "0.6.1", features = ["alloc"], optional = true }

[target.'cfg(target_os = "windows")'.dependencies.windows-sys]
workspace = true
Expand Down Expand Up @@ -428,4 +427,4 @@ debug = [
compile-time-builtins = ['dep:wasm-compose', 'dep:tempfile']

# Enable support for the common base infrastructure of record/replay
rr = ["component-model", "dep:embedded-io"]
rr = ["component-model"]
4 changes: 2 additions & 2 deletions crates/wasmtime/src/runtime/rr/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub use events::{
RRFuncArgVals, ResultEvent, Validate, common_events, component_events, core_events,
marker_events,
};
pub use io::{IOError, RecordWriter, ReplayReader};
pub use io::{RecordWriter, ReplayReader};
use serde::{Deserialize, Serialize};
use wasmtime_environ::{EntityIndex, WasmChecksum};

Expand Down Expand Up @@ -189,7 +189,7 @@ pub enum ReplayError {
FailedValidation,
IncorrectEventVariant,
InvalidEventPosition,
FailedRead(IOError),
FailedRead(anyhow::Error),
EventError(Box<dyn EventError>),
MissingComponent(WasmChecksum),
MissingModule(WasmChecksum),
Expand Down
67 changes: 36 additions & 31 deletions crates/wasmtime/src/runtime/rr/core/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,35 @@ use core::any::Any;
use postcard;
use serde::{Deserialize, Serialize};

pub type IOError = postcard::Error;

cfg_if::cfg_if! {
if #[cfg(feature = "std")] {
use std::io::{Write, Seek, Read};
/// An [`Write`] usable for recording in RR
///
/// This supports `no_std`, but must be [Send] and [Sync]
/// A writer for recording in RR.
pub trait RecordWriter: Write + Send + Sync + Any {}
impl<T: Write + Send + Sync + Any> RecordWriter for T {}

/// An [`Read`] usable for replaying in RR
/// A reader for replaying in RR.
pub trait ReplayReader: Read + Seek + Send + Sync {}
impl<T: Read + Seek + Send + Sync> ReplayReader for T {}

} else {
// `no_std` configuration
use embedded_io::{Read, Seek, Write};
use core::{convert::AsRef, iter::Extend};

/// An [`Write`] usable for recording in RR
///
/// This supports `no_std`, but must be [Send] and [Sync]
pub trait RecordWriter: Write + Send + Sync + Any {}
impl<T: Write + Send + Sync + Any> RecordWriter for T {}
/// A writer for recording in RR.
pub trait RecordWriter: Extend<u8> + Send + Sync + Any {}
impl<T: Extend<u8> + Send + Sync + Any> RecordWriter for T {}

/// An [`Read`] usable for replaying in RR
/// A reader for replaying in RR.
///
/// This supports `no_std`, but must be [Send] and [Sync]
pub trait ReplayReader: Read + Seek + Send + Sync {}
impl<T: Read + Seek + Send + Sync> ReplayReader for T {}
/// In `no_std`, types must provide explicit read/seek capabilities
/// to a underlying byte slice through these methods.
pub trait ReplayReader: AsRef<[u8]> + Send + Sync {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than AsRef<[u8]>, which I think means that the reader must materialize the rest of the trace into memory, could we have a separate fn read(&mut self, len: usize) -> &[u8] that reads len bytes and returns a slice? If EOF then the slice may be shorter than len. This would allow an implementation with a buffer fed by underlying storage on demand (e.g. from a file).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought with no_std, the point is that you don't have a file-like storage? Isn't the implication that everything is materialized in memory?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, no, the literal implication is that there isn't a standard library. The user's custom environment may very well still have storage abstractions. Consider e.g. dropping Wasmtime into a big embedded system with a custom OS, or something like that.

/// Advance the reader's internal cursor by `cnt` bytes
fn advance(&mut self, cnt: usize);
/// Seek to an absolute position `pos` in the reader
fn seek(&mut self, pos: usize);
}

}
}

Expand All @@ -44,12 +43,13 @@ where
T: Serialize + ?Sized,
W: RecordWriter,
{
cfg_if::cfg_if! {
if #[cfg(feature = "std")] {
postcard::to_io(value, writer)?;
} else {
postcard::to_eio(value, writer)?;
}
#[cfg(feature = "std")]
{
postcard::to_io(value, writer)?;
}
#[cfg(not(feature = "std"))]
{
postcard::to_extend(value, writer)?;
}
Ok(())
}
Expand All @@ -58,16 +58,21 @@ where
///
/// Currently uses `postcard` deserializer, with optional scratch
/// buffer to deserialize into
pub(super) fn from_replay_reader<'a, T, R>(reader: R, scratch: &'a mut [u8]) -> Result<T, IOError>
pub(super) fn from_replay_reader<'a, T, R>(reader: &'a mut R, scratch: &'a mut [u8]) -> Result<T>
where
T: Deserialize<'a>,
R: ReplayReader + 'a,
R: ReplayReader,
{
cfg_if::cfg_if! {
if #[cfg(feature = "std")] {
Ok(postcard::from_io((reader, scratch))?.0)
} else {
Ok(postcard::from_eio((reader, scratch))?.0)
}
#[cfg(feature = "std")]
{
Ok(postcard::from_io((reader, scratch))?.0)
}
#[cfg(not(feature = "std"))]
{
let bytes = reader.as_ref();
let original_len = bytes.len();
let (value, new) = postcard::take_from_bytes(bytes)?;
reader.advance(new.len() - original_len);
Ok(value)
}
}
Loading