Jank now has its own custom IR
12 hours ago
- #Intermediate Representation
- #Clojure Dialects
- #Compiler Optimization
- Jank introduces a custom intermediate representation (IR) tailored to Clojure's semantics for better optimization.
- The IR is SSA-based and represented as a control flow graph, with instructions like var-deref and dynamic-call.
- Optimizations include inlining arithmetic via metadata, eliminating redundant IR instructions, and using pointer tagging for integers.
- Tagged pointers reduce dynamic allocations for integers, significantly improving performance in benchmarks like recursive fibonacci.
- Further optimization with C++ attributes ensures arithmetic functions are inlined, making jank faster than Clojure JVM in some cases.
- Jank's AOT compilation approach contrasts with the JVM's JIT optimization, but jank aims to be competitive in performance.