3 ms·
The JEP explains what this does: "The AOT cache builds upon CDS by not only reading and parsing class files ahead-of-time but also loading and linking them."
by brabel 2y ago
The JEP explains what this does:
"The AOT cache builds upon CDS by not only reading and parsing class files ahead-of-time but also loading and linking them."
While CDS (which has been available for years now) only caches a parsed form of the class files that got loaded by the application, the AOT cache will also "load and link" the classes.
The ClassLoader.load method docs explain what loading means: https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/ClassLoader.html#loadClass(java.lang.String,boolean) https://docs.oracle.com/en/java/javase/21/docs/api/java.base...
1. find the class (usually by looking at the file-index of the jar, which is just a zip archive, but ClassLoaders can implement this in many ways).
2. link the class, which is done by the resolveClass method: https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/ClassLoader.html#resolveClass(java.lang.Class) https://docs.oracle.com/en/java/javase/21/docs/api/java.base... and explained in the Java Language Specification: https://docs.oracle.com/javase/specs/jls/se21/html/jls-12.html#jls-12.3 https://docs.oracle.com/javase/specs/jls/se21/html/jls-12.ht...
"Three different activities are involved in linking: verification, preparation, and resolution of symbolic references."
Hence, I assume the AOT cache will somehow keep even symbolic references between classes, which is quite interesting.