JDK-8310906 : Fix -Wconversion warnings in runtime, oops and some code header files.
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 21,22
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-06-26
  • Updated: 2024-06-25
  • Resolved: 2023-06-28
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 21 JDK 22
21.0.5Fixed 22 b04Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
Several header files have size calculations like size = address - address in same blob, that require casting to int.

Changed type of GrowableArray<> for bcis and jsrs in GenerateOopMap.

Changed type of 'phase' to char in jvmFlags.

Eliminating this many warnings (multiplied because of header file inclusions):

2439 src/hotspot/share/code/codeBlob.hpp
830 src/hotspot/share/oops/methodCounters.hpp
693 src/hotspot/share/runtime/stubCodeGenerator.hpp
657 src/hotspot/cpu/x86/nativeInst_x86.hpp
617 src/hotspot/share/oops/compressedOops.inline.hpp
614 src/hotspot/share/oops/stackChunkOop.inline.hpp
614 src/hotspot/share/code/codeBlob.inline.hpp
614 src/hotspot/cpu/x86/frame_x86.inline.hpp
591 src/hotspot/share/ci/ciStreams.hpp
245 src/hotspot/share/code/exceptionHandlerTable.hpp
243 src/hotspot/share/code/dependencies.hpp
170 src/hotspot/share/services/mallocHeader.hpp
94 src/hotspot/share/ci/ciMethodData.hpp
86 src/hotspot/share/utilities/nativeCallStack.hpp
85 src/hotspot/share/services/mallocSiteTable.hpp
72 src/hotspot/share/c1/c1_Instruction.hpp
42 src/hotspot/share/code/vtableStubs.hpp
25 src/hotspot/share/utilities/globalDefinitions.hpp
25 src/hotspot/share/runtime/flags/jvmFlagLimit.hpp
22 src/hotspot/share/classfile/classFileStream.hpp
21 src/hotspot/share/oops/generateOopMap.hpp
18 src/hotspot/share/c1/c1_CodeStubs.hpp
18 src/hotspot/os/linux/cgroupSubsystem_linux.hpp
14 src/hotspot/share/utilities/align.hpp
9 src/hotspot/share/utilities/elfFile.hpp
8 src/hotspot/share/cds/archiveHeapWriter.hpp
7 src/hotspot/share/oops/generateOopMap.cpp
4 src/hotspot/share/utilities/powerOfTwo.hpp
4 src/hotspot/share/runtime/continuationHelper.inline.hpp
2 src/hotspot/share/prims/jvmtiTagMapTable.hpp
2 src/hotspot/cpu/x86/stackChunkFrameStream_x86.inline.hpp
1 src/hotspot/cpu/x86/continuationFreezeThaw_x86.inline.hpp

Comments
This change was part of a bigger set of changes for trying to fix -Wconversion warnings, and many of them weren't very simple. They weren't finished by a long way. Since the changes were somewhat isolated, I can't see how they'd make other things you want to backport more difficult. So I don't see the benefit of backporting these.
20-06-2024

[jdk21u-fix-request] Approval Request from Aleksey Shipilëv Clean backport to avoid more conversion warnings, and lay the ground for subsequent clean backports. All tests pass. The change was in mainline for about a year without a bugtail.
20-06-2024

> I can't imagine how this would backport well. Seems pretty straight-forward :) What's your concern, Coleen? Is there something I am missing?
20-06-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u-dev/pull/767 Date: 2024-06-20 14:50:22 +0000
20-06-2024

Backporting note: Does not seem to compile without JDK-8320370, which resolved some NMT init weirdness.
06-05-2024

I can't imagine how this would backport well.
06-05-2024

Changeset: 9f46fc28 Author: Coleen Phillimore <coleenp@openjdk.org> Date: 2023-06-28 19:42:33 +0000 URL: https://git.openjdk.org/jdk/commit/9f46fc28426630399ca39d443403cc3a7be58854
28-06-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/14675 Date: 2023-06-27 12:41:50 +0000
27-06-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/14659 Date: 2023-06-26 17:47:25 +0000
26-06-2023