Lightning talk on ATP episode 205
Caution - Ahead be spoilers!!
- John, Casey and Marco
- Chris Lattner is on the show. Creator of LLVM and Swift. Now working at Tesla on automotive software (he later calls it autopilot, so ¯_(ツ)_/¯
- LLVM is a collection of compiler infrastructure projects.
- Ex: SourceKit leverages LLVM (rather than a monolith, access underlying services)
- LLVM first used in OpenGL stuff to repack buffers for various GPUs. Code gen stuff. llvm bytecode files -> GPU machine code
- bytecode vs bitcode - originally LLVM had bytecode(inspired from Java Bytecode), later in 2.0 used bitcode (bytestream vs bitstream)
- Bitcode is important because it’s kind of more CPU agnostic. So adding instructions (ARMv7s iPhone 5 chip with integer divide), compiler optimisations, don’t have to make multiple slices(ARMv7 ARMv7s etc).
- Bitcode isn’t panacea though. Can’t move 32 bit to 64 (because you might have
#ifdefs in your C code)
- in ye olde days(even now),
lipowould take your binary slices and put them together.
- Swift first commit in 2010
- Swift is supposed to scale not only in terms of levels(low to high), but also in terms of learning(progressive discoverability of complexity - ex inline assembly code.)
- Swift 3 is going to be source compatible
- Swift 4 will have perl style grammars
- Swift 5 will have go style concurrency
- ABI stability will be somewhere in the middle (source stability >>>>> ABI compatibility)
how an application should make system calls to the operating system and, if the ABI specifies direct system calls rather than procedure calls to system call stubs, the system call numbers
Marco writes swift for Overcast
Swift Server side group (bringing together people)
PigeonHoling is a problem - Swift isn’t just for platforms
Scripting to system level lang.
Make easy things easy, make hard things possible
Swift is the Rorschach test of languages - everyone sees their favorite language in it.
Swift in the browser - asm.js Trojan horse.
ARC is a great default of swift
RxSwift - Chris has no opinions as such. Just happy that the language supports all of these variable models
ARC vs GC (finally!)
- GC is (ideally) a magic fairy in the background
- Python = ARC + Cycle collector (no idea which implementation, probably CPython)
- Perl is GC, btw
- Tracing GC, not regular GC
- Stutter problem - GC haters gonna hate
- finalizers, similar to deinits running on wrong thread, object maybe revived-
- ARC has overhead, have to think about cycles
- But GC injects code to your app.
- generational GCs nursery -> regular memory.
- Safe point in loops(so GC doesn’t run indefinitely) -> your loops may come in
- Memory ownership model more like a middle ground
- ARC has nowhere the near the amount of research done on it as tracing GC (think how JS is fast only because Google and
- also explicitly thinking about memory (weak parents might be a good idea).
- Also, ARC lets swift be big on IoT and low memory domains where GCs can’t run
- ARC lets you interface with C code, no need for JNI.