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
PHP で JVM を実装して、 HelloWorld を出力してみる
Search
memory
PRO
February 09, 2020
Programming
2
4.1k
PHP で JVM を実装して、 HelloWorld を出力してみる
- PHPerKaigi 2020
- English Title:
Implement JVM with PHP and try to output Hello World
memory
PRO
February 09, 2020
Tweet
Share
More Decks by memory
See All by memory
二郎系ラーメンのコールで学ぶ AST 解析
memory1994
PRO
7
1.8k
RubyVM を PHP で実装する 〜Hello World を出力するまで〜
memory1994
PRO
1
560
令和最新版 PHP メモリ管理術
memory1994
PRO
5
3.3k
技術的負債が生まれる背景を理解して,アーリーからレイター向けの根本的なアプローチを考える
memory1994
PRO
23
8k
激辛のすゝめ
memory1994
PRO
1
530
RubyVM を PHP で実装する 〜Hello World を出力するまで〜
memory1994
PRO
1
5.7k
本当の FizzBuzz をお見せします
memory1994
PRO
1
2k
千尋の谷に突き落とされても辛ければ逃げていい
memory1994
PRO
3
1.5k
CTO までのキャリアと転職活動における考え方の変化
memory1994
PRO
10
2.7k
Other Decks in Programming
See All in Programming
AppRouter Panel Talk
yosuke_furukawa
PRO
1
500
dbtのドメイン分割による データ基盤の改善とDigdagとの連携
sakama
0
470
大規模UIKitベースアプリへのTCAの段階的導入/gradual-adoption-of-tca-in-a-large-scale-uikit-based-app
takehilo
2
210
CDKコントリビュートの最初の壁を越えよう! -簡単issueの見つけ方-
badmintoncryer
3
350
PostmanでAPIの動作確認が楽になった話
h455h1
0
190
Compose-View Interop in Practice (mDevCamp 2024)
stewemetal
0
170
Revisiting the Hotwire Landscape after Turbo 8 @ RailsConf 2024, Detroit
marcoroth
0
210
Ruby Function Composition
bkuhlmann
1
340
冗長なエラーログを削減し、スタックトレースを手に入れる / Reducing Verbose Error Logs and Obtaining Stack Traces
upamune
0
1.1k
Node.js v22 で変わること
yosuke_furukawa
PRO
12
4.1k
Anthropic Cookbook のおすすめレシピ
schroneko
7
1.4k
Open AI APIを使う前に知っておきたいアカウントTier の話
akki_megane
0
110
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
21
3.9k
Ruby is Unlike a Banana
tanoku
96
10k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
26
2.3k
Optimising Largest Contentful Paint
csswizardry
13
2.4k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
242
1.2M
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
221
21k
The Art of Programming - Codeland 2020
erikaheidi
43
12k
RailsConf 2023
tenderlove
9
570
Product Roadmaps are Hard
iamctodd
45
9.8k
Into the Great Unknown - MozCon
thekraken
15
1k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
66
14k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
352
28k
Transcript
/ / PHPerKaigi PHP JVM HelloWorld © - BASE, Inc.
© - BASE, Inc. Who am I? (@m m r
) BASE 6 SDVX
© - BASE, Inc. Who am I?
None
© - BASE, Inc. PHPerKaigi Builderscon
© - BASE, Inc. php-java/php-java
OSS
None
© - BASE, Inc. JVM PHP
© - BASE, Inc. Hello World
JVM
JVM
© - BASE, Inc. JVM JVM Java Virtual Machine Java
JVM JRE JDK
JVM
<?php exec('java HelloWorld')
<?php exec('java HelloWorld')
© - BASE, Inc. JVM Java class class JVM
© - BASE, Inc. JVM JVM Java Virtual Machine Specification
Oracle
© - BASE, Inc. JVM
© - BASE, Inc. JVM Java class
© - BASE, Inc. JVM
© - BASE, Inc. JVM class
JVM
© - BASE, Inc. Perl PHP JavaScript / Builderscon YAPC::Kyoto
PHPerKaigi Qiita JVM
JVM
© - BASE, Inc. Rust Emacs Go Ruby rchaser gongoZ
DQNEO Daiki Miura JVM
JVM
JVM,
PHP
None
© - BASE, Inc. fopen / fread OK
None
© - BASE, Inc. 16 short, unsigned short, integer, unsigned
integer pack / unpack JVM
None
PHP
© - BASE, Inc. PHP int (- ^ ^ -
) bool string float, double array null etc...
Java
© - BASE, Inc. Java byte char short (- ^
^ - ) int (- ^ ^ - ) long (- ^ ^ - ) boolean float double
None
PHP Java
None
None
© - BASE, Inc. ( ) JVM invokevirtual iload /
istore
Hello World
Java Virtual Machine Specification
© - BASE, Inc. JVM Spec Java Virtual Machine Specification
JVM Spec JVM Spec Oracle JVM https://docs.oracle.com/javase/specs/ index.html
ClassFile Structure
© - BASE, Inc. ClassFile Structure
© - BASE, Inc. ClassFile Structure
© - BASE, Inc. JVM Spec u unsigned int u
unsigned short
Hello World
© - BASE, Inc. Constant Pool Method Info Code Attribute
Hello World
Method Info
© - BASE, Inc. Method Info
© - BASE, Inc. Method Info
Code Attribute
None
© - BASE, Inc. Code Attribute
© - BASE, Inc. Code Attribute
© - BASE, Inc. Code Attribute
© - BASE, Inc. Code Attribute
© - BASE, Inc. Code Attribute
© - BASE, Inc. Code Attribute
© - BASE, Inc. Code Attribute
None
© - BASE, Inc. JVM Spec code[code_length] JVM Spec
None
None
None
© - BASE, Inc. java.lang.System.out getstatic println invokevirtual
© - BASE, Inc. Constant Pool ldc return
4
None
getstatic
© - BASE, Inc. getstatic getstatic getstatic Constant Pool unsigned
short
© - BASE, Inc. getstatic getstatic <0xB > putstatic
© - BASE, Inc. getstatic
© - BASE, Inc. getstatic
© - BASE, Inc. getstatic
© - BASE, Inc. getstatic
© - BASE, Inc. getstatic
© - BASE, Inc. getstatic
© - BASE, Inc. getstatic
invokevirtual
© - BASE, Inc. invokevirtual invokevirtual Constant Pool
© - BASE, Inc. invokevirtual invokevirtual <0xB > invoke dynamic,
special, interface, static
© - BASE, Inc. invokevirtual invoke JVM invoke invokedynamic invokeinterface
© - BASE, Inc. invokevirtual
© - BASE, Inc. invokevirtual
© - BASE, Inc. invokevirtual
© - BASE, Inc. invokevirtual
© - BASE, Inc. invokevirtual
© - BASE, Inc. invokevirtual
© - BASE, Inc. invokevirtual void
ldc
© - BASE, Inc. ldc ldc Constant Pool UTF Integer,
short, byte Constant Pool unsigned byte
© - BASE, Inc. ldc ldc Long Double
© - BASE, Inc. ldc
© - BASE, Inc. ldc Constant Pool
© - BASE, Inc. ldc Constant Pool
© - BASE, Inc. ldc
return
© - BASE, Inc. return return void moniterenter return areturn,
ireturn, freturn, dreturn
Hello World
© - BASE, Inc. Hello World B NN MM NN
B NN MM B
© - BASE, Inc. Hello World B NN MM NN
B NN MM B getstatic
© - BASE, Inc. Hello World B NN MM NN
B NN MM B unsigned short
© - BASE, Inc. Hello World B NN MM NN
B NN MM B ldc
© - BASE, Inc. Hello World B NN MM NN
B NN MM B unsigned byte Hello World Constant Pool
© - BASE, Inc. Hello World B NN MM NN
B NN MM B invokevirtual
© - BASE, Inc. Hello World B NN MM NN
B NN MM B unsigned short Constant Pool
© - BASE, Inc. Hello World B NN MM NN
B NN MM B return
None
"java.lang.System"
© - BASE, Inc. "java.lang.System" Java java.lang.System PHP "java\lang\System" System
"out"
© - BASE, Inc. "java.lang.System" ;
"out"
© - BASE, Inc. "out" PHP JVM static
© - BASE, Inc. "out"
© - BASE, Inc. "out"
"println" "java.io.PrintStream"
© - BASE, Inc. "java.io.PrintStream"
Hello World
DEMO
THANK YOU FOR YOUR LISTENING