Skip to content

Commit 78f8089

Browse files
committed
[GR-59446] Add test for nested locks
PullRequest: graal/19436
2 parents ffde754 + d884775 commit 78f8089

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/GraalOSRLockTest.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,4 +729,26 @@ public static ReturnValue testOuterLockOptimizeToDeopt() {
729729
}
730730
return ret;
731731
}
732+
733+
@Test
734+
@SuppressWarnings("try")
735+
public void testLocksAtOSREntry() {
736+
run(() -> {
737+
OptionValues options = new OptionValues(getInitialOptions(), osrLockDeopt());
738+
testOSR(options, "testLocksAtOSREntrySnippet", null, new Object(), false);
739+
});
740+
}
741+
742+
private static Object staticLock = new Object();
743+
744+
static synchronized Object testLocksAtOSREntrySnippet(Object object, boolean alwaysFalse) {
745+
synchronized (staticLock) {
746+
synchronized (object) {
747+
while (GraalDirectives.injectBranchProbability(0.001, alwaysFalse)) {
748+
GraalDirectives.sideEffect();
749+
}
750+
}
751+
}
752+
return ReturnValue.SUCCESS;
753+
}
732754
}

0 commit comments

Comments
 (0)