Skip to content

Commit dccd158

Browse files
Merge commit '0a2620a8a2f' into labsjdk/adopt-26+5-master
2 parents 1313de3 + 0a2620a commit dccd158

File tree

12 files changed

+62
-265
lines changed

12 files changed

+62
-265
lines changed

common.json

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

99
"COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet",
1010
"jdks": {
11-
"galahad-jdk": {"name": "jpg-jdk", "version": "25", "build_id": "jdk-26+4-323", "platformspecific": true, "extrabundles": ["static-libs"]},
11+
"galahad-jdk": {"name": "jpg-jdk", "version": "25", "build_id": "jdk-26+5-361", "platformspecific": true, "extrabundles": ["static-libs"]},
1212

1313
"oraclejdk17": {"name": "jpg-jdk", "version": "17.0.7", "build_id": "jdk-17.0.7+8", "platformspecific": true, "extrabundles": ["static-libs"]},
1414
"labsjdk-ce-17": {"name": "labsjdk", "version": "ce-17.0.7+4-jvmci-23.1-b02", "platformspecific": true },

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,15 @@
2828
import static jdk.graal.compiler.api.directives.GraalDirectives.deoptimize;
2929
import static jdk.graal.compiler.api.directives.GraalDirectives.injectBranchProbability;
3030

31-
import org.junit.Assume;
32-
import org.junit.Before;
3331
import org.junit.Test;
3432

3533
import jdk.graal.compiler.api.directives.GraalDirectives;
36-
import jdk.graal.compiler.hotspot.replacements.HotSpotReplacementsUtil;
3734

3835
/**
3936
* Tests that PEA preserves the monitorenter order. This is essential for lightweight locking.
4037
*/
4138
public final class MonitorPEATest extends HotSpotGraalCompilerTest {
4239

43-
@Before
44-
public void checkUseLightweightLocking() {
45-
Assume.assumeTrue(HotSpotReplacementsUtil.useLightweightLocking(runtime().getVMConfig()));
46-
}
47-
4840
static int staticInt = 0;
4941
static Object staticObj;
5042
static Object staticObj1;

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,6 @@ private HotSpotGraalRuntime.HotSpotGC getSelectedGC() throws GraalError {
135135
public final boolean printInlining = getFlag("PrintInlining", Boolean.class);
136136
public final boolean inline = getFlag("Inline", Boolean.class);
137137

138-
// There are 3 available locking modes:
139-
// LM_MONITOR uses only heavy monitors for locking;
140-
// LM_LEGACY uses stack-locking, with monitors as 2nd tier;
141-
// LM_LIGHTWEIGHT uses thread-local space for storing locked objects. This avoids the overload
142-
// of the mark word.
143-
public final int lockingMode = getFlag("LockingMode", Integer.class);
144-
145-
public final int lockingModeStack = getConstant("LockingMode::LM_LEGACY", Integer.class);
146-
public final int lockingModeLightweight = getConstant("LockingMode::LM_LIGHTWEIGHT", Integer.class);
147-
148138
public final boolean foldStableValues = getFlag("FoldStableValues", Boolean.class);
149139
public final int maxVectorSize = getFlag("MaxVectorSize", Integer.class);
150140

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/meta/DefaultHotSpotLoweringProvider.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import static jdk.graal.compiler.hotspot.replacements.HotSpotReplacementsUtil.HUB_LOCATION;
3636
import static jdk.graal.compiler.hotspot.replacements.HotSpotReplacementsUtil.HUB_WRITE_LOCATION;
3737
import static jdk.graal.compiler.hotspot.replacements.HotSpotReplacementsUtil.MARK_WORD_LOCATION;
38-
import static jdk.graal.compiler.hotspot.replacements.HotSpotReplacementsUtil.useLightweightLocking;
3938
import static org.graalvm.word.LocationIdentity.any;
4039

4140
import java.util.Arrays;
@@ -330,7 +329,7 @@ public void initialize(OptionValues options, Iterable<DebugHandlersFactory> fact
330329
assert target == providers.getCodeCache().getTarget() : Assertions.errorMessage(target, providers.getCodeCache().getTarget());
331330
instanceofSnippets = new InstanceOfSnippets.Templates(options, runtime, providers);
332331
allocationSnippets = allocationSnippetTemplates;
333-
monitorSnippets = new MonitorSnippets.Templates(options, runtime, providers, config);
332+
monitorSnippets = new MonitorSnippets.Templates(options, runtime, providers);
334333
g1WriteBarrierSnippets = new HotSpotG1WriteBarrierSnippets.Templates(options, runtime, providers, config);
335334
serialWriteBarrierSnippets = new HotSpotSerialWriteBarrierSnippets.Templates(options, runtime, providers);
336335
exceptionObjectSnippets = new LoadExceptionObjectSnippets.Templates(options, providers);
@@ -397,14 +396,11 @@ public MonitorSnippets.Templates getMonitorSnippets() {
397396
@Override
398397
protected FixedWithNextNode maybeEmitLockingCheck(List<MonitorIdNode> locks, FixedWithNextNode insertionPoint, FrameState stateBefore) {
399398
if (!locks.isEmpty()) {
400-
if (useLightweightLocking(getVMConfig())) {
401-
StructuredGraph graph = insertionPoint.graph();
402-
CheckFastPathMonitorEnterNode check = graph.add(new CheckFastPathMonitorEnterNode(locks));
403-
graph.addAfterFixed(insertionPoint, check);
404-
check.setStateBefore(stateBefore.duplicate());
405-
return check;
406-
}
407-
// The stack lock and heavyweight monitors cases don't need any checks.
399+
StructuredGraph graph = insertionPoint.graph();
400+
CheckFastPathMonitorEnterNode check = graph.add(new CheckFastPathMonitorEnterNode(locks));
401+
graph.addAfterFixed(insertionPoint, check);
402+
check.setStateBefore(stateBefore.duplicate());
403+
return check;
408404
}
409405
return insertionPoint;
410406
}
@@ -530,7 +526,7 @@ private boolean lowerWithoutDelegation(Node n, LoweringTool tool) {
530526
}
531527
} else if (n instanceof CheckFastPathMonitorEnterNode) {
532528
if (graph.getGuardsStage().areFrameStatesAtDeopts()) {
533-
monitorSnippets.lower((CheckFastPathMonitorEnterNode) n, registers, runtime.getVMConfig(), tool);
529+
monitorSnippets.lower((CheckFastPathMonitorEnterNode) n, registers, tool);
534530
}
535531
} else if (n instanceof MonitorExitNode) {
536532
if (graph.getGuardsStage().areFrameStatesAtDeopts()) {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/meta/HotSpotPlatformConfigurationProvider.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 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
@@ -25,7 +25,6 @@
2525
package jdk.graal.compiler.hotspot.meta;
2626

2727
import jdk.graal.compiler.hotspot.GraalHotSpotVMConfig;
28-
import jdk.graal.compiler.hotspot.replacements.HotSpotReplacementsUtil;
2928
import jdk.graal.compiler.nodes.gc.BarrierSet;
3029
import jdk.graal.compiler.nodes.spi.PlatformConfigurationProvider;
3130

@@ -34,12 +33,9 @@ public class HotSpotPlatformConfigurationProvider implements PlatformConfigurati
3433

3534
private final boolean canVirtualizeLargeByteArrayAccess;
3635

37-
private final boolean useLightweightLocking;
38-
3936
public HotSpotPlatformConfigurationProvider(GraalHotSpotVMConfig config, BarrierSet barrierSet) {
4037
this.barrierSet = barrierSet;
4138
this.canVirtualizeLargeByteArrayAccess = config.deoptimizationSupportLargeAccessByteArrayVirtualization;
42-
this.useLightweightLocking = HotSpotReplacementsUtil.useLightweightLocking(config);
4339
}
4440

4541
@Override
@@ -49,7 +45,7 @@ public boolean canVirtualizeLargeByteArrayAccess() {
4945

5046
@Override
5147
public boolean requiresStrictLockOrder() {
52-
return useLightweightLocking;
48+
return true;
5349
}
5450

5551
@Override

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replacements/HotSpotHashCodeSnippets.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
import static jdk.graal.compiler.hotspot.replacements.HotSpotReplacementsUtil.markWordLockMaskInPlace;
3535
import static jdk.graal.compiler.hotspot.replacements.HotSpotReplacementsUtil.monitorValue;
3636
import static jdk.graal.compiler.hotspot.replacements.HotSpotReplacementsUtil.uninitializedIdentityHashCodeValue;
37-
import static jdk.graal.compiler.hotspot.replacements.HotSpotReplacementsUtil.unlockedValue;
38-
import static jdk.graal.compiler.hotspot.replacements.HotSpotReplacementsUtil.useLightweightLocking;
3937
import static jdk.graal.compiler.hotspot.replacements.HotSpotReplacementsUtil.useObjectMonitorTable;
4038
import static jdk.graal.compiler.nodes.extended.BranchProbabilityNode.FAST_PATH_PROBABILITY;
4139
import static jdk.graal.compiler.nodes.extended.BranchProbabilityNode.probability;
@@ -75,9 +73,7 @@ protected int computeIdentityHashCode(final Object x) {
7573
//
7674
// See src/hotspot/share/oops/markWord.hpp for more details.
7775
final Word lockBits = mark.and(Word.unsigned(markWordLockMaskInPlace(INJECTED_VMCONFIG)));
78-
if (useObjectMonitorTable(INJECTED_VMCONFIG) || probability(FAST_PATH_PROBABILITY,
79-
useLightweightLocking(INJECTED_VMCONFIG) ? lockBits.notEqual(Word.unsigned(monitorValue(INJECTED_VMCONFIG)))
80-
: lockBits.equal(Word.unsigned(unlockedValue(INJECTED_VMCONFIG))))) {
76+
if (useObjectMonitorTable(INJECTED_VMCONFIG) || probability(FAST_PATH_PROBABILITY, lockBits.notEqual(Word.unsigned(monitorValue(INJECTED_VMCONFIG))))) {
8177
// `& markWord::hash_mask' is essential with -XX:+UseCompactObjectHeaders, because bit
8278
// 42 might be set.
8379
int hash = (int) mark.unsignedShiftRight(markWordHashCodeShift(INJECTED_VMCONFIG)).and((int) markWordHashMark(INJECTED_VMCONFIG)).rawValue();

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replacements/HotSpotReplacementsUtil.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -535,16 +535,6 @@ public static void initializeObjectHeader(Word memory, Word markWord, KlassPoint
535535
}
536536
}
537537

538-
@Fold
539-
public static boolean useStackLocking(@InjectedParameter GraalHotSpotVMConfig config) {
540-
return config.lockingMode == config.lockingModeStack;
541-
}
542-
543-
@Fold
544-
public static boolean useLightweightLocking(@InjectedParameter GraalHotSpotVMConfig config) {
545-
return config.lockingMode == config.lockingModeLightweight;
546-
}
547-
548538
@Fold
549539
public static boolean useObjectMonitorTable(@InjectedParameter GraalHotSpotVMConfig config) {
550540
return config.useObjectMonitorTable;

0 commit comments

Comments
 (0)