GraalVM

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.[8] The most recent version is GraalVM 20.2.0, made available in August 2020.

GraalVM
Developer(s)Oracle Corporation
Stable release
20.3.0[1][2][3] / November 17, 2020 (2020-11-17)[4]
Repository
Written inJava
Operating systemLinux, Windows and macOS[5]
PlatformJava Virtual Machine
TypeJava dynamic compiler and runtime
LicenseCommunity Edition: GPLv2[6][7] Enterprise Edition: Trialware
Websitewww.graalvm.org

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

A monolingual Graal is also included in HotSpot-based Java VM releases like OpenJDK since Java 9. The jaotc command creates a Native Image.[9] The experimental -XX:+EnableJVMCIProduct flag enables the use of Graal JIT.[10]

Project goals

  1. To improve the performance of Java virtual machine-based languages to match the performance of native languages.[11][12]
  2. To reduce the startup time of JVM-based applications by compiling them ahead-of-time with GraalVM Native Image technology.
  3. To enable GraalVM integration into the Oracle Database, OpenJDK, Node.js, Android/iOS, and to support similar custom embeddings.
  4. To allow freeform mixing of code from any programming language in a single program, billed as "polyglot applications".[11][13]
  5. To include an easily extended set of "polyglot programming tools".[11][14]

History

GraalVM has its roots in the Maxine Virtual Machine project at Sun Microsystems Laboratories (now Oracle Labs). The goal was to write a Java virtual machine in Java itself, hoping to free the development from the problems of developing in C++, particularly manual memory management, and benefit from meta-circular optimizations. Upon realizing that writing everything in Java was too ambitious as a first step, the decision was taken to focus on the compiler only and hook it into Hotspot, to reuse as much as possible the Hotspot runtime. The GraalVM compiler was started by manually converting the code of the Hotspot client compiler (named "C1") into Java, replacing the previous Maxine compiler.[15]

Releases

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.[16] GraalVM can substitute a default JDK on Linux and macOS platforms on x86 64-bit systems.

GraalVM 20

GraalVM 20.3.0

GraalVM 20.3.0 was released in November 2020.[17] It was marked as the first LTS enterprise version of GraalVM and as the final release for year 2020. This version supports code sharing in the GraalVM LLVM runtime, allowing the AST and compiled code of common bitcode libraries to be shared between multiple contexts within a single engine.

GraalVM 20.1.0

GraalVM 20.1.0 was released in May 2020.[18] It included several improvement for many of the components. Besides performance improvements, usability fixes for native-image were published. The JavaScript engine supports all ECMAScript 2020 mode features by default. The regular expression engine (TRegex) used by JavaScript and Python supports all expressions now. Ruby (TruffleRuby) improved in compatibility with native gems.

GraalVM 20.0.0

GraalVM 20.0.0 was released in February 2020.[19] It improved in its Windows support, brought an enhanced native-image tool and improved the tooling support, among many detailed changes in the Compiler and the supported languages.

GraalVM 19

GraalVM 19.0.0

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

The GraalVM compiler 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

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

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 the Fn, Gluon, Helidon, Micronaut, Picocli, Quarkus and Vert.x Java frameworks.[20] 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.[21][22] This proposal, tracked by the JEP 295: Ahead-of-Time Compilation, was included in Java 9.[23] The experimental use of GraalVM as a just-in-time compiler was added for the Linux x86-64 platform for Java 10.[24]

Truffle Language Implementation Framework

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.[25][26]

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

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.[27][28]

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

Language and Runtime Support

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.

Support for additional languages can be implemented by users of GraalVM. Some notable third-party language implementations are grCuda,[37] SOMns,[38] TruffleSqueak,[39][40] and Yona.[41]

References

  1. "GraalVM Release Notes: 20.3.0". Oracle Corporation. Retrieved 2020-06-03.
  2. "Releases - oracle/Graal - GitHub". 3 June 2020.
  3. "Oracle GraalVM Downloads".
  4. Github releases
  5. "Downloads".
  6. "GraalVM FAQ". Retrieved 2018-04-25.
  7. "graal/README.md". Retrieved 2018-04-25.
  8. "For Building Programs That Run Faster Anywhere: Oracle GraalVM Enterprise Edition". Oracle Corporation. Retrieved 2019-05-09.
  9. "OpenJDK: Graal". openjdk.java.net.
  10. "[JDK-8232118] Add JVM option to enable JVMCI compilers in product mode - Java Bug System". bugs.openjdk.java.net.
  11. "Why GraalVM". Retrieved 2018-04-25.
  12. "Graal : Un compilateur dynamique pour Java". lemondeinformatique.fr. 2012-02-13. Retrieved 2013-08-23.
  13. "Reference Manual for Polyglot Applications". Retrieved 2018-04-25.
  14. "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.
  15. https://web.archive.org/web/20200529203136/https://adambien.blog/roller/abien/entry/meta_circularity_is_near_graalvm
  16. "GraalVM 19.3: Announcing GraalVM 19.3 with JDK 11 Support". Oracle Corporation. Retrieved 2019-11-25.
  17. Šelajev, Oleg (2020-11-20). "GraalVM 20.3 is available". Medium. Retrieved 2020-12-31.
  18. GraalVM 20.1
  19. A look at GraalVM 20.0: better Windows support, better Native Images, better tooling
  20. "GraalVM Open Source Ecosystem". Oracle Corporation. Retrieved 2019-09-11.
  21. "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)
  22. 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.
  23. 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.
  24. 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
  25. "Truffle: A Self-Optimizing Runtime System" (PDF). Oracle Corporation. Retrieved 2013-08-23.
  26. "Truffle served in a Holy Graal: Graal and Truffle for polyglot language interpretation on the JVM". 2017-12-05. Retrieved 2018-04-25.
  27. 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". The Art, Science, and Engineering of Programming. 2 (3, Article 14): 30. arXiv:1803.10201v1. Bibcode:2018arXiv180310201V. doi:10.22152/programming-journal.org/2018/2/14.
  28. "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.
  29. "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.
  30. GraalVM JavaScript github repository
  31. TruffleRuby github repository
  32. GraalVM FastR github repository
  33. GraalPython github repository
  34. GraalVM LLVM Runtime github repository
  35. "GraalWasm github repository".
  36. Prokopec, Aleksandar (2019-12-02). "Announcing GraalWasm — a WebAssembly engine in GraalVM". Medium. Retrieved 2020-01-15.
  37. grCuda GitHub repository
  38. SOMns GitHub repository
  39. TruffleSqueak GitHub repository
  40. Niephaus, Fabio; Felgentreff, Tim; Hirschfeld, Robert (2019). "GraalSqueak: Toward a Smalltalk-based Tooling Platform for Polyglot Programming". ACM Digital Library. Retrieved 2020-11-08.
  41. Yona Language
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.