RFR: 8259349: -XX:AvgMonitorsPerThreadEstimate=1 does not work right [v2]

Daniel D.Daugherty dcubed at openjdk.java.net
Fri Jan 8 17:02:57 UTC 2021


On Fri, 8 Jan 2021 13:54:22 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> src/hotspot/share/runtime/synchronizer.cpp line 1187:
>> 
>>> 1185:   // but in reality the ceiling should never get that high.
>>> 1186:   _in_use_list_ceiling = (jint)new_value;
>>> 1187: }
>> 
>> I'm sure I must have asked this before but why is AvgMonitorsPerThreadEstimate typed as `intx` rather than `int`? A `jint is 32-bit and so is `int` on all our 32-bit and 64-bit platforms; whereas `intx` is 64-bit on a 64-bit system.
>> 
>> And if we only ever set this field once why introduce a seemingly general use setter function instead of just doing the initialization directly in the initialize() method?
>
> @dholmes-ora - Thanks for the review.
> 
> The `intx` type was copied from some other option when `AvgMonitorsPerThreadEstimate`
> was introduced. I'd have to look to see why `intx` is used instead of `int` in options.
> 
> set_in_use_list_ceiling() is used in this fix and also in the follow on fix: JDK-8226416.

$ grep -c 'product(int,' src/hotspot/share/runtime/globals.hpp
1

$ grep -c 'product(intx,' src/hotspot/share/runtime/globals.hpp
68

Looks like we have 1 `int` option and 68 `intx` options. I'll look at changing
AvgMonitorsPerThreadEstimate from `intx` to `int`.

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

PR: https://git.openjdk.java.net/jdk/pull/1992


More information about the hotspot-runtime-dev mailing list