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
580
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
210
Deep Dive into "any" and "some"
freddi
3
1.3k
挑戦!ISUCON de Server-side Swift 〜タイムゾーンには気をつけろ〜
freddi
0
1.4k
意外と知られてないXcode13の新しい参照カウンタ最適化オプションの挙動
freddi
2
110
How to develop SIL Optimizer in Swift Language
freddi
0
300
知ろう! ShazamKit
freddi
1
170
Swift Optimizing at Compiler World
freddi
2
770
Recap Pointfree Vol. 1~3
freddi
1
780
社内版SwiftコンパイラにContributeするまで
freddi
0
81
Other Decks in Technology
See All in Technology
comilioとCloudflare、そして未来へと向けて
oliver_diary
6
430
ドメイン駆動設計の実践により事業の成長スピードと保守性を両立するショッピングクーポン
lycorptech_jp
PRO
7
760
30分でわかる「リスクから学ぶKubernetesコンテナセキュリティ」/30min-k8s-container-sec
mochizuki875
3
440
Godot Engineについて調べてみた
unsoluble_sugar
0
360
Azureの開発で辛いところ
re3turn
0
240
完全自律型AIエージェントとAgentic Workflow〜ワークフロー構築という現実解
pharma_x_tech
0
320
EMConf JP の楽しみ方 / How to enjoy EMConf JP
pauli
2
140
RubyでKubernetesプログラミング
sat
PRO
4
150
Copilotの力を実感!3ヶ月間の生成AI研修の試行錯誤&成功事例をご紹介。果たして得たものとは・・?
ktc_shiori
0
340
生成AI × 旅行 LLMを活用した旅行プラン生成・チャットボット
kominet_ava
0
150
I could be Wrong!! - Learning from Agile Experts
kawaguti
PRO
8
3.3k
なぜfreeeはハブ・アンド・スポーク型の データメッシュアーキテクチャにチャレンジするのか?
shinichiro_joya
2
170
Featured
See All Featured
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Building an army of robots
kneath
302
45k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
192
16k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2k
A better future with KSS
kneath
238
17k
Become a Pro
speakerdeck
PRO
26
5.1k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Gamification - CAS2011
davidbonilla
80
5.1k
How to train your dragon (web standard)
notwaldorf
89
5.8k
Embracing the Ebb and Flow
colly
84
4.5k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
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/