RFR: 8313882: Fix -Wconversion warnings in runtime code

Coleen Phillimore coleenp at openjdk.org
Mon Aug 7 13:03:32 UTC 2023


Here are fixes to silence -Wconversion warnings in runtime code.  Use direct cast for 64 bit int to double, otherwise default to checked_cast<>.  I changed the declaration of _held_monitor_count and _jni_monitor count to intx to fix cascade of warnings coming from this.

src/hotspot/share/runtime/synchronizer.cpp:1802:41: warning: conversion from 'intx' {aka 'long int'} to 'int' may change value [-Wconversion]
 1802 |     _thread->dec_held_monitor_count(rec + 1);
      |                                     ~~~~^~~

Tested with tier1-4 on linux-x64-debug and windows-x64-debug and tier1 on Oracle supported platforms.

-------------

Commit messages:
 - Fix jvmci for held_monitor_count type.
 - Fix format strings for monitor_counts and fix arguments.cpp differently.
 - Fix gtests
 - Fix asserted files in runtime with one warning.
 - Fix signature.cpp
 - Fix continuationFreezeThaw.cpp
 - Fix deoptimization.cpp (size_of_frames is used to assign to _total_frame_sizes, which is an int and referred to from cpu code, so left it as an int and added checked cast instead)
 - Fixed synchronizer.cpp by fixing _held_monitor_count and _jni_monitor_count.
 - Fix arguments.cpp
 - Fixed sharedRuntime.cpp
 - ... and 3 more: https://git.openjdk.org/jdk/compare/0bb6af3b...4eeeb165

Changes: https://git.openjdk.org/jdk/pull/15177/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15177&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8313882
  Stats: 115 lines in 24 files changed: 3 ins; 9 del; 103 mod
  Patch: https://git.openjdk.org/jdk/pull/15177.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15177/head:pull/15177

PR: https://git.openjdk.org/jdk/pull/15177


More information about the graal-dev mailing list