Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
登壇その後 - ZJIT への興味とハック
Search
dak2
September 05, 2026
Technology
27
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
登壇その後 - ZJIT への興味とハック
2026/09/05 RubyKaigi 2026 Followup LT 資料
https://rhc.connpass.com/event/392503/
dak2
September 05, 2026
More Decks by dak2
See All by dak2
特殊変数大全
dak2
0
370
現場のトークンマネジメント
dak2
1
330
KaigiEffect.new(name: "dak2").generate
dak2
1
140
No Types Needed, Just Callable Method Check
dak2
1
9.1k
MCP Security Best Practices に見るセキュリティリスクとmodelcontextprotocol/ruby-sdk の authorization の現在地
dak2
0
76
自然言語で ActiveRecord を操作する試み
dak2
0
67
DoD x RBS
dak2
0
41
Other Decks in Technology
See All in Technology
AIがコードを書く時代に、エンジニアは何で自分の価値を証明するのか / In an era where AI writes code how do engineers prove their value
carta_engineering
2
830
今さら理解するウェブフォントver.2026
takanorip
3
670
自分で立ててみるLLMサービス
y_sera15
0
160
ファミコンでPHPを動かす / PHP on the Famicom side b
tomzoh
0
140
"優秀な誰か"の下位互換にならないために
yut0naga1_fa
1
1.7k
メルペイ 会計システム概要と歴史
mewuto
0
210
実践!Cloud Run ハンズオン!! / Cloud Run handson
y0hgi
0
210
並行性の問題を防げ!実践トランザクション入門
occhi
0
280
ai_cording_with_k8s_knowledge.pdf
mochizuki875
1
330
AIは爆速なのに、私が詰まっていた話 ― 音声入力と鳴くマスコットでボトルネックを削る
yama3133
0
610
Post AI時代のリファクタリング実践記 / Refactoring in the post AI era
kaminashi
1
130
LocalStack を使ったサーバーレスアプリケーション開発 / Serverless Development with LocalStack
kakakakakku
1
390
Featured
See All Featured
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
470
Docker and Python
trallard
47
4.2k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
330
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Evolving SEO for Evolving Search Engines
ryanjones
0
320
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
470
The Curse of the Amulet
leimatthew05
3
15k
Facilitating Awesome Meetings
lara
57
7.2k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.5k
Transcript
登壇その後 - ZJIT への興味と Hack - RubyKaigi 2026 follow up
| 2026-09-05 Daichi Kamiyama (@_dak2_)
1 自己紹介
自己紹介 Daichi Kamiyama(@_dak2_) • • 株式会社タイミー バックエンド / 新規事業開発
来年の RubyKaigi 2027 予習をしました Hideji Beer / 日向夏ラガー
2 本編
本日のお品書き • 登壇の振り返り • ZJIT への興味 • 今後
None
興味を引かれた セッションがあった
None
FFI スタイルの Ruby を C 拡張に自動変 換する FFX + ZJIT
トランポリンの jump 命令の直後に型情 報を仕込み、ZJIT のコンパイル時だけ読 む
興味深い Hack だった かっこいい!!!
ZJIT は型をどう扱ってる? 気になって読み始めた
つまり、あまり自分の発表に 関する進捗はありません!
3 ZJIT の仕組み
YARV bytecode HIR (SSA) optimize() LIR
機械語
• 何度か実行し、型を観測(プロファイ ル) • 「この値は◦◦型」を収集 • それを根拠に速い機械語を吐く
4 例: 割り算を速く
None
プロファイルの結果、`a` も `b` も `Integer` だった。 じゃあ CPU の割り算命令を直接呼び出 す形に置き換えていい?
ちょっと待って、 Integer って2種類ある
• Fixnum ◦ 63ビット 符号付き整数 ◦ ポインタ埋め込みの値 • Bignum ◦
多倍長 ◦ ヒープ上
• CRuby ◦ 実行時に値を見て判断(FIXNUM_P) • ZJIT ◦ コンパイル時に解決したい
Fixnum か Bignum の 判別を型レベルで表現
None
• u64 は 64ビット の符号なし整数 • 1u64 は u64 型の整数リテラル
• << はシフト演算
• コンパイル時には「この値が取りうる 型」を1つに断定できない ◦ → 型を「可能性の集合」として持つ
5 割り算が Fixnum にならない
• さっきの `div`、Fixnum / Fixnum の 結果も必ず Fixnum? • 割り算は絶対値が小さくなるから、ほ
ぼ Yes
• FIXNUM_MIN / -1 が例外 ◦ Fixnum の範囲は負側が 1 つ広い(2
の補 数) ◦ 最小値の符号反転だけ溢れる
桁あふれしてBignum
ZJIT は HIR の命令に「結果の型」を宣言してい る 下流の最適化が「Fixnum 確定」と信じて guard を消していた =
miscompile
• Expected ◦ 0 • Actual ◦ false
6 FixnumDiv の戻 り値の型を直す
https://github.com/ruby/ruby/pull/17165
面白い
• 実行時プロファイルして型をハンドリ ングする奥深さ • 必要に応じてインタプリタへside exit する、安全側に倒す設計
7 とはいえ
Method-Ray(自作型検査器)を改善 するための準備もしていました
None
Ruby RBS の crate を拡 充する 自分の gem で使いたい強い気持ちがある
8 まとめ
実装を読んで小さな違和感を 追うと、Ruby本体への貢献 につながる
Hack 楽しんでいきたい
カジュアル面談はこちらから!