Skip to content

Commit 8e4597f

Browse files
OracleLabsAutomationzapster
authored andcommitted
[GR-57740] Update labsjdk to 24+13-jvmci-b01
PullRequest: graal/18706
2 parents aa60f84 + f05d73d commit 8e4597f

File tree

42 files changed

+217
-69
lines changed

Some content is hidden

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

42 files changed

+217
-69
lines changed

common.json

Lines changed: 8 additions & 8 deletions
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": "24", "build_id": "jdk-24+12-1236", "platformspecific": true, "extrabundles": ["static-libs"]},
11+
"galahad-jdk": {"name": "jpg-jdk", "version": "24", "build_id": "jdk-24+13-1404", "platformspecific": true, "extrabundles": ["static-libs"]},
1212

1313
"oraclejdk11": {"name": "jpg-jdk", "version": "11.0.11", "build_id": "jdk-11.0.11+9", "platformspecific": true, "extrabundles": ["static-libs"] },
1414

@@ -45,13 +45,13 @@
4545
"labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21.0.2+13-jvmci-23.1-b33-sulong", "platformspecific": true },
4646
"graalvm-ee-21": {"name": "graalvm-java21", "version": "23.1.3", "platformspecific": true },
4747

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

5757
"eclipse": {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,9 @@ public long defaultPrototypeMarkWord() {
370370
*/
371371
public final int identityHashCodeShift = getConstant("markWord::hash_shift", Integer.class);
372372

373+
public final int contEntry = getFieldOffset("JavaThread::_cont_entry", Integer.class, "ContinuationEntry*", -1, JDK >= 24);
374+
public final int pinCount = getFieldOffset("ContinuationEntry::_pin_count", Integer.class, "uint32_t", -1, JDK >= 24);
375+
373376
/**
374377
* Identity hash code value when uninitialized.
375378
*/

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+12", 1),
59-
DEFAULT_VENDOR_ENTRY, createLabsJDKVersion("24+12", 1)));
58+
"Oracle Corporation", createLabsJDKVersion("24+13", 1),
59+
DEFAULT_VENDOR_ENTRY, createLabsJDKVersion("24+13", 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/meta/HotSpotGraphBuilderPlugins.java

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@
4040
import static jdk.graal.compiler.hotspot.HotSpotBackend.SHAREDRUNTIME_NOTIFY_JVMTI_VTHREAD_UNMOUNT;
4141
import static jdk.graal.compiler.hotspot.HotSpotBackend.UPDATE_BYTES_CRC32;
4242
import static jdk.graal.compiler.hotspot.HotSpotBackend.UPDATE_BYTES_CRC32C;
43+
import static jdk.graal.compiler.hotspot.replacements.HotSpotReplacementsUtil.HOTSPOT_CONTINUATION_ENTRY_PIN_COUNT;
44+
import static jdk.graal.compiler.hotspot.replacements.HotSpotReplacementsUtil.HOTSPOT_JAVA_THREAD_CONT_ENTRY;
4345
import static jdk.graal.compiler.java.BytecodeParserOptions.InlineDuringParsing;
4446
import static jdk.graal.compiler.nodes.ConstantNode.forBoolean;
47+
import static jdk.graal.compiler.nodes.ProfileData.BranchProbabilityData.injected;
4548
import static jdk.graal.compiler.nodes.extended.BranchProbabilityNode.NOT_FREQUENT_PROBABILITY;
49+
import static jdk.vm.ci.meta.DeoptimizationReason.TypeCheckedInliningViolated;
4650
import static jdk.vm.ci.services.Services.IS_IN_NATIVE_IMAGE;
4751

4852
import java.lang.annotation.Annotation;
@@ -98,8 +102,6 @@
98102
import jdk.graal.compiler.nodes.MergeNode;
99103
import jdk.graal.compiler.nodes.NodeView;
100104
import jdk.graal.compiler.nodes.PiNode;
101-
import jdk.graal.compiler.nodes.ProfileData;
102-
import jdk.graal.compiler.nodes.ProfileData.BranchProbabilityData;
103105
import jdk.graal.compiler.nodes.StructuredGraph;
104106
import jdk.graal.compiler.nodes.ValueNode;
105107
import jdk.graal.compiler.nodes.ValuePhiNode;
@@ -245,6 +247,7 @@ public void run() {
245247
registerSystemPlugins(invocationPlugins);
246248
registerThreadPlugins(invocationPlugins, config, replacements);
247249
registerVirtualThreadPlugins(invocationPlugins, config, replacements);
250+
registerContinuationPlugins(invocationPlugins, config, replacements);
248251
registerCallSitePlugins(invocationPlugins);
249252
registerReflectionPlugins(invocationPlugins, replacements, config);
250253
registerAESPlugins(invocationPlugins, config, replacements, target.arch);
@@ -732,8 +735,7 @@ private static void inlineNativeNotifyJvmtiFunctions(GraalHotSpotVMConfig config
732735
BeginNode trueSuccessor = graph.add(new BeginNode());
733736
BeginNode falseSuccessor = graph.add(new BeginNode());
734737

735-
ProfileData.BranchProbabilityData probability = ProfileData.BranchProbabilityData.injected(NOT_FREQUENT_PROBABILITY);
736-
b.add(new IfNode(testNotifyJvmtiEnabled, trueSuccessor, falseSuccessor, probability));
738+
b.add(new IfNode(testNotifyJvmtiEnabled, trueSuccessor, falseSuccessor, injected(NOT_FREQUENT_PROBABILITY)));
737739

738740
// if notifyJvmti enabled then make a call to the given runtime function
739741
ForeignCallNode runtimeCall = graph.add(new ForeignCallNode(descriptor, virtualThread, hide, javaThread));
@@ -761,6 +763,62 @@ private static void inlineNativeNotifyJvmtiFunctions(GraalHotSpotVMConfig config
761763
}
762764
}
763765

766+
// @formatter:off
767+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/20d8f58c92009a46dfb91b951e7d87b4cb8e8b41/src/hotspot/share/opto/library_call.cpp#L3741-L3824",
768+
sha1 = "d65356dbc0235df26aa56b233bcd100462a5dab4")
769+
// @formatter:on
770+
private static class ContinuationPinningPlugin extends InvocationPlugin {
771+
772+
private final GraalHotSpotVMConfig config;
773+
private final boolean pin;
774+
775+
ContinuationPinningPlugin(GraalHotSpotVMConfig config, boolean pin) {
776+
super(pin ? "pin" : "unpin");
777+
this.config = config;
778+
this.pin = pin;
779+
}
780+
781+
@Override
782+
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
783+
try (HotSpotInvocationPluginHelper helper = new HotSpotInvocationPluginHelper(b, targetMethod, config)) {
784+
// @formatter:off
785+
// if (currentThread::_cont_entry != null)
786+
// uint pin_count = currentThread::_cont_entry::_pin_count;
787+
// if (pin_count == (pin ? 0xFFFFFFFFUL : 0)) deoptimize;
788+
// else currentThread::_cont_entry::_pin_count = pin_count + (pin ? 1 : -1);
789+
// @formatter:on
790+
StructuredGraph graph = b.getGraph();
791+
CurrentJavaThreadNode javaThread = graph.addOrUniqueWithInputs(new CurrentJavaThreadNode(helper.getWordKind()));
792+
793+
GraalError.guarantee(config.contEntry != -1, "JavaThread::_cont_entry is not exported");
794+
OffsetAddressNode lastContinuationAddr = graph.addOrUniqueWithInputs(new OffsetAddressNode(javaThread, helper.asWord(config.contEntry)));
795+
ValueNode lastContinuation = b.add(new JavaReadNode(JavaKind.Object, lastContinuationAddr, HOTSPOT_JAVA_THREAD_CONT_ENTRY, BarrierType.NONE, MemoryOrderMode.PLAIN, false));
796+
ValueNode nonNullLastContinuation = helper.emitNullReturnGuard(lastContinuation, null, NOT_FREQUENT_PROBABILITY);
797+
798+
GraalError.guarantee(config.pinCount != -1, "ContinuationEntry::_pin_count is not exported");
799+
OffsetAddressNode pinCountAddr = graph.addOrUniqueWithInputs(new OffsetAddressNode(nonNullLastContinuation, helper.asWord(config.pinCount)));
800+
ValueNode pinCount = b.add(new JavaReadNode(JavaKind.Int, pinCountAddr, HOTSPOT_CONTINUATION_ENTRY_PIN_COUNT, BarrierType.NONE, MemoryOrderMode.PLAIN, false));
801+
802+
LogicNode overFlow = IntegerEqualsNode.create(pinCount, pin ? ConstantNode.forInt(-1) : ConstantNode.forInt(0), NodeView.DEFAULT);
803+
// TypeCheckedInliningViolated (Reason_type_checked_inlining) is aliasing
804+
// Reason_intrinsic
805+
b.append(new FixedGuardNode(overFlow, TypeCheckedInliningViolated, DeoptimizationAction.None, true));
806+
ValueNode newPinCount = b.add(AddNode.create(pinCount, pin ? ConstantNode.forInt(1) : ConstantNode.forInt(-1), NodeView.DEFAULT));
807+
b.add(new JavaWriteNode(JavaKind.Int, pinCountAddr, HOTSPOT_CONTINUATION_ENTRY_PIN_COUNT, newPinCount, BarrierType.NONE, false));
808+
helper.emitFinalReturn(JavaKind.Void, null);
809+
}
810+
return true;
811+
}
812+
}
813+
814+
private static void registerContinuationPlugins(InvocationPlugins plugins, GraalHotSpotVMConfig config, Replacements replacements) {
815+
Registration r = new Registration(plugins, "jdk.internal.vm.Continuation", replacements);
816+
if (JavaVersionUtil.JAVA_SPEC >= 24) {
817+
r.register(new ContinuationPinningPlugin(config, true));
818+
r.register(new ContinuationPinningPlugin(config, false));
819+
}
820+
}
821+
764822
private static void registerVirtualThreadPlugins(InvocationPlugins plugins, GraalHotSpotVMConfig config, Replacements replacements) {
765823
Registration r = new Registration(plugins, "java.lang.VirtualThread", replacements);
766824
if (config.supportJVMTIVThreadNotification()) {
@@ -1374,7 +1432,7 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec
13741432
ValueNode layoutHelperLong = b.add(SignExtendNode.create(layoutHelper, JavaKind.Long.getBitCount(), NodeView.DEFAULT));
13751433
ValueNode instanceSizeLong = b.add(AndNode.create(layoutHelperLong, ConstantNode.forLong(-((long) JavaKind.Long.getByteCount())), NodeView.DEFAULT));
13761434

1377-
b.add(new IfNode(isArray, arrayLengthNode, instanceBranch, BranchProbabilityData.injected(0.5D)));
1435+
b.add(new IfNode(isArray, arrayLengthNode, instanceBranch, injected(0.5D)));
13781436
MergeNode merge = b.append(new MergeNode());
13791437
merge.addForwardEnd(arrayBranch);
13801438
merge.addForwardEnd(instanceBranch);

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141
import java.util.function.Function;
4242

43+
import jdk.graal.compiler.core.common.type.AbstractPointerStamp;
4344
import org.graalvm.word.LocationIdentity;
4445

4546
import jdk.graal.compiler.core.common.memory.MemoryOrderMode;
@@ -202,9 +203,9 @@ public ValueNode readKlassSuperKlass(PiNode klassNonNull) {
202203
return readLocation(klassNonNull, HotSpotVMConfigField.KLASS_SUPER_KLASS_OFFSET);
203204
}
204205

205-
public PiNode emitNullReturnGuard(ValueNode klass, ValueNode returnValue, double probability) {
206-
GuardingNode nonnullGuard = emitReturnIf(IsNullNode.create(klass), returnValue, probability);
207-
return piCast(klass, nonnullGuard, KlassPointerStamp.klassNonNull());
206+
public PiNode emitNullReturnGuard(ValueNode pointer, ValueNode returnValue, double probability) {
207+
GuardingNode nonnullGuard = emitReturnIf(IsNullNode.create(pointer), returnValue, probability);
208+
return piCast(pointer, nonnullGuard, ((AbstractPointerStamp) pointer.stamp(NodeView.DEFAULT)).asNonNull());
208209
}
209210

210211
/**

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,9 @@ public static NamedLocationIdentity mutable(String name) {
901901
public static final LocationIdentity HOTSPOT_JAVA_THREAD_IS_IN_TMP_VTMS_TRANSITION = NamedLocationIdentity.mutable("JavaThread::_is_in_tmp_VTMS_transition");
902902
public static final LocationIdentity HOTSPOT_JAVA_THREAD_IS_DISABLE_SUSPEND = NamedLocationIdentity.mutable("JavaThread::_is_disable_suspend");
903903
public static final LocationIdentity HOTSPOT_JAVA_LANG_THREAD_IS_IN_VTMS_TRANSITION = NamedLocationIdentity.mutable("Thread::_is_in_VTMS_transition");
904+
public static final LocationIdentity HOTSPOT_JAVA_THREAD_CONT_ENTRY = NamedLocationIdentity.mutable("JavaThread::_cont_entry");
905+
906+
public static final LocationIdentity HOTSPOT_CONTINUATION_ENTRY_PIN_COUNT = NamedLocationIdentity.mutable("ContinuationEntry::_pin_count");
904907

905908
@Fold
906909
public static int layoutHelperHeaderSizeShift(@InjectedParameter GraalHotSpotVMConfig config) {

sdk/mx.sdk/mx_sdk_vm_impl.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3281,6 +3281,10 @@ def __init__(self, component, language_library_config, jvm_standalone=None, **kw
32813281
**kwargs
32823282
)
32833283

3284+
def isJDKDependent(self):
3285+
# because of -DLAUNCHER_JDK_VERSION (GR-57817)
3286+
return True
3287+
32843288
@staticmethod
32853289
def library_launcher_project_name(language_library_config, for_jvm_standalone=False):
32863290
return "org.graalvm.launcher.native." + ("jvm_standalone." if for_jvm_standalone else "") + language_library_config.language
@@ -3298,6 +3302,8 @@ def cflags(self):
32983302
'-DCP_SEP=' + os.pathsep,
32993303
'-DDIR_SEP=' + ('\\\\' if mx.is_windows() else '/'),
33003304
'-DGRAALVM_VERSION=' + _suite.release_version(),
3305+
# Might not be needed anymore if GR-57817 gets fixed.
3306+
f'-DLAUNCHER_JDK_VERSION={mx_sdk_vm.base_jdk_version()}',
33013307
]
33023308
if not mx.is_windows():
33033309
_dynamic_cflags += ['-pthread']

sdk/src/org.graalvm.launcher.native/src/launcher.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,10 @@ static void parse_vm_options(int argc, char **argv, std::string exeDir, JavaVMIn
558558

559559
/* Allow Truffle NFI Panama to use Linker#{downcallHandle,upcallStub} without warnings. */
560560
vmArgs.push_back("--enable-native-access=org.graalvm.truffle");
561+
#if LAUNCHER_JDK_VERSION > 21
562+
/* Ignore illegal native access until is GR-57817 fixed. */
563+
vmArgs.push_back("--illegal-native-access=allow");
564+
#endif
561565
}
562566

563567
jint nOptions = jvmMode ? vmArgs.size() : 1 + vmArgs.size();

substratevm/src/com.oracle.svm.core.foreign/src/com/oracle/svm/core/foreign/Target_java_lang_foreign_SymbolLookup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static void ensureNativeAccess(Class<?> currentClass, Class<?> owner, String met
142142
if (JavaVersionUtil.JAVA_SPEC <= 21) {
143143
module.ensureNativeAccess(owner, methodName);
144144
} else {
145-
module.ensureNativeAccess(owner, methodName, currentClass);
145+
module.ensureNativeAccess(owner, methodName, currentClass, false);
146146
}
147147

148148
}

substratevm/src/com.oracle.svm.core.posix/src/com/oracle/svm/core/posix/PosixNativeLibraryFeature.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ protected void loadJavaLibrary() {
133133
Target_java_io_UnixFileSystem_JNI.initIDs();
134134
}
135135

136+
@SuppressWarnings("restricted")
136137
private static void loadNetLibrary() {
137138
if (Isolates.isCurrentFirst()) {
138139
/*

0 commit comments

Comments
 (0)