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
600
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
240
Deep Dive into "any" and "some"
freddi
3
1.4k
挑戦!ISUCON de Server-side Swift 〜タイムゾーンには気をつけろ〜
freddi
0
1.5k
意外と知られてないXcode13の新しい参照カウンタ最適化オプションの挙動
freddi
2
130
How to develop SIL Optimizer in Swift Language
freddi
0
320
知ろう! ShazamKit
freddi
1
180
Swift Optimizing at Compiler World
freddi
2
800
Recap Pointfree Vol. 1~3
freddi
1
790
社内版SwiftコンパイラにContributeするまで
freddi
0
91
Other Decks in Technology
See All in Technology
[CATS]Amazon Bedrock GenUハンズオン座学資料 #2 GenU環境でRAGを体験してみよう
tsukuboshi
0
150
Proxmox VE超入門 〜 無料で作れるご自宅仮想化プラットフォームブックマークする
devops_vtj
0
160
30代エンジニアが考える、エンジニア生存戦略~~セキュリティを添えて~~
masakiokuda
4
2k
セマンティックレイヤー入門
ikkimiyazaki
8
3.3k
IAMのマニアックな話 2025 ~40分バージョン ~
nrinetcom
PRO
8
930
チームの性質によって変わる ADR との向き合い方と、生成 AI 時代のこれから / How to deal with ADR depends on the characteristics of the team
mh4gf
4
340
RAGの基礎から実践運用まで:AWS BedrockとLangfuseで実現する構築・監視・評価
sonoda_mj
0
440
ウェブアクセシビリティとは
lycorptech_jp
PRO
0
280
Security response for open source ecosystems
frasertweedale
0
100
データベースで見る『家族アルバム みてね』の変遷 / The Evolution of Family Album Through the Lens of Databases
kohbis
2
440
Road to SRE NEXT@仙台 IVRyの組織の形とSLO運用の現状
abnoumaru
0
390
「ラベルにとらわれない」エンジニアでいること/Be an engineer beyond labels
kaonavi
0
150
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
28
1.6k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Code Reviewing Like a Champion
maltzj
522
39k
Java REST API Framework Comparison - PWX 2021
mraible
29
8.5k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
How GitHub (no longer) Works
holman
314
140k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.8k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
30
1.1k
Adopting Sorbet at Scale
ufuk
75
9.3k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
46
2.4k
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/