From 5289cbf5331dfd0d0c2242a7e7c8030aa4032c7e Mon Sep 17 00:00:00 2001 From: johannst Date: Sat, 7 Dec 2024 01:01:45 +0000 Subject: deploy: 9c3c3fd923d894d2351eb22129ea693eb98fa8ff --- juicebox_asm/struct.Runtime.html | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) (limited to 'juicebox_asm/struct.Runtime.html') diff --git a/juicebox_asm/struct.Runtime.html b/juicebox_asm/struct.Runtime.html index e530951..8da3fb1 100644 --- a/juicebox_asm/struct.Runtime.html +++ b/juicebox_asm/struct.Runtime.html @@ -1,21 +1,20 @@ -Runtime in juicebox_asm - Rust -

Struct juicebox_asm::Runtime

source ·
pub struct Runtime { /* private fields */ }
Expand description

A simple mmaped runtime with executable pages.

+Runtime in juicebox_asm - Rust
juicebox_asm

Struct Runtime

source
pub struct Runtime { /* private fields */ }
Expand description

A simple mmaped runtime with executable pages.

Implementations§

source§

impl Runtime

source

pub fn new() -> Runtime

Create a new Runtime.

-
Panics
+
§Panics

Panics if the mmap call fails.

source

pub fn with_profile() -> Runtime

Create a new Runtime which also generates static perf metat data.

For each function added to the Runtime, an entry will be generated in the /tmp/perf-<PID>.map file, which perf report uses to symbolicate unknown addresses. This is applicable for static runtimes only.

-
Panics
+
§Panics

Panics if the mmap call fails.

-
source

pub unsafe fn add_code<F>(&mut self, code: impl AsRef<[u8]>) -> F

Add the block of code to the runtime and a get function pointer of type F.

-
Panics
+
source

pub unsafe fn add_code<F>(&mut self, code: impl AsRef<[u8]>) -> F

Add the block of code to the runtime and a get function pointer of type F.

+
§Panics

Panics if the code does not fit on the mmaped pages or is empty.

-
Safety
+
§Safety

The code added must fulfill the ABI of the specified function F and the returned function pointer is only valid until the Runtime is dropped.

-
Examples
+
§Examples
let mut rt = juicebox_asm::Runtime::new();
 
 let code = [ 0x90 /* nop */, 0xc3 /* ret */ ];
@@ -26,19 +25,18 @@ nop();
current working directory.

The code can be inspected with a disassembler as for example ndiasm from nasm.us.

-
ndisasm -b 64 jit.asm
-
Panics
+
ndisasm -b 64 jit.asm
§Panics

Panics if writing the file failed.

-

Trait Implementations§

source§

impl Drop for Runtime

source§

fn drop(&mut self)

Unmaps the code page. This invalidates all the function pointer returned by +

Trait Implementations§

source§

impl Drop for Runtime

source§

fn drop(&mut self)

Unmaps the code page. This invalidates all the function pointer returned by Runtime::add_code.

-

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where - T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where - T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where - T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

-
source§

impl<T, U> Into<U> for T
where - U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
source§

impl<T, U> TryFrom<U> for T
where - U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where - U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file -- cgit v1.2.3