chc4 / lineiform

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

Implement inlining heuristics #15

Open chc4 opened 3 years ago

chc4 commented 3 years ago

Right now Lineiform just tries to inline every call unconditionally. This is pretty stupid. Most JITs use some combination of current function size, CFG complexity, and target function size to decide if it should inline a call or not, and we'd like to do the same. This is slightly hampered in that we don't have an CFG building pass, but we do have target function size from the symbol.

chc4 commented 3 years ago

This should probably be user-configurable in some way? Maybe we allow the user to set a closure as the heuristic that we call? Idk realistically I don't really know what's good inlining or not until we have a bunch of benchmarks and can twiddle knobs to see what goes fast or not.