Skip to content

Commit 935ab2f

Browse files
Merge branch 'master' into labsjdk/adopt-25+23-master
2 parents 0514146 + 381adbb commit 935ab2f

File tree

151 files changed

+9119
-2689
lines changed

Some content is hidden

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

151 files changed

+9119
-2689
lines changed

.github/workflows/micronaut.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
name: Weekly Micronaut Tests
4242

4343
on:
44-
push:
45-
paths:
46-
- '.github/workflows/micronaut.yml'
4744
pull_request:
4845
paths:
4946
- '.github/workflows/micronaut.yml'

.github/workflows/ni-layers.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@
4141
name: Weekly Native Image Layer Building Tests
4242

4343
on:
44-
push:
45-
paths:
46-
- '.github/workflows/ni-layers.yml'
47-
- 'vm/tests/gh_workflows/NILayerTests/**'
4844
pull_request:
4945
paths:
5046
- '.github/workflows/ni-layers.yml'

.github/workflows/quarkus.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
name: Weekly Quarkus Tests
4242

4343
on:
44-
push:
45-
paths:
46-
- '.github/workflows/quarkus.yml'
4744
pull_request:
4845
paths:
4946
- '.github/workflows/quarkus.yml'

.github/workflows/reachability-metadata.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
name: Weekly Reachability Metadata Tests
4242

4343
on:
44-
push:
45-
paths:
46-
- '.github/workflows/reachability-metadata.yml'
4744
pull_request:
4845
paths:
4946
- '.github/workflows/reachability-metadata.yml'

.github/workflows/spring.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
name: Weekly Spring Tests
4242

4343
on:
44-
push:
45-
paths:
46-
- '.github/workflows/spring.yml'
4744
pull_request:
4845
paths:
4946
- '.github/workflows/spring.yml'

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/truffle/test/TruffleRuntimeTest.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 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
@@ -29,15 +29,16 @@
2929
import static org.junit.Assert.assertNull;
3030
import static org.junit.Assert.assertTrue;
3131

32-
import jdk.graal.compiler.api.test.Graal;
33-
import jdk.graal.compiler.runtime.RuntimeProvider;
3432
import org.junit.Test;
3533

3634
import com.oracle.truffle.api.Truffle;
3735
import com.oracle.truffle.api.TruffleRuntime;
3836
import com.oracle.truffle.api.impl.DefaultTruffleRuntime;
3937
import com.oracle.truffle.api.impl.TVMCI;
4038

39+
import jdk.graal.compiler.api.test.Graal;
40+
import jdk.graal.compiler.runtime.RuntimeProvider;
41+
4142
public class TruffleRuntimeTest {
4243

4344
@Test
@@ -75,12 +76,4 @@ public void testGetCapabilityObjectClass() {
7576
assertNull("Expected null return value for Object.class", object);
7677
}
7778

78-
@SuppressWarnings("deprecation")
79-
@Test
80-
public void testGetLayoutFactory() {
81-
TruffleRuntime runtime = Truffle.getRuntime();
82-
com.oracle.truffle.api.object.LayoutFactory layoutFactory = runtime.getCapability(com.oracle.truffle.api.object.LayoutFactory.class);
83-
assertNotNull("LayoutFactory not found", layoutFactory);
84-
// Rely on modules to only load trusted service providers
85-
}
8679
}

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/loop/phases/LoopTransformations.java

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,6 @@ public static PreMainPostResult insertPrePostLoops(Loop loop) {
370370
AbstractMergeNode postMergeNode = postEndNode.merge();
371371
graph.getDebug().dump(DebugContext.VERY_DETAILED_LEVEL, graph, "After post loop duplication");
372372

373-
preLoopBegin.incrementSplits();
374-
preLoopBegin.incrementSplits();
375373
preLoopBegin.setPreLoop();
376374
mainLoopBegin.setMainLoop();
377375
postLoopBegin.setPostLoop();
@@ -454,8 +452,18 @@ public static PreMainPostResult insertPrePostLoops(Loop loop) {
454452
assert mainLoopExitNode.predecessor() instanceof IfNode : Assertions.errorMessage(mainLoopExitNode);
455453
assert postLoopExitNode.predecessor() instanceof IfNode : Assertions.errorMessage(postLoopExitNode);
456454

457-
setSingleVisitedLoopFrequencySplitProbability(preLoopExitNode);
458-
setSingleVisitedLoopFrequencySplitProbability(postLoopExitNode);
455+
/*
456+
* The bodies of pre and post loops are assumed to be executed just once. As the local loop
457+
* frequency is calculated from the loop exit probabilities, it has to be taken into account
458+
* how often the exit check is performed. If the loop is inverted, i.e., tail-counted, the
459+
* exit will be taken at the end of the first body execution. Thus, the frequency of the
460+
* exit check is 1. If the loop is head-counted, the exit check will be performed twice,
461+
* which is reflected by a frequency of 2. This results in the correct relative frequency
462+
* being propagated into the loop body.
463+
*/
464+
final int prePostFrequency = loop.counted().isInverted() ? 1 : 2;
465+
adaptCountedLoopExitProbability(preLoopExitNode, prePostFrequency);
466+
adaptCountedLoopExitProbability(postLoopExitNode, prePostFrequency);
459467

460468
if (graph.isAfterStage(StageFlag.VALUE_PROXY_REMOVAL)) {
461469
// The pre and post loops don't require safepoints at all
@@ -473,7 +481,8 @@ public static PreMainPostResult insertPrePostLoops(Loop loop) {
473481

474482
/**
475483
* Inject a split probability for the (counted) loop check that will result in a loop frequency
476-
* of 1 (in case this is the only loop exit).
484+
* of 1 (in case this is the only loop exit). This implies that the loop body is expected to be
485+
* never entered.
477486
*/
478487
private static void setSingleVisitedLoopFrequencySplitProbability(AbstractBeginNode lex) {
479488
IfNode ifNode = ((IfNode) lex.predecessor());
@@ -482,11 +491,12 @@ private static void setSingleVisitedLoopFrequencySplitProbability(AbstractBeginN
482491
}
483492

484493
/**
485-
* Inject a new frequency for the condition dominating the given loop exit path. This
486-
* calculation will act as if the given loop exit is the only exit of the loop.
494+
* Inject a new branch probability for the condition dominating the given loop exit path. This
495+
* probability is based on the local frequency of the exit check. This calculation will act as
496+
* if the given loop exit is the only exit of the loop.
487497
*/
488-
public static void adaptCountedLoopExitProbability(AbstractBeginNode lex, double newFrequency) {
489-
double probability = 1.0D - 1.0D / newFrequency;
498+
public static void adaptCountedLoopExitProbability(AbstractBeginNode lex, double newExitCheckFrequency) {
499+
double probability = 1.0D - 1.0D / newExitCheckFrequency;
490500
if (probability <= 0D) {
491501
setSingleVisitedLoopFrequencySplitProbability(lex);
492502
return;

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/LoopBeginNode.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ public LoopBeginNode() {
210210
super(TYPE);
211211
loopOrigFrequency = 1;
212212
unswitches = 0;
213-
splits = 0;
214213
loopEndsSafepointState = SafepointState.ENABLED;
215214
loopExitsSafepointState = SafepointState.ENABLED;
216215
guestLoopEndsSafepointState = SafepointState.ENABLED;
@@ -483,10 +482,6 @@ public EndNode forwardEnd() {
483482
return forwardEndAt(0);
484483
}
485484

486-
public void incrementSplits() {
487-
splits++;
488-
}
489-
490485
public int peelings() {
491486
return peelings;
492487
}

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/replacements/nodes/MacroInvokable.java

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 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
@@ -26,6 +26,7 @@
2626

2727
import static jdk.vm.ci.code.BytecodeFrame.isPlaceholderBci;
2828

29+
import jdk.graal.compiler.core.common.type.ObjectStamp;
2930
import jdk.graal.compiler.core.common.type.StampPair;
3031
import jdk.graal.compiler.debug.Assertions;
3132
import jdk.graal.compiler.debug.DebugContext;
@@ -89,6 +90,13 @@ public interface MacroInvokable extends Invokable, Lowerable, StateSplit, Single
8990
*/
9091
NodeInputList<ValueNode> getArguments();
9192

93+
/**
94+
* Gets {@linkplain #getArguments() the arguments} for this macro node as an array.
95+
*/
96+
default ValueNode[] toArgumentArray() {
97+
return getArguments().toArray(ValueNode.EMPTY_ARRAY);
98+
}
99+
92100
/**
93101
* @see #getArguments()
94102
*/
@@ -197,4 +205,21 @@ default MethodCallTargetNode createCallTarget() {
197205
* {@link Invoke} later.
198206
*/
199207
void addMethodHandleInfo(ResolvedMethodHandleCallTargetNode methodHandle);
208+
209+
/**
210+
* Build a new copy of the {@link MacroNode.MacroParams} stored in this node.
211+
*/
212+
default MacroNode.MacroParams copyParams() {
213+
return new MacroNode.MacroParams(getInvokeKind(), getContextMethod(), getTargetMethod(), bci(), getReturnStamp(), toArgumentArray());
214+
}
215+
216+
/**
217+
* Builds a new copy of this node's macro parameters, but with the return stamp replaced by the
218+
* trusted {@code newStamp}.
219+
*/
220+
default MacroNode.MacroParams copyParamsWithImprovedStamp(ObjectStamp newStamp) {
221+
GraalError.guarantee(newStamp.join(getReturnStamp().getTrustedStamp()).equals(newStamp), "stamp should improve from %s to %s", getReturnStamp(), newStamp);
222+
StampPair improvedReturnStamp = StampPair.createSingle(newStamp);
223+
return new MacroNode.MacroParams(getInvokeKind(), getContextMethod(), getTargetMethod(), bci(), improvedReturnStamp, toArgumentArray());
224+
}
200225
}

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/replacements/nodes/MacroNode.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
import org.graalvm.word.LocationIdentity;
3232

33-
import jdk.graal.compiler.core.common.type.ObjectStamp;
3433
import jdk.graal.compiler.core.common.type.StampPair;
3534
import jdk.graal.compiler.debug.DebugCloseable;
3635
import jdk.graal.compiler.debug.GraalError;
@@ -187,10 +186,6 @@ public NodeInputList<ValueNode> getArguments() {
187186
return arguments;
188187
}
189188

190-
public ValueNode[] toArgumentArray() {
191-
return arguments.toArray(ValueNode.EMPTY_ARRAY);
192-
}
193-
194189
@Override
195190
public int bci() {
196191
return bci;
@@ -243,15 +238,6 @@ public final boolean hasSideEffect() {
243238
return true;
244239
}
245240

246-
/**
247-
* Returns {@code true} if the lowered version of the macro, or the fallback invoke, can
248-
* deoptimize in any way or throw any implicit or explicit exception. Such nodes should be
249-
* represented as {@link MacroWithExceptionNode} in SVM runtime compilations.
250-
*/
251-
public boolean canDeoptimizeOrThrow() {
252-
return true;
253-
}
254-
255241
/**
256242
* Returns {@link LocationIdentity#any()}. This node needs to kill any location because it might
257243
* get {@linkplain MacroInvokable#replaceWithInvoke() replaced with an invoke} and
@@ -310,21 +296,4 @@ public void addMethodHandleInfo(ResolvedMethodHandleCallTargetNode methodHandle)
310296
originalTargetMethod = methodHandle.originalTargetMethod;
311297
originalArguments.addAll(methodHandle.originalArguments);
312298
}
313-
314-
/**
315-
* Build a new copy of the {@link MacroParams} stored in this node.
316-
*/
317-
public MacroParams copyParams() {
318-
return new MacroParams(invokeKind, callerMethod, targetMethod, bci, returnStamp, toArgumentArray());
319-
}
320-
321-
/**
322-
* Builds a new copy of this node's macro parameters, but with the return stamp replaced by the
323-
* trusted {@code newStamp}.
324-
*/
325-
protected MacroParams copyParamsWithImprovedStamp(ObjectStamp newStamp) {
326-
GraalError.guarantee(newStamp.join(returnStamp.getTrustedStamp()).equals(newStamp), "stamp should improve from %s to %s", returnStamp, newStamp);
327-
StampPair improvedReturnStamp = StampPair.createSingle(newStamp);
328-
return new MacroParams(invokeKind, callerMethod, targetMethod, bci, improvedReturnStamp, toArgumentArray());
329-
}
330299
}

0 commit comments

Comments
 (0)