RFR: 8296136: Use correct register in aarch64_enc_fast_unlock()

Roman Kennke rkennke at openjdk.org
Mon Oct 31 17:40:03 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
 - [ ] tier2
 - [ ] tier3
 - [ ] tier4

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

Commit messages:
 - 8296136: Use correct register in aarch64_enc_fast_unlock()

Changes: https://git.openjdk.org/jdk/pull/10921/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10921&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8296136
  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