Porting the Swift Runtime to Android, Part One: The How
Shortly after Swift was open-sourced, Zhuowei Zhang sent an email to the swift-dev mailing list, introducing his fork of Swift, which could produce code that ran on Android devices. I worked on his fork, to adapt the code so that it could be merged into the Apple Swift repository. In February 2016 I sent a pull request, entitled simply “Port to Android”. It was merged in April.
What does it mean to “port” the Swift runtime to Android?
The Swift compiler is a program that simply translates Swift source code into an intermediate representation, called LLVM IR. LLVM is a program that translates LLVM IR into assembly code. Assembly code is a slightly more readable version of the 0’s and 1’s that are used to represent machine instructions. LLVM can generate assembly for many different platforms, including Android, PS4, and Windows.
Swift already generates LLVM IR, and LLVM can already
Continue reading →