RFR: 8296136: Use correct register in aarch64_enc_fast_unlock() [v2]

Roman Kennke rkennke at openjdk.org
Tue Nov 1 12:16:48 UTC 2022


> 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

Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:

  Same fix for RISC-V

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/10921/files
  - new: https://git.openjdk.org/jdk/pull/10921/files/0b8cfea5..832dbb06

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10921&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10921&range=00-01

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/10921.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10921/head:pull/10921

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


More information about the hotspot-compiler-dev mailing list