AOT code usage restrictions

Severin Gehwolf sgehwolf at redhat.com
Mon Jan 26 09:38:49 UTC 2026


On Fri, 2026-01-23 at 13:35 -0800, Vladimir Kozlov wrote:
> So the main question for now what default mode we should choose for AOT 
> code in JEP: "generic" or "native"?

IMHO, the default should be "generic".

Why? Most Java users don't know about the exact details of instruction
sets and which instruction sets the actual deployment machine will
support. In some cases this just isn't known when they do a training
run. For example, they do a training run on their development machines,
produce a container image with all the bits in place and then run the
container on the deployment clusters. What they are looking for is a
good - and consistent - user experience. By using "generic" by default
they see a similar improvement when doing development (of the trained
AOT cache) and the actual production deployment. Using "native" by
default - on the other hand - means that they could see some "strange"
variance. Strange because, they don't understand the exact details why
it sometimes works better. Consider that they could run into the trap
of thinking they'd get a good boost, but then are disappointed on the
production run because the AOT code cache cannot be used and is being
thrown away. The user walks away being disappointed and might only come
back trying the feature with a later JDK release.

For those power users who know all the details of their precise
deployment setup and want to squeeze every little bit out of AOT, they
are probably savvy enough to a) pass an extra JVM flag when doing the
training run b) have the relevant insight into the instruction sets of
their deployment hardware.

In summary, the AOT feature should work well and consistent (enough)
for the less savvy developers while it should allow for better tuning
for power users. It would be nice if the JVM could print "hints" to use
"native" for best performance, though. The hint should give some advise
what would be needed to get best performance.

Those are my $0.02 cents (based on some experience with "compile to
native" from the Quarkus ecosystem).

Thanks,
Severin



More information about the leyden-dev mailing list