Skip to content

Commit b97786e

Browse files
committed
Fix: processing memory/table.grow also on non-validating runs
1 parent 047056f commit b97786e

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

crates/wasmtime/src/runtime/rr/hooks/core_hooks.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ use crate::rr::FlatBytes;
44
#[cfg(feature = "rr")]
55
use crate::rr::{
66
RREvent, RRFuncArgVals, RRFuncArgValsConvertable, ReplayError, Replayer, ResultEvent, Validate,
7-
common_events::{HostFuncEntryEvent, HostFuncReturnEvent, MemoryGrowEvent, TableGrowEvent, WasmFuncReturnEvent},
7+
common_events::{
8+
HostFuncEntryEvent, HostFuncReturnEvent, MemoryGrowEvent, TableGrowEvent,
9+
WasmFuncReturnEvent,
10+
},
811
core_events::{InstantiationEvent, WasmFuncEntryEvent},
912
};
1013
use crate::store::{InstanceId, StoreOpaque};
@@ -217,34 +220,30 @@ pub fn record_and_replay_validate_instantiation<T: 'static>(
217220

218221
/// Record and replay hook for memory.grow return value
219222
#[inline]
220-
pub fn record_and_replay_validate_memory_grow(
221-
result: u32,
222-
store: &mut StoreOpaque,
223-
) -> Result<()> {
223+
pub fn record_and_replay_validate_memory_grow(result: u32, store: &mut StoreOpaque) -> Result<()> {
224224
let _ = (result, &store);
225225
#[cfg(feature = "rr")]
226226
{
227227
store.record_event(|| MemoryGrowEvent { result })?;
228-
store.next_replay_event_validation::<MemoryGrowEvent, _, _>(|| MemoryGrowEvent {
229-
result,
230-
})?;
228+
if let Some(buf) = store.replay_buffer_mut() {
229+
buf.next_event_typed::<MemoryGrowEvent>()?
230+
.validate(&MemoryGrowEvent { result })?;
231+
}
231232
}
232233
Ok(())
233234
}
234235

235236
/// Record and replay hook for table.grow return value
236237
#[inline]
237-
pub fn record_and_replay_validate_table_grow(
238-
result: u32,
239-
store: &mut StoreOpaque,
240-
) -> Result<()> {
238+
pub fn record_and_replay_validate_table_grow(result: u32, store: &mut StoreOpaque) -> Result<()> {
241239
let _ = (result, &store);
242240
#[cfg(feature = "rr")]
243241
{
244242
store.record_event(|| TableGrowEvent { result })?;
245-
store.next_replay_event_validation::<TableGrowEvent, _, _>(|| TableGrowEvent {
246-
result,
247-
})?;
243+
if let Some(buf) = store.replay_buffer_mut() {
244+
buf.next_event_typed::<TableGrowEvent>()?
245+
.validate(&TableGrowEvent { result })?;
246+
}
248247
}
249248
Ok(())
250249
}

0 commit comments

Comments
 (0)