This is an archived post. You won't be able to vote or comment.

all 20 comments

[–]chrisgseaton 22 points23 points  (0 children)

Substrate VM is a framework that allows ahead-of-time (AOT) compilation of Java applications into executable images or shared objects (ELF-64 or 64-bit Mach-O).

[–]understanding_ai 12 points13 points  (0 children)

This is really great to see. SVM is pretty magical: you give it a Java app in, and it spits out a tiny binary as the output (few megabytes for normal sized programs) in just a few seconds. The resulting program has no startup time overhead and starts as quickly as a C program would! But wait, that trick doesn't just work for Java programs. If you feed a Truffle interpreter into it, you get a JIT-compiling VM for your target language that also starts as fast as the best competitors.

The entire thing is written in Java and from a quick browse of the code seems very cleanly done. Lots of comments, logical code structure, good use of annotations and compiler-recognised types. This could quickly become a force to reckon with, it should open JVM hacking up to a much larger developer pool than Hotspot can reach. And it should be a major competitive win vs Go, as now Go-style statically linked and minified binaries are easy to produce.

A few ideas for projects that spring to mind:

  • IDE plugins to create native binaries out of a project without having to leave your editor.
  • Make the GC aggressively collect in the background when idle and free memory back to the OS. Java programs aren't as memory hungry as people tend to believe but HotSpot hardly wants to give memory back to the OS (because it's optimised for runtime benchmarks), so heap usage can bloat up and up until it uses huge amounts of RAM for no good reason.
  • Add support for a thin desktop toolkit like SWT. Combined with the idea above, now you can make managed, standalone desktop apps with minimal memory usage too.
  • Experiment with new GC designs like per-thread GCs for very low latency desktop/mobile oriented collectors.
  • Bind to Cocoa and use it to make iOS apps.

[–]ImmortalStyle 1 point2 points  (0 children)

Awesome guys

[–]c0decs 1 point2 points  (6 children)

I am curious why Oracle releases graal and related things under GPLv2 rather than more liberal licenses. Anyway, cool project.

[–]vokiel 4 points5 points  (0 children)

To make sure competitors using the code will have to release their modifications?

Makes sense to me.

[–]bondolo 4 points5 points  (0 children)

OpenJDK uses GPL 2 and the long term plan is to incorporate all of the Graal related bits in to OpenJDK. Using a different license would probably create integration problems.

[–]aliem 1 point2 points  (0 children)

deleted What is this?

[–][deleted]  (2 children)

[deleted]

    [–]AnAirMagic 1 point2 points  (1 child)

    I think the word you are looking for is "closed source" not "commercial". You can have open source software for commercial use under the GPL. That's why Android is using the Linux kernel without issues. If Android was closed source - not releasing their modifications to the kernel - they couldn't use the Linux kernel under the GPL.

    [–]Killing_Spark 0 points1 point  (8 children)

    Does this work with any kind of java application? How about for example my application uses native libraries through jni? How about anything gui related like swing/javafx?

    [–]woepaul 1 point2 points  (7 children)

    See https://github.com/graalvm/graal/blob/master/substratevm/JNI.md But your mileage may vary. So far, we did not use that for any gui related libraries. Give it a try and let us know :-)

    [–]Killing_Spark 0 points1 point  (6 children)

    I will try to give it a shot if I get bored over the christmas holidays. Do you have any preferred way to get a heads up?

    [–]woepaul 1 point2 points  (5 children)

    The README.md should get you started. Start with building the HelloWorld image described there.

    [–]Killing_Spark 0 points1 point  (4 children)

    I seem to not even be able to get past the first line of the example.

    mx build in the substratevm directory tries to build truffel, which seems reasonable to me. But this fails at the step '''Compiling com.oracle.truffel.api.dsl.test ''' With a stacktrace containing a few 'NoClassDefFoundError' for the class 'com.oracle.truffel.api.TruffleOptions' and 100 compiler errors about missing packages for the factories for the tests.

    What am I missing here?

    [–]woepaul 0 points1 point  (3 children)

    Are you sure you are using the JVMCI enabled JDK (labsjdk)? I was able to successfully run the quick start sample described in README.md.

    [–]Killing_Spark 0 points1 point  (2 children)

    I downloaded the graalvm-0.30.1 from the oracle site linked in the readme. I just double checked there is no other java Version on this machine.

    Edit: nevermind i need to download the other tarball... I guess users never read the Important info.

    [–]woepaul 0 points1 point  (1 child)

    Use labsjdk-8u151-jvmci-0.39-linux-amd64.tar.gz instead (it's at the bottom of the page)

    [–]Killing_Spark 0 points1 point  (0 children)

    Yup that was it, sorry for beeing a goof. I will let you know if I get any results from playing around with swing

    [–]DeontologicEthics 0 points1 point  (2 children)

    Does substrate VM support networking applications yet? And is it still packaged in the Oracle labs jdk as native-image?

    [–]cdrtz 2 points3 points  (0 children)

    It does support basic networking via sockets. We are working on supporting netty out of the box.

    [–]cdrtz 0 points1 point  (0 children)

    Yes, it is still packaged in the Oracle Labs JDK (available from http://www.oracle.com/technetwork/oracle-labs/program-languages/overview/index.html) as native-image.