diff --git a/src/hotspot/share/c1/c1_Compiler.cpp b/src/hotspot/share/c1/c1_Compiler.cpp index ee878d04d8488..7f0f0ce95b7ef 100644 --- a/src/hotspot/share/c1/c1_Compiler.cpp +++ b/src/hotspot/share/c1/c1_Compiler.cpp @@ -49,6 +49,7 @@ Compiler::Compiler() : AbstractCompiler(compiler_c1) { } void Compiler::init_c1_runtime() { + if (Runtime1::blob_for((Runtime1::StubID)0) == nullptr) // check if Runtime1 is initialized Runtime1::initialize(CompilerThread::current()->get_buffer_blob()); } @@ -243,7 +244,9 @@ bool Compiler::is_intrinsic_supported(vmIntrinsics::ID id) { } void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci, bool install_code, DirectiveSet* directive) { - BufferBlob* buffer_blob = init_buffer_blob(); + BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob(); + if (buffer_blob == nullptr) { buffer_blob = init_buffer_blob(); } + if (buffer_blob == nullptr) { warning("no space to run C1 compiler"); return; diff --git a/src/hotspot/share/c1/c1_Runtime1.cpp b/src/hotspot/share/c1/c1_Runtime1.cpp index ffebe38964495..8d8227ca2c760 100644 --- a/src/hotspot/share/c1/c1_Runtime1.cpp +++ b/src/hotspot/share/c1/c1_Runtime1.cpp @@ -109,7 +109,7 @@ void StubAssembler::set_num_rt_args(int args) { // Implementation of Runtime1 -CodeBlob* Runtime1::_blobs[Runtime1::number_of_ids]; +CodeBlob* Runtime1::_blobs[Runtime1::number_of_ids] = {nullptr}; const char *Runtime1::_blob_names[] = { RUNTIME1_STUBS(STUB_NAME, LAST_STUB_NAME) }; diff --git a/src/hotspot/share/opto/output.cpp b/src/hotspot/share/opto/output.cpp index f2baf2d3ef1e8..49d2f86a5bf8e 100644 --- a/src/hotspot/share/opto/output.cpp +++ b/src/hotspot/share/opto/output.cpp @@ -253,7 +253,7 @@ PhaseOutput::PhaseOutput() PhaseOutput::~PhaseOutput() { C->set_output(nullptr); if (_scratch_buffer_blob != nullptr) { -// BufferBlob::free(_scratch_buffer_blob); + BufferBlob::free(_scratch_buffer_blob); } }