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

Roman Kennke rkennke at openjdk.org
Thu Jan 19 13:36:38 UTC 2023


On Thu, 19 Jan 2023 11:14:48 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> Roman Kennke has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 25 commits:
>> 
>>  - Merge branch 'master' into JDK-8139457
>>  - Fix gtest for correct base offsets in 32bit builds
>>  - Fix cast warning
>>  - Revert relaxation of array length
>>  - Add guards to ArrayBaseOffsets test to allow running with -UseCompressedClassPointers
>>  - Fix another cast warning
>>  - Clean cast warning from size_t to int
>>  - Clear leading 32bits in Z array allocator
>>  - SA adjustments
>>  - Test for 32bit build
>>  - ... and 15 more: https://git.openjdk.org/jdk/compare/500b45e1...c278a53b
>
> src/hotspot/share/opto/runtime.cpp line 316:
> 
>> 314:     HeapWord* obj = cast_from_oop<HeapWord*>(result);
>> 315:     if (aligned_hs_bytes > hs_bytes) {
>> 316:       Copy::zero_to_bytes(obj + hs_bytes, aligned_hs_bytes - hs_bytes);
> 
> I think this is wrong. `obj` is a `HeapWord*` and hs_bytes is in bytes. You shouldn't be adding to a pointer with a variable holding bytes.

Ugh, right. Good find. I have rewritten that code to be a little clearer.

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

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


More information about the hotspot-dev mailing list