Integrated: 8296136: Use correct register in aarch64_enc_fast_unlock()

Roman Kennke rkennke at openjdk.org
Wed Nov 2 11:36:31 UTC 2022


On Mon, 31 Oct 2022 17:31:31 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> In aarch64_enc_fast_unlock() (aarch64.ad) we have this piece of code:
> 
> 
>     __ ldr(tmp, Address(oop, oopDesc::mark_offset_in_bytes()));
>     __ tbnz(disp_hdr, exact_log2(markWord::monitor_value), object_has_monitor);
> 
> 
> The tbnz uses the wrong register - it should really use tmp. disp_hdr has been loaded with the displaced header of the stack-lock, which would never have its monitor bits set, thus the branch will always take the slow path. In this common case, it is only a performance nuisance. In the case of !UseHeavyMonitors it is even worse, then disp_hdr will be unitialized, and we are facing a correctness problem.
> 
> As far as I can tell, the problem dates back to when aarch64 C2 parts have been added to OpenJDK.
> 
> Testing:
>  - [x] tier1
>  - [x] tier2
>  - [x] tier3
>  - [x] tier4

This pull request has now been integrated.

Changeset: 7619602c
Author:    Roman Kennke <rkennke at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/7619602c365acee73a490f05be2bd0d3dd09d7a4
Stats:     2 lines in 2 files changed: 0 ins; 0 del; 2 mod

8296136: Use correct register in aarch64_enc_fast_unlock()

Reviewed-by: aph, fyang

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

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


More information about the hotspot-compiler-dev mailing list