This article was written by Paul Krill, Editor at Large at Infoworld. This post was originally published on Infoworld on 6 April 2017.
In a recent presentation, Oracle detailed both progress and future plans for implementing Java on Java
Oracle is moving forward with its Java-on-Java intentions, in which Java would be implemented on itself via the experimental Project Metropolis.
With Metropolis, the company proceeds on building a JIT (just-in-time) compiler written in Java, said Georges Saab, Oracle vice president of development for the Java platform. The project was described in a recent presentation as an experimental clone of JDK (Java Development Kit) 10, hosting work on ahead-of-time compilation and the Graal compiler. Metropolis also would provide for translation of discrete HotSpot modules in System Java.
A presentation description says that Metropolis was “contemplating ‘Java on Java,’ the promise of a reboot of JVM technology using a modern code generator, Graal, which can be easily ported to new platforms and adapted to new workloads.”
Java-on-Java would implement the Java runtime with less C++/asm, cutting down on situations in which developers would have to code in both Java and C++. “This kind of experimentation [with Metropolis] is not new, but more and more of it is happening in collaborative projects in the OpenJDK community,” Saab said. There is no predetermined timeline to complete Metropolis, he said. “It’s not starting with some committed JDK version or date. Rather, the purpose is to learn more about what could be done in future versions.”
Project Panama, an effort to bridge native libraries to Java, would provide interoperability in Java-on-Java, while Project Valhalla would spruce up Java with multiple capabilities, such as value types, and provide flat data types for Java-on-Java. “Project Valhalla will naturalize flat, pointer-free data types to the JVM heap, giving JVM programmers the ability to define new classes with the flexibility of Java objects or C++ templates, and the efficiency of C or assembly code,” the presentation description reads.
Oracle’s conference presentation also referred to Project Amber, a recently unveiled effort to provide an incubator for productivity-oriented Java enhancement proposals, including local variable-type inference, enhanced enums, and lambda leftovers. It also promoted the notion of platform interoperability, including making native code and data more like Java code and data, but interoperability depends partly on value types and low-level bridges to non-Java APIs and data layouts.
The presentation discussed long-range plans for the JVM integrating with and running most modern languages. Goals for the JVM include having a uniform model to make objects, arrays, values, and types feel similar, being memory-efficient, having tune-able data layouts, and being naturally local and pointer-thrifty.
Oracle also wants the JVM to be performant, getting the most out of major CPUs and systems. In addition, the presentation cited “post-threaded,” as a goal, offering granular concurrency and confined/immutable data, along with having shared code mechanically customized to each hot path.