aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/fib/fib.rs.html
diff options
context:
space:
mode:
Diffstat (limited to 'src/fib/fib.rs.html')
-rw-r--r--src/fib/fib.rs.html14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/fib/fib.rs.html b/src/fib/fib.rs.html
index 32ebea0..c1a746f 100644
--- a/src/fib/fib.rs.html
+++ b/src/fib/fib.rs.html
@@ -76,8 +76,7 @@
<a href="#75" id="75">75</a>
<a href="#76" id="76">76</a>
<a href="#77" id="77">77</a>
-<a href="#78" id="78">78</a>
-<a href="#79" id="79">79</a></pre></div><pre class="rust"><code><span class="doccomment">//! Fibonacci example.
+<a href="#78" id="78">78</a></pre></div><pre class="rust"><code><span class="doccomment">//! Fibonacci example.
//!
//! Jit compile a function at runtime (generate native host code) to compute the fibonacci sequence
//! to demonstrate the [`juicebox_asm`] crate.
@@ -141,14 +140,13 @@
asm.bind(<span class="kw-2">&amp;mut </span>end);
asm.ret();
- <span class="comment">// Write out JIT code for visualization.
- // Disassemble for example with `ndisasm -b 64 jit.asm`.
- </span><span class="kw">let </span>code = asm.into_code();
- std::fs::write(<span class="string">"jit.asm"</span>, <span class="kw-2">&amp;</span>code).unwrap();
-
<span class="comment">// Move code into executable page and get function pointer to it.
</span><span class="kw">let </span><span class="kw-2">mut </span>rt = Runtime::new();
- <span class="kw">let </span>fib = <span class="kw">unsafe </span>{ rt.add_code::&lt;<span class="kw">extern </span><span class="string">"C" </span><span class="kw">fn</span>(u64) -&gt; u64&gt;(code) };
+ <span class="kw">let </span>fib = <span class="kw">unsafe </span>{ rt.add_code::&lt;<span class="kw">extern </span><span class="string">"C" </span><span class="kw">fn</span>(u64) -&gt; u64&gt;(asm.into_code()) };
+
+ <span class="comment">// Write out JIT code for visualization.
+ // Disassemble for example with `ndisasm -b 64 jit.asm`.
+ </span>rt.dump();
<span class="kw">for </span>n <span class="kw">in </span><span class="number">0</span>..<span class="number">15 </span>{
<span class="kw">let </span>fib_jit = fib(n);