From 596eaec7fa9678939031eb1a434735c51f3ecec2 Mon Sep 17 00:00:00 2001 From: johannst Date: Wed, 28 Feb 2024 18:41:33 +0000 Subject: deploy: aee91960846cc5786b1ce0f87b107534440a8450 --- juicebox_asm/struct.Runtime.html | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'juicebox_asm/struct.Runtime.html') diff --git a/juicebox_asm/struct.Runtime.html b/juicebox_asm/struct.Runtime.html index 7872799..e530951 100644 --- a/juicebox_asm/struct.Runtime.html +++ b/juicebox_asm/struct.Runtime.html @@ -1,10 +1,16 @@ Runtime in juicebox_asm - Rust

Struct juicebox_asm::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.

+

Implementations§

source§

impl Runtime

source

pub fn new() -> Runtime

Create a new Runtime.

Panics

Panics if the mmap call fails.

-
source

pub fn with_profile() -> Runtime

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.

+
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 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

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

Safety

The code added must fulfill the ABI of the specified function F and the returned function @@ -16,14 +22,14 @@ pointer is only valid until the let nop = unsafe { rt.add_code::<extern "C" fn()>(&code) }; nop();

-
source

pub fn dump(&self)

Dump the code added so far to the runtime into a file called jit.asm in the processes +

source

pub fn dump(&self)

Dump the code added so far to the runtime into a file called jit.asm in the processes current working directory.

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

ndisasm -b 64 jit.asm
-
Panics
+
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 -- cgit v1.2.3