Substrate VM – A framework that allows AOT compilation of Java applications
github.com
github.com
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.
http://www.oracle.com/technetwork/java/jvmls2015-wimmer-2637...
Page 4.
Project Metropolis is about rewriting OpenJDK C++ parts in Java, so SubstrateVM needs to support all major OpenJDK targets.
It depends on the application, how it is written, the compiler and optimizer being used.
https://mjg123.github.io/2017/10/02/JVM-startup.html
Substrate VM is more mature? jaotc was response to closed Substrate VM?
FWIW, both use Graal as a compiler.
https://news.ycombinator.com/item?id=6232240
Gosh 4 years already.
Cant wait to see how TruffleRuby perform with SubstrateVM.
And i get what ? an executable which includes only what the program needs / uses ?
> 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.
We focus on getting really high performance from our Truffle languages, so we often forget to emphasise this point: Truffle is the easy way to create languages, as well as the high performance way. Truffle uses the AST pattern, which is how an undergraduate would implement an interpreter after one compilers course. And you can get 90% of the high performance from a simple interpreter, and then work on it a bit more to get the remaining 10% when you find you need it.
Graal VM is based on HotSpot, which is sort of "bloated" for the specific use case that Truffle has.
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.
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.
https://github.com/bazelbuild/bazel/wiki/Bazel-Users
Asana, Databricks, Dropbox, Pinterest, Stripe and Uber ATG are not Google.
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.
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.
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://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.
Just curious, how the reflection and dynamic class loading things work when generating an executable?
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-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.
Why? Consider VirtualBox, Java, and MySql. Did anyone get in trouble for using these?
There's a reason the MariaDB fork exists.
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.
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.
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-compatib...
Now every Java developer that wants to target Android needs to write Android Java, instead of pure Java.
A jury looked at the evidence, heard the arguments, and disagreed with you. The decision held on appeal.
An alternative interpretation of historical events: had Sun (and Oracle) provided Apache Harmony with the JCK from then, Harmony wouldn't have fallen behind.
It is all about who has the best lawyers that are able to influence the jury to achieve the goals of their clients.
The amount of US mistrials is a good example of it.
Uhm, for the reasons I stated, that Oracle doesn't mind if our industry implodes in return of a $1bn API copyright payout. Is that the sort of attitude you want to reward with your mindshare?
If the above concern isn't cogent to you, then perhaps their poor custodianship of other open source projects might convince you instead (Open Office and OpenSolaris).
Thanks Google, only Java libraries written with Android Java in mind do actually work flawlessly in Android.
Forcing many of us to have either two versions of a Java library or resort to a common subset.
Yeah Google is not malicious at all.
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.
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.