RFR: 8374828: Save load_barrier_on_oop_field_preloaded in aot CodeCache

Andrew Dinn adinn at openjdk.org
Mon Jan 12 17:39:37 UTC 2026


On Mon, 12 Jan 2026 15:20:45 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

> Ahh. I see now that there are two overloads named load_barrier_on_oop_field_preloaded_addr and the one I referred to above returns load_barrier_on_phantom_oop_field_preloaded_addr. This function could probably have a clearer name

Ok, so that explains why mainline is adding whatever address `load_barrier_on_phantom_oop_field_preloaded_addr()` returns to the external addresses list and hence why we don't see a crash in mainline when using an AOT cache with ZGC. I failed to spot that this was being done when Vladimir committed the associated patch to mainline.

However, the fact that ZGC requires a barrier for an off-heap phantom oop load does mean that we must stick with ZGC in production when we use it in assembly and vice versa (while we can safely mix and match Serial, Parallel, G1 and Shenandoah GCs).

@coleenp Looking at the JIRA I understand now how these other two target addresses get embedded in adapters generated with the Valhalla but are never referenced from adapters generated in mainline. There is no real danger of these two address registrations being forgotten about when the Valhalla i2c/c2i changes are upstreamed. All AOT save/restore tests will find that they are missing and throw an exception.

It won't cause any harm to push this in mainline before Valhalla lands (although there is always the possibility that someone performing a zealous cleanup will take them out again ;-). So, go ahead and commit if you want.

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

PR Comment: https://git.openjdk.org/jdk/pull/29129#issuecomment-3739700481


More information about the hotspot-compiler-dev mailing list