提交 02e6b195 编写于 作者: A anoll

8014430: JRE crashes instead of stop compilation on full Code Cache. Internal...

8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
Summary: Disable client compiler and switch to interpreter if there is not enough free space in the code cache.
Reviewed-by: kvn, twisti
上级 f75b1dbd
...@@ -77,30 +77,42 @@ void Compiler::initialize() { ...@@ -77,30 +77,42 @@ void Compiler::initialize() {
} }
BufferBlob* Compiler::build_buffer_blob() { BufferBlob* Compiler::get_buffer_blob(ciEnv* env) {
// 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;
}
// setup CodeBuffer. Preallocate a BufferBlob of size // setup CodeBuffer. Preallocate a BufferBlob of size
// NMethodSizeLimit plus some extra space for constants. // NMethodSizeLimit plus some extra space for constants.
int code_buffer_size = Compilation::desired_max_code_buffer_size() + int code_buffer_size = Compilation::desired_max_code_buffer_size() +
Compilation::desired_max_constant_size(); Compilation::desired_max_constant_size();
BufferBlob* blob = BufferBlob::create("Compiler1 temporary CodeBuffer",
code_buffer_size); buffer_blob = BufferBlob::create("Compiler1 temporary CodeBuffer",
guarantee(blob != NULL, "must create initial code buffer"); code_buffer_size);
return blob; if (buffer_blob == NULL) {
CompileBroker::handle_full_code_cache();
env->record_failure("CodeCache is full");
} else {
CompilerThread::current()->set_buffer_blob(buffer_blob);
}
return buffer_blob;
} }
void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci) { void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci) {
// Allocate buffer blob once at startup since allocation for each BufferBlob* buffer_blob = Compiler::get_buffer_blob(env);
// compilation seems to be too expensive (at least on Intel win32).
BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
if (buffer_blob == NULL) { if (buffer_blob == NULL) {
buffer_blob = build_buffer_blob(); return;
CompilerThread::current()->set_buffer_blob(buffer_blob);
} }
if (!is_initialized()) { if (!is_initialized()) {
initialize(); initialize();
} }
// invoke compilation // invoke compilation
{ {
// We are nested here because we need for the destructor // We are nested here because we need for the destructor
......
...@@ -46,7 +46,7 @@ class Compiler: public AbstractCompiler { ...@@ -46,7 +46,7 @@ class Compiler: public AbstractCompiler {
virtual bool is_c1() { return true; }; virtual bool is_c1() { return true; };
BufferBlob* build_buffer_blob(); BufferBlob* get_buffer_blob(ciEnv* env);
// Missing feature tests // Missing feature tests
virtual bool supports_native() { return true; } virtual bool supports_native() { return true; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册