RFR: 8286397: Address possibly lossy conversions in jdk.hotspot.agent [v2]

Ryan Ernst duke at openjdk.org
Fri Jun 24 20:34:11 UTC 2022


On Fri, 24 Jun 2022 18:22:28 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> Ryan Ernst has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
>> 
>>  - Merge branch 'master' into implicit_casts_jdk.hotspot.agent
>>  - 8286397: Address possibly lossy conversions in jdk.hotspot.agent
>>    
>>    Applied required casts in jdk.hotspot.agent for the upcoming warning.
>>    Verified by cherry-picking @asotona's patch.
>
> src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java line 540:
> 
>> 538:             Iterator<Field> itr = null;
>> 539:             // loader + signer + protectionDomain + 2 reserved + fieldSize + cpool entris number
>> 540:             size += (int) (OBJ_ID_SIZE * 5 + INT_SIZE + SHORT_SIZE);
> 
> Why are INT_SIZE and SHORT_SIZE longs? It seems that making them int (along with all the other related _SIZE fields) is the proper fix for this and the changes below.

These come from ObjectHeap. I do agree it would be better to change these upstream (all the type sizes there are currently `long`), but that would be a much more invasive change. I'm happy to try that, but it looked like a can of worms.

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

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


More information about the serviceability-dev mailing list