8205499: C1 temporary code buffers are not removed with -XX:+UseDynamicNumberOfCompilerThreads
authorthartmann
Fri, 29 Jun 2018 11:08:38 +0200
changeset 50912 0d6ab24b6ad9
parent 50911 c1e56891d768
child 50913 9816d7cc655e
8205499: C1 temporary code buffers are not removed with -XX:+UseDynamicNumberOfCompilerThreads Summary: Deallocate C1 code buffers in the compiler thread destructor. Reviewed-by: neliasso, kvn, mdoerr
src/hotspot/share/compiler/compileBroker.cpp
src/hotspot/share/runtime/thread.cpp
--- a/src/hotspot/share/compiler/compileBroker.cpp	Thu Jun 28 21:58:23 2018 -0700
+++ b/src/hotspot/share/compiler/compileBroker.cpp	Fri Jun 29 11:08:38 2018 +0200
@@ -1638,12 +1638,6 @@
  * out to be a problem.
  */
 void CompileBroker::shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread) {
-  // Free buffer blob, if allocated
-  if (thread->get_buffer_blob() != NULL) {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
-    CodeCache::free(thread->get_buffer_blob());
-  }
-
   if (comp->should_perform_shutdown()) {
     // There are two reasons for shutting down the compiler
     // 1) compiler runtime initialization failed
--- a/src/hotspot/share/runtime/thread.cpp	Thu Jun 28 21:58:23 2018 -0700
+++ b/src/hotspot/share/runtime/thread.cpp	Fri Jun 29 11:08:38 2018 +0200
@@ -3298,6 +3298,11 @@
 }
 
 CompilerThread::~CompilerThread() {
+  // Free buffer blob, if allocated
+  if (get_buffer_blob() != NULL) {
+    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    CodeCache::free(get_buffer_blob());
+  }
   // Delete objects which were allocated on heap.
   delete _counters;
 }