Skip to content
Prev Previous commit
Next Next commit
chore: re-add and deprecate Memory::get_slice
  • Loading branch information
DaniPopes committed Aug 25, 2023
commit 2510ae9b2df64cc3baf40bf89738cd3303d147c5
7 changes: 7 additions & 0 deletions crates/interpreter/src/interpreter/memory.rs
Copy link
Collaborator Author

@DaniPopes DaniPopes Aug 25, 2023

Choose a reason for hiding this comment

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

  • changed runtime panics to be unreachable_unchecked in release mode since they should never happen. This helps performance quite a bit

Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ impl Memory {
}
}

#[deprecated = "use `slice` instead"]
#[inline(always)]
#[cfg_attr(debug_assertions, track_caller)]
pub fn get_slice(&self, offset: usize, size: usize) -> &[u8] {
self.slice(offset, size)
}

/// Returns a mutable byte slice of the memory region at the given offset.
///
/// Panics on out of bounds.
Expand Down