Recap of Virtual Meetup on GraalVM (part 1 & 2)

Yesterday we had a great meeting on GraalVM, presented by @Niko

It was a great meeting which sparkled a lot of interest. Thank you to everyone who joined!

In the chat we exchanged a lot of useful resources.

Here they are.

On Twitter using GraalVM

Graal & Truffle to write JVM interpreters

List of resources on Graal(VM)

GraalVM to write MPS-based interpreters

https://www.nikostotz.de/blog/mps-quest-of-the-holy-graalvm-of-interpreters

Some information on using Truffle:

Motivations for Truffle DSL:

https://www.researchgate.net/publication/333510523_Truffle_DSL_A_DSL_for_Building_Self-Optimizing_AST_Interpreters

Luna, a language using Truffle

TruffleSqueak

Another interesting (but old) article on Truffle:

http://cesquivias.github.io/tags/truffle.html

Recent tutorial by Nicolas Laurent on Truffle:

https://norswap.com/truffle-tutorial/

On AST vs. Bytecode: Fabio Niephaus’ paper compares AST-based :

4 Likes

Thank you for the recap
I couldn’t join but fortunately found this useful post

1 Like

We had a great second meeting on GraalVM.

Native images

@rafael asked if exception stack traces look different and @fniephaus replied that yes they do. He also said that RedHat people are adding more debug info, so you can see Java stack frame info more or less from within GDB. Here there are some related PRs: Pull requests · oracle/graal · GitHub

@neomatrix369 shared this link: https://github.com/neomatrix369/awesome-ai-ml-dl/blob/master/examples/data/databases/graph/grakn/builder.sh It is an example to convert Jar into Native Image

Starting point for native image: https://www.graalvm.org/docs/reference-manual/native-image/

And here a description of the limitations: https://github.com/oracle/graal/blob/master/substratevm/LIMITATIONS.md

And specifically on reflection: https://github.com/oracle/graal/blob/master/substratevm/REFLECTION.md

@neomatrix369 also suggest to look for the .md files in here https://github.com/oracle/graal/tree/master/substratevm . There you should find docs on the individual aspects of java config and how to handle them like JNA/JNI etc…

Article that covers also native image: Top 10 Things To Do With GraalVM | by Chris Seaton | graalvm | Medium

Polyglot

Article on running Java inside a Jupyter Notebooks using GraalVM (java 11 or higher) Exploring NLP concepts using Apache OpenNLP inside a Java-enabled Jupyter notebook | by Mani Sarkar | Towards Data Science?

Espresso is an implementation in Truffle of Java. You can find more about it here: https://github.com/oracle/graal/search?q=espresso&type=Code

Regarding Espresso, @rafael points out this Espresso Status · Issue #1656 · oracle/graal · GitHub

We’re currently working on making Espresso 100% TCK compliant (about 1% to go). Soon after that, we plan to open source it.

Tool support

@fniephaus GraalVM comes with an extension for VSCode with support for the LSP…the integration is built on top of the instrumentation API: https://github.com/oracle/graal/tree/master/vscode/graalvm#language-server-integration

Truffle

@chrisseaton pointed out that you can also parse binary files and he has also generated an AST without going through any serialised format

Other stuff

You should subscribe to the GraalVM slack. Get an invitation here: Redirecting…

I shared the link to an RPG interpreter which we co-developed and is open-source: GitHub - smeup/jariko: a JAva virtual machine Rpg Interpreter written in KOtlin

1 Like

Thinking again about Truffle, I was wondering how this “specialization via annotations” approach compares to generating Java source code (using whatever method available) then compiling it for the GraalVM or any other VM. The point is, when generating Java source code, you have to resolve all specializations anyway.

The flow is more complex, since you have to generate an intermediate representation as source code rather than work directly on the AST. But this have some advantages as well, such as easier debugging.

Any thoughts ?

1 Like

But how would be the information for generation be provided? I think it is useful to have it in a source connected to the code of the interpreter, as they seem strongly related

1 Like