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

David Holmes dholmes at openjdk.java.net
Tue Jan 12 08:45:59 UTC 2021


On Mon, 11 Jan 2021 21:41:23 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> This is a trivial fix to make the "-XX:AvgMonitorsPerThreadEstimate"
>> option work correctly for values < 1024.
>> 
>> I've locally built and tested this fix on my MBP13. It will be included in my
>> next Mach5 Tier[1-3] testing batch.
>
> Daniel D. Daugherty has updated the pull request incrementally with one additional commit since the last revision:
> 
>   change AvgMonitorsPerThreadEstimate from int to size_t and _in_use_list_ceiling from jint to size_t.

Hi Dan,
I'm happy with the consistent use of size_t - thanks. :)

A couple of minor comments remaining.

Thanks,
David

src/hotspot/share/runtime/synchronizer.cpp line 1167:

> 1165: 
> 1166: void ObjectSynchronizer::dec_in_use_list_ceiling() {
> 1167:   Atomic::add(&_in_use_list_ceiling, -AvgMonitorsPerThreadEstimate);

Don't you need to cast AMPTE to a signed type to take the negative of it?
Why not just use Atomic::sub?

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

Marked as reviewed by dholmes (Reviewer).

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


More information about the hotspot-runtime-dev mailing list