RFR: 8313882: Fix -Wconversion warnings in runtime code [v2]

Coleen Phillimore coleenp at openjdk.org
Thu Aug 10 12:09:29 UTC 2023


On Thu, 10 Aug 2023 07:02:35 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Make bytecode.hpp index() functions return u2 not long.
>
> src/hotspot/share/runtime/javaThread.hpp line 599:
> 
>> 597: 
>> 598:   void inc_held_monitor_count(intx i = 1, bool jni = false);
>> 599:   void dec_held_monitor_count(intx i = 1, bool jni = false);
> 
> Does the parameter type need to be changed? AFAICS we never increment by other than one in any case (and inc/dec imply one - else they should be add/sub).

Yes, the parameter type needed to be changed because:

  void do_monitor(ObjectMonitor* mid) {
    intx rec = mid->complete_exit(_thread);
    _thread->dec_held_monitor_count(rec + 1);
  }


In general, I only widen things when there's a warning produced.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15177#discussion_r1290010985


More information about the graal-dev mailing list