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

Roman Kennke rkennke at openjdk.org
Thu Dec 15 13:23:12 UTC 2022


On Mon, 5 Dec 2022 13:45:38 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Test for 32bit build
>
> src/hotspot/share/oops/arrayOop.hpp line 148:
> 
>> 146:       // overflowing an int when we add the header. See CRs 4718400 and 7110613.
>> 147:       int header_size_words = align_up(base_offset_in_bytes(type), HeapWordSize) / HeapWordSize;
>> 148:       return align_down(max_jint - header_size_words, MinObjAlignment);
> 
> I somehow was under the impression that for smaller types we should now have a larger max, since we can fit more elements.

Yes, but this doesn't have much to do with that it now fits better, but because smaller types would not cause the overflow. This was pre-existing, but I improved the calculation here anyway. Also, I filed:

https://bugs.openjdk.org/browse/JDK-8298863

to try and fix the remaining places where int is used for object size in words, and then we could use max_jint for all types.

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

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


More information about the hotspot-dev mailing list