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のDemanglerを書く @ わいわいswiftc番外編
Search
ukitaka
December 15, 2018
Programming
500
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SwiftのDemanglerを書く @ わいわいswiftc番外編
ukitaka
December 15, 2018
More Decks by ukitaka
See All by ukitaka
あなたの知らない「動画広告」の世界 - iOSDC Japan 2025
ukitaka
0
1.8k
CSの生産性改善を支える分析環境 Mercari CS/CRE Tech Talk #1
ukitaka
1
3.1k
switchのexhaustiveness/redundancy チェック 理論と実装 わいわいswiftc #8 @ukitaka
ukitaka
0
270
Swiftの型システムに入門する - iOSDC Japan 2018
ukitaka
10
7.4k
Responder Chainを使って コードをスッキリさせたい - 第1回 HAKATA.swift
ukitaka
6
1.5k
理論から入門するswift/lib/Sema - わいわいswiftc #1
ukitaka
5
1.8k
Realmの処理を再利用可能かつ合成可能にする
ukitaka
0
990
マルチスレッドRxSwift @ 社内RxSwift勉強会
ukitaka
5
1.3k
今日こそ理解するHot / Cold @社内RxSwift勉強会
ukitaka
14
3k
Other Decks in Programming
See All in Programming
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
1.1k
ソフトウェアエンジニアにとっての生成AI - 特性を知って使い倒す / generative ai for software enginner
kishida
7
2.1k
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
240
Jindong: Introducing Declarative Haptics in Compose Multiplatform
l2hyunwoo
0
130
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
380
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
270
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
260
ここ半年くらいでAIに作らせたR用ツール
eitsupi
0
400
Discordを用いたラボオートメーション関連情報収集の自動化
noguhiro2002
0
370
Pythonの実行はどこまで賢くなったのか? CPythonとPyPyから見る最適化のしくみ
curekoshimizu
3
1.6k
freeeにおけるEvalsの実践例の紹介
freee
PRO
0
140
楽しそうなつよつよエンジニアと目が死んでる僕/A brilliant engineer having a blast, and dead-eyed me.
3l4l5
2
230
Featured
See All Featured
Faster Mobile Websites
deanohume
310
32k
Navigating Weather and Climate Data
rabernat
0
490
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
Scaling GitHub
holman
464
140k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
73
41k
Exploring anti-patterns in Rails
aemeredith
3
470
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
470
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.5k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
280
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
450
Transcript
Θ͍Θ͍swiftc൪֎ฤ @ukitaka SwiftͷDemanglerΛॻ͘
ࠓͷඪ
$S13ExampleNumber6isEven6numberSbSi_tF isEven(number: Int) -> Bool Ψν
Mangle / Demangleͱ Mangleͱ $S13ExampleNumber6isEven6numberSbSi_tF ExampleNumber.swift ͷ isEven(number: Int) ->
Bool
Mangle / Demangleͱ Demangleͱ $S13ExampleNumber6isEven6numberSbSi_tF ExampleNumber.isEven(number: Swift.Int) -> Swift.Bool
Mangle / Demangleͱ Mangle͞ΕͨγϯϘϧ໊Λ֬ೝ͢Δ $ swiftc -emit-sil Examples/ExampleNumber.swift
Mangle / Demangleͱ Mangle͞ΕͨγϯϘϧ໊Λ֬ೝ͢Δ $ swiftc -emit-sil Examples/ExampleNumber.swift
Mangle / Demangleͱ SwiftͷDemangleίϚϯυ $ swift demangle '$S13ExampleNumber6isEven6numberSbSi_tF' $S13ExampleNumber6isEven6numberSbSi_tF —>
ExampleNumber.isEven(number: Swift.Int) -> Swift.Bool
Mangle / Demangleͱ SwiftͷDemangleίϚϯυ $ swift demangle '$S13ExampleNumber6isEven6numberSbSi_tF' $S13ExampleNumber6isEven6numberSbSi_tF —>
ExampleNumber.isEven(number: Swift.Int) -> Swift.Bool ࠓ͜ΕΛ࡞Γ·͢
Demangler Demangler ▸ Demanglerͷ࡞Λ௨ͯ͠ҎԼΛֶ΅͏ ▸ SwiftͷManglingͷΈΛֶͿ ▸ ؆୯ͳParserΛ࡞͢ΔͷͰɺParserͷςΫχοΫΛମݧͰ͖Δ
Swift Demangler workshop ՝ʹ͍ͭͯ ▸ جຊ֤ࣗREADMEΛΈͳ͕ΒਐΊͯΒ͍·͢ ▸ ՝1ʙ5·Ͱ͋Γɺ՝1Λશһ͕ୡ͢Δ͜ͱΛඪʹ͠·͢ ▸ ՝1ʹαϙʔτ͕͍ͭͯΔͷͰɺͦΕΛΈͳ͕ΒͬͯΈ·͠ΐ͏
▸ Ͱ͖ΔਓͲΜͲΜਐΊͯΒͬͯେৎͰ͢ ▸ ಛʹ5ͷsubstitutionॏཁͳͱ͜ΖͳͷͰ
՝1
Swift Demangler workshop ՝1 $S13ExampleNumber6isEven6numberSbSi_tF ExampleNumber.isEven(number: Swift.Int) -> Swift.Bool
Swift Demangler workshop ՝1 $S13ExampleNumber6isEven6numberSbSi_tF SwiftͷMangle nameʹڞ௨Ͱͭ͘Prefix
Swift Demangler workshop ՝1 $S13ExampleNumber6isEven6numberSbSi_tF ؔΛMangleͨ͠ͷͰ͋Δͱ͍͏ҹ F
Swift Demangler workshop ՝1 $S13ExampleNumber6isEven6numberSbSi_tF “ExampleNumber” ͱ͍͏Ϟδϡʔϧ໊ (ϑΝΠϧ໊) 13͔͜͜Β13จࣈ͕ࣝผࢠͰ͋Δ͜ͱΛද͢
Swift Demangler workshop ՝1 $S13ExampleNumber6isEven6numberSbSi_tF “isEven” ͱ͍͏ؔͷ໊લ 6จࣈ͕ࣝผࢠͰ͋Δ͜ͱΛࣔ͢
Swift Demangler workshop ՝1 $S13ExampleNumber6isEven6numberSbSi_tF “number” ͱ͍͏ϥϕϧ 6จࣈ͕ࣝผࢠͰ͋Δ͜ͱΛࣔ͢
Swift Demangler workshop ՝1 $S13ExampleNumber6isEven6numberSbSi_tF ؔͷγάωνϟ (≒ ܕ) SbฦΓͷܕ Bool
Si_tҾͷܕ (Int)
Swift Demangler workshop ՝1 global ::= entity entity ::= context
entity-spec context ::= module module ::= identifier $S13ExampleNumber6isEven6numberSbSi_tF global
Swift Demangler workshop ՝1 global ::= entity entity ::= context
entity-spec context ::= module module ::= identifier $S13ExampleNumber6isEven6numberSbSi_tF global entity
Swift Demangler workshop ՝1 global ::= entity entity ::= context
entity-spec context ::= module module ::= identifier $S13ExampleNumber6isEven6numberSbSi_tF context entity-spec module
Swift Demangler workshop ՝1 entity-spec ::= decl-name label-list function-signature 'F'
function-signature ::= params-type params-type throws? label-list ::= empty-list label-list ::= ('_' | identifier)* throws ::= 'K' params-type ::= type decl-name ::= identifier identifier ::= NATURAL IDENTIFIER-STRING $S13ExampleNumber6isEven6numberSbSi_tF decl-name label-list function-signature
Swift Demangler workshop ՝1 (࠶ܝ) $S13ExampleNumber6isEven6numberSbSi_tF ExampleNumber.isEven(number: Swift.Int) -> Swift.Bool