RFR: 8308745: ObjArrayKlass::allocate_objArray_klass may call into java while holding a lock
Coleen Phillimore
coleenp at openjdk.org
Tue Mar 5 19:50:11 UTC 2024
On Tue, 13 Feb 2024 02:07:54 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> src/hotspot/share/oops/arrayKlass.cpp line 141:
>>
>>> 139: ObjArrayKlass::allocate_objArray_klass(class_loader_data(), dim + 1, this, CHECK_NULL);
>>> 140: // use 'release' to pair with lock-free load
>>> 141: release_set_higher_dimension(ak);
>>
>> Why has this code changed? I only expected to see the lock changed.
>
> The assert is dumb, leftover from when we didn't have C++ types (only klassOop). Of course it's an objArrayKlass, that's its type! The higher dimension should be set in the constructor of ObjArrayKlass. Every version of this change, I move this assignment there.
Changing this like this makes it more similar to the InstanceKlass::array_klass function in structure, and there was unnecessary { } scopes in both and an unnecessary ResourceMark.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17739#discussion_r1487058776
More information about the serviceability-dev
mailing list