Slide 1

Slide 1 text

/ / PHPerKaigi PHP JVM HelloWorld © - BASE, Inc.

Slide 2

Slide 2 text

© - BASE, Inc. Who am I? (@m m r ) BASE 6 SDVX

Slide 3

Slide 3 text

© - BASE, Inc. Who am I?

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

© - BASE, Inc. PHPerKaigi Builderscon

Slide 6

Slide 6 text

© - BASE, Inc. php-java/php-java

Slide 7

Slide 7 text

OSS

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

© - BASE, Inc. JVM PHP

Slide 10

Slide 10 text

© - BASE, Inc. Hello World

Slide 11

Slide 11 text

JVM

Slide 12

Slide 12 text

JVM

Slide 13

Slide 13 text

© - BASE, Inc. JVM JVM Java Virtual Machine Java JVM JRE JDK

Slide 14

Slide 14 text

JVM

Slide 15

Slide 15 text

Slide 16

Slide 16 text

Slide 17

Slide 17 text

© - BASE, Inc. JVM Java class class JVM

Slide 18

Slide 18 text

© - BASE, Inc. JVM JVM Java Virtual Machine Specification Oracle

Slide 19

Slide 19 text

© - BASE, Inc. JVM

Slide 20

Slide 20 text

© - BASE, Inc. JVM Java class

Slide 21

Slide 21 text

© - BASE, Inc. JVM

Slide 22

Slide 22 text

© - BASE, Inc. JVM class

Slide 23

Slide 23 text

JVM

Slide 24

Slide 24 text

© - BASE, Inc. Perl PHP JavaScript / Builderscon YAPC::Kyoto PHPerKaigi Qiita JVM

Slide 25

Slide 25 text

JVM

Slide 26

Slide 26 text

© - BASE, Inc. Rust Emacs Go Ruby rchaser gongoZ DQNEO Daiki Miura JVM

Slide 27

Slide 27 text

JVM

Slide 28

Slide 28 text

JVM,

Slide 29

Slide 29 text

PHP

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

© - BASE, Inc. fopen / fread OK

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

© - BASE, Inc. 16 short, unsigned short, integer, unsigned integer pack / unpack JVM

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

PHP

Slide 36

Slide 36 text

© - BASE, Inc. PHP int (- ^ ^ - ) bool string float, double array null etc...

Slide 37

Slide 37 text

Java

Slide 38

Slide 38 text

© - BASE, Inc. Java byte char short (- ^ ^ - ) int (- ^ ^ - ) long (- ^ ^ - ) boolean float double

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

PHP Java

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

© - BASE, Inc. ( ) JVM invokevirtual iload / istore

Slide 44

Slide 44 text

Hello World

Slide 45

Slide 45 text

Java Virtual Machine Specification

Slide 46

Slide 46 text

© - BASE, Inc. JVM Spec Java Virtual Machine Specification JVM Spec JVM Spec Oracle JVM https://docs.oracle.com/javase/specs/ index.html

Slide 47

Slide 47 text

ClassFile Structure

Slide 48

Slide 48 text

© - BASE, Inc. ClassFile Structure

Slide 49

Slide 49 text

© - BASE, Inc. ClassFile Structure

Slide 50

Slide 50 text

© - BASE, Inc. JVM Spec u unsigned int u unsigned short

Slide 51

Slide 51 text

Hello World

Slide 52

Slide 52 text

© - BASE, Inc. Constant Pool Method Info Code Attribute Hello World

Slide 53

Slide 53 text

Method Info

Slide 54

Slide 54 text

© - BASE, Inc. Method Info

Slide 55

Slide 55 text

© - BASE, Inc. Method Info

Slide 56

Slide 56 text

Code Attribute

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

© - BASE, Inc. Code Attribute

Slide 59

Slide 59 text

© - BASE, Inc. Code Attribute

Slide 60

Slide 60 text

© - BASE, Inc. Code Attribute

Slide 61

Slide 61 text

© - BASE, Inc. Code Attribute

Slide 62

Slide 62 text

© - BASE, Inc. Code Attribute

Slide 63

Slide 63 text

© - BASE, Inc. Code Attribute

Slide 64

Slide 64 text

© - BASE, Inc. Code Attribute

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

© - BASE, Inc. JVM Spec code[code_length] JVM Spec

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

No content

Slide 69

Slide 69 text

No content

Slide 70

Slide 70 text

© - BASE, Inc. java.lang.System.out getstatic println invokevirtual

Slide 71

Slide 71 text

© - BASE, Inc. Constant Pool ldc return

Slide 72

Slide 72 text

4

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

getstatic

Slide 75

Slide 75 text

© - BASE, Inc. getstatic getstatic getstatic Constant Pool unsigned short

Slide 76

Slide 76 text

© - BASE, Inc. getstatic getstatic <0xB > putstatic

Slide 77

Slide 77 text

© - BASE, Inc. getstatic

Slide 78

Slide 78 text

© - BASE, Inc. getstatic

Slide 79

Slide 79 text

© - BASE, Inc. getstatic

Slide 80

Slide 80 text

© - BASE, Inc. getstatic

Slide 81

Slide 81 text

© - BASE, Inc. getstatic

Slide 82

Slide 82 text

© - BASE, Inc. getstatic

Slide 83

Slide 83 text

© - BASE, Inc. getstatic

Slide 84

Slide 84 text

invokevirtual

Slide 85

Slide 85 text

© - BASE, Inc. invokevirtual invokevirtual Constant Pool

Slide 86

Slide 86 text

© - BASE, Inc. invokevirtual invokevirtual <0xB > invoke dynamic, special, interface, static

Slide 87

Slide 87 text

© - BASE, Inc. invokevirtual invoke JVM invoke invokedynamic invokeinterface

Slide 88

Slide 88 text

© - BASE, Inc. invokevirtual

Slide 89

Slide 89 text

© - BASE, Inc. invokevirtual

Slide 90

Slide 90 text

© - BASE, Inc. invokevirtual

Slide 91

Slide 91 text

© - BASE, Inc. invokevirtual

Slide 92

Slide 92 text

© - BASE, Inc. invokevirtual

Slide 93

Slide 93 text

© - BASE, Inc. invokevirtual

Slide 94

Slide 94 text

© - BASE, Inc. invokevirtual void

Slide 95

Slide 95 text

ldc

Slide 96

Slide 96 text

© - BASE, Inc. ldc ldc Constant Pool UTF Integer, short, byte Constant Pool unsigned byte

Slide 97

Slide 97 text

© - BASE, Inc. ldc ldc Long Double

Slide 98

Slide 98 text

© - BASE, Inc. ldc

Slide 99

Slide 99 text

© - BASE, Inc. ldc Constant Pool

Slide 100

Slide 100 text

© - BASE, Inc. ldc Constant Pool

Slide 101

Slide 101 text

© - BASE, Inc. ldc

Slide 102

Slide 102 text

return

Slide 103

Slide 103 text

© - BASE, Inc. return return void moniterenter return areturn, ireturn, freturn, dreturn

Slide 104

Slide 104 text

Hello World

Slide 105

Slide 105 text

© - BASE, Inc. Hello World B NN MM NN B NN MM B

Slide 106

Slide 106 text

© - BASE, Inc. Hello World B NN MM NN B NN MM B getstatic

Slide 107

Slide 107 text

© - BASE, Inc. Hello World B NN MM NN B NN MM B unsigned short

Slide 108

Slide 108 text

© - BASE, Inc. Hello World B NN MM NN B NN MM B ldc

Slide 109

Slide 109 text

© - BASE, Inc. Hello World B NN MM NN B NN MM B unsigned byte Hello World Constant Pool

Slide 110

Slide 110 text

© - BASE, Inc. Hello World B NN MM NN B NN MM B invokevirtual

Slide 111

Slide 111 text

© - BASE, Inc. Hello World B NN MM NN B NN MM B unsigned short Constant Pool

Slide 112

Slide 112 text

© - BASE, Inc. Hello World B NN MM NN B NN MM B return

Slide 113

Slide 113 text

No content

Slide 114

Slide 114 text

"java.lang.System"

Slide 115

Slide 115 text

© - BASE, Inc. "java.lang.System" Java java.lang.System PHP "java\lang\System" System "out"

Slide 116

Slide 116 text

© - BASE, Inc. "java.lang.System" ;

Slide 117

Slide 117 text

"out"

Slide 118

Slide 118 text

© - BASE, Inc. "out" PHP JVM static

Slide 119

Slide 119 text

© - BASE, Inc. "out"

Slide 120

Slide 120 text

© - BASE, Inc. "out"

Slide 121

Slide 121 text

"println" "java.io.PrintStream"

Slide 122

Slide 122 text

© - BASE, Inc. "java.io.PrintStream"

Slide 123

Slide 123 text

Hello World

Slide 124

Slide 124 text

DEMO

Slide 125

Slide 125 text

THANK YOU FOR YOUR LISTENING