Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8313552

Fix -Wconversion warnings in JFR code

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 22
    • 22
    • hotspot
    • jfr
    • b10

      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);
            | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

            mgronlun Markus Grönlund
            coleenp Coleen Phillimore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: