2 ms·
My impression from reading this was it was about knowing which classes reference which other classes when and which jars everything is in. So I think you’re ri
by MBCook 2y ago
My impression from reading this was it was about knowing which classes reference which other classes when and which jars everything is in.
So I think you’re right.
So a bit more linker style optimization than compiler related caching stuff.
- brabel 2y agoThe 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.