GraalVM

From Wikipedia, the free encyclopedia
  (Redirected from Graal (compiler))
Jump to navigation Jump to search
GraalVM
Developer(s)Oracle Corporation
Preview release
19.0[1][2][3] / 9 May 2019; 2 months ago (2019-05-09)
Repository Edit this at Wikidata
Written inJava
Operating systemLinux and macOS[4]
PlatformJava Virtual Machine
TypeJava dynamic compiler and runtime
LicenseCommunity Edition: GPLv2[5][6] Enterprise Edition: Trialware
Websitewww.graalvm.org

GraalVM is a Java VM and JDK based on HotSpot/OpenJDK, implemented in Java. It supports additional programming languages and execution modes, like ahead-of-time compilation of Java applications for fast startup and low memory footprint. The first production-ready version, GraalVM 19.0, was released in May 2019[1].

Major differentiators of GraalVM compared to the base JDK are:

  • GraalVM Compiler, a JIT compiler for Java
  • GraalVM Native Image, allowing the ahead-of-time compilation of Java applications
  • Truffle Language Implementation framework and the GraalVM SDK, to implement additional programming language runtimes
  • LLVM Runtime and JavaScript Runtime

Project goals[edit]

One objective of GraalVM is to improve the performance of Java virtual machine-based languages to match the performance of native languages.[7][8] Another goal is to reduce the startup time of JVM-based applications by compiling them ahead-of-time with GraalVM Native Image technology. A third goal is to enable GraalVM integration into the Oracle Database, OpenJDK, Node.js, Android/iOS, and to support similar custom embeddings. A fourth goal is to allow freeform mixing of code from any programming language in a single program, billed as "polyglot applications".[7][9] A last goal is to include an easily extended set of "polyglot programming tools".[7][10]

Releases[edit]

GraalVM is a production-ready software and is available as Community Edition for an open-source license and as Oracle GraalVM Enterprise Edition accessible by accepting OTN License Agreement Oracle GraalVM Enterprise Edition Including License for Early Adopter Versions. Oracle Corporation announced the release of Oracle GraalVM Enterprise Edition on 8 May, 2019. GraalVM can substitute a default JDK on Linux and macOS platforms on x86 64-bit systems. The support on Windows is currently under development and released as an early adopter functionality in GraalVM 19.0.

GraalVM 19.0 is based on top of JDK version 8u212.

Components[edit]

GraalVM is shipped with the components of a normal Java virtual machine (OpenJDK). Additional components are included in GraalVM to support new execution modes (GraalVM Native Image) or programming languages (LLVM runtime, GraalVM JavaScript as a potential replacement to the deprecated Nashorn engine, TRegex as a regular expression engine).

GraalVM Compiler[edit]

The GraalVM Compiler is a modern Java just-in-time compiler. It complements or replaces the existing compilers (C1/C2 in HotSpot). In contrast to those existing compilers, the GraalVM compiler is written in modular, maintainable and extendable fashion in Java itself.

It is released under GPL version 2 with the classpath exception.

GraalVM Native Image[edit]

GraalVM Native Image is an ahead-of-time compilation technology that produces executable binaries of class files. It is released as an early adopter plugin, which means it is production-ready but may include backport incompatible updates in the future releases.

This functionality supports JVM-based languages, but can optionally execute dynamic languages, developed on top of GraalVM with Truffle framework. The executable file does not run on a JVM and uses necessary runtime components as thread scheduling or GC from “Substrate VM” - a trivial version of a virtual machine. Since the resulting native binary includes application classes, JDK dependencies and libraries already, the startup and execution time reduces significantly.

GraalVM Native Image is officially supported by Helidon, Quarkus and Micronaut Java microservices frameworks. The support for Spring Boot applications is under development. In September 2016, Oracle detailed plans to add ahead-of-time compilation to the OpenJDK using the GraalVM compiler for Java 9.[11][12] This proposal, tracked by the JEP 295: Ahead-of-Time Compilation, was included in Java 9.[13] The experimental use of GraalVM as a just-in-time compiler was added for the Linux x86-64 platform for Java 10.[14]

Truffle Language Implementation Framework[edit]

In association with GraalVM, Oracle Labs developed a language abstract syntax tree interpreter called "Truffle" which would allow it to implement languages on top of the GraalVM.[15][16]

The Truffle framework and its dependent part, GraalVM SDK, are released under Universal Permissive License version 1.0 to encourage use of the framework for projects which do not want to be bound by the copyright or other parent rights.

Instrumentation-based Tool Support[edit]

A major advantage of the GraalVM ecosystem is language-agnostic, fully dynamic instrumentation support built-in directly into the VM runtime. Execution events can be captured by API clients with overhead that is extremely low in fully optimized code.[17][18]

The core GraalVM installation provides a language-agnostic debugger, profiler, heap viewer, and others based on instrumentation and other VM support.[10] GraalVM also includes a backend implementation of the Chrome Inspector remote debugging protocol.[19] Although designed originally for JavaScript debugging, it can be used to debug all GraalVM languages from a browser.

Language and Runtime Support[edit]

GraalVM is written in and for the Java ecosystem. It can execute applications written in all languages that compile to the Java bytecode format, e.g. Java, Scala, Kotlin, and more.

Based on Truffle Language Implementation framework additional languages can be supported in GraalVM.

  • GraalVM JavaScript[20]: ECMAScript 2019 compliant JavaScript runtime, with support for Node.js
  • TruffleRuby[21]: Ruby language implementation with preliminary support for Ruby on Rails
  • FastR[22]: R language implementation
  • GraalVM Python[23]: Python 3 language implementation
  • GraalVM LLVM Runtime (SuLong)[24]: LLVM bitcode interpreter implementation

Support for additional languages can be implemented by users of GraalVM.

References[edit]

  1. ^ a b "For Building Programs That Run Faster Anywhere: Oracle GraalVM Enterprise Edition". Oracle Corporation. Retrieved 2019-05-09.
  2. ^ https://github.com/oracle/graal/releases
  3. ^ https://www.oracle.com/technetwork/graalvm/downloads/index.html
  4. ^ https://www.graalvm.org/downloads/
  5. ^ "GraalVM FAQ". Retrieved 2018-04-25.
  6. ^ "graal/README.md". Retrieved 2018-04-25.
  7. ^ a b c "Why GraalVM". Retrieved 2018-04-25.
  8. ^ "Graal : Un compilateur dynamique pour Java". lemondeinformatique.fr. 2012-02-13. Retrieved 2013-08-23.
  9. ^ "Reference Manual for Polyglot Applications". Retrieved 2018-04-25.
  10. ^ a b "GraalVM Debugging and Monitoring Tools". www.graalvm.org. Retrieved 2019-04-08. GraalVM provides a set of tools for developers, integrators, and IT administrators to debug and monitor GraalVM and deployed applications.
  11. ^ "Ahead-of-Time (AOT) Compilation May Come to OpenJDK HotSpot in Java 9". InfoQ.com. 2016-10-01. Retrieved 2016-10-06. AOT brings about a new tool called ‘jaotc' which uses Graal as the backend (to generate code)
  12. ^ Vladimir Kozlov (2016-09-14). "JDK-8166089: Ahead-of-Time Compilation". Oracle Corporation. Retrieved 2016-10-06. Compile an application's Java classes to native code prior to launching the virtual machine.
  13. ^ Vladimir Kozlov (2016-10-13). "JEP 295: Ahead-of-Time Compilation". Oracle Corporation. Retrieved 2016-10-13. Compile Java classes to native code prior to launching the virtual machine.
  14. ^ Vladimir Kozlov (2017-10-20). "JEP 317: Experimental Java-Based JIT Compiler". Oracle Corporation. Retrieved 2018-01-21. JEP 317: Experimental Java-Based JIT Compiler
  15. ^ "Truffle: A Self-Optimizing Runtime System" (PDF). Oracle Corporation. Retrieved 2013-08-23.
  16. ^ "Truffle served in a Holy Graal: Graal and Truffle for polyglot language interpretation on the JVM". 2017-12-05. Retrieved 2018-04-25.
  17. ^ Van De Vanter, Michael; Seaton, Chris; Haupt, Michael; Humer, Christian; Würthinger, Thomas (March 9, 2018). "Fast, Flexible, Polyglot Instrumentation Support for Debuggers and other Tools" (PDF). The Art, Science, and Engineering of Programming. 2 (3, Article 14): 30. doi:10.22152/programming-journal.org/2018/2/14.
  18. ^ "Getting started with Instruments in GraalVM". www.graalvm.org. Retrieved 2019-04-08. Truffle instruments can track very fine-grained VM-level runtime events to profile, inspect, and analyze the runtime behavior of applications running on GraalVM.
  19. ^ "Chrome DevTools". developers.google.com. Retrieved 2019-04-08. Chrome DevTools is a set of web developer tools built directly into the Google Chrome browser. DevTools can help you edit pages on-the-fly and diagnose problems quickly, which ultimately helps you build better websites, faster.
  20. ^ GraalVM JavaScript github repository
  21. ^ TruffleRuby github repository
  22. ^ GraalVM FastR github repository
  23. ^ GraalPython github repository
  24. ^ GraalVM LLVM Runtime github repository

External links[edit]