Skip to content

Commit 79a039f

Browse files
authored
Merge pull request #862 from jerboaa/merge-vm-24.2.2-tag-upstream
[24.2] Merge upstream vm-24.2.2 tag into mandrel/24.2
2 parents c63ef23 + 1a38229 commit 79a039f

File tree

114 files changed

+2314
-1014
lines changed

Some content is hidden

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

114 files changed

+2314
-1014
lines changed

ci/ci_common/bench-common.libsonnet

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@
6969
default_numa_node:: 0,
7070
num_threads:: 16
7171
},
72+
x52:: common.linux_amd64 + self._bench_machine + {
73+
machine_name:: "x52",
74+
capabilities+: ["tmpfs25g"],
75+
numa_nodes:: [0, 1],
76+
default_numa_node:: 1,
77+
num_threads:: 72
78+
},
7279
x82:: common.linux_amd64 + self._bench_machine + {
7380
machine_name:: "x82",
7481
capabilities+: ["tmpfs25g"],

ci/ci_common/common-utils.libsonnet

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@
1010
hyphenize(a_list)::
1111
std.join("-", std.filterMap(function(el) el != null, function(el) std.toString(el), a_list)),
1212

13+
# generate a string that describes the specific hardware being executed on with format: <jdk_name>-<machine_name>-<os>-<arch>
14+
jdk_and_hardware(build)::
15+
self.hyphenize([
16+
if std.objectHasAll(build, 'jdk_name') then build.jdk_name else null,
17+
if std.objectHasAll(build, 'machine_name') then build.machine_name else null,
18+
if std.objectHasAll(build, 'os') then build.os else null,
19+
if std.objectHasAll(build, 'arch') then build.arch else null,
20+
]),
21+
1322
# Pattern for a guard.includes clause that captures all top-level CI files.
1423
top_level_ci:: ["*.json", "*.jsonnet", "*.libsonnet", "ci/**"],
1524

ci/common.jsonnet

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ local common_json = import "../common.json";
152152
"@(?P<filename>.*SubprocessUtil-argfiles.*\\.argfile)",
153153
# Keep in sync with com.oracle.truffle.api.test.SubprocessTestUtils#makeArgfile
154154
"@(?P<filename>.*SubprocessTestUtils-argfiles.*\\.argfile)",
155+
# Keep in sync with mx_gate.py:get_jacoco_agent_args
156+
"JaCoCo agent config: '(?P<filename>[^']+)'",
155157
],
156158
},
157159

@@ -284,7 +286,7 @@ local common_json = import "../common.json";
284286
if (self.os == "linux" && self.arch == "amd64") then {
285287
readline: '==6.3',
286288
pcre2: '==10.37',
287-
curl: '>=7.50.1',
289+
curl: '==7.50.1',
288290
gnur: '==4.0.3-gcc4.8.5-pcre2',
289291
}
290292
else if (self.os == "darwin" && self.arch == "amd64") then {

common.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@
4545

4646
"oraclejdk23": {"name": "jpg-jdk", "version": "23", "build_id": "jdk-23+37", "platformspecific": true, "extrabundles": ["static-libs"]},
4747

48-
"oraclejdk-latest": {"name": "jpg-jdk", "version": "24", "build_id": "jdk-24.0.1+9", "platformspecific": true, "extrabundles": ["static-libs"]},
49-
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-24.0.1+9-jvmci-b01", "platformspecific": true },
50-
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-24.0.1+9-jvmci-b01-debug", "platformspecific": true },
51-
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-24.0.1+9-jvmci-b01-sulong", "platformspecific": true },
52-
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-24.0.1+9-jvmci-b01", "platformspecific": true },
53-
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-24.0.1+9-jvmci-b01-debug", "platformspecific": true },
54-
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-24.0.1+9-jvmci-b01-sulong", "platformspecific": true }
48+
"oraclejdk-latest": {"name": "jpg-jdk", "version": "24", "build_id": "jdk-24.0.2+11", "platformspecific": true, "extrabundles": ["static-libs"]},
49+
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-24.0.2+11-jvmci-b01", "platformspecific": true },
50+
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-24.0.2+11-jvmci-b01-debug", "platformspecific": true },
51+
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-24.0.2+11-jvmci-b01-sulong", "platformspecific": true },
52+
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-24.0.2+11-jvmci-b01", "platformspecific": true },
53+
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-24.0.2+11-jvmci-b01-debug", "platformspecific": true },
54+
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-24.0.2+11-jvmci-b01-sulong", "platformspecific": true }
5555
},
5656

5757
"eclipse": {

compiler/ci/ci_common/benchmark-builders.jsonnet

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,14 @@
3636
for suite in bench.groups.main_suites
3737
]),
3838

39-
local weekly_amd64_forks_builds = std.flattenArrays([
39+
local weekly_amd64_forks_builds = std.flattenArrays(std.flattenArrays([
40+
[
41+
bc.generate_fork_builds(c.weekly + hw.x52 + jdk + cc.libgraal + suite, subdir='compiler'),
4042
bc.generate_fork_builds(c.weekly + hw.e3 + jdk + cc.libgraal + suite, subdir='compiler')
43+
]
4144
for jdk in cc.product_jdks
4245
for suite in bench.groups.weekly_forks_suites
43-
]),
46+
])),
4447

4548
local weekly_aarch64_forks_builds = std.flattenArrays([
4649
bc.generate_fork_builds(c.weekly + hw.a12c + jdk + cc.libgraal + suite, subdir='compiler')

compiler/mx.compiler/suite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
"groupId" : "org.graalvm.compiler",
77
"version" : "24.2.2.0",
8-
"release" : False,
8+
"release" : True,
99
"url" : "http://www.graalvm.org/",
1010
"developer" : {
1111
"name" : "GraalVM Development",

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/HotSpotGraalCompiler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import jdk.graal.compiler.hotspot.HotSpotGraalRuntime.HotSpotGC;
4646
import jdk.graal.compiler.hotspot.meta.HotSpotProviders;
4747
import jdk.graal.compiler.hotspot.phases.OnStackReplacementPhase;
48+
import jdk.graal.compiler.hotspot.phases.VerifyLockDepthPhase;
4849
import jdk.graal.compiler.java.GraphBuilderPhase;
4950
import jdk.graal.compiler.lir.asm.CompilationResultBuilderFactory;
5051
import jdk.graal.compiler.lir.phases.LIRSuites;
@@ -352,6 +353,9 @@ protected PhaseSuite<HighTierContext> configGraphBuilderSuite(PhaseSuite<HighTie
352353
}
353354
GraphBuilderPhase newGraphBuilderPhase = new HotSpotGraphBuilderPhase(graphBuilderConfig);
354355
newGbs.findPhase(GraphBuilderPhase.class).set(newGraphBuilderPhase);
356+
if (Assertions.assertionsEnabled()) {
357+
newGbs.appendPhase(new VerifyLockDepthPhase());
358+
}
355359
if (isOSR) {
356360
newGbs.appendPhase(new OnStackReplacementPhase());
357361
}

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/JVMCIVersionCheck.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public final class JVMCIVersionCheck {
5555
private static final Map<String, Map<String, Version>> JVMCI_MIN_VERSIONS = Map.of(
5656
"21", Map.of(DEFAULT_VENDOR_ENTRY, createLegacyVersion(23, 1, 33)),
5757
"24", Map.of(
58-
"Oracle Corporation", createLabsJDKVersion("24.0.1+9", 1),
59-
DEFAULT_VENDOR_ENTRY, createLabsJDKVersion("24.0.1+9", 1)));
58+
"Oracle Corporation", createLabsJDKVersion("24.0.2+11", 1),
59+
DEFAULT_VENDOR_ENTRY, createLabsJDKVersion("24.0.2+11", 1)));
6060
private static final int NA = 0;
6161
/**
6262
* Minimum Java release supported by Graal.

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/phases/OnStackReplacementPhase.java

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import jdk.graal.compiler.debug.DebugCloseable;
3939
import jdk.graal.compiler.debug.DebugContext;
4040
import jdk.graal.compiler.debug.GraalError;
41-
import jdk.graal.compiler.graph.Node;
4241
import jdk.graal.compiler.graph.iterators.NodeIterable;
4342
import jdk.graal.compiler.hotspot.HotSpotGraalServices;
4443
import jdk.graal.compiler.loop.phases.LoopTransformations;
@@ -68,10 +67,7 @@
6867
import jdk.graal.compiler.nodes.extended.OSRMonitorEnterNode;
6968
import jdk.graal.compiler.nodes.extended.OSRStartNode;
7069
import jdk.graal.compiler.nodes.extended.ObjectIsArrayNode;
71-
import jdk.graal.compiler.nodes.java.AccessMonitorNode;
7270
import jdk.graal.compiler.nodes.java.InstanceOfNode;
73-
import jdk.graal.compiler.nodes.java.MonitorEnterNode;
74-
import jdk.graal.compiler.nodes.java.MonitorExitNode;
7571
import jdk.graal.compiler.nodes.java.MonitorIdNode;
7672
import jdk.graal.compiler.nodes.loop.Loop;
7773
import jdk.graal.compiler.nodes.loop.LoopsData;
@@ -253,12 +249,6 @@ protected void run(StructuredGraph graph, CoreProviders providers) {
253249
ValueNode lockedObject = osrState.lockAt(i);
254250
OSRMonitorEnterNode osrMonitorEnter = graph.add(new OSRMonitorEnterNode(lockedObject, id));
255251
osrMonitorEnter.setStateAfter(osrStart.stateAfter());
256-
for (Node usage : id.usages()) {
257-
if (usage instanceof AccessMonitorNode) {
258-
AccessMonitorNode access = (AccessMonitorNode) usage;
259-
access.setObject(lockedObject);
260-
}
261-
}
262252
FixedNode oldNext = osrStart.next();
263253
oldNext.replaceAtPredecessor(null);
264254
osrMonitorEnter.setNext(oldNext);
@@ -267,19 +257,10 @@ protected void run(StructuredGraph graph, CoreProviders providers) {
267257
}
268258

269259
debug.dump(DebugContext.DETAILED_LEVEL, graph, "After inserting OSR monitor enters");
270-
/*
271-
* Ensure balanced monitorenter - monitorexit
272-
*
273-
* Ensure that there is no monitor exit without a monitor enter in the graph. If there
274-
* is one this can only be done by bytecode as we have the monitor enter before the OSR
275-
* loop but the exit in a path of the loop that must be under a condition, else it will
276-
* throw an IllegalStateException anyway in the 2.iteration
277-
*/
278-
for (MonitorExitNode exit : graph.getNodes(MonitorExitNode.TYPE)) {
279-
MonitorIdNode id = exit.getMonitorId();
280-
if (id.usages().filter(MonitorEnterNode.class).count() != 1) {
281-
throw new PermanentBailoutException("Unbalanced monitor enter-exit in OSR compilation with locks. Object is locked before the loop but released inside the loop.");
282-
}
260+
try {
261+
new VerifyLockDepthPhase().run(graph);
262+
} catch (VerifyLockDepthPhase.LockStructureError e) {
263+
throw new PermanentBailoutException("Unbalanced monitor enter-exit in OSR compilation with locks: " + e.getMessage());
283264
}
284265
}
285266
debug.dump(DebugContext.DETAILED_LEVEL, graph, "OnStackReplacement result");
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
/*
2+
* Copyright (c) 2025, 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 jdk.graal.compiler.hotspot.phases;
26+
27+
import java.util.ArrayList;
28+
import java.util.List;
29+
import java.util.Optional;
30+
31+
import jdk.graal.compiler.debug.GraalError;
32+
import jdk.graal.compiler.nodes.AbstractMergeNode;
33+
import jdk.graal.compiler.nodes.DeoptimizingNode;
34+
import jdk.graal.compiler.nodes.FixedNode;
35+
import jdk.graal.compiler.nodes.FrameState;
36+
import jdk.graal.compiler.nodes.GraphState;
37+
import jdk.graal.compiler.nodes.StructuredGraph;
38+
import jdk.graal.compiler.nodes.extended.OSRMonitorEnterNode;
39+
import jdk.graal.compiler.nodes.extended.OSRStartNode;
40+
import jdk.graal.compiler.nodes.java.AccessMonitorNode;
41+
import jdk.graal.compiler.nodes.java.MonitorEnterNode;
42+
import jdk.graal.compiler.nodes.java.MonitorExitNode;
43+
import jdk.graal.compiler.nodes.java.MonitorIdNode;
44+
import jdk.graal.compiler.phases.Phase;
45+
import jdk.graal.compiler.phases.graph.MergeableState;
46+
import jdk.graal.compiler.phases.graph.PostOrderNodeIterator;
47+
48+
/**
49+
* Ensure that the lock depths and {@link MonitorIdNode ids} agree with the enter and exits.
50+
*/
51+
public class VerifyLockDepthPhase extends Phase {
52+
53+
@Override
54+
public Optional<NotApplicable> notApplicableTo(GraphState graphState) {
55+
/*
56+
* The current algorithm is only correct before PEA because it creates virtual locks, which
57+
* complicates checking for the correct correspondence because the FrameState can be out of
58+
* sync with the actual locking operations.
59+
*/
60+
return NotApplicable.unlessRunBefore(this, GraphState.StageFlag.PARTIAL_ESCAPE, graphState);
61+
}
62+
63+
@Override
64+
public boolean shouldApply(StructuredGraph graph) {
65+
return graph.getNodes(MonitorIdNode.TYPE).isNotEmpty();
66+
}
67+
68+
@Override
69+
protected void run(StructuredGraph graph) {
70+
// The current algorithm is only correct before PEA because it might virtual locks, which
71+
// complicates the matching.
72+
VerifyLockDepths verify = new VerifyLockDepths(graph.start());
73+
verify.apply();
74+
}
75+
76+
public static class LockStructureError extends RuntimeException {
77+
private static final long serialVersionUID = 1L;
78+
79+
LockStructureError(String message, Object... args) {
80+
super(String.format(message, args));
81+
}
82+
}
83+
84+
static class VerifyLockDepths extends PostOrderNodeIterator<VerifyLockDepths.LockingState> {
85+
VerifyLockDepths(FixedNode start) {
86+
super(start, null);
87+
state = new LockingState();
88+
}
89+
90+
/**
91+
* The current state of locks which are held.
92+
*/
93+
static class LockingState extends MergeableState<LockingState> implements Cloneable {
94+
final ArrayList<MonitorIdNode> locks;
95+
96+
LockingState() {
97+
locks = new ArrayList<>();
98+
}
99+
100+
LockingState(LockingState state) {
101+
this.locks = new ArrayList<>(state.locks);
102+
}
103+
104+
public void pop(MonitorExitNode exit) {
105+
MonitorIdNode id = exit.getMonitorId();
106+
if (locks.isEmpty()) {
107+
throw new LockStructureError("%s: lock stack is empty at", exit);
108+
}
109+
MonitorIdNode top = locks.removeLast();
110+
if (top != id) {
111+
throw new LockStructureError(top + " != " + id);
112+
}
113+
}
114+
115+
public void push(MonitorEnterNode enter) {
116+
MonitorIdNode id = enter.getMonitorId();
117+
if (locks.size() != id.getLockDepth()) {
118+
throw new LockStructureError("%s: lock depth mismatch %d != %d", enter, locks.size(), id.getLockDepth());
119+
}
120+
locks.add(id);
121+
}
122+
123+
@Override
124+
public LockingState clone() {
125+
return new LockingState(this);
126+
}
127+
128+
@Override
129+
public boolean merge(AbstractMergeNode merge, List<LockingState> withStates) {
130+
for (LockingState other : withStates) {
131+
if (!locks.equals(other.locks)) {
132+
throw new LockStructureError("%s: lock depth mismatch %d != %d", merge, locks, other.locks);
133+
}
134+
}
135+
return true;
136+
}
137+
138+
@Override
139+
public String toString() {
140+
return "LockingState{" + locks + '}';
141+
}
142+
143+
public void verifyState(FixedNode forNode, FrameState frameState) {
144+
if (frameState == null) {
145+
return;
146+
}
147+
if (forNode instanceof OSRStartNode || forNode instanceof OSRMonitorEnterNode) {
148+
/*
149+
* Ignore the FrameState on these nodes as the FrameState on the OSRStartNode is
150+
* used to construct the OSRMonitorEnterNodes which come after the start so
151+
* there's always an apparent mismatch. These nodes all the have same state and
152+
* it's only truly valid for the very last OSRMonitorEnterNode.
153+
*/
154+
return;
155+
}
156+
if (locks.size() != frameState.nestedLockDepth()) {
157+
throw new LockStructureError("Wrong number of locks held at %s: %d != %d", forNode, locks.size(), frameState.nestedLockDepth());
158+
}
159+
FrameState current = frameState;
160+
int depth = locks.size();
161+
while (current != null) {
162+
depth -= current.locksSize();
163+
for (int i = 0; i < current.locksSize(); i++) {
164+
MonitorIdNode frameId = locks.get(depth + i);
165+
MonitorIdNode stackId = current.monitorIdAt(i);
166+
if (frameId != stackId) {
167+
throw new LockStructureError("%s: mismatched lock at depth % in %s: %s != %s", forNode, i, current, frameId, stackId);
168+
}
169+
}
170+
current = current.outerFrameState();
171+
}
172+
}
173+
}
174+
175+
@Override
176+
protected void node(FixedNode node) {
177+
if (node instanceof DeoptimizingNode.DeoptBefore) {
178+
DeoptimizingNode.DeoptBefore before = (DeoptimizingNode.DeoptBefore) node;
179+
state.verifyState(before.asFixedNode(), before.stateBefore());
180+
}
181+
if (node instanceof DeoptimizingNode.DeoptDuring) {
182+
DeoptimizingNode.DeoptDuring during = (DeoptimizingNode.DeoptDuring) node;
183+
state.verifyState(during.asFixedNode(), during.stateDuring());
184+
}
185+
if (node instanceof MonitorEnterNode) {
186+
MonitorEnterNode enter = (MonitorEnterNode) node;
187+
state.push(enter);
188+
state.verifyState(node, enter.stateAfter());
189+
} else if (node instanceof MonitorExitNode) {
190+
state.pop((MonitorExitNode) node);
191+
} else if (node instanceof AccessMonitorNode) {
192+
throw GraalError.shouldNotReachHere(node.getClass().toString());
193+
}
194+
if (node instanceof DeoptimizingNode.DeoptAfter) {
195+
DeoptimizingNode.DeoptAfter after = (DeoptimizingNode.DeoptAfter) node;
196+
state.verifyState(after.asFixedNode(), after.stateAfter());
197+
}
198+
}
199+
}
200+
}

0 commit comments

Comments
 (0)