RFR: 8374828: Save load_barrier_on_oop_field_preloaded in aot CodeCache
Stefan Karlsson
stefank at openjdk.org
Mon Jan 12 15:24:03 UTC 2026
On Mon, 12 Jan 2026 15:04:42 GMT, Andrew Dinn <adinn at openjdk.org> wrote:
> > If we follow the ZBarrierSetAssembler::load_at we see the call:
> > ` __ call_VM_leaf(ZBarrierSetRuntime::load_barrier_on_oop_field_preloaded_addr(decorators), 2);`
>
> Hmm, well if that call is being generated then any attempt to save an AOT cache when using ZGC ought fail as it did in the Valhalla case because the generated code will reference an unknown external address. I just checked head and `load_barrier_on_oop_field_preloaded_addr` is not added as an external address. Oddly though `load_barrier_on_phantom_oop_field_preloaded_addr` is included -- it ought not to be needed as no saved code should be referring to it.
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:
address ZBarrierSetRuntime::load_barrier_on_oop_field_preloaded_addr(DecoratorSet decorators) {
if (decorators & AS_NO_KEEPALIVE) {
if (decorators & ON_PHANTOM_OOP_REF) {
return no_keepalive_load_barrier_on_phantom_oop_field_preloaded_addr();
} else if (decorators & ON_WEAK_OOP_REF) {
return no_keepalive_load_barrier_on_weak_oop_field_preloaded_addr();
} else {
assert((decorators & ON_STRONG_OOP_REF), "Expected type");
// Normal loads on strong oop never keep objects alive
return load_barrier_on_oop_field_preloaded_addr();
}
} else {
if (decorators & ON_PHANTOM_OOP_REF) {
return load_barrier_on_phantom_oop_field_preloaded_addr();
} else if (decorators & ON_WEAK_OOP_REF) {
return load_barrier_on_weak_oop_field_preloaded_addr();
} else {
assert((decorators & ON_STRONG_OOP_REF), "Expected type");
return load_barrier_on_oop_field_preloaded_addr();
}
}
}
> That may be a hangover from when the code was copied from Leyden premain but it also suggests that maybe something has changed in the Z barrier code and the AOT support is not up to date with it?
I don't think we have changed barriers in a long time.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29129#issuecomment-3739101221
More information about the hotspot-compiler-dev
mailing list