On 9 Jun 2023, at 8:32, Dan Heidinga wrote: > On Thu, Jun 8, 2023 at 2:47 PM Frederic Parain <[email protected]> > wrote: > >> Hi Dan, >> >> I've looked at your exploration of the Preload attribute. The LoaderTest >> test loads class A but it doesn't link it. HotSpot looks at the PreLoad >> attribute at class link time, not class load time (yes, the name is >> misleading), this is why class B is not loaded. >> > > Thanks Fred. I knew I had to be doing something wrong as I couldn't find > anything in the jdk that would have accounted for it. > > Interestingly, I missed this in part due to a behaviour difference between > OpenJ9 and Hotspot - by the time OpenJ9 returns a j.l.Class instance, the > vtables have been built and method sendTargets have been set. It appears > Hotspot initializes the vtable in a separate pass.
This is an example of how it will be hard to specify Preload, if it is not just a pure optimization, since the existing JVMS allows latitude for different implementations to sequence class loading different, in subtle ways.
