Skip to content

Commit

Permalink
threads: use hex addresses in log messages (bytecodealliance#7241)
Browse files Browse the repository at this point in the history
In bytecodealliance#7220, we began logging the arguments of WebAssembly `wait` and
`notify` as these instructions are executed. This change prints the
addresses using hexadecimal, which is simply more convenient when
dealing with addressing.
  • Loading branch information
abrown authored Oct 14, 2023
1 parent f952ff2 commit f7f22f0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/runtime/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ impl SharedMemory {
/// Implementation of `memory.atomic.notify` for this shared memory.
pub fn atomic_notify(&self, addr_index: u64, count: u32) -> Result<u32, Trap> {
validate_atomic_addr(&self.0.def.0, addr_index, 4, 4)?;
log::trace!("memory.atomic.notify(addr={addr_index}, count={count})");
log::trace!("memory.atomic.notify(addr={addr_index:#x}, count={count})");
Ok(self.0.spot.unpark(addr_index, count))
}

Expand All @@ -578,7 +578,7 @@ impl SharedMemory {
) -> Result<WaitResult, Trap> {
let addr = validate_atomic_addr(&self.0.def.0, addr_index, 4, 4)?;
log::trace!(
"memory.atomic.wait32(addr={addr_index}, expected={expected}, timeout={timeout:?})"
"memory.atomic.wait32(addr={addr_index:#x}, expected={expected}, timeout={timeout:?})"
);

// SAFETY: `addr_index` was validated by `validate_atomic_addr` above.
Expand All @@ -603,7 +603,7 @@ impl SharedMemory {
) -> Result<WaitResult, Trap> {
let addr = validate_atomic_addr(&self.0.def.0, addr_index, 8, 8)?;
log::trace!(
"memory.atomic.wait64(addr={addr_index}, expected={expected}, timeout={timeout:?})"
"memory.atomic.wait64(addr={addr_index:#x}, expected={expected}, timeout={timeout:?})"
);

// SAFETY: `addr_index` was validated by `validate_atomic_addr` above.
Expand Down

0 comments on commit f7f22f0

Please sign in to comment.