Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
SwiftコンパイラがSwiftで開発できるようになる話
Search
freddi(Yuki Aki)
July 21, 2021
Technology
3
560
SwiftコンパイラがSwiftで開発できるようになる話
freddi(Yuki Aki)
July 21, 2021
Tweet
Share
More Decks by freddi(Yuki Aki)
See All by freddi(Yuki Aki)
輝け俺のViewController 〜海外iOSカンファレンス登壇編〜
freddi
4
200
Deep Dive into "any" and "some"
freddi
3
1.3k
挑戦!ISUCON de Server-side Swift 〜タイムゾーンには気をつけろ〜
freddi
0
1.4k
意外と知られてないXcode13の新しい参照カウンタ最適化オプションの挙動
freddi
2
100
How to develop SIL Optimizer in Swift Language
freddi
0
290
知ろう! ShazamKit
freddi
1
160
Swift Optimizing at Compiler World
freddi
1
740
Recap Pointfree Vol. 1~3
freddi
1
770
社内版SwiftコンパイラにContributeするまで
freddi
0
76
Other Decks in Technology
See All in Technology
5分でわかるDuckDB
chanyou0311
10
3.2k
Qiita埋め込み用スライド
naoki_0531
0
860
Wantedly での Datadog 活用事例
bgpat
1
430
TSKaigi 2024 の登壇から広がったコミュニティ活動について
tsukuha
0
160
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
100
Postman と API セキュリティ / Postman and API Security
yokawasa
0
200
コンテナセキュリティのためのLandlock入門
nullpo_head
2
320
マイクロサービスにおける容易なトランザクション管理に向けて
scalar
0
110
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
12
3.5k
10分で学ぶKubernetesコンテナセキュリティ/10min-k8s-container-sec
mochizuki875
3
330
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
260
NilAway による静的解析で「10 億ドル」を節約する #kyotogo / Kyoto Go 56th
ytaka23
3
370
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
510
Docker and Python
trallard
42
3.1k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Rails Girls Zürich Keynote
gr2m
94
13k
Fireside Chat
paigeccino
34
3.1k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
For a Future-Friendly Web
brad_frost
175
9.4k
Making Projects Easy
brettharned
116
5.9k
Transcript
2021/07/21 SwiftѪձ SwiftίϯύΠϥ͕SwiftͰ։ൃͰ͖ΔΑ͏ʹͳΔ freddi (@_ _ _ freddi _ _
_)
͓·͑ͩΕ • freddi • iOS Engineer at Fukuoka • LINEελϯϓൢചத
• ΦϦδφϧTγϟπ
͓·͑ͩΕ • Geekle ͱ͍͏ஂମ͕ओ࠵ͯ͠Δ iOS Conference ʹొஃ͠·͢ʂ • https://geekle.us/ios
SwiftίϯύΠϥ͕SwiftͰ։ൃͰ͖ΔΑ͏ʹͳΔ
ͨͩ͠Ұ෦ͷ
SwiftίϯύΠϥͷ։ൃݴޠ • ϨϙδτϦͷC++ • ඪ४ϥΠϒϥϦΛআ͍ͯ΄΅ C++ • Driver, Parser, Type
Checker, Optimizer ͳͲ • ࣮ΛಡΉʹC++LLVMͷࣄલ͕͍͔ࣝͭ͘ඞཁ
Swift Driver ʹ͍ͭͯ
Swift Driver ʹ͍ͭͯ • ࣮ͪΒͬͱࠓͷWWDCͰݴٴ͞Ε͍ͯΔ • ΠϯΫϦϝϯλϧϏϧυΛߴԽ͢ΔͨΊͷ3ͭͷओཁͳվળͷҰͭ https://developer.apple.com/videos/play/wwdc2021/10192/
͜͜ͰͷDriverͱԿ • USBͱ͔ͷυϥΠόͱશ͘ผͳͷͰҙ͞Εͨ͠ • DriverϓϩάϥϜͱɺ • ͍͔ͭ͘ͷύʔπͱͯ͠ͷϓϩάϥϜΛదʹݺͼग़͢ϓϩάϥϜ • gcc ίϚϯυυϥΠόϓϩάϥϜ
• ࣮ swift swiftc ίϚϯυυϥΠόϓϩάϥϜ
swift ͷ߹ swift (driver) package hello.swift (Կͳ͠) REPLͷىಈ helllo.swift
ͷίϯύΠϧɾϏϧυ ࣮ߦϑΝΠϧੜ Swift package ؔ࿈ͷಈ࡞ swift (driver) swift (driver) … υϥΠό …υϥΠόͷ໋ྩ … ݁Ռ
ίϚϯυϥΠϯͷҾͱͷؔ swift (driver) package hello.swift (Կͳ͠) REPLͷىಈ helllo.swift ͷίϯύΠϧɾϏϧυ
࣮ߦϑΝΠϧੜ Swift package ؔ࿈ͷಈ࡞ swift (driver) swift (driver) $ swift package $ swift hello.world $ swift … ϝΠϯͷίϚϯυ … ҾͳͲ … ݁Ռ … ίϚϯυϥΠϯ্Ͱͷॻ͖ํ
SwiftͷDriver • swift ίϚϯυ͕ Driver ͕ͩɺ࣮ଶ swift-driver ίϚϯυ • swift-driver
͕ࣗͲ͏͍͏໊લͰݺΕ͔ͨɺٴͼҾʹΑͬͯ ৼΔ͍ɺݺͼग़͢SwiftίϯύΠϥͷϞδϡʔϧΛม͑Δ • ͳͷͰίϚϯυ͕ࣗ swift swiftc ͱݺΕΔ͔ʹΑͬͯذ͕͋Δ • swift swiftc ࣮΄΅ swift-driver ͱಉ͡ίϚϯυ • ҎલͷDriverC++࣮͕ͩɺSwift Driver Swift Ͱॻ͔Ε͍ͯΔ
͜Ε͔Βͷ Swift Driver ʹ͍ͭͯ • Swift 5.5 (Xcode 13 Beta)
Ҏ߱Ͱඪ४Ͱར༻͞ΕΔ
͜Ε͔Βͷ Swift Driver ʹ͍ͭͯ • Swift Driver ͷͷϝϦοτ͋·Γ·ͱ·ͬͯͳ͍ • ͳΜ͔
Twitter ʹస͕͍ͬͯΔ͘Β͍ • https://twitter.com/dgregor79/status/1260798039515488257 ͜͜ • ࠓ࢈ۀ • SwiftPM ͚ͳͲͷΠϯΫϦϝϯλϧϏϧυͷվળ • ΞʔΩςΫνϟ͕վળ͞Εͯɺར͕૿͑ΔʢฒྻԽͳͲʣ • ৺ஔ͖ͳ͖͘ͳݴޠʢSwiftʣͰॻ͚Δ
Swift Driver ʹؔ͢Δৄ͍͠ࢿྉ • ຊޠͷࢿྉ • https://speakerdeck.com/freddi/jin-ri-karashi-meruswift-driver • https://qiita.com/freddi_/items/4c2149055959248dda28 •
ݱঢ়ݸਓͰॻ͍ͯΔࢿྉੈքͰͷ͘Β͍͔͠ͳ͍ • ϓϩδΣΫτࣗମOSSͳͷͰͦͪΒࢀর͞Εͨ͠ • https://github.com/apple/swift-driver
࠷దԽʹ͍ͭͯ
SwiftίϯύΠϥͷ࠷దԽ෦ • ࠷దԽ෦ͷ࣮ͯ͢C++ͩͬͨ • ͔͠͠ɺlibswift ͱ͍͏ͷʹΑͬͯ Swift Ͱॻ͚ΔΑ͏ʹͳͬͨ • ଟஈ֊తʹҠߦ͢Δʁ
• https://github.com/apple/swift/blob/main/libswift/README.md
SwiftίϯύΠϥͷ࠷దԽ෦ raw SIL canonical SIL Pass Pass Pass Pass •
Swift ίʔυίϯύΠϥͰ SIL ͱݺΕΔίʔυʹม͞ΕΔ • SIL ࠷దԽ͞ΕΔ͕ɺ࠷దԽલ͕ raw SILɺޙ͕ canonical SIL • raw SIL ΛͦΕͧΕͷׂͰ࠷దԽ͢ΔϞδϡʔϧ͕ Pass • Pass ͕ Swift Ͱॻ͚ΔΑ͏ʹͳͬͨɺͱ͍͏ (libswift)
SwiftίϯύΠϥͷ࠷దԽ෦ • NSSpain 2020 Ͱ ͜͜ΒΜͷৄ͍͕͋͠ΔͷͰؾʹͳΔํ ࢀর͞Εͨ͠ https://vimeo.com/479467405
C++ ͔Β Swift ʹ͢Δࡍͷݒ೦ • SwiftͷϝϞϦཧํ๏ ARCɺҰํC++΄΅ϓϩάϥϚ͕Δ • ARC ศར͚ͩͲΦʔόʔϔου͕͋Δ
• ARCͷΧϯτɺཪͰίʔυ͕૿͑ͨΓ͍ͯ͠Δͷࣄ࣮ • libswift ͰͦΕΛճආ͢ΔͨΊͷ͕͋Δ Θ͍Θ͍swiftc #29 Ͱ͜͜ΒΜͷ͕͋Γ·͢ʂ https://iosdiscord.connpass.com/event/218858/
Swift Ͱॻ͘ํ๏ • libswift Swift Package Manager ܦ༝ͰimportՄೳʂ •
͔ΜͨΜʹ Optimizer ͷ Pass Λ։ൃͰ͖·͢ Θ͍Θ͍swiftc #29 Ͱ͜͜ΒΜͷ͕͋Γ·͢ʂ https://iosdiscord.connpass.com/event/218858/
·ͱΊ
SwiftίϯύΠϥͷҰ෦͕SwiftͰ։ൃͰ͖Δ • Swift Driver Project • https://github.com/apple/swift-driver • https://twitter.com/dgregor79/status/1260798039515488257 •
Swift ͷ࠷దԽ෦ • https://github.com/apple/swift/blob/main/libswift/README.md • Θ͍Θ͍swiftc #29 Ͱղઆ͞ΕΔͷͰདྷͯͶʂ https://iosdiscord.connpass.com/event/218858/