6 ms·
Smalltalk with the GraalVM
- pron 7y agoJust a clarification: when used as a JIT, Graal does not compile languages defined with the Truffle framework into Java bytecode. Rather it compiles both Java bytecode and Truffle languages directly into machine code (in this case, the Truffle language is Smalltalk bytecode), which it then installs in Hotspot's code cache. The diagram places the Graal compiler above Hotspot when it would be more appropriate to place it as a component inside of Hotspot, where it replaces the C2 compiler (Java bytecode to machine code), as well as directly compiles Truffle languages into machine code. Graal can also be used as an AOT compiler ("GraalVM Native Image") -- from Java bytecode (only!) to a native executable that runs independently of Hotspot. If the Java program so compiled is itself a Truffle interpreter, the result is a native interpreter for the Truffle language, that contains an optimizing JIT (for the Truffle language only). To make things even more interesting, when Graal is used as a Hotspot JIT, because Graal itself is written in Java, it must either compile itself (bootstrapped by Hotspot's Java bytecode interpreter) -- in which case it is both a Java component run by Hotspot as well as a component of Hotspot -- or it could be AOT-compiled into a native shared library, which is then loaded by Hotspot like any other shared library.
- fniephaus 7y agoYes, you're right. I've updated the diagram accordingly.
- walkingolof 7y agoAs of Graal 19.1 , libGraal, a pre-compiled C2 JIT compiler, is bundled with GraalVM. You can use it by adding the following JAVA_OPTS: -XX:+UseJVMCICompiler -XX:+UseJVMCINativeLibrary
- chrisseaton 7y ago> libGraal, a pre-compiled C2 JIT compiler, is bundled with GraalVM libgraal isn't a C2 JIT compiler - it's (the clue is in the name here) a Graal compiler. And the person you're replying to already mentioned it: > or it could be AOT-compiled into a native shared library, which is then loaded by Hotspot like any other shared library
- fniephaus 7y agoHi everyone, I'm the author of the blog post. Feel free to let me know if you have any questions or suggestions!
- tus88 7y agoDoes anyone actually outside of Oracle actually use Graal?
- chrisseaton 7y agoTwitter uses Graal in production right now - if you send a Tweet it goes through Graal. Goldman Sachs use Graal for their Slang language experiments. I use Graal at Shopify. There are others.
- tus88 7y agoInteresting. Is it the cross-language support or are there other reasons to use it?
- chrisseaton 7y agoTwitter use it for simple performance in Scala. Goldman Sachs use it as an easy way to implement languages, to integrate existing C code, and possibly integrate Python in the future. I use it for Ruby performance.
- fniephaus 7y agoI'm not aware of anyone using GraalVM for its language interoperability in production. However, it's used by GraalVM languages internally for supporting things like C extensions and FFIs. So far, there's been a lot of interest in the performance improvements that the Graal compiler provides [1] and GraalVM Native Image [2], the toolchain that allows the compilation of Java apps and Truffle languages into binaries. But, there's a lot more you can do with GraalVM [3]. [1] http://www.ssw.uni-linz.ac.at/Research/Papers/Stadler14/Stadler2014-CGO-PEA.pdf http://www.ssw.uni-linz.ac.at/Research/Papers/Stadler14/Stad... [2] https://www.graalvm.org/docs/reference-manual/native-image/ https://www.graalvm.org/docs/reference-manual/native-image/ [3] https://www.graalvm.org/docs/why-graal/ https://www.graalvm.org/docs/why-graal/
- radiowave 7y agoThe embedded video showing a Smalltalk inspector being used to examine Python objects - that put a big smile on my face.
- fniephaus 7y agoHappy to hear that! If you'd like to see some Smalltalk tools rendered in Java Swing, check out this demo [1]. More details on this are in the blog post on our Polyglot Programming seminar [2]. [1] https://www.youtube.com/watch?v=If7xNBYA0Bk https://www.youtube.com/watch?v=If7xNBYA0Bk [2] https://medium.com/graalvm/hpi-polyglot-programming-seminar-3fd06ffa59d2 https://medium.com/graalvm/hpi-polyglot-programming-seminar-...
- azinman2 7y agoIs Graal finally there? Years ago there was a lot of promise that it would be THE “one true VM” that allowed python and ruby to fly. But I don’t really hear much about it on those fronts. Where are we at?
- txdv 7y agoTwitter is using it, they are seeing gains of 10% for Scala. It is a big project, there are many runtimes it supports, it already seems production ready.