Skip to content

Commit

Permalink
Fix #84: be more explicit about the ownership of the data pointed to …
Browse files Browse the repository at this point in the history
…by the the pointers returned from ExecutableBuffer::ptr.
  • Loading branch information
CensoredUsername committed Sep 27, 2024
1 parent 23cb1db commit 8601ea3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions runtime/src/mmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ impl ExecutableBuffer {
/// will only be valid as long as its lock is held. When no locks are held,
/// the assembler is free to relocate the executable buffer when it requires
/// more memory than available.
///
/// The memory this pointer points to is owned by this `ExecutableBuffer`.
/// The programmer is responsible for ensuring that pointers generated from this API do not
/// outlive the `ExecutableBuffer`.
pub fn ptr(&self, offset: AssemblyOffset) -> *const u8 {
&self[offset.0] as *const u8
}
Expand Down

0 comments on commit 8601ea3

Please sign in to comment.