Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Commit

Permalink
8293019: [JVMCI] change ratio of libgraal to C1 threads and use one i…
Browse files Browse the repository at this point in the history
…solate per libgraal thread

Reviewed-by: never, iveresov
  • Loading branch information
dougxc committed Aug 31, 2022
1 parent 9c11091 commit 5a90ad9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/hotspot/share/jvmci/jvmci_globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() {
CHECK_NOT_SET(JVMCIThreadsPerNativeLibraryRuntime, EnableJVMCI)
CHECK_NOT_SET(JVMCICompilerIdleDelay, EnableJVMCI)
CHECK_NOT_SET(UseJVMCINativeLibrary, EnableJVMCI)
CHECK_NOT_SET(JVMCINativeLibraryThreadFraction, EnableJVMCI)
CHECK_NOT_SET(JVMCILibPath, EnableJVMCI)
CHECK_NOT_SET(JVMCINativeLibraryErrorFile, EnableJVMCI)
CHECK_NOT_SET(JVMCILibDumpJNIConfig, EnableJVMCI)
Expand Down Expand Up @@ -193,6 +194,7 @@ bool JVMCIGlobals::enable_jvmci_product_mode(JVMFlag::Flags origin) {
"JVMCILibPath",
"JVMCILibDumpJNIConfig",
"UseJVMCINativeLibrary",
"JVMCINativeLibraryThreadFraction",
"JVMCINativeLibraryErrorFile",
NULL
};
Expand Down
12 changes: 9 additions & 3 deletions src/hotspot/share/jvmci/jvmci_globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@
"JVMCI flags to be non-experimental and defaults " \
"UseJVMCICompiler and EnableJVMCI to true.") \
\
experimental(uint, JVMCIThreadsPerNativeLibraryRuntime, 0, \
experimental(uint, JVMCIThreadsPerNativeLibraryRuntime, 1, \
"Max number of threads per JVMCI native runtime. " \
"Specify 0 to force use of a single JVMCI native runtime. ") \
"Specify 0 to force use of a single JVMCI native runtime. " \
"Specify 1 to force a single JVMCI native runtime per thread. ") \
\
experimental(uint, JVMCICompilerIdleDelay, DEFAULT_COMPILER_IDLE_DELAY, \
"Number of milliseconds a JVMCI compiler queue should wait for " \
Expand Down Expand Up @@ -136,11 +137,16 @@
"and methods the JVMCI shared library must provide") \
\
experimental(bool, UseJVMCINativeLibrary, false, \
"Execute JVMCI Java code from a shared library " \
"Execute JVMCI Java code from a shared library (\"libjvmci\") " \
"instead of loading it from class files and executing it " \
"on the HotSpot heap. Defaults to true if UseJVMCICompiler is " \
"true and a JVMCI native library is available.") \
\
experimental(double, JVMCINativeLibraryThreadFraction, 0.33, \
"The fraction of compiler threads used by libjvmci. " \
"The remaining compiler threads are used by C1.") \
range(0.0, 1.0) \
\
experimental(ccstr, JVMCINativeLibraryErrorFile, NULL, \
"If an error in the JVMCI native library occurs, save the " \
"error data to this file" \
Expand Down
14 changes: 12 additions & 2 deletions src/hotspot/share/runtime/tieredThresholdPolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,18 @@ void TieredThresholdPolicy::initialize() {
// No C2 compiler thread required
set_c1_count(count);
} else {
set_c1_count(MAX2(count / 3, 1));
set_c2_count(MAX2(count - c1_count(), 1));
#if INCLUDE_JVMCI
if (UseJVMCICompiler && UseJVMCINativeLibrary) {
int libjvmci_count = MAX2((int) (count * JVMCINativeLibraryThreadFraction), 1);
int c1_count = MAX2(count - libjvmci_count, 1);
set_c2_count(libjvmci_count);
set_c1_count(c1_count);
} else
#endif
{
set_c1_count(MAX2(count / 3, 1));
set_c2_count(MAX2(count - c1_count(), 1));
}
}
assert(count == c1_count() + c2_count(), "inconsistent compiler thread count");

Expand Down

0 comments on commit 5a90ad9

Please sign in to comment.