From 96e2820ff4d5cf5b2d0d234badba71833dadff37 Mon Sep 17 00:00:00 2001 From: Yudi Zheng Date: Fri, 12 Jan 2024 11:44:38 +0100 Subject: [PATCH] JavaThread::_is_disable_suspend is exported after JDK22 b31. --- .../src/jdk/graal/compiler/hotspot/GraalHotSpotVMConfig.java | 2 +- .../compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/GraalHotSpotVMConfig.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/GraalHotSpotVMConfig.java index e7e39ef0a2a9..f9c78435d7c8 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/GraalHotSpotVMConfig.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/GraalHotSpotVMConfig.java @@ -270,7 +270,7 @@ public final int arrayOopDescLengthOffset() { public final int threadIsInVTMSTransitionOffset = getFieldOffset("JavaThread::_is_in_VTMS_transition", Integer.class, "bool"); public final int threadIsInTmpVTMSTransitionOffset = getFieldOffset("JavaThread::_is_in_tmp_VTMS_transition", Integer.class, "bool"); - public final int threadIsDisableSuspendOffset = getFieldOffset("JavaThread::_is_disable_suspend", Integer.class, "bool", -1, JDK >= 22); + public final int threadIsDisableSuspendOffset = getFieldOffset("JavaThread::_is_disable_suspend", Integer.class, "bool", -1, JDK >= 22 && JDK_BUILD >= 31); public final int javaLangThreadJFREpochOffset = getFieldValue("java_lang_Thread::_jfr_epoch_offset", Integer.class, "int"); public final int javaLangThreadTIDOffset = getFieldValue("java_lang_Thread::_tid_offset", Integer.class, "int"); diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java index 8f7f083d476c..bdcaf89c4182 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java @@ -161,7 +161,6 @@ import jdk.graal.compiler.replacements.nodes.VectorizedHashCodeNode; import jdk.graal.compiler.replacements.nodes.VectorizedMismatchNode; import jdk.graal.compiler.serviceprovider.GraalServices; -import jdk.graal.compiler.serviceprovider.JavaVersionUtil; import jdk.graal.compiler.word.WordTypes; import jdk.vm.ci.aarch64.AArch64; import jdk.vm.ci.code.Architecture; @@ -778,7 +777,7 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec } }); - if (JavaVersionUtil.JAVA_SPEC >= 22) { + if (config.threadIsDisableSuspendOffset != -1) { r.register(new InvocationPlugin("notifyJvmtiDisableSuspend", Receiver.class, boolean.class) { @Override public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode enter) { @@ -787,7 +786,6 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec receiver.get(); // unconditionally update the is_disable_suspend bit in current // JavaThread - GraalError.guarantee(config.threadIsDisableSuspendOffset != -1, "JavaThread::_is_disable_suspend is not exported"); CurrentJavaThreadNode javaThread = b.add(new CurrentJavaThreadNode(helper.getWordKind())); OffsetAddressNode address = b.add(new OffsetAddressNode(javaThread, helper.asWord(config.threadIsDisableSuspendOffset))); b.add(new JavaWriteNode(JavaKind.Boolean, address, HotSpotReplacementsUtil.HOTSPOT_JAVA_THREAD_IS_DISABLE_SUSPEND, enter, BarrierType.NONE, false));