mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8209670: CompilerThread releasing code buffer in destructor is unsafe
Don't free temporary code buffers in compiler thread destructor to avoid interference with safepoint code. Reviewed-by: kvn, dholmes, zgu
This commit is contained in:
parent
ea4f2f60d5
commit
aef7c93375
2 changed files with 11 additions and 5 deletions
|
@ -1637,6 +1637,12 @@ bool CompileBroker::init_compiler_runtime() {
|
|||
* 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
|
||||
|
@ -1767,6 +1773,11 @@ void CompileBroker::compiler_thread_loop() {
|
|||
tty->print_cr("Removing compiler thread %s after " JLONG_FORMAT " ms idle time",
|
||||
thread->name(), thread->idle_time_millis());
|
||||
}
|
||||
// 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());
|
||||
}
|
||||
return; // Stop this thread.
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue