9 ms·
Substrate VM – A framework that allows AOT compilation of Java applications
- chrisseaton 9y ago> Substrate VM is a framework that allows ahead-of-time (AOT) compilation of Java applications under closed-world assumption into executable images or shared objects (ELF-64 or 64-bit Mach-O).
- espadrine 9y agoIs there a way to test it without creating an Oracle account? The documentation leads me to http://www.oracle.com/technetwork/oracle-labs/program-languages/downloads/index.html http://www.oracle.com/technetwork/oracle-labs/program-langua..., which requires an account to download the files.
- lewurm 9y agoThis is huge, congrats to the team! I hope it helps Substrate VM to get better adoption outside of Oracle.
- jeswin 9y agoFOSS community (or anyone else for that matter) shouldn't touch anything coming out of Oracle with a bargepole. Given the level of maliciousness, their Open Source work should be considered a minefield.
- holydude 9y agoYeah yeah lets abandon perfectly usable piece of technology because some john smith from the internet hates oracle.
- sangnoir 9y ago> Yeah yeah lets abandon perfectly usable piece of technology because some john smith from the internet hates oracle It's doesn't need to be hate, anyone concerned about the well-being of this industry should be wary of being an enabler/complicit. Oracle is actively malicious: remember this is the company that was actively trying to make API's copyrightable[1]. How many APIs do you use in a day do you think such a ruling would have impacted? You wouldn't be able to have drop-in replacement libraries (or web-services). Hell, it would have made it illegal to fork an open source project unless you got the copyright to the API as well. Given a viable choice between an Oracle project and a non-Oracle project, always go for the latter. [1]https://www.computerworld.com/article/2857293/legal/oracle-asks-supreme-court-to-reject-android-copyright-case.html https://www.computerworld.com/article/2857293/legal/oracle-a... edit: changed to past tense: I had forgotten the supreme court refused the case, but that just means the argument hasn't been tested in the courts.
- carterehsmith 9y ago>> Given a viable choice between an Oracle project and a non-Oracle project, always go for the latter. Why? Consider VirtualBox, Java, and MySql. Did anyone get in trouble for using these?
- TheDong 9y agoGoogle infamously got in a ton of trouble for using Java since oracle wanted a slice of that pie. There's a reason the MariaDB fork exists.
- carterehsmith 9y ago>> Google infamously got in a ton of trouble for using Java since oracle wanted a slice of that pie. They sure did, by... being reckless, and possibly stupid. You can use OpenJDK (and bazillions people do), and noone will bother you. But if you get something trademarked "Java", and then change it to your liking, and you still call it "Java", and release it under trademarked name, then you do deserve the lawsuit & c.
- pjmlp 9y agoRightly so, after they pulled a Microsoft into Java. Now any Java developer writing libraries is forced to write Android specific versions thanks to how Google forked Java. No 100% support for all JVM bytecodes, so no invokedynamic support. Cherry picked packages and classes from Java 6, 7 and 8. It will only get worse with the current Java roadmap.
- sangnoir 9y ago> Now any Java developer writing libraries is forced to write Android specific versions thanks to how Google forked Java. This is inaccurate. The Apache Project (Harmony) forked Java in the Sun days and Sun refused[1] to provide the compatibility tests (JCK) in order to prove that Harmony was Java. Google adopted the pre-forked Apache Harmony because Sun, in its brilliance, decided that J2ME and only J2ME was to be allowed on mobile. Incidentally, Oracle supported Apache Harmony before buying Sun, unsurprisingly Oracle changed their tune when they became custodians of Java and bribed/negotiated with IBM for IBM to recant its support for Harmony. 1. https://www.cnet.com/news/apache-grouses-about-java-compatibility-checker/ https://www.cnet.com/news/apache-grouses-about-java-compatib...
- floatboth 9y agoex-Sun team != Oracle execs
- carterehsmith 9y ago>> their Open Source work should be considered a minefield.) Well, any license can be a minefield. E.g. FB React had some questionable license... (they changed it) and so on. Indeed, one should check a license before using a product. Meantime, is Oracle that bad? I mean, people have been using VirtualBox, Java (OpenJDK), MySql, MySqlWorkbench, NetBeans, maybe more. All of those provided by Oracle with no fee required, and a liberal license. And, I do not see people being sued by Oracle over those.
- jacques_chester 9y agoI think Oracle's push into cloud is changing their approach. If only because a) Java is still slightly more than half of the enterprise app workload (the rest is .NET), b) those customers like opensource because it gives them options. Right now it's a buyer's market and Oracle are way behind AWS, Azure and GCP, with Alibaba trying to smash through the side door. Which is another thing. Oracle went on a hiring spree and pulled people from the other three willy-nilly. A large fraction of whom will have never really been fans of the classical Oracle way of doing things.
- stuaxo 9y agoI wonder how the performance and size of apps compiled with Graal compares with traditional Java apps ?
- mike_hearn 9y agoGraal can be used with "traditional" HotSpot, in which case the user would observe no particular difference in (download/disk) sizes. But this article is about SubstrateVM, which is a JVM that links itself with the program being run and throws out the rest. You can get very small program sizes this way, comparable to Go.
- loopbit 9y agoBoth app size and startup time should improve greatly with Graal (or with Java 9's jlink or jaotc), the idea is to generate an executable with only the part of the JRE and external libraries that the app really uses. There was some discussion on HN about this VM before (about performance with TruffleRuby, an implementation of Ruby on the JVM): https://news.ycombinator.com/item?id=13652541 https://news.ycombinator.com/item?id=13652541
- nirvdrum 9y agoIf you're interested, I gave a talk at RubyConf a couple months back with updated info for TruffleRuby on the SVM: https://www.youtube.com/watch?v=hIMldcAzd5o https://www.youtube.com/watch?v=hIMldcAzd5o The SVM is a critical component in achieving some of our performance objectives for TruffleRuby, particularly when it comes to startup time and running code that hasn't warmed up yet. Short-lived applications have always been something of an Achilles heel for dynamic languages targeting the JVM. The SVM provides a nice way of solving that problem as long as your program can operate with its restrictions (e.g., no dynamic class loading). From a positioning perspective, I think an interesting aspect of the SVM is TruffleRuby is no longer an implementation of Ruby on the JVM. It's an implementation of Ruby written in Java for sure, but the JVM isn't required.
- SureshG 9y ago> only the part of the JRE and external libraries that the app really uses Just curious, how the reflection and dynamic class loading things work when generating an executable?
- jdc0589 9y agoI haven't touched java in years, but have known this existed. How does it compare to some of the features added in recent versions of java that do similar stuff?
- chrisseaton 9y agoThe AOT in the OpenJDK? It actually uses the same compiler, Graal, under the hood. But SubstrateVM is another level - it produces a single statically linked binary of your Java program - no JVM needed on your system or included in the binary. It's all written in Java - the GC and everything.
- edko 9y agoThanks for the explanation. Is this for Java only, or can it be used with all other languages that produce JVM bytecode?
- chrisseaton 9y agoIt works on JVM bytecode in classfiles and doesn't have an opinion on where it came from. Some JVM languages may be more likely to use features that aren't supported though, like reflection on classes you haven't annotated. I think we've used it on Kotlin and Scala at least.
- edko 9y agoThis is very exciting. Are JavaFx applications supported?
- chrisseaton 9y agoI don’t know how it’s implemented, but JNI works I believe.
- trishume 9y agoThis is awesome! Substrate VM not being open source was a major reason I wasn't more excited about Truffle/Graal. Without Substrate VM, startup times for Truffle-based interpreters are terrible (see http://nirvdrum.com/2017/02/15/truffleruby-on-the-substrate-vm.html http://nirvdrum.com/2017/02/15/truffleruby-on-the-substrate-...). Now anyone outside of Oracle can write cool JIT compilers using Truffle, and have them start quickly! I think it can also be used to compile normal Java programs to native executables. So great. I was worried that Oracle would keep Substrate VM as a proprietary secret sauce, but that would have really torpedoed the potential of Graal.
- deleted 9y ago[deleted]
- aseipp 9y agoExtremely happy to see this happen. I had played with a little Graal/Truffle language and tried using SVM when it was closed source, but ended up setting down the project (not really because of SVM, mind you). Maybe now I can restart it. :)
- fohara 9y agoDoes Substrate VM have cross-platform support for major operating systems (i.e. for Linux, Windows, MacOS)? If so, can a binary compiled on MacOS run on Windows, and vice versa?
- pjmlp 9y agoYes, that is the long term goal. Project Metropolis is about rewriting OpenJDK C++ parts in Java, so SubstrateVM needs to support all major OpenJDK targets.
- EgoIncarnate 9y agoI might be misreading this, but it seems like most of SVM is not under Classpath exception (most of the files are missing the magic words), which implies SubstrateVM binaries must be GPL 2. Is this intentional?
- lewurm 9y agothat's most likely intentional, I'm sure Oracle has a lot of lawyers to look over this kind of stuff ;-)
- mbreese 9y agoIt seems you are right and that they are very aware of which parts of the project are GPL2+classpath and which are not... https://github.com/graalvm/graal/issues/269 https://github.com/graalvm/graal/issues/269
- 0xFFC 9y agoFor those who has problem understanding relation between Graal and Substrate VM : http://www.oracle.com/technetwork/java/jvmls2015-wimmer-2637907.pdf http://www.oracle.com/technetwork/java/jvmls2015-wimmer-2637... Page 4.
- holydude 9y agoSo let me get this straight. With Truffle i can get whatever prog lang abd compile it with Graal and either use with Graal VM or Substrate VM. And i get what ? an executable which includes only what the program needs / uses ?
- nirvdrum 9y agoI'm not entirely sure what you're asking, so I'll split it in two parts and hope one of them is applicable. > With Truffle i can get whatever prog lang abd compile it with Graal and either use with Graal VM or Substrate VM. Truffle is basically a toolkit for building language runtimes. It provides a framework for creating AST interpreters. Generally AST interpreters are easy to work with and reason about, but slow. Truffle addresses the speed issue by using Graal's API to perform partial evaluation on the interpreter. So, you get very fast runtimes without having to build a custom VM. But, it also exposes some compiler details by way of an annotation-based DSL if you want to take advantage of it. This includes control for PIC sizes, loop exploding, and explicit branch profiling amongst others. As a language toolkit, Truffle also gives you an instrumentation framework so you get things like a debugger and profiler for minimal effort. It provides a polyglot system so you can call into other Truffle languages. Since they all inherit from the same base Node class, the compiler can even inline nodes across language boundaries. Truffle takes advantage of that itself by shipping functionality, such as its own native function interface, as its own Truffle language. > And i get what ? an executable which includes only what the program needs / uses ? The SVM can be used to compile any Java program. Truffle-based language implementations are just Java programs. Compiling with the SVM allows you to build a statically linked native binary that contains your language runtime. Generally that binary will have improved startup time, ease distribution issues, and so on. The SVM links in Graal, so you get all that without sacrificing peak performance.
- holydude 9y agoThanks for the thorough explanation. I am curious how hard / time consuming is to reimplement the existing languages in Truffle.
- sandGorgon 9y agomy biggest peeve is graal/substrate creating and using its own build tooling - for example mx (written in python) to do the build and compilation. Graal itself uses mx. I would wish they would use something far more popular and common like Bazel or even Gradle. TBH, mx predates all of these .... but its time to use modern tooling.
- pjmlp 9y agoBazel is popular for Google employees. Gradle is an enduring suffering for all Android developers, except the ones blessed with 16GB Xeons and SSDs. None of them sound modern to me. Specially Gradle, given my experience on Android development.
- sandGorgon 9y ago>Bazel is popular for Google employees. https://github.com/bazelbuild/bazel/wiki/Bazel-Users https://github.com/bazelbuild/bazel/wiki/Bazel-Users Asana, Databricks, Dropbox, Pinterest, Stripe and Uber ATG are not Google.
- pjmlp 9y agoAll of them irrelevant in the world of Java programming, hence why I wasn't even aware they were using Bazel.
- sandGorgon 9y agoThere are 13 references to building java projects on that page. I really don't want to get into a flamewar on this, but Bazel does have a lot of traction and is used in many wildly popular tools like Tensorflow. It would be nice to have that here as well.
- deleted 9y ago[deleted]
- danjoc 9y agoWhat's the difference between substrate vm and jaotc? https://mjg123.github.io/2017/10/02/JVM-startup.html https://mjg123.github.io/2017/10/02/JVM-startup.html Substrate VM is more mature? jaotc was response to closed Substrate VM?
- lewurm 9y ago`jaotc` integrates with the HotSpot VM, while Substrate VM provides its own runtime (GC etc.) and intentionally supports only a subset of the JVM features. FWIW, both use Graal as a compiler.
- ksec 9y agoI still remember the original submission, One VM to rule them All. https://news.ycombinator.com/item?id=6232240 https://news.ycombinator.com/item?id=6232240 Gosh 4 years already. Cant wait to see how TruffleRuby perform with SubstrateVM.