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
640
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
270
Deep Dive into "any" and "some"
freddi
3
1.4k
挑戦!ISUCON de Server-side Swift 〜タイムゾーンには気をつけろ〜
freddi
0
1.7k
意外と知られてないXcode13の新しい参照カウンタ最適化オプションの挙動
freddi
2
150
How to develop SIL Optimizer in Swift Language
freddi
0
350
知ろう! ShazamKit
freddi
1
210
Swift Optimizing at Compiler World
freddi
2
820
Recap Pointfree Vol. 1~3
freddi
1
820
社内版SwiftコンパイラにContributeするまで
freddi
0
110
Other Decks in Technology
See All in Technology
EKS Pod Identity における推移的な session tags
z63d
1
200
Amazon Bedrock AgentCore でプロモーション用動画生成エージェントを開発する
nasuvitz
6
420
Yahoo!ニュースにおけるソフトウェア開発
lycorptech_jp
PRO
0
340
マイクロモビリティシェアサービスを支える プラットフォームアーキテクチャ
grimoh
1
200
事業価値と Engineering
recruitengineers
PRO
1
200
.NET開発者のためのAzureの概要
tomokusaba
0
230
浸透しなさいRFC 5322&7208
hinono
0
120
Webアクセシビリティ入門
recruitengineers
PRO
1
240
ソフトウェア エンジニアとしての 姿勢と心構え
recruitengineers
PRO
2
670
LLM時代の検索とコンテキストエンジニアリング
shibuiwilliam
2
1.1k
広島銀行におけるAWS活用の取り組みについて
masakimori
0
130
サービスロボット最前線:ugoが挑むPhysical AI活用
kmatsuiugo
0
190
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
9
780
RailsConf 2023
tenderlove
30
1.2k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.6k
Practical Orchestrator
shlominoach
190
11k
Code Reviewing Like a Champion
maltzj
525
40k
Unsuck your backbone
ammeep
671
58k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
6k
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/