aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/fib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/fib.rs')
-rw-r--r--examples/fib.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/fib.rs b/examples/fib.rs
index b495067..c38589f 100644
--- a/examples/fib.rs
+++ b/examples/fib.rs
@@ -62,14 +62,13 @@ fn main() {
asm.bind(&mut end);
asm.ret();
- // Write out JIT code for visualization.
- // Disassemble for example with `ndisasm -b 64 jit.asm`.
- let code = asm.into_code();
- std::fs::write("jit.asm", &code).unwrap();
-
// Move code into executable page and get function pointer to it.
let mut rt = Runtime::new();
- let fib = unsafe { rt.add_code::<extern "C" fn(u64) -> u64>(code) };
+ let fib = unsafe { rt.add_code::<extern "C" fn(u64) -> u64>(asm.into_code()) };
+
+ // Write out JIT code for visualization.
+ // Disassemble for example with `ndisasm -b 64 jit.asm`.
+ rt.dump();
for n in 0..15 {
let fib_jit = fib(n);