From 2294180c3778d0fcfa877818e98c420fcd54bb8a Mon Sep 17 00:00:00 2001 From: johannst Date: Tue, 5 Dec 2023 22:08:06 +0000 Subject: deploy: 7e98f5def5942969f97f5f015e7fb8417793d132 --- juicebox_asm/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'juicebox_asm/index.html') diff --git a/juicebox_asm/index.html b/juicebox_asm/index.html index 10ba3d9..d3198b3 100644 --- a/juicebox_asm/index.html +++ b/juicebox_asm/index.html @@ -1,4 +1,4 @@ -juicebox_asm - Rust

Crate juicebox_asm

source ·
Expand description

A simple x64 jit assembler with a minimal runtime to execute emitted code for fun.

+juicebox_asm - Rust

Crate juicebox_asm

source ·
Expand description

A simple x64 jit assembler with a minimal runtime to execute emitted code for fun.

The following is an fibonacci example implementation.

use juicebox_asm::prelude::*;
@@ -60,8 +60,8 @@
     asm.ret();
 
     // Move code into executable page and get function pointer to it.
-    let rt = Runtime::new(&asm.into_code());
-    let fib = unsafe { rt.as_fn::<extern "C" fn(u64) -> u64>() };
+    let mut rt = Runtime::new();
+    let fib = unsafe { rt.add_code::<extern "C" fn(u64) -> u64>(&asm.into_code()) };
 
     for n in 0..15 {
         let fib_jit = fib(n);
-- 
cgit v1.2.3