[lilliput-jdk17u:lilliput] RFR: 8303771: [Lilliput/JDK17] Fix interpreter asymmetric fast-locking [v2]

Roman Kennke rkennke at openjdk.org
Thu Mar 9 17:40:19 UTC 2023


> Backport of https://github.com/openjdk/lilliput/pull/76.
> 
> Currently we get the asymmetric locking check in the interpreters wrong:
> 
> ldr(header_reg, Address(rthread, JavaThread::lock_stack_current_offset()));
> cmpoop(header_reg, obj_reg);
> br(Assembler::NE, slow_case);
> 
> The intention is to load the top of the lock-stack, and compare it to the unlocked object, and, if not equal, branch to the slow-path to handle it. However, what it really does is, it loads the *address* of the top of lock-stack, and compares that to the unlocked object. This can never succeed, and therefore we always call the slow-path. Additionally, the address is not the address of the topmost object, it is the address of the next free slot. What we really want to load is the element at -1 oop from that address. This is not incorrect, but it's unnecessarily slow.
> 
> Testing:
>  - [x] tier1 (x86_64, x86_32, aarch64)
>  - [ ] tier2 (x86_64, x86_32, aarch64)

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

  Alias tmp registers

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

Changes:
  - all: https://git.openjdk.org/lilliput-jdk17u/pull/9/files
  - new: https://git.openjdk.org/lilliput-jdk17u/pull/9/files/9ec75e57..bfa310ed

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=lilliput-jdk17u&pr=9&range=01
 - incr: https://webrevs.openjdk.org/?repo=lilliput-jdk17u&pr=9&range=00-01

  Stats: 7 lines in 2 files changed: 2 ins; 0 del; 5 mod
  Patch: https://git.openjdk.org/lilliput-jdk17u/pull/9.diff
  Fetch: git fetch https://git.openjdk.org/lilliput-jdk17u pull/9/head:pull/9

PR: https://git.openjdk.org/lilliput-jdk17u/pull/9


More information about the lilliput-dev mailing list