JDK-8310332 : Fix -Wconversion warnings in MethodData
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 22
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-06-19
  • Updated: 2023-07-12
  • Resolved: 2023-06-21
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 b03Fixed
Related Reports
Relates :  
Description
There were some warnings from methodData.hpp and methodData.cpp:

3048 src/hotspot/share/oops/methodData.hpp
9 src/hotspot/share/oops/methodData.cpp

eg:

/src/hotspot/share/oops/methodData.hpp:207:28: warning: conversion from 'int' to 'u1' {aka 'unsigned char'} may change value [-Wconversion]
  207 |     _header._struct._flags |= (0x1 << flag_number);
      |     ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/src/hotspot/share/oops/methodData.hpp: In static member function 'static u8 DataLayout::flag_mask_to_header_mask(uint)':
/src/hotspot/share/oops/methodData.hpp:238:35: warning: conversion from 'uint' {aka 'unsigned int'} to 'u1' {aka 'unsigned char'} may change value [-Wconversion]
  238 |     temp._header._struct._flags = byte_constant;
      |                                   ^~~~~~~~~~~~~
/src/hotspot/share/oops/methodData.hpp: In member function 'void ProfileData::set_flag_at(int)':
/src/hotspot/share/oops/methodData.hpp:348:25: warning: conversion from 'int' to 'u1' {aka 'unsigned char'} may change value [-Wconversion]
  348 |     data()->set_flag_at(flag_number);
      |                         ^~~~~~~~~~~
/src/hotspot/share/oops/methodData.hpp: In member function 'bool ProfileData::flag_at(int) const':
/src/hotspot/share/oops/methodData.hpp:351:28: warning: conversion from 'int' to 'u1' {aka 'unsigned char'} may change value [-Wconversion]
  351 |     return data()->flag_at(flag_number);
      |                            ^~~~~~~~~~~
/src/hotspot/share/oops/methodData.hpp: In static member function 'static int ProfileData::flag_number_to_constant(int)': 
/src/hotspot/share/oops/methodData.hpp:359:48: warning: conversion from 'int' to 'u1' {aka 'unsigned char'} may change value [-Wconversion]
  359 |     return DataLayout::flag_number_to_constant(flag_number);
      |      
Comments
Changeset: fd1163d5 Author: Coleen Phillimore <coleenp@openjdk.org> Date: 2023-06-21 17:58:29 +0000 URL: https://git.openjdk.org/jdk/commit/fd1163d5f1f702ba81553c224ee86a2c6566fe55
21-06-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/14557 Date: 2023-06-20 12:29:17 +0000
20-06-2023