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

Fix -Wconversion warnings in MethodData

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 22
    • 22
    • hotspot
    • b03

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

            coleenp Coleen Phillimore
            coleenp Coleen Phillimore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: