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
550
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
190
Deep Dive into "any" and "some"
freddi
3
1.3k
挑戦!ISUCON de Server-side Swift 〜タイムゾーンには気をつけろ〜
freddi
0
1.3k
意外と知られてないXcode13の新しい参照カウンタ最適化オプションの挙動
freddi
2
97
How to develop SIL Optimizer in Swift Language
freddi
0
280
知ろう! ShazamKit
freddi
1
160
Swift Optimizing at Compiler World
freddi
1
730
Recap Pointfree Vol. 1~3
freddi
1
760
社内版SwiftコンパイラにContributeするまで
freddi
0
66
Other Decks in Technology
See All in Technology
OS 標準のデザインシステムを超えて - より柔軟な Flutter テーマ管理 | FlutterKaigi 2024
ronnnnn
0
160
Making your applications cross-environment - OSCG 2024 NA
salaboy
0
190
これまでの計測・開発・デプロイ方法全部見せます! / Findy ISUCON 2024-11-14
tohutohu
3
370
VideoMamba: State Space Model for Efficient Video Understanding
chou500
0
190
SREによる隣接領域への越境とその先の信頼性
shonansurvivors
2
520
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.8k
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
250
AI前提のサービス運用ってなんだろう?
ryuichi1208
8
1.4k
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
320
Platform Engineering for Software Developers and Architects
syntasso
1
520
生成AIが変えるデータ分析の全体像
ishikawa_satoru
0
160
ドメインの本質を掴む / Get the essence of the domain
sinsoku
2
160
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
The World Runs on Bad Software
bkeepers
PRO
65
11k
Typedesign – Prime Four
hannesfritz
40
2.4k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Gamification - CAS2011
davidbonilla
80
5k
Become a Pro
speakerdeck
PRO
25
5k
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/