RFR: 8369742 link aot linked classes at vm bootstrap

Ioi Lam iklam at openjdk.org
Tue Oct 14 16:44:38 UTC 2025


On Tue, 14 Oct 2025 15:57:01 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

> This assumes that `Foo.doit()` can be called before `Foo.<clinit>` class initialization when `static Bar b = new Bar();` is executed and `Bar` class is initialized. Which should not happened (call `doit()` before `<clinit>`) AFAIU. Do I miss something?

If the `Foo` class was cached in AOT-initialized state, then `Foo.<clinit>` is executed only once, during the assembly phase. `Foo.b` will be stored inside the AOT cache. In the production run,  `Foo.<clinit>` is not executed and `Foo.b` will not be re-initialized.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/27783#issuecomment-3402763634


More information about the hotspot-dev mailing list