Skip to content

Commit

Permalink
[JDK-8343193] Adapt JDK-8343132: Remove temporary transitions from Vi…
Browse files Browse the repository at this point in the history
…rtual thread implementation

PullRequest: graal/19160
  • Loading branch information
mur47x111 committed Oct 31, 2024
2 parents 9f54e05 + 47babcb commit c27efe1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 25 deletions.
2 changes: 1 addition & 1 deletion common.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

"COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet",
"jdks": {
"galahad-jdk": {"name": "jpg-jdk", "version": "24", "build_id": "jdk-24+21-2467", "platformspecific": true, "extrabundles": ["static-libs"]},
"galahad-jdk": {"name": "jpg-jdk", "version": "24", "build_id": "jdk-24+22-2651", "platformspecific": true, "extrabundles": ["static-libs"]},

"oraclejdk17": {"name": "jpg-jdk", "version": "17.0.7", "build_id": "jdk-17.0.7+8", "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ce-17": {"name": "labsjdk", "version": "ce-17.0.7+4-jvmci-23.1-b02", "platformspecific": true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public final int arrayOopDescLengthOffset() {
public final int threadScopedValueCacheOffset = getFieldOffset("JavaThread::_scopedValueCache", Integer.class, "OopHandle");

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 threadIsInTmpVTMSTransitionOffset = getFieldOffset("JavaThread::_is_in_tmp_VTMS_transition", Integer.class, "bool", -1, JDK == 21);
public final int threadIsDisableSuspendOffset = getFieldOffset("JavaThread::_is_disable_suspend", Integer.class, "bool", -1, JDK >= 22);

public final int javaLangThreadJFREpochOffset = getFieldValue("java_lang_Thread::_jfr_epoch_offset", Integer.class, "int");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -870,26 +870,25 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec
}
});
}
Type[] notifyJvmtiHideFramesArgTypes = JavaVersionUtil.JAVA_SPEC >= 23 ? new Type[]{boolean.class} : new Type[]{Receiver.class, boolean.class};
r.register(new InvocationPlugin("notifyJvmtiHideFrames", notifyJvmtiHideFramesArgTypes) {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode hide) {
if (config.doJVMTIVirtualThreadTransitions) {
try (HotSpotInvocationPluginHelper helper = new HotSpotInvocationPluginHelper(b, targetMethod, config)) {
if (JavaVersionUtil.JAVA_SPEC < 23) {
if (JavaVersionUtil.JAVA_SPEC == 21) {
r.register(new InvocationPlugin("notifyJvmtiHideFrames", Receiver.class, boolean.class) {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode hide) {
if (config.doJVMTIVirtualThreadTransitions) {
try (HotSpotInvocationPluginHelper helper = new HotSpotInvocationPluginHelper(b, targetMethod, config)) {
receiver.get(true);
// unconditionally update the temporary VTMS transition bit in current
// JavaThread
GraalError.guarantee(config.threadIsInTmpVTMSTransitionOffset != -1, "JavaThread::_is_in_tmp_VTMS_transition is not exported");
CurrentJavaThreadNode javaThread = b.add(new CurrentJavaThreadNode(helper.getWordKind()));
OffsetAddressNode address = b.add(new OffsetAddressNode(javaThread, helper.asWord(config.threadIsInTmpVTMSTransitionOffset)));
b.add(new JavaWriteNode(JavaKind.Boolean, address, HotSpotReplacementsUtil.HOTSPOT_JAVA_THREAD_IS_IN_TMP_VTMS_TRANSITION, hide, BarrierType.NONE, false));
}
// unconditionally update the temporary VTMS transition bit in current
// JavaThread
GraalError.guarantee(config.threadIsInTmpVTMSTransitionOffset != -1, "JavaThread::_is_in_tmp_VTMS_transition is not exported");
CurrentJavaThreadNode javaThread = b.add(new CurrentJavaThreadNode(helper.getWordKind()));
OffsetAddressNode address = b.add(new OffsetAddressNode(javaThread, helper.asWord(config.threadIsInTmpVTMSTransitionOffset)));
b.add(new JavaWriteNode(JavaKind.Boolean, address, HotSpotReplacementsUtil.HOTSPOT_JAVA_THREAD_IS_IN_TMP_VTMS_TRANSITION, hide, BarrierType.NONE, false));
}
return true;
}
return true;
}
});
});
}

if (JavaVersionUtil.JAVA_SPEC >= 22) {
Type[] notifyJvmtiDisableSuspendArgTypes = JavaVersionUtil.JAVA_SPEC >= 23 ? new Type[]{boolean.class} : new Type[]{Receiver.class, boolean.class};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,6 @@ private void notifyJvmtiUnmount(boolean hide) {
// unimplemented (GR-45392)
}

@Substitute
@TargetElement(onlyWith = JDKLatest.class)
@SuppressWarnings("unused")
private static void notifyJvmtiHideFrames(boolean hide) {
// unimplemented (GR-45392)
}

@Substitute
@TargetElement(name = "notifyJvmtiHideFrames", onlyWith = JDK21OrEarlier.class)
@SuppressWarnings({"static-method", "unused"})
Expand Down

0 comments on commit c27efe1

Please sign in to comment.