RFR: 8139457: Array bases are aligned at HeapWord granularity [v15]

Roman Kennke rkennke at openjdk.org
Tue Jan 31 11:30:03 UTC 2023


On Tue, 24 Jan 2023 18:22:00 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Move filler_array_min_size() into inline header file
>
> src/hotspot/share/oops/arrayKlass.cpp line 128:
> 
>> 126: 
>> 127: objArrayOop ArrayKlass::allocate_arrayArray(int n, int length, TRAPS) {
>> 128:   check_array_allocation_length(length, arrayOopDesc::max_array_length(element_type()), CHECK_NULL);
> 
> Wait, why? This method allocates the array of the "this"-typed arrays, I think. I.e. if `this` is `int[]`, then `element_type()` is `int`, and then `allocate_arrayArray(y, len)` allocates `int[length][]`, and we still need to check `length` against `max_array_length(T_ARRAY)`? Which is also why we do `objArrayOopDesc::object_size` at the very next line.

Right. My bad.

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

PR: https://git.openjdk.org/jdk/pull/11044


More information about the hotspot-dev mailing list