Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LizBing committed Dec 16, 2023
1 parent 4aa6f9f commit 59aea1f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,22 @@ jint G1ConcurrentRefineThreadControl::initialize(G1ConcurrentRefine* cr) {
_cr = cr;

if (max_num_threads() > 0) {
uint ensure_id = UseDynamicNumberOfGCThreads ? 0 : max_num_threads() - 1;
if (!ensure_threads_created(ensure_id, true)) {
_threads.push(create_refinement_thread(0, true));
if (_threads.at(0) == nullptr) {
vm_shutdown_during_initialization("Could not allocate primary refinement thread");
return JNI_ENOMEM;
}

if (UseDynamicNumberOfGCThreads) {
for (uint i = 1; i < max_num_threads(); ++i) {
_threads.push(nullptr);
}
} else {
if (!ensure_threads_created(max_num_threads() - 1, true)) {
vm_shutdown_during_initialization("Could not allocate refinement threads");
return JNI_ENOMEM;
}
}
}

return JNI_OK;
Expand Down

0 comments on commit 59aea1f

Please sign in to comment.