The use of AOT optimisations can be enabled automatically when running in a native through a NativeDetector.inNativeImage() check. When running on the JVM, we want to provide a way to opt in to using those same optimisations.

Comment From: wilkinsona

Duplicates #30559.