chc4 / lineiform

A meta-JIT library for Rust interpreters
156 stars 4 forks source link

Do JIT compilation based on perf counters #11

Open chc4 opened 2 years ago

chc4 commented 2 years ago

Currently we block on JIT compilation as soon as we call Jit::speedup. We can instead return a FastFn that delays JIT compilation until it's called, and even better use performance counters like every other JIT on earth to only trigger compilation if it's called >N times, where N is a const generic parameter to the Lineiform trait for compile-time tweaking.

Probably just look up how LuaJIT does fast performance counters to minimize overhead. We might also want to store the performance counters out of band, since optimally we want FastFn to implement Freeze from #4 so we can inline calls to JIT'd closures without having to register them in some map and special casing them?