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

List:       openjdk-hotspot-compiler-dev
Subject:    Re: RFR: 8322743: C2: prevent lock region elimination in OSR compilation [v4]
From:       Vladimir Kozlov <kvn () openjdk ! org>
Date:       2024-02-29 19:17:55
Message-ID: IAelZioSFJ5-W9H1JEkouasXIgQvop4e80JKG2hpBko=.b9824f00-cdad-4dc0-be09-008194c5750d () github ! com
[Download RAW message or body]

On Thu, 29 Feb 2024 19:10:16 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.
> 
> Vladimir Kozlov has updated the pull request incrementally with one additional \
> commit since the last revision: 
> Added general run to regression test

Thank you Dean, Vladimir and Emanuel for reviews

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

PR Comment: https://git.openjdk.org/jdk/pull/17331#issuecomment-1971798383


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

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