The official Kotlin/Native documentation states that Kotlin/Native
.. is an LLVM based backend for the Kotlin compiler.
As far as I understand:
- The Kotlin compiler (kotlinc) produces .class files (with Java bytecode) from your Kotlin source files.
- Generic LLVM backends (that are not related to Kotlin) take LLVM IR and turn it into binary code.
Therefore, is Kotlin/Native converting Java bytecode into LLVM IR? If so, is it correct to state that Kotlin/Native is a LLVM backend? Does Kotlin code get compiled into LLVM IR? If not, what is the input and output of each compilation step? (e.g.: Kotlin -(kotlinc)-> Java bytecode -(LLVM backend-> native binary)
This blog post states that the Kotlin frontend compiler (I think it is referring to kotlinc) produces Kotlin IR, which I have never read of.
Kotlin compiler has a single front-end but multiple back-end depending upon the the plugin you are using to build the code. Kotlin/Native plugin converts the Kotlin Intermediate Representation (IR) to native code (i.e code that is machine executable).
Is this quote correct?
It tells you that the compilation process is the same for Java bytecode, native code and JavaScript. You compile your Kotlin code and then you have 3 backend compilers that deliver the expected output format (Java bytecode, JavaScript, binary code).
Does the final platform specific binary include the native Kotlin standard library or is it linked dynamically?