Skip to content

Commit 004651d

Browse files
author
Tom Rodriguez
committedAug 15, 2023
8311557: [JVMCI] deadlock with JVMTI thread suspension
Reviewed-by: thartmann, dnsimon
1 parent 9ded868 commit 004651d

File tree

6 files changed

+23
-6
lines changed

6 files changed

+23
-6
lines changed
 

‎src/hotspot/share/compiler/abstractCompiler.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ class AbstractCompiler : public CHeapObj<mtCompiler> {
150150
bool is_c2() const { return _type == compiler_c2; }
151151
bool is_jvmci() const { return _type == compiler_jvmci; }
152152
CompilerType type() const { return _type; }
153+
virtual bool is_hidden_from_external_view() const { return false; }
153154

154155
// Customization
155156
virtual void initialize () = 0;

‎src/hotspot/share/compiler/compilerThread.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,8 @@ void CompilerThread::thread_entry(JavaThread* thread, TRAPS) {
6161
bool CompilerThread::can_call_java() const {
6262
return _compiler != nullptr && _compiler->is_jvmci();
6363
}
64+
65+
// Hide native compiler threads from external view.
66+
bool CompilerThread::is_hidden_from_external_view() const {
67+
return _compiler == nullptr || _compiler->is_hidden_from_external_view();
68+
}

‎src/hotspot/share/compiler/compilerThread.hpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ class CompilerThread : public JavaThread {
7272

7373
virtual bool can_call_java() const;
7474

75-
// Hide native compiler threads from external view.
76-
bool is_hidden_from_external_view() const { return !can_call_java(); }
75+
// Returns true if this CompilerThread is hidden from JVMTI and FlightRecorder. C1 and C2 are
76+
// always hidden but JVMCI compiler threads might be hidden.
77+
virtual bool is_hidden_from_external_view() const;
7778

7879
void set_compiler(AbstractCompiler* c) { _compiler = c; }
7980
AbstractCompiler* compiler() const { return _compiler; }

‎src/hotspot/share/jvmci/jvmciCompiler.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ class JVMCICompiler : public AbstractCompiler {
103103
bool is_c1 () { return false; }
104104
bool is_c2 () { return false; }
105105

106+
virtual bool is_hidden_from_external_view() const { return UseJVMCINativeLibrary && LibJVMCICompilerThreadHidden; }
107+
108+
106109
bool needs_stubs () { return false; }
107110

108111
// Initialization

‎src/hotspot/share/jvmci/jvmci_globals.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,11 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() {
7373
JVMCI_FLAG_CHECKED(EnableJVMCIProduct)
7474
JVMCI_FLAG_CHECKED(UseGraalJIT)
7575

76-
CHECK_NOT_SET(BootstrapJVMCI, UseJVMCICompiler)
77-
CHECK_NOT_SET(PrintBootstrap, UseJVMCICompiler)
78-
CHECK_NOT_SET(JVMCIThreads, UseJVMCICompiler)
79-
CHECK_NOT_SET(JVMCIHostThreads, UseJVMCICompiler)
76+
CHECK_NOT_SET(BootstrapJVMCI, UseJVMCICompiler)
77+
CHECK_NOT_SET(PrintBootstrap, UseJVMCICompiler)
78+
CHECK_NOT_SET(JVMCIThreads, UseJVMCICompiler)
79+
CHECK_NOT_SET(JVMCIHostThreads, UseJVMCICompiler)
80+
CHECK_NOT_SET(LibJVMCICompilerThreadHidden, UseJVMCICompiler)
8081

8182
if (UseJVMCICompiler) {
8283
if (FLAG_IS_DEFAULT(UseJVMCINativeLibrary) && !UseJVMCINativeLibrary) {
@@ -185,6 +186,7 @@ bool JVMCIGlobals::enable_jvmci_product_mode(JVMFlagOrigin origin, bool use_graa
185186
"UseJVMCINativeLibrary",
186187
"JVMCINativeLibraryThreadFraction",
187188
"JVMCINativeLibraryErrorFile",
189+
"LibJVMCICompilerThreadHidden",
188190
nullptr
189191
};
190192

‎src/hotspot/share/jvmci/jvmci_globals.hpp

+5
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ class fileStream;
157157
"error data to this file" \
158158
"[default: ./" LIBJVMCI_ERR_FILE "] (%p replaced with pid)") \
159159
\
160+
product(bool, LibJVMCICompilerThreadHidden, true, EXPERIMENTAL, \
161+
"If true then native JVMCI compiler threads are hidden from " \
162+
"JVMTI and FlightRecorder. This must be set to false if you " \
163+
"wish to use a Java debugger against JVMCI threads.") \
164+
\
160165
NOT_COMPILER2(product(bool, UseMultiplyToLenIntrinsic, false, DIAGNOSTIC, \
161166
"Enables intrinsification of BigInteger.multiplyToLen()")) \
162167
\

0 commit comments

Comments
 (0)
Please sign in to comment.