RFR: 8310921: Fix -Wconversion warnings from GenerateOopMap

David Holmes dholmes at openjdk.org
Tue Jun 27 06:56:08 UTC 2023


On Mon, 26 Jun 2023 20:36:57 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> This is broken out from but tested with the PR from https://github.com/openjdk/jdk/pull/14659

src/hotspot/share/oops/generateOopMap.cpp line 663:

> 661: 
> 662: int GenerateOopMap::next_bb_start_pc(BasicBlock *bb) {
> 663:  int bbNum = (int)(bb - _basic_blocks + 1);

If this is an offset into a memory region then shouldn't it be `intptr_t` or `size_t`?

src/hotspot/share/oops/generateOopMap.cpp line 2060:

> 2058:   tty->print_cr ("  Total : %3.3f sec.", GenerateOopMap::_total_oopmap_time.seconds());
> 2059:   tty->print_cr ("  (%3.0f bytecodes per sec) ",
> 2060:   (float)GenerateOopMap::_total_byte_count / GenerateOopMap::_total_oopmap_time.seconds());

I don't understand this change. The denominator is a double due to `seconds()` so the numerator will be promoted to double as well, and the whole expression is a double.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14666#discussion_r1243218891
PR Review Comment: https://git.openjdk.org/jdk/pull/14666#discussion_r1243221577


More information about the hotspot-dev mailing list