aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm/c1/c1_Compilation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/share/vm/c1/c1_Compilation.cpp')
-rw-r--r--src/share/vm/c1/c1_Compilation.cpp34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/share/vm/c1/c1_Compilation.cpp b/src/share/vm/c1/c1_Compilation.cpp
index 2bf890294..d6f72b8d1 100644
--- a/src/share/vm/c1/c1_Compilation.cpp
+++ b/src/share/vm/c1/c1_Compilation.cpp
@@ -66,9 +66,6 @@ class PhaseTraceTime: public TraceTime {
}
};
-Arena* Compilation::_arena = NULL;
-Compilation* Compilation::_compilation = NULL;
-
// Implementation of Compilation
@@ -238,9 +235,23 @@ void Compilation::emit_code_epilog(LIR_Assembler* assembler) {
}
+void Compilation::setup_code_buffer(CodeBuffer* code, int call_stub_estimate) {
+ // Preinitialize the consts section to some large size:
+ int locs_buffer_size = 20 * (relocInfo::length_limit + sizeof(relocInfo));
+ char* locs_buffer = NEW_RESOURCE_ARRAY(char, locs_buffer_size);
+ code->insts()->initialize_shared_locs((relocInfo*)locs_buffer,
+ locs_buffer_size / sizeof(relocInfo));
+ code->initialize_consts_size(Compilation::desired_max_constant_size());
+ // Call stubs + deopt/exception handler
+ code->initialize_stubs_size((call_stub_estimate * LIR_Assembler::call_stub_size) +
+ LIR_Assembler::exception_handler_size +
+ LIR_Assembler::deopt_handler_size);
+}
+
+
int Compilation::emit_code_body() {
// emit code
- Runtime1::setup_code_buffer(code(), allocator()->num_calls());
+ setup_code_buffer(code(), allocator()->num_calls());
code()->initialize_oop_recorder(env()->oop_recorder());
_masm = new C1_MacroAssembler(code());
@@ -422,7 +433,8 @@ void Compilation::generate_exception_handler_table() {
}
-Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* method, int osr_bci)
+Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* method,
+ int osr_bci, BufferBlob* buffer_blob)
: _compiler(compiler)
, _env(env)
, _method(method)
@@ -437,8 +449,10 @@ Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* metho
, _bailout_msg(NULL)
, _exception_info_list(NULL)
, _allocator(NULL)
-, _code(Runtime1::get_buffer_blob()->instructions_begin(),
- Runtime1::get_buffer_blob()->instructions_size())
+, _next_id(0)
+, _next_block_id(0)
+, _code(buffer_blob->instructions_begin(),
+ buffer_blob->instructions_size())
, _current_instruction(NULL)
#ifndef PRODUCT
, _last_instruction_printed(NULL)
@@ -446,17 +460,15 @@ Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* metho
{
PhaseTraceTime timeit(_t_compile);
- assert(_arena == NULL, "shouldn't only one instance of Compilation in existence at a time");
_arena = Thread::current()->resource_area();
- _compilation = this;
+ _env->set_compiler_data(this);
_exception_info_list = new ExceptionInfoList();
_implicit_exception_table.set_size(0);
compile_method();
}
Compilation::~Compilation() {
- _arena = NULL;
- _compilation = NULL;
+ _env->set_compiler_data(NULL);
}