Firing up the engines for multiple languages
Have you seen the latest update from John on our efforts to make the JVM run multiple languages ? (I’m in a staff meeting writing this, but don’t tell anyone :) ).
From one to many languages
For those of you who would like a little context around International Invokedynamic Day, for the last few years we’ve been on a path towards first class support for other languages on the JVM. No small feat this, since the Java Platform was originally designed with one language in mind. Now, we still believe that Java is the best language for robust, long lived code. But we know that developers like to mix in other languages that for special reasons: for particular applications, for particular styles of development. Just as important, we’ve spent 13 years creating an incredibly scalable and high performing runtime across a variety of operating systems. So for developers who create applications with other languages (and we hope there will be many who like JavaFX Script), we figure they would like to run those apps on the best runtime around.
So, as a matter of fact, do the creators of the engines for other languages like Ruby, Python, Groovy, Scala - they started creating the engines to run on the Java Platform.
Lining up the engines
Firing up the engines
Now, many of the languages that are attracting the buzz that have been invented since the Java language have a feature in common with each other, but not with Java: they are dynamically rather than statically typed. So the types of the variables, method parameters, return variables and so on are not known at development time, unlike in Java where you are required to declare them. All very nice for rapid prototyping and a more informal style of programming, but a big problem for compiling it down to the Java bytecode because the Java bytecode needs that type information filled out. So engines for dynamic languages have to create artificial interfaces or classes just to do the form filling. Making them brittle, difficult to maintain and slower than they could be. But not if we modify the bytecode to remove the need to fill out all the type information.
So back to the update: John has prototyped support for the modified bytecode in the HotSpot JVM !
What this means is that implementors of dynamic language engines are now free to try this out and prove the theory. I’m predicting that Charlie will be one of the first with his JRuby project, but the race is on.
Some of the newer languages have other features in common, like closures for example. There may well be other features we will build into the Java runtime to support such features better like tail call recursions, continuations and lightweight method handles. But we’ll see how it goes with new bytecode and get some real data and decide how much further we need to go.
If, say, Ruby, Python and Scala run faster on the JVM than anywhere else, we may just be done. For now :)
We will contact you as soon as possible.