Skip to content

Commit

Permalink
Mark some frequently used methods as inline
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottt committed Sep 28, 2023
1 parent 7f79a09 commit a4e35cc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/jit/src/instantiate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ impl CompiledModule {
/// Returns the text section of the ELF image for this compiled module.
///
/// This memory should have the read/execute permissions.
#[inline]
pub fn text(&self) -> &[u8] {
self.code_memory.text()
}
Expand Down Expand Up @@ -575,6 +576,7 @@ impl CompiledModule {
///
/// These trampolines are used for native callers (e.g. `Func::wrap`)
/// calling Wasm callees.
#[inline]
pub fn native_to_wasm_trampoline(&self, index: DefinedFuncIndex) -> Option<&[u8]> {
let loc = self.funcs[index].native_to_wasm_trampoline?;
Some(&self.text()[loc.start as usize..][..loc.length as usize])
Expand Down
1 change: 1 addition & 0 deletions crates/runtime/src/mmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ impl Mmap {
/// # Panics
///
/// Panics of the `range` provided is outside of the limits of this mmap.
#[inline]
pub unsafe fn slice(&self, range: Range<usize>) -> &[u8] {
assert!(range.start <= range.end);
assert!(range.end <= self.len());
Expand Down
1 change: 1 addition & 0 deletions crates/runtime/src/mmap_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ impl MmapVec {
impl Deref for MmapVec {
type Target = [u8];

#[inline]
fn deref(&self) -> &[u8] {
// SAFETY: this mmap owns its own range of the underlying mmap so it
// should be all good-to-read.
Expand Down
1 change: 1 addition & 0 deletions crates/wasmtime/src/signatures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ impl SignatureCollection {
}

/// Gets the shared signature index given a module signature index.
#[inline]
pub fn shared_signature(&self, index: SignatureIndex) -> Option<VMSharedSignatureIndex> {
self.signatures.get(index).copied()
}
Expand Down

0 comments on commit a4e35cc

Please sign in to comment.