Kotlin Native Compiler Under the Hood
summary
Walks through the Kotlin compiler stack from PSI to IR to codegen, shows how the K2 analysis API emits symbols, how IR is visited and mutated by the Compose compiler plugin, and how Kotlin/Native runs a phase engine to produce kexe binaries via Kotlin bindings to LLVM and dumped LLVM bitcode. Demonstrates the new Kotlin Swift export (beta) pipeline that maps IR to SIR then to Swift (not all features supported), shows performance timing per phase, and points to test data and a live code walkthrough for reproduction.
AI-written summary · about
chapters (12)
- 0:00Kotlin Native compiler intro
- 1:07Repository and entry points
- 5:45Compiler architecture and K2 API
- 10:01Phase engine in Kotlin Native
- 12:06Kotlin to macOS executable
- 16:38Complex codebases like Kotlin
- 20:28LLVM bindings and IR conversion
- 23:01Performance metrics
- 23:43Kotlin to Swift export
- 27:26Swift Intermediate Representation
- 28:28Exploring with test data
- 29:12Q&A
related talks
43mCrash Course on the Kotlin Compiler
19mDemystifying the Kotlin Compiler
52mKEYNOTE: Kotlin/Native – Embracing existing ecosystems
34mKotlin: Uncovered
45mKotlin Under the Hood
26mBuild your own compiler with KSP
49mEffective Kotlin-Swift Interoperability
44mMeta-programming with KSP and Kotlin compiler plugins
