JDK-8313552 : Fix -Wconversion warnings in JFR code
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: jfr
  • Affected Version: 22
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-08-01
  • Updated: 2023-08-14
  • Resolved: 2023-08-08
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 22
22 b10Fixed
Related Reports
Relates :  
Description
These are some of the warnings you get when turning -Wconversion on and -Werror off.

Because of multiple files that include these, the number of warnings in the result file for some of the header files is high for only a couple of errors.

555 src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp
535 src/hotspot/share/jfr/writers/jfrEncoders.hpp
18 src/hotspot/share/jfr/utilities/jfrBigEndian.hpp
18 src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp
14 src/hotspot/share/jfr/support/jfrAdaptiveSampler.cpp
8 src/hotspot/share/jfr/periodic/jfrThreadCPULoadEvent.cpp
6 src/hotspot/share/jfr/periodic/jfrPeriodic.cpp
4 src/hotspot/share/jfr/recorder/stacktrace/jfrStackTrace.cpp
1 src/hotspot/share/jfr/recorder/service/jfrEventThrottler.cpp
1 src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp
1 src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdKlassQueue.cpp
1 src/hotspot/share/jfr/recorder/checkpoint/types/jfrThreadGroup.cpp

src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp:67:83: warning: conversion from 'traceid' {aka 'long unsigned int'} to 'jbyte' {aka 'signed char'} may change value [-Wconversion]        
   67 | #define THIS_EPOCH_BIT                            (JfrTraceIdEpoch::this_epoch_bit())
      |                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp:81:74: note: in definition of macro 'TRACE_ID_TAG'
   81 | #define TRACE_ID_TAG(ptr, bits)                   (JfrTraceIdBits::store(bits, ptr))
      |                                                                          ^~~~
src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp:111:70: note: in expansion of macro 'THIS_EPOCH_BIT'
  111 | #define SET_USED_THIS_EPOCH(ptr)                  (TRACE_ID_TAG(ptr, THIS_EPOCH_BIT))
      |                                                                      ^~~~~~~~~~~~~~
src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.inline.hpp:70:5: note: in expansion of macro 'SET_USED_THIS_EPOCH'
   70 |     SET_USED_THIS_EPOCH(klass);
      |     ^~~~~~~~~~~~~~~~~~~
src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.inline.hpp: In static member function 'static traceid JfrTraceIdLoadBarrier::load(const Klass*, const Method*)':
src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp:71:101: warning: conversion from 'traceid' {aka 'long unsigned int'} to 'jbyte' {aka 'signed char'} may change value [-Wconversion]       
   71 | #define THIS_EPOCH_METHOD_AND_CLASS_BITS          (JfrTraceIdEpoch::this_epoch_method_and_class_bits())
      |                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp:81:74: note: in definition of macro 'TRACE_ID_TAG'
   81 | #define TRACE_ID_TAG(ptr, bits)                   (JfrTraceIdBits::store(bits, ptr))
      |                                                                          ^~~~
src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdMacros.hpp:112:70: note: in expansion of macro 'THIS_EPOCH_METHOD_AND_CLASS_BITS'
  112 | #define SET_METHOD_AND_CLASS_USED_THIS_EPOCH(kls) (TRACE_ID_TAG(kls, THIS_EPOCH_METHOD_AND_CLASS_BITS))
      |                                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdLoadBarrier.inline.hpp:92:6: note: in expansion of macro 'SET_METHOD_AND_CLASS_USED_THIS_EPOCH'
   92 |      SET_METHOD_AND_CLASS_USED_THIS_EPOCH(klass);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Comments
Changeset: 091e65e9 Author: Markus Grönlund <mgronlun@openjdk.org> Date: 2023-08-08 11:01:59 +0000 URL: https://git.openjdk.org/jdk/commit/091e65e95b42f7c425b1a39ee518230d4e8bb05c
08-08-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/15152 Date: 2023-08-04 10:55:04 +0000
04-08-2023