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
PHP で JVM を実装して、 HelloWorld を出力してみる
Search
memory
PRO
February 09, 2020
Programming
4.9k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
PHP で JVM を実装して、 HelloWorld を出力してみる
- PHPerKaigi 2020
- English Title:
Implement JVM with PHP and try to output Hello World
memory
PRO
February 09, 2020
Transcript
125 slides
/ / 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
More Decks by memory
See All by memory
AI 時代のスタートアップエコシステ厶から考究する技術的負債との向き合い方
m3m0r7
PRO
3
3.9k
pnl で簡易的に作る PHP ネイティブアプリケーション
m3m0r7
PRO
0
110
セグメントとターゲットを意識するプロポーザルの書き方 〜採択の鍵は、誰に刺すかを見極めるマーケティング戦略にある〜
m3m0r7
PRO
1
1.3k
PHP で mp3 プレイヤーを実装しよう
m3m0r7
PRO
0
650
PHP でエミュレータを自作して Ubuntu を動かそう
m3m0r7
PRO
2
380
AI 時代だからこそ学ぶべき PHP の基礎
m3m0r7
PRO
7
2.7k
JVM の仕組みを理解して PHP で実装してみよう
m3m0r7
PRO
1
710
コードゴルファー道
m3m0r7
PRO
0
700
ChatGPT とつくる PHP で OS 実装
m3m0r7
PRO
2
590
Other Decks in Programming
See All in Programming
Distance field of Julia set
kinakomoti321
0
330
Vue.jsで作る空間解析アプリとCapacitorプラグインのData Bridge
hal_spidernight
1
180
DroidKnights 2026 Android A2UI Jetpack Compose 기반의 안전한 AI UI 렌더링 - 박제창
itsmedreamwalker
1
260
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
1k
Kotlin JVM用に作られたライブラリのKMPを前提とした再設計
jsoizo
0
220
SFCで実現する病院・医療システムの動的組み立て式UI
koukimiura
1
190
imagewebp()の向こう側: WebPはなぜ JPEG・PNGより軽いのか
yuzneri
0
140
Rails初心者がパスキーを実装してみて大変だったこと
ktombow
0
230
Goコンパイラを作ってGoをもっと理解する / Build a Go compiler to better understand Go
ikura_hamu
0
130
読みやすい!と評判(?)の発表の準備にかける私のこだわり
shoheimitani
0
120
Spec-Driven Development - Why Vaadin Is the Perfect Fit
simas
PRO
0
260
AppFunctionsの内部実装を紐解く
hiroaki404
0
110
Featured
See All Featured
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
330
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
310
Claude Code のすすめ
schroneko
67
230k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
エンジニアに許された特別な時間の終わり
watany
109
250k
Building Applications with DynamoDB
mza
96
7.3k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.9k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
61k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
77k
Why Our Code Smells
bkeepers
PRO
340
58k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
380