Skip to content

Commit

Permalink
8311557: [JVMCI] deadlock with JVMTI thread suspension
Browse files Browse the repository at this point in the history
Reviewed-by: thartmann, dnsimon
  • Loading branch information
Tom Rodriguez committed Aug 15, 2023
1 parent 9ded868 commit 004651d
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/hotspot/share/compiler/abstractCompiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class AbstractCompiler : public CHeapObj<mtCompiler> {
bool is_c2() const { return _type == compiler_c2; }
bool is_jvmci() const { return _type == compiler_jvmci; }
CompilerType type() const { return _type; }
virtual bool is_hidden_from_external_view() const { return false; }

// Customization
virtual void initialize () = 0;
Expand Down
5 changes: 5 additions & 0 deletions src/hotspot/share/compiler/compilerThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,8 @@ void CompilerThread::thread_entry(JavaThread* thread, TRAPS) {
bool CompilerThread::can_call_java() const {
return _compiler != nullptr && _compiler->is_jvmci();
}

// Hide native compiler threads from external view.
bool CompilerThread::is_hidden_from_external_view() const {
return _compiler == nullptr || _compiler->is_hidden_from_external_view();
}
5 changes: 3 additions & 2 deletions src/hotspot/share/compiler/compilerThread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ class CompilerThread : public JavaThread {

virtual bool can_call_java() const;

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

void set_compiler(AbstractCompiler* c) { _compiler = c; }
AbstractCompiler* compiler() const { return _compiler; }
Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/share/jvmci/jvmciCompiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ class JVMCICompiler : public AbstractCompiler {
bool is_c1 () { return false; }
bool is_c2 () { return false; }

virtual bool is_hidden_from_external_view() const { return UseJVMCINativeLibrary && LibJVMCICompilerThreadHidden; }


bool needs_stubs () { return false; }

// Initialization
Expand Down
10 changes: 6 additions & 4 deletions src/hotspot/share/jvmci/jvmci_globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() {
JVMCI_FLAG_CHECKED(EnableJVMCIProduct)
JVMCI_FLAG_CHECKED(UseGraalJIT)

CHECK_NOT_SET(BootstrapJVMCI, UseJVMCICompiler)
CHECK_NOT_SET(PrintBootstrap, UseJVMCICompiler)
CHECK_NOT_SET(JVMCIThreads, UseJVMCICompiler)
CHECK_NOT_SET(JVMCIHostThreads, UseJVMCICompiler)
CHECK_NOT_SET(BootstrapJVMCI, UseJVMCICompiler)
CHECK_NOT_SET(PrintBootstrap, UseJVMCICompiler)
CHECK_NOT_SET(JVMCIThreads, UseJVMCICompiler)
CHECK_NOT_SET(JVMCIHostThreads, UseJVMCICompiler)
CHECK_NOT_SET(LibJVMCICompilerThreadHidden, UseJVMCICompiler)

if (UseJVMCICompiler) {
if (FLAG_IS_DEFAULT(UseJVMCINativeLibrary) && !UseJVMCINativeLibrary) {
Expand Down Expand Up @@ -185,6 +186,7 @@ bool JVMCIGlobals::enable_jvmci_product_mode(JVMFlagOrigin origin, bool use_graa
"UseJVMCINativeLibrary",
"JVMCINativeLibraryThreadFraction",
"JVMCINativeLibraryErrorFile",
"LibJVMCICompilerThreadHidden",
nullptr
};

Expand Down
5 changes: 5 additions & 0 deletions src/hotspot/share/jvmci/jvmci_globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ class fileStream;
"error data to this file" \
"[default: ./" LIBJVMCI_ERR_FILE "] (%p replaced with pid)") \
\
product(bool, LibJVMCICompilerThreadHidden, true, EXPERIMENTAL, \
"If true then native JVMCI compiler threads are hidden from " \
"JVMTI and FlightRecorder. This must be set to false if you " \
"wish to use a Java debugger against JVMCI threads.") \
\
NOT_COMPILER2(product(bool, UseMultiplyToLenIntrinsic, false, DIAGNOSTIC, \
"Enables intrinsification of BigInteger.multiplyToLen()")) \
\
Expand Down

1 comment on commit 004651d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.