[master] Integrated: 8303769: [Lilliput] Fix interpreter asymmetric fast-locking

Roman Kennke rkennke at openjdk.org
Thu Mar 9 18:44:04 UTC 2023


On Tue, 7 Mar 2023 20:38:28 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> 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.'
> 
> I've already pushed that fix to the upstream fast-locking PR https://github.com/openjdk/jdk/pull/10907
> 
> Testing:
>  - [x] tier1 (x86_64, x86_32, aarch64)
>  - [ ] tier2 (x86_64, x86_32, aarch64)

This pull request has now been integrated.

Changeset: 88fe2227
Author:    Roman Kennke <rkennke at openjdk.org>
URL:       https://git.openjdk.org/lilliput/commit/88fe2227c981f80ddab567e3e32888d2e8b4ec92
Stats:     11 lines in 3 files changed: 6 ins; 0 del; 5 mod

8303769: [Lilliput] Fix interpreter asymmetric fast-locking

Reviewed-by: stuefe

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

PR: https://git.openjdk.org/lilliput/pull/76


More information about the lilliput-dev mailing list