Live Coding Kotlin/Native Snake - - PowerPoint PPT Presentation

live coding kotlin native snake
SMART_READER_LITE
LIVE PREVIEW

Live Coding Kotlin/Native Snake - - PowerPoint PPT Presentation

Live Coding Kotlin/Native Snake github.com/dkandalov/kotlin-native-snake @dmitrykandalov Lightning talk What is Kotlin/Native? Kotlin/Native is an LLVM backend for the Kotlin compiler, runtime implementation, and native code


slide-1
SLIDE 1

Live Coding Kotlin/Native Snake

@dmitrykandalov github.com/dkandalov/kotlin-native-snake
slide-2
SLIDE 2
slide-3
SLIDE 3

⚡ Lightning talk ⚡

slide-4
SLIDE 4

What is Kotlin/Native?

slide-5
SLIDE 5
slide-6
SLIDE 6
slide-7
SLIDE 7

Kotlin/Native is an LLVM backend for the Kotlin compiler, runtime implementation, and native code generation facility using the LLVM toolchain.

slide-8
SLIDE 8

🤸

slide-9
SLIDE 9

Kotlin/Native is an LLVM backend for the Kotlin compiler, runtime implementation, and native code generation facility using the LLVM toolchain.

slide-10
SLIDE 10
slide-11
SLIDE 11

IR

slide-12
SLIDE 12

IR

slide-13
SLIDE 13

IR Compiler frontend

slide-14
SLIDE 14

IR Compiler backend

slide-15
SLIDE 15

IR Compiler backend

slide-16
SLIDE 16

IR Compiler backend

slide-17
SLIDE 17

Kotlin/Native is an LLVM backend for the Kotlin compiler, runtime implementation, and native code generation facility using the LLVM toolchain.

slide-18
SLIDE 18

LLVM

slide-19
SLIDE 19
slide-20
SLIDE 20

IR Kotlin/Native

slide-21
SLIDE 21

IR Kotlin/Native

LLVM IR
slide-22
SLIDE 22

IR Kotlin/Native

LLVM IR

Done by LLVM

slide-23
SLIDE 23

C/C++ (clang) Objective-C Rust Swift Julia Graal VM

slide-24
SLIDE 24

Kotlin/Native is an LLVM backend for the Kotlin compiler, runtime implementation, and native code generation facility using the LLVM toolchain.

slide-25
SLIDE 25

kotlin.String java.lang.String

slide-26
SLIDE 26

kotlin.String java.lang.String JS string

slide-27
SLIDE 27

kotlin.String java.lang.String JS string KString

slide-28
SLIDE 28

kotlin.* JVM JS Native

slide-29
SLIDE 29
  • reference counting
  • native-specific code
slide-30
SLIDE 30

Kotlin/Native is an LLVM backend for the Kotlin compiler, runtime implementation, and native code generation facility using the LLVM toolchain.

slide-31
SLIDE 31
slide-32
SLIDE 32

Why?

slide-33
SLIDE 33
  • 1. Performance
slide-34
SLIDE 34
slide-35
SLIDE 35
  • 2. C APIs
slide-36
SLIDE 36
  • POSIX
  • native OS UI
  • interop between languages
  • C libraries

(search for “awesome-c“)

slide-37
SLIDE 37
  • 3. Kotlin
slide-38
SLIDE 38

End of the ⚡Lightning talk ⚡

slide-39
SLIDE 39
slide-40
SLIDE 40

Live coding

slide-41
SLIDE 41
slide-42
SLIDE 42
slide-43
SLIDE 43

Disclaimer: Very few unit tests 😔

slide-44
SLIDE 44

Disclaimer: This is a happy path 🌉🦅

slide-45
SLIDE 45
slide-46
SLIDE 46

There are more native things…

slide-47
SLIDE 47
  • C and Objective-C interop
  • concurrency with workers
  • object.freeze()
  • object.pin()
  • @CName, @ThreadLocal
slide-48
SLIDE 48
  • memory leaks
  • segmentation faults
slide-49
SLIDE 49

Takeaways

slide-50
SLIDE 50
slide-51
SLIDE 51

Kotlin/Native

slide-52
SLIDE 52

Kotlin/Native Rust Scala Native

slide-53
SLIDE 53

Kotlin/Native Rust Scala Native

slide-54
SLIDE 54

github.com/dkandalov/rust-snake github.com/dkandalov/scala-native-snake github.com/dkandalov/go-snake

See also:

github.com/dkandalov/graalvm-snake

slide-55
SLIDE 55

It’s early days for Kotlin/Native

slide-56
SLIDE 56
  • slow compilation 😵
  • only CLion & AppCode
  • tools are not perfect yet
slide-57
SLIDE 57

What can you do next?

slide-58
SLIDE 58
slide-59
SLIDE 59
slide-60
SLIDE 60
slide-61
SLIDE 61
slide-62
SLIDE 62
slide-63
SLIDE 63
slide-64
SLIDE 64

Kotlin/Native 😏

slide-65
SLIDE 65
slide-66
SLIDE 66

The End

@dmitrykandalov github.com/dkandalov/kotlin-native-snake
slide-67
SLIDE 67

The End

@dmitrykandalov github.com/dkandalov/kotlin-native-snake

slide-68
SLIDE 68