Mercurial > hg > graal-compiler
comparison src/share/vm/c1/c1_Compilation.cpp @ 1584:b812ff5abc73
6958292: C1: Enable parallel compilation
Summary: Enable parallel compilation in C1
Reviewed-by: never, kvn
author | iveresov |
---|---|
date | Fri, 04 Jun 2010 11:18:04 -0700 |
parents | c18cbe5936b8 |
children | 9887b5e57f9e |
comparison
equal
deleted
inserted
replaced
1583:02e771df338e | 1584:b812ff5abc73 |
---|---|
64 PhaseTraceTime(TimerName timer): | 64 PhaseTraceTime(TimerName timer): |
65 TraceTime("", &timers[timer], CITime || CITimeEach, Verbose) { | 65 TraceTime("", &timers[timer], CITime || CITimeEach, Verbose) { |
66 } | 66 } |
67 }; | 67 }; |
68 | 68 |
69 Arena* Compilation::_arena = NULL; | |
70 Compilation* Compilation::_compilation = NULL; | |
71 | |
72 // Implementation of Compilation | 69 // Implementation of Compilation |
73 | 70 |
74 | 71 |
75 #ifndef PRODUCT | 72 #ifndef PRODUCT |
76 | 73 |
236 // done | 233 // done |
237 masm()->flush(); | 234 masm()->flush(); |
238 } | 235 } |
239 | 236 |
240 | 237 |
238 void Compilation::setup_code_buffer(CodeBuffer* code, int call_stub_estimate) { | |
239 // Preinitialize the consts section to some large size: | |
240 int locs_buffer_size = 20 * (relocInfo::length_limit + sizeof(relocInfo)); | |
241 char* locs_buffer = NEW_RESOURCE_ARRAY(char, locs_buffer_size); | |
242 code->insts()->initialize_shared_locs((relocInfo*)locs_buffer, | |
243 locs_buffer_size / sizeof(relocInfo)); | |
244 code->initialize_consts_size(Compilation::desired_max_constant_size()); | |
245 // Call stubs + deopt/exception handler | |
246 code->initialize_stubs_size((call_stub_estimate * LIR_Assembler::call_stub_size) + | |
247 LIR_Assembler::exception_handler_size + | |
248 LIR_Assembler::deopt_handler_size); | |
249 } | |
250 | |
251 | |
241 int Compilation::emit_code_body() { | 252 int Compilation::emit_code_body() { |
242 // emit code | 253 // emit code |
243 Runtime1::setup_code_buffer(code(), allocator()->num_calls()); | 254 setup_code_buffer(code(), allocator()->num_calls()); |
244 code()->initialize_oop_recorder(env()->oop_recorder()); | 255 code()->initialize_oop_recorder(env()->oop_recorder()); |
245 | 256 |
246 _masm = new C1_MacroAssembler(code()); | 257 _masm = new C1_MacroAssembler(code()); |
247 _masm->set_oop_recorder(env()->oop_recorder()); | 258 _masm->set_oop_recorder(env()->oop_recorder()); |
248 | 259 |
420 exception_handler_table()->add_subtable(info->pco(), bcis, scope_depths, pcos); | 431 exception_handler_table()->add_subtable(info->pco(), bcis, scope_depths, pcos); |
421 } | 432 } |
422 } | 433 } |
423 | 434 |
424 | 435 |
425 Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* method, int osr_bci) | 436 Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* method, |
437 int osr_bci, BufferBlob* buffer_blob) | |
426 : _compiler(compiler) | 438 : _compiler(compiler) |
427 , _env(env) | 439 , _env(env) |
428 , _method(method) | 440 , _method(method) |
429 , _osr_bci(osr_bci) | 441 , _osr_bci(osr_bci) |
430 , _hir(NULL) | 442 , _hir(NULL) |
435 , _has_fpu_code(true) // pessimistic assumption | 447 , _has_fpu_code(true) // pessimistic assumption |
436 , _has_unsafe_access(false) | 448 , _has_unsafe_access(false) |
437 , _bailout_msg(NULL) | 449 , _bailout_msg(NULL) |
438 , _exception_info_list(NULL) | 450 , _exception_info_list(NULL) |
439 , _allocator(NULL) | 451 , _allocator(NULL) |
440 , _code(Runtime1::get_buffer_blob()->instructions_begin(), | 452 , _next_id(0) |
441 Runtime1::get_buffer_blob()->instructions_size()) | 453 , _next_block_id(0) |
454 , _code(buffer_blob->instructions_begin(), | |
455 buffer_blob->instructions_size()) | |
442 , _current_instruction(NULL) | 456 , _current_instruction(NULL) |
443 #ifndef PRODUCT | 457 #ifndef PRODUCT |
444 , _last_instruction_printed(NULL) | 458 , _last_instruction_printed(NULL) |
445 #endif // PRODUCT | 459 #endif // PRODUCT |
446 { | 460 { |
447 PhaseTraceTime timeit(_t_compile); | 461 PhaseTraceTime timeit(_t_compile); |
448 | 462 |
449 assert(_arena == NULL, "shouldn't only one instance of Compilation in existence at a time"); | |
450 _arena = Thread::current()->resource_area(); | 463 _arena = Thread::current()->resource_area(); |
451 _compilation = this; | 464 _env->set_compiler_data(this); |
452 _exception_info_list = new ExceptionInfoList(); | 465 _exception_info_list = new ExceptionInfoList(); |
453 _implicit_exception_table.set_size(0); | 466 _implicit_exception_table.set_size(0); |
454 compile_method(); | 467 compile_method(); |
455 } | 468 } |
456 | 469 |
457 Compilation::~Compilation() { | 470 Compilation::~Compilation() { |
458 _arena = NULL; | 471 _env->set_compiler_data(NULL); |
459 _compilation = NULL; | |
460 } | 472 } |
461 | 473 |
462 | 474 |
463 void Compilation::add_exception_handlers_for_pco(int pco, XHandlers* exception_handlers) { | 475 void Compilation::add_exception_handlers_for_pco(int pco, XHandlers* exception_handlers) { |
464 #ifndef PRODUCT | 476 #ifndef PRODUCT |