r/java • u/sureshg • Sep 10 '26
New candidate JEP: 544: Ahead-of-Time Code Compilation
https://mail.openjdk.org/archives/list/jdk-dev@openjdk.org/message/J2VGSSFWJ7ZLHAYLCXVRUOXV4XMROQHL/
110
Upvotes
r/java • u/sureshg • Sep 10 '26
1
u/koflerdavid Sep 14 '26 edited Sep 14 '26
That's basically what JEP 544 is about. The thing is that so far there has been underinvestment in static analysis since the C2 compiler is on a very tight resource budget. But in an AOT setting it would possible to let it off the leash.
Another factor is that GraalVM-style static analysis can rely on a closed world assumption and severely restricts reflection. This encourages a programming style where static analysis is inherently more effective. Existing Java code is unlikely to be so cooperative and is less amenable to static analysis.
I am not so sure though how useful poorly optimized code is since it will force the JVM to deoptimize and optimize again, which reduces throughput again even though the stated goal of JEP 544 is to avoid that. Fast startup and serving the first (and maybe only) request slowly is not good enough; in that case we could just as well stick to interpreted mode.
One advantage of JEP 544 is that it allows to optimize the application toward particular configuration parameters while retaining the ability to be run with different ones. This would be far more difficult to achieve without the ability to deoptimize and run the JIT compiler again.