GraalVM

__GraalVM__ is an extension of the Java virtual machine to support more languages and execution modes. The Graal project includes a new high performance Java compiler, itself called Graal, which can be used in a just-in-time configuration on the HotSpot VM, or in an ahead-of-time configuration on the SubstrateVM - wikipedia

YOUTUBE oWX2tpIO4Yc Published on Apr 23, 2017. See "Why Graal" on graalvm.org

# Features

- Run your code faster and more efficiently Interoperate directly with most modern programming languages - Embed languages with the Graal SDK - Create compiled native images - Use a single set of tools to monitor, debug, and profile all your code

GraalVM is a universal virtual machine for running applications written in: - JavaScript - Python - Ruby - R (programming language) - JVM-based languages like Java, Scala, Kotlin - LLVM-based languages such as C and C++

GraalVM removes the isolation between programming languages and enables interoperability in a shared runtime. It can run either standalone or in the context of OpenJDK, Node.js, Oracle Database, or MySQL.

# Implement your own language

Graal makes it easy to optimise a language that you implement, and to make it available in a polyglot context. Given an abstract syntax tree created in a language like Java, you can use Graal to compile the language down to bitecode so that it runs within the GraalVM.

# Goals

- One objective of Graal is to improve the performance of Java virtual machine-based languages to match the performance of native languages. - Another goal, dubbed "Project Metropolis" or "Java-on-Java", is to implement a substitute for the substantial use of C++ within HotSpot. - A third goal is to allow freeform mixing of code from any programming language in a single program, billed as "polyglot applications".

# Scale

The SimpleLanguage example uses Coco to generate an abstract syntax tree from code (I think) - graalvm.org

Twitter is a massively distributed system with thousands of machines running thousands of JVMs. In any similar big system a small change in performance and CPU utilization is multiplied thousandfold and results in big savings. Twitter is going down that road and experimenting with Graal to generate better code and reduce cost.

# So what is it?

Graal is a native code generator, just like LLVM. You give it some intermediate model of executable code, and then you get native code for processors. And of course it is written in Java - medium

Once you have a code generator, you can do many other things such as a compiler to native code for some language, you can do a JIT (just-in-time) compiler for another language, etc.

# Faster R with FastR

FastR is a GraalVM based implementation of the R (programming language) that provides significant improvements in the performance of R code, the embedding of the R execution engine into Java applications, and the ability to interface with other GraalVM and JVM languages including Python, Java, and Scala. FastR is also able to utilize the tooling support provided by the GraalVM ecosystem - medium

# TruffleRuby

YOUTUBE mRKjWrNJ8DI Parallel and Thread-Safe Ruby at High-Speed with TruffleRuby (Jun 2018)

# A Universal and Embeddable Virtual Machine

It can easily be embedded into existing systems such as databases. By embedding GraalVM into the Oracle Database, we can provide many modern languages and their ecosystems for transaction processing, data analytics and machine learning - medium

YOUTUBE G-vlQaPMAxg Twitter’s Quest for a Wholly Graal Runtime. Broadcast on 2 Oct 2017.

We only have to maintain a single runtime independent of the number of supported languages as opposed to embedding one runtime for each supported language. Basic components such as data type conversions or a server-internal SQL driver can be shared across all languages with GraalVM.

YOUTUBE ZbccuoaLChk Published on Nov 9, 2017.

# Limitations

- Full list of limitations - github

# Truffle

In association with GraalVM, Oracle developed a language abstract syntax tree interpreter called Truffle which would allow it to implement languages on top of the Graal framework - wikipedia

The Truffle framework was released under GNU General Public License with the classpath exception to encourage use of the framework for projects which do not want to be bound by the viral license, copyleft nature of the GPL, while the Graal compiler remains under GPLv2 only.

# Research - Let’s Build A Simple... - ruslanspivak.com - data structures - How... - stackexchange.com - Abstract syntax tree -... - wikipedia.org - Implement Your Language for... - graalvm.org - Implement Your Language for... - graalvm.org - graalvm/simplelanguage: A... - github.com - Home - API Connect - ibm.com

- LoopBack 4 | LoopBack... - loopback.io - cyberhoboing with dominic... - dominictarr.com

- Learning to Use the GraalVM... - dzone.com - graalvm/sulong: Sulong, the... - github.com - Project Sulong: an LLVM... - youtube.com

# See also