Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Graal VM: Multi-Language Execution Platform

2,709 views

Published on

Updates on the current status of Graal VM, a platform dedicated to run multiple programming languages at excellent performance. Experimental binaries are available from http://www.oracle.com/technetwork/oracle-labs/program-languages/overview/index.html.

Published in: Software
  • Be the first to comment

Graal VM: Multi-Language Execution Platform

  1. 1. One VM To Rule Them All Thomas Wuerthinger @thomaswue Oracle Labs Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
  2. 2. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 2
  3. 3. 3 Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 3 Goal:
  4. 4. You can execute any language on the JVM / CLR -­‐ as long as it looks like Java / C#. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 4
  5. 5. Prototype a new language Parser and language work to build syntax tree (AST), AST Interpreter People complain about performance Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 5 Write a “real” VM In C/C++, sXll using AST interpreter, spend a lot of Xme implemenXng runXme system, GC, … Define a bytecode format and write bytecode interpreter Performance is sXll bad Write a JIT compiler Improve the garbage collector
  6. 6. Prototype a new language Parser and language work to build syntax tree (AST), AST Interpreter People complain about performance Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 6 Write a “real” VM In C/C++, sXll using AST interpreter, spend a lot of Xme implemenXng runXme system, GC, … People start using it Define a bytecode format and write bytecode interpreter Performance is sXll bad Write a JIT compiler Improve the garbage collector
  7. 7. Speculate and OpXmize… G G Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 7 U U U U U I I I G I I I G Node Rewriting for Profiling Feedback AST Interpreter Rewritten Nodes AST Interpreter Uninitialized Nodes Compilation using Partial Evaluation Compiled Code Node Transitions S U I D String Double G Uninitialized Integer Generic
  8. 8. DeopXmize and ReopXmize… G G Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 8 I G I I G I G I I G Deoptimization to AST Interpreter D I D G D I D G Node Rewriting to Update Profiling Feedback Recompilation using Partial Evaluation
  9. 9. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Graal VM • A new JIT compiler for Java wriben in Java. • Designed for mulX-­‐language performance. • Downloadable from the Oracle Technology Network (OTN) with Java and JavaScript support. C
  10. 10. Ruby R Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 10 Graal Truffle Java Scala JavaScript Python Smalltalk C J Parallel Graph AnalyXcs
  11. 11. Written by: Written in: Guest Language Application Guest Language Implementation Host Services Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 11 OS Application Developer Language Developer VM Expert Guest Language Managed Host Language Managed Host Language or Unmanaged Language Unmanaged Language (typically C or C++) OS Expert
  12. 12. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Languages – Special Aspects • Everything is a map… • Everything is a map and every operaXon a funcXon call… • Everything is a map and every operaXon a funcXon call and everything is a vector…
  13. 13. Performance – Java and Scala Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 13 2.5 2 1.5 1 0.5 0 Java Scala graal server DaCapo benchmarks -­‐ Normalized versus client compiler
  14. 14. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 14 7 6 5 4 3 2 1 0 Graal/JS V8 Performance – JavaScript
  15. 15. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 15 FFI? C
  16. 16. Cross-­‐Language Inlining Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 16
  17. 17. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 17 1x! 1x! 8x! 11x! 32x! 35! 30! 25! 20! 15! 10! 5! 0! MRI! JRuby! Graal/Ruby! MRI + C! Graal/Ruby + Graal/C! speedup relative to MRI! Image Processing Composite Speedup!
  18. 18. High-­‐Performance Language Interoperability Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 1200 1000 800 600 400 200 0 Ruby data JS data C data Ruby program JS program C program C • Scores for mixing Ruby/JS/C execuXng the scimark benchmarks.
  19. 19. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 19 • Graal VM Binaries for Java and JavaScript hbp://www.oracle.com/technetwork/oracle-­‐labs/program-­‐languages • Graal and Truffle API hbp://openjdk.java.net/projects/graal/ • FastR hbps://bitbucket.org/allr/fastr • TruffleRuby hbps://github.com/jruby/jruby/wiki/Truffle • ZipPy hbps://bitbucket.org/ssllab/zippy • Other projects for Smalltalk, Clojure, Lua, …
  20. 20. Safe Harbor Statement The preceding is intended to provide some insight into a line of research in Oracle Labs. It is intended for informaXon purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or funcXonality, and should not be relied upon in making purchasing decisions. The development, release, and Xming of any features or funcXonality described in connecXon with any Oracle product or service remains at the sole discreXon of Oracle. Any views expressed in this presentaXon are my own and do not necessarily reflect the views of Oracle. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 20
  21. 21. Q/A @thomaswue Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
  22. 22. Copyright © 2014 Oracle and/or its affiliates. All rights reserved.

×