From 779f16ef901642de5012297734af0e20f36767cf Mon Sep 17 00:00:00 2001 From: johannst Date: Thu, 19 Dec 2024 17:29:34 +0000 Subject: deploy: f76bf4e81d6b039007715ca0af3ad3a5d043367f --- src/add/add.rs.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/add') diff --git a/src/add/add.rs.html b/src/add/add.rs.html index 38058ec..580daa0 100644 --- a/src/add/add.rs.html +++ b/src/add/add.rs.html @@ -36,7 +36,8 @@ 35 36 37 -38
//! Add example.
+38
+39
//! Add example.
 //!
 //! Jit compile a function at runtime (generate native host code) which calls a function defined in
 //! the example based on the SystemV abi to demonstrate the [`juicebox_asm`] crate.
@@ -65,11 +66,12 @@
     asm.call(rax);
     asm.ret();
 
-    let code = asm.into_code();
-    std::fs::write("jit.asm", &code).unwrap();
-
     let mut rt = Runtime::new();
-    let add42 = unsafe { rt.add_code::<extern "C" fn(u32) -> u32>(code) };
+    let add42 = unsafe { rt.add_code::<extern "C" fn(u32) -> u32>(asm.into_code()) };
+
+    // Write out JIT code for visualization.
+    // Disassemble for example with `ndisasm -b 64 jit.asm`.
+    rt.dump();
 
     let res = add42(5);
     assert_eq!(res, 47);
-- 
cgit v1.2.3