[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-hotspot-compiler-dev
Subject:    Integrated: 8322743: C2: prevent lock region elimination in OSR compilation
From:       Vladimir Kozlov <kvn () openjdk ! org>
Date:       2024-02-29 20:23:57
Message-ID: J33BW-w7sM_dYhAj9iEgDkl5CTHBhZ8WBf_JIyaNKYo=.71104d76-a62c-4dc6-b63f-5053c7d9a18a () github ! com
[Download RAW message or body]

On Tue, 9 Jan 2024 22:57:27 GMT, Vladimir Kozlov <kvn@openjdk.org> wrote:

> Corner case with a local (not escaped) object used for synchronization. C2 Escape \
> Analysis thinks that it can eliminate locks for it. In most cases it is true but \
> not in this case. 
> 
> for (int i = 0; i < 2; ++i) {
> Object o = new Object();
> synchronized (o) { // monitorenter
> // Trigger OSR compilation
> for (int j = 0; j < 100_000; ++j) {
> 
> The test has nested loop which trigger OSR compilation. The locked object comes \
> from Interpreter into compiled OSR code. During parsing C2 creates an other non \
> escaped object and correctly merge both together (with Phi node) so that non \
> escaped object is not scalar replaceable. Because it does not globally escapes EA \
> still removes locks for it and, as result, also for merged locked object from \
> Interpreter which is the bug. 
> The fix is to mark BoxLock node associated with OSR entry as Unbalanced to prevent \
> EA from removing locks/unlocks from it. It is based on \
> [JDK-8324969](https://github.com/openjdk/jdk/pull/17697) changes. 
> Added regression test prepared by @TobiHartmann. Tested tier1-5, xcomp and stress.
> Performance testing show no difference.

This pull request has now been integrated.

Changeset: 742c776a
Author:    Vladimir Kozlov <kvn@openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/742c776a922bc226a3beaa9e219ff0bd2baf7bc4
                
Stats:     97 lines in 3 files changed: 94 ins; 1 del; 2 mod

8322743: C2: prevent lock region elimination in OSR compilation

Reviewed-by: epeter, dlong, vlivanov

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

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic