JDK-8310675 : Fix -Wconversion warnings in ZGC code
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 22
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-06-22
  • Updated: 2024-08-12
  • Resolved: 2024-08-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24 b10Fixed
Related Reports
Relates :  
Sub Tasks
JDK-8313791 :  
Description
There are two warnings in zPage.inline.hpp that are reported a lot (1226) times because of inclusion.

src/hotspot/share/gc/z/zPage.inline.hpp: In member function 'uint8_t ZPage::numa_id()':
src/hotspot/share/gc/z/zPage.inline.hpp:183:32: warning: conversion from 'uint32_t' {aka 'unsigned int'} to 'uint8_t' {aka 'unsigned char'} may change value [-Wconversion]
  183 |     _numa_id = ZNUMA::memory_id(untype(ZOffset::address(start())));
      |                ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/hotspot/share/gc/z/zPage.inline.hpp: In member function 'void ZPage::set_last_used()':
src/hotspot/share/gc/z/zPage.inline.hpp:210:20: warning: conversion from 'double' to 'uint64_t' {aka 'long unsigned int'} may change value [-Wfloat-conversion]
  210 |   _last_used = ceil(os::elapsedTime());
      |                ~~~~^~~~~~~~~~~~~~~~~~~
It might make sense to fix all the ZGC code at once.

9 src/hotspot/share/gc/z/zHeuristics.cpp
9 src/hotspot/share/gc/z/zDirector.cpp
8 src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp
6 src/hotspot/share/gc/z/zStat.cpp
6 src/hotspot/share/gc/z/zNMethodTable.cpp
5 src/hotspot/share/gc/z/zStoreBarrierBuffer.cpp
3 src/hotspot/share/gc/z/zRelocationSetSelector.cpp
2 src/hotspot/share/gc/z/zUnmapper.cpp
2 src/hotspot/share/gc/z/zPageCache.cpp
2 src/hotspot/share/gc/z/zMetronome.cpp
2 src/hotspot/share/gc/z/zMarkStack.cpp
2 src/hotspot/os/linux/gc/z/zSyscall_linux.cpp
2 src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp
1 src/hotspot/share/gc/z/zVerify.cpp
1 src/hotspot/share/gc/z/zHeapIterator.cpp

Comments
Changeset: 21f710e7 Branch: master Author: Joel Sikström <joel.sikstrom@oracle.com> Committer: Albert Mingkun Yang <ayang@openjdk.org> Date: 2024-08-07 14:16:01 +0000 URL: https://git.openjdk.org/jdk/commit/21f710e7f6698b12b06cc3685cefa31f5fcff2a2
07-08-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/20406 Date: 2024-07-31 13:01:50 +0000
06-08-2024

Where genzgc (gc/z/*) and zgc-singlegen (gc/x/*) are identical, it may make sense to apply such changes to both to keep them in sync.
23-06-2023