RFR: 8296136: Use correct register in aarch64_enc_fast_unlock()
Andrew Haley
aph at openjdk.org
Mon Oct 31 17:43:51 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
> - [ ] tier2
> - [ ] tier3
> - [ ] tier4
Ouch!
Yes, thanks. I just checked the code against x86, which confirms your analysis.
-------------
Marked as reviewed by aph (Reviewer).
PR: https://git.openjdk.org/jdk/pull/10921
More information about the hotspot-compiler-dev
mailing list