[jdk8u-dev] RFR: 6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp

Severin Gehwolf sgehwolf at openjdk.org
Tue Sep 19 16:52:06 UTC 2023


On Tue, 19 Sep 2023 15:28:00 GMT, Sun Jianye <jianyesun at openjdk.org> wrote:

>> Hi all,
>> 
>> This pull request contains a backport of commit [b256989eb34a32c8f03be448c0645baeb5192a01](https://github.com/openjdk/jdk11u-dev/commit/b256989eb34a32c8f03be448c0645baeb5192a01) from the [openjdk/jdk11u-dev](https://github.com/openjdk/jdk11u-dev) repository.
>> 
>> As reported by issue :  https://bugs.openjdk.org/browse/JDK-8316278 .  We found  the indexing method of PtrQueue's buf  is not  correct  when  converting an integer of type size_t to type int, then calling the method PtrQueue::byte_index_to_index . 
>> The key problem is this way of using: 
>> 
>> size_t i=0;    _buf[byte_index_to_index((int)i)] = NULL;  
>> 
>> The variable i of size_t type  cannot be converted directly to an int type . Other than that, the return value of the function byte_index_to_index is the index of the array _buf, and it should be non-negative. So it  should be a type of size_t. 
>> Currently we have found 2 issues related to this problem,  https://bugs.openjdk.org/browse/JDK-8308169 and  https://bugs.openjdk.org/browse/JDK-8303961.  They are all triggered by a special  size number of buf, like '-XX:G1UpdateBufferSize=512M'  or  '-XX:G1SATBBufferSize=500m'
>> We also added a test case.
>> Please review this PR. Thanks.
>
> It triggers the jcheck error again... It shows this: 
> 
> The commit message does not reference any issue. To add an issue reference to this PR, edit the title to be of the format issue number: message.
> 
> This PR's title seems ok, do you know why? @jerboaa

@jianyesun PR title needs to be `Backport b256989eb34a32c8f03be448c0645baeb5192a01` (provided the sha is correct).

@jianyesun You are changing the title to something like `Backport b256989eb34a32c8f03be448c0645baeb5192a01 8316278: Fix the indexing method of PtrQueue's buf when a large integer value overflow`. It should be `Backport b256989eb34a32c8f03be448c0645baeb5192a01`. I.e. drop `8316278: ...` from the title.

The bots will do the rest.

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

PR Comment: https://git.openjdk.org/jdk8u-dev/pull/374#issuecomment-1725904237
PR Comment: https://git.openjdk.org/jdk8u-dev/pull/374#issuecomment-1726061338


More information about the jdk8u-dev mailing list