164 points · by ianopolous · 8y ago · 56 comments
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.
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.
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.
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.
Why? Consider VirtualBox, Java, and MySql. Did anyone get in trouble for using these?
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.