Using the Falcon Compiler
The Falcon compiler is the default optimizing JIT (Just-In-Time) compiler in the Azul Zing Builds of OpenJDK (Zing).
Falcon Optimization Notes
The main focus of the Falcon compiler is generating high performance code. This may result in longer compile times because additional CPU time is required for higher levels of optimization. Longer Falcon compile times can increase the application startup and warm-up times when compared to the startup and warm-up times when running Zing using the C2 compiler.
Falcon fully supports Azul ReadyNow technology, which helps improve consistency of application performance during warmup.
While future versions of Zing will likely include automatic ongoing eviction of contents in the Falcon cache, the current Zing version does not, and as of version 18.01.0.0, the Falcon cache is not automatically cleared or evicted. The cache will accumulate contents up to FalconMaxCacheSize. Once it reaches that size, newly encountered compilations will no longer be added to the cache. The cache can be reset at any time (including while Zing is running) by destroying the contents of the cache with, for example, rm -r .zing-falcon-cache.
Background
Falcon is Azul’s proprietary Tier 2 optimizing JIT compiler, built on the LLVM compiler infrastructure. When Azul shipped Falcon with Zing 17.03.0.0 in May 2017, it was the first new production JIT compiler for Java SE since HotSpot’s C2 debuted in 1997, and Azul was the first organization to integrate LLVM into a production-grade managed runtime.
By using LLVM as its optimization backend, Falcon benefits from an ongoing stream of optimization contributions made by the broader LLVM community — including vectorization improvements and support for new processor instruction sets (SSE, AVX, AVX2, and so on) — without requiring Azul to implement each new processor feature from scratch. For example, loops that include predicated operations can be fully vectorized using modern vector masking instructions, delivering significantly faster code on modern server hardware.
Azul also made substantial upstream contributions to LLVM over the course of the Falcon project. LLVM was not originally designed for use in managed runtimes with JIT compilation, speculative optimization, deoptimization, and garbage collection. Azul improved LLVM’s ability to handle these patterns without defeating its optimizations, and contributed those improvements back to the LLVM project.
Falcon completes a three-part combination in Azul Prime:
-
Falcon raises the peak performance ceiling by applying deeper optimizations and leveraging modern hardware capabilities.
-
ReadyNow eliminates the warmup period by replaying profiling data, so applications run at full optimized speed from the first request.
-
C4 Garbage Collector eliminates Stop-The-World GC pauses that interrupt throughput.
For more technical detail on Falcon’s design and this combination, see Zing Hits the Trifecta and the Falcon JIT Compiler announcement.
Since Falcon’s initial release, Azul has continued to invest in Falcon performance and correctness through every Azul Prime release. Notable improvements include register allocation and code generation enhancements, CPU Budgeting for the Falcon Tier 2 compiler (introduced in 23.02.0.0), and integration with Cloud Native Compiler.
History and Alternatives
The Falcon compiler first became available as a feature in Azul Prime 16.12.0.0. Falcon became the default Tier 2 optimizing compiler in Azul Prime 17.03.0.0. If, for some reason, you need to switch to the non-default Tier 2 C2 compiler in Azul Prime 17.03.0.0 - 20.03.1.0, use the -XX:+UseC2 option. For example,
$JAVA_HOME/bin/java -XX:+UseC2 –cp . myprog
The -XX:+UseKestrelC2 option uses KestrelC2 JIT compilation. KestrelC2 is based on a lightweight use of the LLVM backend, and typically produces faster code than the deprecated SeaOfNodesC2 while keeping compilation effort at similar levels. KestrelC2 typically exhibits significantly lower compilation-time CPU consumption than Falcon.
|
Note
|
The legacy SeaOfNodesC2 compiler implementation was deprecated in 24.02.0.0, and -XX:+UseC2 now uses KestrelC2; active C2 development had mostly stopped earlier. Switching away from Falcon should be seen as a workaround until a Falcon/KestrelC2 issue can be resolved, and you are encouraged to retry Falcon and/or KestrelC2 after every major upgrade.
|
Falcon Compiler Options
For a full list of Falcon-specific command-line options, see Falcon Compiler Options.
Cloud Native Compiler
Cloud Native Compiler, a service of Optimizer Hub, can further improve the performance of the Falcon compiler by removing JIT compilation from your JVM and running it on a dedicated server. By offloading JIT compilation to the server, you get faster warm-up times with lower CPU consumption on your client JVMs. See the Cloud Native Compiler documentation for more information.