RFR: 8277180: Intrinsify recursive ObjectMonitor locking for C2 x64 and A64

Andrew Haley aph at openjdk.java.net
Wed Nov 17 10:18:34 UTC 2021


On Tue, 16 Nov 2021 08:58:49 GMT, Erik Österlund <eosterlund at openjdk.org> wrote:

> The C2 fast_lock and fast_unlock intrinsics don't support recursive ObjectMonitor locking. Some workloads can significantly benefit from this. Recent ObjectMonitor work has changed heuristics such that ObjectMonitors are deflated less aggressively. Therefore we can expect to see more inflated monitors in workloads where we would usually see more stack locks. That in itself is fine, except that C2 doesn't intrinsify the recursive locking paths for object monitors. Enabling those cases in the C2 code, removes a (~17%) regression we have seen with DaCapo h2 -t 1, and makes a few more benchmarks happy as well.

Normally I would hate any code added to our hand-carved assembler sequences, but even I have to admit that this surprisingly simple addition is worthwhile.

src/hotspot/cpu/aarch64/aarch64.ad line 3872:

> 3870:     __ ldr(tmp, Address(disp_hdr, ObjectMonitor::recursions_offset_in_bytes() - markWord::monitor_value));
> 3871:     __ add(tmp, tmp, 1u);
> 3872:     __ str(tmp, Address(disp_hdr, ObjectMonitor::recursions_offset_in_bytes() - markWord::monitor_value));

Suggestion:

    __ increment(Address(disp_hdr, ObjectMonitor::recursions_offset_in_bytes() - markWord::monitor_value));

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

Marked as reviewed by aph (Reviewer).

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


More information about the hotspot-compiler-dev mailing list