mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
Ensure ensure correct initialization of compiler runtime Reviewed-by: kvn, twisti
This commit is contained in:
parent
7f46feeee2
commit
aef0d74e96
18 changed files with 386 additions and 265 deletions
|
@ -42,26 +42,16 @@
|
|||
#include "runtime/interfaceSupport.hpp"
|
||||
#include "runtime/sharedRuntime.hpp"
|
||||
|
||||
volatile int Compiler::_runtimes = uninitialized;
|
||||
|
||||
Compiler::Compiler() {
|
||||
}
|
||||
Compiler::Compiler () {}
|
||||
|
||||
|
||||
Compiler::~Compiler() {
|
||||
Unimplemented();
|
||||
}
|
||||
|
||||
|
||||
void Compiler::initialize_all() {
|
||||
void Compiler::init_c1_runtime() {
|
||||
BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
|
||||
Arena* arena = new (mtCompiler) Arena();
|
||||
Runtime1::initialize(buffer_blob);
|
||||
FrameMap::initialize();
|
||||
// initialize data structures
|
||||
ValueType::initialize(arena);
|
||||
// Instruction::initialize();
|
||||
// BlockBegin::initialize();
|
||||
GraphBuilder::initialize();
|
||||
// note: to use more than one instance of LinearScan at a time this function call has to
|
||||
// be moved somewhere outside of this constructor:
|
||||
|
@ -70,32 +60,33 @@ void Compiler::initialize_all() {
|
|||
|
||||
|
||||
void Compiler::initialize() {
|
||||
if (_runtimes != initialized) {
|
||||
initialize_runtimes( initialize_all, &_runtimes);
|
||||
// Buffer blob must be allocated per C1 compiler thread at startup
|
||||
BufferBlob* buffer_blob = init_buffer_blob();
|
||||
|
||||
if (should_perform_init()) {
|
||||
if (buffer_blob == NULL) {
|
||||
// When we come here we are in state 'initializing'; entire C1 compilation
|
||||
// can be shut down.
|
||||
set_state(failed);
|
||||
} else {
|
||||
init_c1_runtime();
|
||||
set_state(initialized);
|
||||
}
|
||||
}
|
||||
mark_initialized();
|
||||
}
|
||||
|
||||
|
||||
BufferBlob* Compiler::get_buffer_blob(ciEnv* env) {
|
||||
BufferBlob* Compiler::init_buffer_blob() {
|
||||
// Allocate buffer blob once at startup since allocation for each
|
||||
// compilation seems to be too expensive (at least on Intel win32).
|
||||
BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
|
||||
if (buffer_blob != NULL) {
|
||||
return buffer_blob;
|
||||
}
|
||||
assert (CompilerThread::current()->get_buffer_blob() == NULL, "Should initialize only once");
|
||||
|
||||
// setup CodeBuffer. Preallocate a BufferBlob of size
|
||||
// NMethodSizeLimit plus some extra space for constants.
|
||||
int code_buffer_size = Compilation::desired_max_code_buffer_size() +
|
||||
Compilation::desired_max_constant_size();
|
||||
|
||||
buffer_blob = BufferBlob::create("Compiler1 temporary CodeBuffer",
|
||||
code_buffer_size);
|
||||
if (buffer_blob == NULL) {
|
||||
CompileBroker::handle_full_code_cache();
|
||||
env->record_failure("CodeCache is full");
|
||||
} else {
|
||||
BufferBlob* buffer_blob = BufferBlob::create("C1 temporary CodeBuffer", code_buffer_size);
|
||||
if (buffer_blob != NULL) {
|
||||
CompilerThread::current()->set_buffer_blob(buffer_blob);
|
||||
}
|
||||
|
||||
|
@ -104,15 +95,8 @@ BufferBlob* Compiler::get_buffer_blob(ciEnv* env) {
|
|||
|
||||
|
||||
void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci) {
|
||||
BufferBlob* buffer_blob = Compiler::get_buffer_blob(env);
|
||||
if (buffer_blob == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_initialized()) {
|
||||
initialize();
|
||||
}
|
||||
|
||||
BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
|
||||
assert(buffer_blob != NULL, "Must exist");
|
||||
// invoke compilation
|
||||
{
|
||||
// We are nested here because we need for the destructor
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue