Main image of article Java 12: 64-Bit Focus, Adds Experimental Garbage Collector
Java 12, currently set for release March 19, will have some interesting new features, including a narrower view on 64-bit ARM development. Specifically, Java 12 will have a single AArch64 port. The new version will retain the 32-bit ARM port, but will remove the arm64 port. Oracle, which tends Java, says: “Removing this port will allow all contributors to focus their efforts on a single 64-bit ARM implementation, and eliminate the duplicate work required to maintain two ports.” The idea is that AArch64 will handle all 64-bit builds, as it’s the more modern implementation from ARM. The 32-bit port is a legacy holdover; we’ve seen platform providers such as Apple and Google start to distance their developer corps from 32-bit binaries. In an effort to meet the demands of more powerful devices and 64-bit applications (and ARM architecture), Java 12 will add an experimental garbage collector, dubbed ‘Shenandoah.’ This feature does evacuation work concurrently with running Java threads, which Oracle claims will result in “the same consistent pause times whether your heap is 200 MB or 200 GB.” More:
Modern machines have more memory and more processors than ever before. Service Level Agreement (SLA) applications guarantee response times of 10-500ms. In order to meet the lower end of that goal we need garbage collection algorithms which are efficient enough to allow programs to run in the available memory, but also optimized to never interrupt the running program for more than a handful of milliseconds. Shenandoah is an open-source low-pause time collector for OpenJDK designed to move us closer to those goals. Shenandoah trades concurrent cpu cycles and space for pause time improvements. We've added an indirection pointer to every Java object which enables the GC threads to compact the heap while the Java threads are running. Marking and compacting are performed concurrently so we only need to pause the Java threads long enough to scan the thread stacks to find and update the roots of the object graph.
Shenandoah will only be considered a ‘success’ if it can maintain consistently low garbage collection times. Here are the rest of the Java 12 features:
  • Microbenchmark Suite: JDK source code will gain a suite of microbenchmarks, allowing developers to run basic benchmarks from the set or create their own.
  • Default CDS Archives: Class data-sharing (CDS) archives eliminates the need for -Xshare:dump runs, and improves “out-of-the-box” startup times.
  • Switch expressions: Allows the switch statement to be used as a statement or an expression, and either form can use “traditional” or “simplified” control flow and scope behaviors.
  • G1 garbage collector improvements: While Shenandoah is trialed, the G1 garbage collector will automatically return heap memory to the operating system while idle. Mixed collections can also be aborted if they exceed the pause target.
  • JVM Constants API: A new API to “model nominal descriptions of key class-file and run-time artifacts, in particular constants that are loadable from the constant pool.”
The final draft of Java 12 was submitted February 7, and its go-live date is March 19.