GraalVM
Oracle Code One in 2018/11/17
LINE Fukuoka
•
• LINE Fukuoka
• @kis
• Oracle Code One
• Oracle Code One
• GraalVM
• GraalVM
Oracle Code One
• JavaOne
• Java
• Sun Francisco Moscone Center West
• Beck
• Marriortt
•
Marriott
• Marriott Westin
• One Job Enough
•
( )
•
• → → →
• 2
• JDK11 with JShell(120 )
•
(45 )
https://qiita.com/nowokay/items/80e8ccd50f6749846dd6
GraalVM
• Oracle JVM
• http://www.graalvm.org/
• Graal + Truffle
• Polyglot
• JS, Python, Ruby, …
•
GraalVM and MicroProfile: A Polyglot Microservices Solution [DEV6016]
Graal
• Java JIT
• C2
Client(C1) Server(C2)
Compiler Interface
HotSpot
Graal
JVMCI
HotSpot
Written in Java
Truffle Sulong
• Truffle
•
• AST GC
• LLVM
• Sulong
• LLVM bitcode -> Truffle AST
• LLVM
• Rust, Swift, C…
Polyglot
• Truffle
• JavaScript(Graal JS), Ruby(TruffleRuby), Python, R…
•
•
• Oracle MySQL SQL JavaScript
• Java
• SubstrateVM
Instant Startup and Low Footprint for Java [DEV5705]
GraalVM in Oracle Code One 2018
• graal 10
• Vision and Roadmap
• GraalVM JavaScript
vue ( )
GraalVM
• JVM
• Polyglot
• LLVM
•
• See also
• Ten Things You Can Do with GraalVM - BYOL [HOL5576]
• Instant Startup and Low Footprint for Java [DEV5705]
VM
• JIT
• Also available with JDK11
java -XX:+UnlockExperimentalVMOptions
-XX:+EnableJVMCI
-XX:+UseJVMXCICompiler Hello
• Oracle Code One
•
•
0
2
4
6
8
10
12
14
16
18
( )
JDK8 JDK11 JDK11+Graal GraalVM
https://github.com/kishida/smallpt4j/blob/original/src/main/java/naoki/smallpt/SmallPT.java
•
• Graal
• Graal
• JIT Graal
2172 5376 1 org.graalvm.compiler.lir.amd64.AMD64Move::canMoveConst2Stack (81 bytes)
2172 5377 1 org.graalvm.compiler.core.amd64.AMD64NodeMatchRules$1::<init> (50 bytes)
2172 5385 1 org.graalvm.compiler.core.common.type.ObjectStamp::getLIRKind (7 bytes)
2172 5386 1 org.graalvm.compiler.core.amd64.AMD64ArithmeticLIRGenerator::emitAdd (232 bytes)
2174 5387 1 org.graalvm.compiler.lir.gen.LIRGenerator::emitJavaConstant (16 bytes)
2174 5378 1 org.graalvm.compiler.core.amd64.AMD64NodeMatchRules$1::evaluate (181 bytes)
2175 5388 1 org.graalvm.compiler.core.common.type.FloatStamp::getLIRKind (11 bytes)
2175 5392 3 org.graalvm.collections.EconomicMapImpl$1::iterator (9 bytes)
2175 5393 3 org.graalvm.collections.EconomicMapImpl$1$1::<init> (15 bytes)
Polyglot
• JavaScript Java
$ js --jvm --polyglot
> var BigInteger = Java.type(‘BigInteger’)
> BigInteger.valueOf(123).pow(10).toString()
• JavaScript Ruby
> Interop.eval(‘ruby’, ‘print “hello”’)
LLVM
• Rust
$ rustc --emit=llvm-bc main.rs
$ lli --lib $(rustc --print sysroot)/lib/libstd-* main.bc
•
$ native-image Hello
$ ./Hello
•
• 46 (JDK11 11 , GraalVM 17 )
• ->10MB
• GraalVM 1.0 RC1
ImageIO
graaldemo $ time java Hello
Hello!
real 0m0.103s
user 0m0.068s
sys 0m0.025s
graaldemo $ time ./hello
Hello!
real 0m0.013s
user 0m0.005s
sys 0m0.006s
• GraalVM

GraalVMについて

  • 1.
    GraalVM Oracle Code Onein 2018/11/17 LINE Fukuoka
  • 2.
    • • LINE Fukuoka •@kis • Oracle Code One
  • 3.
    • Oracle CodeOne • GraalVM • GraalVM
  • 4.
    Oracle Code One •JavaOne • Java • Sun Francisco Moscone Center West • Beck
  • 5.
  • 6.
    Marriott • Marriott Westin •One Job Enough • ( )
  • 7.
  • 8.
    • 2 • JDK11with JShell(120 ) • (45 ) https://qiita.com/nowokay/items/80e8ccd50f6749846dd6
  • 9.
    GraalVM • Oracle JVM •http://www.graalvm.org/ • Graal + Truffle • Polyglot • JS, Python, Ruby, … •
  • 10.
    GraalVM and MicroProfile:A Polyglot Microservices Solution [DEV6016]
  • 11.
    Graal • Java JIT •C2 Client(C1) Server(C2) Compiler Interface HotSpot Graal JVMCI HotSpot Written in Java
  • 12.
    Truffle Sulong • Truffle • •AST GC • LLVM • Sulong • LLVM bitcode -> Truffle AST • LLVM • Rust, Swift, C…
  • 13.
    Polyglot • Truffle • JavaScript(GraalJS), Ruby(TruffleRuby), Python, R… • • • Oracle MySQL SQL JavaScript
  • 14.
    • Java • SubstrateVM InstantStartup and Low Footprint for Java [DEV5705]
  • 15.
    GraalVM in OracleCode One 2018 • graal 10 • Vision and Roadmap • GraalVM JavaScript vue ( )
  • 16.
    GraalVM • JVM • Polyglot •LLVM • • See also • Ten Things You Can Do with GraalVM - BYOL [HOL5576] • Instant Startup and Low Footprint for Java [DEV5705]
  • 17.
    VM • JIT • Alsoavailable with JDK11 java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMXCICompiler Hello • Oracle Code One
  • 18.
    • • 0 2 4 6 8 10 12 14 16 18 ( ) JDK8 JDK11JDK11+Graal GraalVM https://github.com/kishida/smallpt4j/blob/original/src/main/java/naoki/smallpt/SmallPT.java
  • 19.
    • • Graal • Graal •JIT Graal 2172 5376 1 org.graalvm.compiler.lir.amd64.AMD64Move::canMoveConst2Stack (81 bytes) 2172 5377 1 org.graalvm.compiler.core.amd64.AMD64NodeMatchRules$1::<init> (50 bytes) 2172 5385 1 org.graalvm.compiler.core.common.type.ObjectStamp::getLIRKind (7 bytes) 2172 5386 1 org.graalvm.compiler.core.amd64.AMD64ArithmeticLIRGenerator::emitAdd (232 bytes) 2174 5387 1 org.graalvm.compiler.lir.gen.LIRGenerator::emitJavaConstant (16 bytes) 2174 5378 1 org.graalvm.compiler.core.amd64.AMD64NodeMatchRules$1::evaluate (181 bytes) 2175 5388 1 org.graalvm.compiler.core.common.type.FloatStamp::getLIRKind (11 bytes) 2175 5392 3 org.graalvm.collections.EconomicMapImpl$1::iterator (9 bytes) 2175 5393 3 org.graalvm.collections.EconomicMapImpl$1$1::<init> (15 bytes)
  • 20.
    Polyglot • JavaScript Java $js --jvm --polyglot > var BigInteger = Java.type(‘BigInteger’) > BigInteger.valueOf(123).pow(10).toString() • JavaScript Ruby > Interop.eval(‘ruby’, ‘print “hello”’)
  • 21.
    LLVM • Rust $ rustc--emit=llvm-bc main.rs $ lli --lib $(rustc --print sysroot)/lib/libstd-* main.bc
  • 22.
    • $ native-image Hello $./Hello • • 46 (JDK11 11 , GraalVM 17 ) • ->10MB • GraalVM 1.0 RC1 ImageIO graaldemo $ time java Hello Hello! real 0m0.103s user 0m0.068s sys 0m0.025s graaldemo $ time ./hello Hello! real 0m0.013s user 0m0.005s sys 0m0.006s
  • 23.