Skip to content

Commit 05e17de

Browse files
committed
Merge 'graalvm-community-jdk21u' into mandrel/23.1 (2025-08-21 edition)
2 parents f40522c + 0b2eed0 commit 05e17de

File tree

64 files changed

+1335
-339
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1335
-339
lines changed

MAINTAINING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ Between step 1 and 3 no new pull requests should be merged.
2626

2727
* [Boris Ulasevich](https://github.com/bulasevich)
2828
* [Cesar Soares](https://github.com/JohnTortugo)
29+
* [John Spurling](https://github.com/synecdoche)
2930
* [Volker Simonis](https://github.com/simonis/)

compiler/mx.compiler/suite.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,33 +85,39 @@
8585
"urls" : ["https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/batik-all-1.7.jar"],
8686
},
8787

88-
"ASM_9.5" : {
89-
"digest" : "sha512:9e65f2983783725bae196ca939b45246958731246df1c495089c8ea5ce646de77c4e01a5a9ba10642016bb3258e1727e9ebcece6e74d9e3c32f528025d76b955",
88+
"ASM_9.7.1" : {
89+
"digest" : "sha512:4767b01603dad5c79cc1e2b5f3722f72b1059d928f184f446ba11badeb1b381b3a3a9a801cc43d25d396df950b09d19597c73173c411b1da890de808b94f1f50",
90+
"sourceDigest" : "sha512:d7c0de5912d04949a3d06cad366ff35a877da2682d9c74579625d62686032ea9349aff6102b17f92e9ec7eb4e9b1cd906b649c6a3ac798bfb9e31e5425de009d",
9091
"maven" : {
9192
"groupId" : "org.ow2.asm",
9293
"artifactId" : "asm",
93-
"version" : "9.5",
94+
"version" : "9.7.1",
9495
},
96+
"license" : "BSD-new",
9597
},
9698

97-
"ASM_TREE_9.5" : {
98-
"digest" : "sha512:816de8f84c216a7bd97b2458bde64a4b99a039b7b59fbd1ef52edf8bf869edabb93967736fe0c61e8eb3e1520e0cefe69ba59cda12df30f9f85db75fb6c064f3",
99+
"ASM_TREE_9.7.1" : {
100+
"digest" : "sha512:e55008c392fdd35e95d3404766b12dd4b46e13d5c362fcd0ab42a65751a82737eaf0ebc857691d1916190d34407adfde4437615d69c278785416fd911e00978d",
101+
"sourceDigest" : "sha512:3cea80bc7b55679dfa3d2065c6cb6951007cc7817082e9fcf4c5e3cdc073c22eddf7c7899cff60b1092049ec9038e8d3aa9a8828ef731739bda8b5afcec30e86",
99102
"maven" : {
100103
"groupId" : "org.ow2.asm",
101104
"artifactId" : "asm-tree",
102-
"version" : "9.5",
105+
"version" : "9.7.1",
103106
},
104-
"dependencies" : ["ASM_9.5"],
107+
"dependencies" : ["ASM_9.7.1"],
108+
"license" : "BSD-new",
105109
},
106110

107-
"ASM_UTIL_9.5" : {
108-
"digest" : "sha512:f68284d8f8fd029f3f428112225b2035ed3a4216cf3b34e0aacc83c32a6d44ab5e5d128b60a13ef768e3396041a62cf63f7fd3445dc5a05ce0ae03a2b2ed3080",
111+
"ASM_UTIL_9.7.1" : {
112+
"digest" : "sha512:522d793d15a2c5ea6504a50222cf0750f1eab7b881cf289675042539b1aba8b3868197b1bebe729de728dd10020eb028ae16252dcd5d84fdcbf7f925832bc269",
113+
"sourceDigest" : "sha512:387aa887bfec24aec287d9aacebfdc0c2e1ab16a4adce933aecac6fc41545ce43a3eea0ed139db52dd0d0af910cfd2162aa4d6330a81b32b64b36f03b49db66a",
109114
"maven" : {
110115
"groupId" : "org.ow2.asm",
111116
"artifactId" : "asm-util",
112-
"version" : "9.5",
117+
"version" : "9.7.1",
113118
},
114-
"dependencies" : ["ASM_9.5"],
119+
"dependencies" : ["ASM_9.7.1"],
120+
"license" : "BSD-new",
115121
},
116122

117123
"HSDIS" : {
@@ -236,8 +242,8 @@
236242
"dependencies" : [
237243
"jdk.internal.vm.compiler",
238244
"mx:JUNIT",
239-
"ASM_TREE_9.5",
240-
"ASM_UTIL_9.5",
245+
"ASM_TREE_9.7.1",
246+
"ASM_UTIL_9.7.1",
241247
"JAVA_ALLOCATION_INSTRUMENTER",
242248
"truffle:TRUFFLE_SL_TEST",
243249
"truffle:TRUFFLE_TEST",
@@ -456,8 +462,8 @@
456462
"truffle:TRUFFLE_COMPILER",
457463
"truffle:TRUFFLE_RUNTIME",
458464
"regex:TREGEX",
459-
"ASM_TREE_9.5",
460-
"ASM_UTIL_9.5",
465+
"ASM_TREE_9.7.1",
466+
"ASM_UTIL_9.7.1",
461467
],
462468
"exclude" : [
463469
"mx:JUNIT",
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
package org.graalvm.compiler.core.aarch64.test;
26+
27+
import org.graalvm.compiler.core.test.GraalCompilerTest;
28+
import org.junit.Test;
29+
30+
/**
31+
* Add/sub with an immediate MIN_VALUE may result in infinite recursion since MIN_VALUE < 0 and
32+
* -MIN_VALUE < 0.
33+
*/
34+
public class AddSubInfiniteRecursionTest extends GraalCompilerTest {
35+
public static int testAddIntMinValue(int arg) {
36+
return arg + Integer.MIN_VALUE;
37+
}
38+
39+
public static int testSubIntMinValue(int arg) {
40+
return arg - Integer.MIN_VALUE;
41+
}
42+
43+
@Test
44+
public void runIntMinValue() {
45+
test("testAddIntMinValue", 0);
46+
test("testSubIntMinValue", 0);
47+
}
48+
}

compiler/src/jdk.internal.vm.compiler.test/src/org/graalvm/compiler/replacements/test/UnsafeReplacementsTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -155,6 +155,15 @@ public void testCompareAndSet() {
155155
test("unsafeCompareAndSetDouble");
156156
}
157157

158+
public static Boolean unsafeCompareAndSetFloatVar(Container c) {
159+
return unsafe.compareAndSetFloat(c, floatOffset, 1.0f, 2.0f);
160+
}
161+
162+
@Test
163+
public void testUnsafeCompareAndSetFloatVar() {
164+
test("unsafeCompareAndSetFloatVar", new Container());
165+
}
166+
158167
public static boolean unsafeWeakCompareAndSetBoolean() {
159168
Container container = new Container();
160169
boolean success = false;
Lines changed: 247 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,247 @@
1+
/*
2+
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
package org.graalvm.compiler.truffle.test;
26+
27+
import static com.oracle.truffle.runtime.OptimizedRuntimeOptions.SingleTierCompilationThreshold;
28+
29+
import java.util.concurrent.CountDownLatch;
30+
import java.util.concurrent.atomic.AtomicBoolean;
31+
import java.util.concurrent.atomic.AtomicReference;
32+
import java.util.function.Supplier;
33+
34+
import org.graalvm.polyglot.Context;
35+
import org.junit.Assert;
36+
import org.junit.Assume;
37+
import org.junit.Test;
38+
39+
import com.oracle.truffle.api.CallTarget;
40+
import com.oracle.truffle.api.CompilerDirectives;
41+
import com.oracle.truffle.api.Truffle;
42+
import com.oracle.truffle.api.dsl.Cached;
43+
import com.oracle.truffle.api.dsl.Specialization;
44+
import com.oracle.truffle.api.frame.VirtualFrame;
45+
import com.oracle.truffle.api.nodes.DirectCallNode;
46+
import com.oracle.truffle.api.nodes.ExecutableNode;
47+
import com.oracle.truffle.api.nodes.Node;
48+
import com.oracle.truffle.api.nodes.RootNode;
49+
import com.oracle.truffle.compiler.TruffleCompilerListener;
50+
import com.oracle.truffle.runtime.AbstractCompilationTask;
51+
import com.oracle.truffle.runtime.OptimizedCallTarget;
52+
import com.oracle.truffle.runtime.OptimizedTruffleRuntime;
53+
import com.oracle.truffle.runtime.OptimizedTruffleRuntimeListener;
54+
55+
/*
56+
* Test that reproduces the not-yet fixed bug GR-42688 and makes sure the issue is alleviated by MaximumCompilations limit.
57+
*/
58+
public class GR42688Test {
59+
60+
@SuppressWarnings("truffle-inlining")
61+
public abstract static class ClassNode extends Node {
62+
63+
public abstract Class<?> execute(Object value);
64+
65+
@SuppressWarnings("unused")
66+
@Specialization
67+
public Class<?> doInt(int n) {
68+
return Integer.class;
69+
}
70+
71+
@SuppressWarnings("unused")
72+
@Specialization
73+
public Class<?> doDouble(double n) {
74+
return Double.class;
75+
}
76+
}
77+
78+
public abstract static class CalleeNode extends ExecutableNode {
79+
protected CalleeNode() {
80+
super(null);
81+
}
82+
83+
@Override
84+
public final Object execute(VirtualFrame frame) {
85+
return execute(frame.getArguments()[0], frame.getArguments()[1]);
86+
}
87+
88+
public abstract Object execute(Object value, Object klass);
89+
90+
// One classNode per specialization instance, intended here and representative of more
91+
// complex nodes which also create new helper node instances for new specialization
92+
// instances
93+
@SuppressWarnings("unused")
94+
@Specialization(guards = "classNode.execute(value) == cachedClass", limit = "4")
95+
public boolean doCached(Object value, Class<?> checkedAgainst,
96+
@Cached ClassNode classNode,
97+
@Cached("classNode.execute(value)") Class<?> cachedClass) {
98+
return cachedClass == checkedAgainst;
99+
}
100+
}
101+
102+
public static class CalleeRoot extends RootNode {
103+
104+
@Child private CalleeNode calleeNode;
105+
private final CountDownLatch compilationStartLatch;
106+
private final CountDownLatch compilationFinishedLatch;
107+
108+
protected CalleeRoot(CountDownLatch compilationStartLatch, CountDownLatch compilationFinishedLatch) {
109+
super(null);
110+
this.compilationStartLatch = compilationStartLatch;
111+
this.compilationFinishedLatch = compilationFinishedLatch;
112+
this.calleeNode = GR42688TestFactory.CalleeNodeGen.create();
113+
}
114+
115+
@Override
116+
public final Object execute(VirtualFrame frame) {
117+
if (CompilerDirectives.inInterpreter()) {
118+
if (frame.getArguments()[0] instanceof Double) {
119+
compilationStartLatch.countDown();
120+
try {
121+
compilationFinishedLatch.await();
122+
} catch (InterruptedException ie) {
123+
throw new AssertionError(ie);
124+
}
125+
}
126+
}
127+
return calleeNode.execute(frame);
128+
}
129+
130+
@Override
131+
public String getName() {
132+
return "callee";
133+
}
134+
135+
@Override
136+
public String toString() {
137+
return getName();
138+
}
139+
}
140+
141+
private static class CallerRoot extends RootNode {
142+
@Child private DirectCallNode callNode;
143+
private final String name;
144+
145+
CallerRoot(CallTarget target, String name) {
146+
super(null);
147+
this.name = name;
148+
this.callNode = Truffle.getRuntime().createDirectCallNode(target);
149+
}
150+
151+
@Override
152+
public Object execute(VirtualFrame frame) {
153+
return callNode.call(frame.getArguments());
154+
}
155+
156+
@Override
157+
public String getName() {
158+
return name;
159+
}
160+
161+
@Override
162+
public String toString() {
163+
return getName();
164+
}
165+
}
166+
167+
@Test
168+
public void testDeoptLoopStoppedByMaximumCompilations() {
169+
Assume.assumeTrue(Truffle.getRuntime() instanceof OptimizedTruffleRuntime);
170+
OptimizedTruffleRuntime optimizedTruffleRuntime = (OptimizedTruffleRuntime) Truffle.getRuntime();
171+
AtomicReference<OptimizedCallTarget> calleeRef = new AtomicReference<>();
172+
AtomicReference<OptimizedCallTarget> callerRef = new AtomicReference<>();
173+
CountDownLatch calleeCompilationStartLatch = new CountDownLatch(1);
174+
CountDownLatch calleeCompilationFinishedLatch = new CountDownLatch(1);
175+
AtomicBoolean intCallerCompilationFailed = new AtomicBoolean();
176+
optimizedTruffleRuntime.addListener(new OptimizedTruffleRuntimeListener() {
177+
@Override
178+
public void onCompilationSuccess(OptimizedCallTarget target, AbstractCompilationTask task, TruffleCompilerListener.GraphInfo graph, TruffleCompilerListener.CompilationResultInfo result) {
179+
if (target == calleeRef.get()) {
180+
calleeCompilationFinishedLatch.countDown();
181+
}
182+
}
183+
184+
@Override
185+
public void onCompilationStarted(OptimizedCallTarget target, AbstractCompilationTask task) {
186+
if (target == calleeRef.get()) {
187+
try {
188+
calleeCompilationStartLatch.await();
189+
} catch (InterruptedException ie) {
190+
throw new AssertionError(ie);
191+
}
192+
}
193+
}
194+
195+
@Override
196+
public void onCompilationFailed(OptimizedCallTarget target, String reason, boolean bailout, boolean permanentBailout, int tier, Supplier<String> lazyStackTrace) {
197+
if (target == callerRef.get() && "Maximum compilation count 100 reached.".equals(reason)) {
198+
intCallerCompilationFailed.set(true);
199+
}
200+
}
201+
});
202+
try (Context context = Context.newBuilder().allowExperimentalOptions(true).option("engine.CompileImmediately", "false").option("engine.BackgroundCompilation", "true").option(
203+
"engine.DynamicCompilationThresholds", "false").option("engine.MultiTier", "false").option("engine.Splitting", "false").option("engine.SingleTierCompilationThreshold",
204+
"10").option("engine.CompilationFailureAction", "Silent").build()) {
205+
context.enter();
206+
OptimizedCallTarget callee = (OptimizedCallTarget) new CalleeRoot(calleeCompilationStartLatch, calleeCompilationFinishedLatch).getCallTarget();
207+
OptimizedCallTarget intCaller = (OptimizedCallTarget) new CallerRoot(callee, "intCaller").getCallTarget();
208+
calleeRef.set(callee);
209+
callerRef.set(intCaller);
210+
211+
final int compilationThreshold = callee.getOptionValue(SingleTierCompilationThreshold);
212+
213+
for (int i = 0; i < compilationThreshold; i++) {
214+
callee.call(42, Integer.class);
215+
}
216+
/*
217+
* The loop above triggers compilation in a separate thread, but using a compilation
218+
* listener, the compilation is delayed until the following call reaches a certain
219+
* point.
220+
*/
221+
callee.call(3.14, Double.class);
222+
Assert.assertTrue(callee.isValid());
223+
/*
224+
* The compiled callee is still valid for integer, because the compilation finished
225+
* before the AST respecialized for double. The respecialization for double made it
226+
* invalid for integer, it would need another specialization round to be valid both for
227+
* integer and double.
228+
*/
229+
callee.call(42, Integer.class);
230+
Assert.assertTrue(callee.isValid());
231+
/*
232+
* The intCaller uses the compiled callee for executions in the interpreter, which is
233+
* valid for integer, but when intCaller is compiled, in inlines the AST for callee,
234+
* which is not valid for integer and calling the compiled callee results in an
235+
* immediate deopt, but the deopt lands outside the callee AST, which means the compiled
236+
* callee is used again without the AST getting a chance to respecialize. Therefore, the
237+
* deopts of the intCaller are repeated until the MaximumRepeatedCompilations limit
238+
* kicks in and marks the intCaller call target as permanent opt fail which means no
239+
* further compilations of it are attempted.
240+
*/
241+
for (int i = 0; i < 1000000000 && !intCallerCompilationFailed.get(); i++) {
242+
intCaller.call(42, Integer.class);
243+
}
244+
Assert.assertTrue(intCallerCompilationFailed.get());
245+
}
246+
}
247+
}

0 commit comments

Comments
 (0)