From 8700de66e45b526958c7a2923d43abe2a736d1d2 Mon Sep 17 00:00:00 2001 From: Serguei Spitsyn Date: Fri, 19 Jan 2024 18:40:55 +0000 Subject: [PATCH] 8322744: VirtualThread.notifyJvmtiDisableSuspend should be static Reviewed-by: pchilanomate, alanb --- src/hotspot/share/classfile/vmIntrinsics.hpp | 6 +++--- src/hotspot/share/include/jvm.h | 6 +++--- src/hotspot/share/opto/library_call.cpp | 6 +++--- src/hotspot/share/prims/jvm.cpp | 6 +++--- src/java.base/share/classes/java/lang/VirtualThread.java | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/hotspot/share/classfile/vmIntrinsics.hpp b/src/hotspot/share/classfile/vmIntrinsics.hpp index c9bc4acbeff..9c16028d09a 100644 --- a/src/hotspot/share/classfile/vmIntrinsics.hpp +++ b/src/hotspot/share/classfile/vmIntrinsics.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -596,8 +596,8 @@ class methodHandle; do_intrinsic(_notifyJvmtiVThreadEnd, java_lang_VirtualThread, notifyJvmtiEnd_name, void_method_signature, F_RN) \ do_intrinsic(_notifyJvmtiVThreadMount, java_lang_VirtualThread, notifyJvmtiMount_name, bool_void_signature, F_RN) \ do_intrinsic(_notifyJvmtiVThreadUnmount, java_lang_VirtualThread, notifyJvmtiUnmount_name, bool_void_signature, F_RN) \ - do_intrinsic(_notifyJvmtiVThreadHideFrames, java_lang_VirtualThread, notifyJvmtiHideFrames_name, bool_void_signature, F_RN) \ - do_intrinsic(_notifyJvmtiVThreadDisableSuspend, java_lang_VirtualThread, notifyJvmtiDisableSuspend_name, bool_void_signature, F_RN) \ + do_intrinsic(_notifyJvmtiVThreadHideFrames, java_lang_VirtualThread, notifyJvmtiHideFrames_name, bool_void_signature, F_SN) \ + do_intrinsic(_notifyJvmtiVThreadDisableSuspend, java_lang_VirtualThread, notifyJvmtiDisableSuspend_name, bool_void_signature, F_SN) \ \ /* support for UnsafeConstants */ \ do_class(jdk_internal_misc_UnsafeConstants, "jdk/internal/misc/UnsafeConstants") \ diff --git a/src/hotspot/share/include/jvm.h b/src/hotspot/share/include/jvm.h index 5d6ab27a3a1..b49c15d73b6 100644 --- a/src/hotspot/share/include/jvm.h +++ b/src/hotspot/share/include/jvm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1152,10 +1152,10 @@ JNIEXPORT void JNICALL JVM_VirtualThreadUnmount(JNIEnv* env, jobject vthread, jboolean hide); JNIEXPORT void JNICALL -JVM_VirtualThreadHideFrames(JNIEnv* env, jobject vthread, jboolean hide); +JVM_VirtualThreadHideFrames(JNIEnv* env, jclass clazz, jboolean hide); JNIEXPORT void JNICALL -JVM_VirtualThreadDisableSuspend(JNIEnv* env, jobject vthread, jboolean enter); +JVM_VirtualThreadDisableSuspend(JNIEnv* env, jclass clazz, jboolean enter); /* * Core reflection support. diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp index 6bb3e16475a..33f9db4553d 100644 --- a/src/hotspot/share/opto/library_call.cpp +++ b/src/hotspot/share/opto/library_call.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2941,7 +2941,7 @@ bool LibraryCallKit::inline_native_notify_jvmti_hide() { { // unconditionally update the temporary VTMS transition bit in current JavaThread Node* thread = ideal.thread(); - Node* hide = _gvn.transform(argument(1)); // hide argument for temporary VTMS transition notification + Node* hide = _gvn.transform(argument(0)); // hide argument for temporary VTMS transition notification Node* addr = basic_plus_adr(thread, in_bytes(JavaThread::is_in_tmp_VTMS_transition_offset())); const TypePtr *addr_type = _gvn.type(addr)->isa_ptr(); @@ -2964,7 +2964,7 @@ bool LibraryCallKit::inline_native_notify_jvmti_sync() { { // unconditionally update the is_disable_suspend bit in current JavaThread Node* thread = ideal.thread(); - Node* arg = _gvn.transform(argument(1)); // argument for notification + Node* arg = _gvn.transform(argument(0)); // argument for notification Node* addr = basic_plus_adr(thread, in_bytes(JavaThread::is_disable_suspend_offset())); const TypePtr *addr_type = _gvn.type(addr)->isa_ptr(); diff --git a/src/hotspot/share/prims/jvm.cpp b/src/hotspot/share/prims/jvm.cpp index 9a8a9a5bec0..4ec0dfa34cc 100644 --- a/src/hotspot/share/prims/jvm.cpp +++ b/src/hotspot/share/prims/jvm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -3986,7 +3986,7 @@ JVM_ENTRY(void, JVM_VirtualThreadUnmount(JNIEnv* env, jobject vthread, jboolean JVM_END // Always update the temporary VTMS transition bit. -JVM_ENTRY(void, JVM_VirtualThreadHideFrames(JNIEnv* env, jobject vthread, jboolean hide)) +JVM_ENTRY(void, JVM_VirtualThreadHideFrames(JNIEnv* env, jclass clazz, jboolean hide)) #if INCLUDE_JVMTI if (!DoJVMTIVirtualThreadTransitions) { assert(!JvmtiExport::can_support_virtual_threads(), "sanity check"); @@ -4000,7 +4000,7 @@ JVM_END // Notification from VirtualThread about disabling JVMTI Suspend in a sync critical section. // Needed to avoid deadlocks with JVMTI suspend mechanism. -JVM_ENTRY(void, JVM_VirtualThreadDisableSuspend(JNIEnv* env, jobject vthread, jboolean enter)) +JVM_ENTRY(void, JVM_VirtualThreadDisableSuspend(JNIEnv* env, jclass clazz, jboolean enter)) #if INCLUDE_JVMTI if (!DoJVMTIVirtualThreadTransitions) { assert(!JvmtiExport::can_support_virtual_threads(), "sanity check"); diff --git a/src/java.base/share/classes/java/lang/VirtualThread.java b/src/java.base/share/classes/java/lang/VirtualThread.java index 72ae1070242..76ff6501ecb 100644 --- a/src/java.base/share/classes/java/lang/VirtualThread.java +++ b/src/java.base/share/classes/java/lang/VirtualThread.java @@ -1175,10 +1175,10 @@ final class VirtualThread extends BaseVirtualThread { @IntrinsicCandidate @JvmtiMountTransition - private native void notifyJvmtiHideFrames(boolean hide); + private static native void notifyJvmtiHideFrames(boolean hide); @IntrinsicCandidate - private native void notifyJvmtiDisableSuspend(boolean enter); + private static native void notifyJvmtiDisableSuspend(boolean enter); private static native void registerNatives(); static {