GraalVM

Downloads

https://github.com/oracle/graal/releases

https://www.graalvm.org/docs/getting-started/

https://www.graalvm.org/docs/reference-manual/languages/jvm/#running-jvm-based-apps

https://medium.com/@jponge/the-graalvm-frenzy-f54257f5932c

https://medium.com/graalvm/oracle-graalvm-announces-support-for-nashorn-migration-c04810d75c1f

https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/Context.html

https://www.beyondjava.net/graal-towards-the-holy-grail-of-polyglot-programming

https://github.com/graalvm/graalpython/blob/master/doc/INTEROP.md

https://github.com/oracle/truffleruby/blob/master/doc/user/polyglot.md#accessing-java-objects

https://github.com/oracle/graal/blob/master/sulong/projects/com.oracle.truffle.llvm.libraries.bitcode/include/polyglot.h

Benchmarking

$ export PATH=/path/to/graalvm/Contents/Home/bin:$PATH
$ java -version
openjdk version "1.8.0_172"
OpenJDK Runtime Environment (build 1.8.0_172-20180626105433.graaluser.jdk8u-src-tar-g-b11)
GraalVM 1.0.0-rc6 (build 25.71-b01-internal-jvmci-0.48, mixed mode)
$ ./netkernel.sh
NKPerf10 Test GraalVM 1.0.0-rc6

NKPerf10 Test GraalVM 1.0.0-rc6

$ java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
$ ./netkernel.sh
NKPerf10 Test Hotspot 1.8.0.66

NKPerf10 Test Hotspot 1.8.0.66

Conclusion

  1. It works!
  2. No significant performance difference between GraalVM and Hotspot
  3. Would love to try and write a GraalVM - enabled language runtime module. Endpoints written in C!

Building Netkernel Modules using GraalVM

  1. Set GraalVM as alternate JVM in Eclipse project
  2. Change PATH to include GraalVM
  3. Change JAVA_HOME to point to GraalVM installation folder
  4. Run gradle build.
$ gu install R
$ gu install python
$ gu list
<request>
    <verb>SOURCE</verb>
    <identifier>active:graalvm</identifier>
    <argument name="operator">res:/r/script</argument>
   <argument name="graalvm-language">R</argument>
</request>
$ cd src/resources
$ export GRAALVM_HOME=/Users/richardsmith/Projects/graalvm-ce-1.0.0-rc6/Contents/Home
$ clang -g -O1 -c -emit-llvm -I$GRAALVM_HOME/jre/languages/llvm hello.c
$ cd ..
$ cd ..
$ gradle build deployModuleNK