< prev index next >

src/hotspot/share/c1/c1_Compilation.cpp

Print this page




 346 
 347   _masm = new C1_MacroAssembler(code());
 348   _masm->set_oop_recorder(env()->oop_recorder());
 349 
 350   LIR_Assembler lir_asm(this);
 351 
 352   lir_asm.emit_code(hir()->code());
 353   CHECK_BAILOUT_(0);
 354 
 355   emit_code_epilog(&lir_asm);
 356   CHECK_BAILOUT_(0);
 357 
 358   generate_exception_handler_table();
 359 
 360 #ifndef PRODUCT
 361   if (PrintExceptionHandlers && Verbose) {
 362     exception_handler_table()->print();
 363   }
 364 #endif /* PRODUCT */
 365 

 366   return frame_map()->framesize();
 367 }
 368 
 369 
 370 int Compilation::compile_java_method() {
 371   assert(!method()->is_native(), "should not reach here");
 372 
 373   if (BailoutOnExceptionHandlers) {
 374     if (method()->has_exception_handlers()) {
 375       bailout("linear scan can't handle exception handlers");
 376     }
 377   }
 378 
 379   CHECK_BAILOUT_(no_frame_size);
 380 
 381   if (is_profiling() && !method()->ensure_method_data()) {
 382     BAILOUT_("mdo allocation failed", no_frame_size);
 383   }
 384 




 385   {
 386     PhaseTraceTime timeit(_t_buildIR);
 387     build_hir();
 388   }
 389   if (BailoutAfterHIR) {
 390     BAILOUT_("Bailing out because of -XX:+BailoutAfterHIR", no_frame_size);
 391   }
 392 
 393 
 394   {
 395     PhaseTraceTime timeit(_t_emit_lir);
 396 
 397     _frame_map = new FrameMap(method(), hir()->number_of_locks(), MAX2(4, hir()->max_stack()));
 398     emit_lir();
 399   }
 400   CHECK_BAILOUT_(no_frame_size);
 401 
 402   {
 403     PhaseTraceTime timeit(_t_codeemit);
 404     return emit_code_body();
 405   }
 406 }
 407 
 408 void Compilation::install_code(int frame_size) {
 409   // frame_size is in 32-bit words so adjust it intptr_t words
 410   assert(frame_size == frame_map()->framesize(), "must match");
 411   assert(in_bytes(frame_map()->framesize_in_bytes()) % sizeof(intptr_t) == 0, "must be at least pointer aligned");
 412   _env->register_method(
 413     method(),
 414     osr_bci(),
 415     &_offsets,
 416     in_bytes(_frame_map->sp_offset_for_orig_pc()),
 417     code(),
 418     in_bytes(frame_map()->framesize_in_bytes()) / sizeof(intptr_t),
 419     debug_info_recorder()->_oopmaps,
 420     exception_handler_table(),
 421     implicit_exception_table(),
 422     compiler(),
 423     has_unsafe_access(),
 424     SharedRuntime::is_wide_vector(max_vector_size())


 425   );
 426 }
 427 
 428 
 429 void Compilation::compile_method() {
 430   {
 431     PhaseTraceTime timeit(_t_setup);
 432 
 433     // setup compilation
 434     initialize();
 435   }
 436 
 437   if (!method()->can_be_compiled()) {
 438     // Prevent race condition 6328518.
 439     // This can happen if the method is obsolete or breakpointed.
 440     bailout("Bailing out because method is not compilable");
 441     return;
 442   }
 443 
 444   if (_env->jvmti_can_hotswap_or_post_breakpoint()) {


 541 Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* method,
 542                          int osr_bci, BufferBlob* buffer_blob, DirectiveSet* directive)
 543 : _next_id(0)
 544 , _next_block_id(0)
 545 , _compiler(compiler)
 546 , _directive(directive)
 547 , _env(env)
 548 , _log(env->log())
 549 , _method(method)
 550 , _osr_bci(osr_bci)
 551 , _hir(NULL)
 552 , _max_spills(-1)
 553 , _frame_map(NULL)
 554 , _masm(NULL)
 555 , _has_exception_handlers(false)
 556 , _has_fpu_code(true)   // pessimistic assumption
 557 , _has_unsafe_access(false)
 558 , _would_profile(false)
 559 , _has_method_handle_invokes(false)
 560 , _has_reserved_stack_access(method->has_reserved_stack_access())

 561 , _bailout_msg(NULL)
 562 , _exception_info_list(NULL)
 563 , _allocator(NULL)
 564 , _code(buffer_blob)
 565 , _has_access_indexed(false)
 566 , _interpreter_frame_size(0)

 567 , _current_instruction(NULL)
 568 #ifndef PRODUCT
 569 , _last_instruction_printed(NULL)
 570 , _cfg_printer_output(NULL)
 571 #endif // PRODUCT
 572 {
 573   PhaseTraceTime timeit(_t_compile);
 574   _arena = Thread::current()->resource_area();
 575   _env->set_compiler_data(this);
 576   _exception_info_list = new ExceptionInfoList();
 577   _implicit_exception_table.set_size(0);
 578 #ifndef PRODUCT
 579   if (PrintCFGToFile) {
 580     _cfg_printer_output = new CFGPrinterOutput(this);
 581   }
 582 #endif
 583   compile_method();
 584   if (bailed_out()) {
 585     _env->record_method_not_compilable(bailout_msg(), !TieredCompilation);
 586     if (is_profiling()) {




 346 
 347   _masm = new C1_MacroAssembler(code());
 348   _masm->set_oop_recorder(env()->oop_recorder());
 349 
 350   LIR_Assembler lir_asm(this);
 351 
 352   lir_asm.emit_code(hir()->code());
 353   CHECK_BAILOUT_(0);
 354 
 355   emit_code_epilog(&lir_asm);
 356   CHECK_BAILOUT_(0);
 357 
 358   generate_exception_handler_table();
 359 
 360 #ifndef PRODUCT
 361   if (PrintExceptionHandlers && Verbose) {
 362     exception_handler_table()->print();
 363   }
 364 #endif /* PRODUCT */
 365 
 366   _immediate_oops_patched = lir_asm.nr_immediate_oops_patched();
 367   return frame_map()->framesize();
 368 }
 369 
 370 
 371 int Compilation::compile_java_method() {
 372   assert(!method()->is_native(), "should not reach here");
 373 
 374   if (BailoutOnExceptionHandlers) {
 375     if (method()->has_exception_handlers()) {
 376       bailout("linear scan can't handle exception handlers");
 377     }
 378   }
 379 
 380   CHECK_BAILOUT_(no_frame_size);
 381 
 382   if (is_profiling() && !method()->ensure_method_data()) {
 383     BAILOUT_("mdo allocation failed", no_frame_size);
 384   }
 385 
 386   if (method()->is_synchronized()) {
 387     set_has_monitors(true);
 388   }
 389 
 390   {
 391     PhaseTraceTime timeit(_t_buildIR);
 392     build_hir();
 393   }
 394   if (BailoutAfterHIR) {
 395     BAILOUT_("Bailing out because of -XX:+BailoutAfterHIR", no_frame_size);
 396   }
 397 
 398 
 399   {
 400     PhaseTraceTime timeit(_t_emit_lir);
 401 
 402     _frame_map = new FrameMap(method(), hir()->number_of_locks(), MAX2(4, hir()->max_stack()));
 403     emit_lir();
 404   }
 405   CHECK_BAILOUT_(no_frame_size);
 406 
 407   {
 408     PhaseTraceTime timeit(_t_codeemit);
 409     return emit_code_body();
 410   }
 411 }
 412 
 413 void Compilation::install_code(int frame_size) {
 414   // frame_size is in 32-bit words so adjust it intptr_t words
 415   assert(frame_size == frame_map()->framesize(), "must match");
 416   assert(in_bytes(frame_map()->framesize_in_bytes()) % sizeof(intptr_t) == 0, "must be at least pointer aligned");
 417   _env->register_method(
 418     method(),
 419     osr_bci(),
 420     &_offsets,
 421     in_bytes(_frame_map->sp_offset_for_orig_pc()),
 422     code(),
 423     in_bytes(frame_map()->framesize_in_bytes()) / sizeof(intptr_t),
 424     debug_info_recorder()->_oopmaps,
 425     exception_handler_table(),
 426     implicit_exception_table(),
 427     compiler(),
 428     has_unsafe_access(),
 429     SharedRuntime::is_wide_vector(max_vector_size()),
 430     has_monitors(),
 431     _immediate_oops_patched
 432   );
 433 }
 434 
 435 
 436 void Compilation::compile_method() {
 437   {
 438     PhaseTraceTime timeit(_t_setup);
 439 
 440     // setup compilation
 441     initialize();
 442   }
 443 
 444   if (!method()->can_be_compiled()) {
 445     // Prevent race condition 6328518.
 446     // This can happen if the method is obsolete or breakpointed.
 447     bailout("Bailing out because method is not compilable");
 448     return;
 449   }
 450 
 451   if (_env->jvmti_can_hotswap_or_post_breakpoint()) {


 548 Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* method,
 549                          int osr_bci, BufferBlob* buffer_blob, DirectiveSet* directive)
 550 : _next_id(0)
 551 , _next_block_id(0)
 552 , _compiler(compiler)
 553 , _directive(directive)
 554 , _env(env)
 555 , _log(env->log())
 556 , _method(method)
 557 , _osr_bci(osr_bci)
 558 , _hir(NULL)
 559 , _max_spills(-1)
 560 , _frame_map(NULL)
 561 , _masm(NULL)
 562 , _has_exception_handlers(false)
 563 , _has_fpu_code(true)   // pessimistic assumption
 564 , _has_unsafe_access(false)
 565 , _would_profile(false)
 566 , _has_method_handle_invokes(false)
 567 , _has_reserved_stack_access(method->has_reserved_stack_access())
 568 , _has_monitors(false)
 569 , _bailout_msg(NULL)
 570 , _exception_info_list(NULL)
 571 , _allocator(NULL)
 572 , _code(buffer_blob)
 573 , _has_access_indexed(false)
 574 , _interpreter_frame_size(0)
 575 , _immediate_oops_patched(0)
 576 , _current_instruction(NULL)
 577 #ifndef PRODUCT
 578 , _last_instruction_printed(NULL)
 579 , _cfg_printer_output(NULL)
 580 #endif // PRODUCT
 581 {
 582   PhaseTraceTime timeit(_t_compile);
 583   _arena = Thread::current()->resource_area();
 584   _env->set_compiler_data(this);
 585   _exception_info_list = new ExceptionInfoList();
 586   _implicit_exception_table.set_size(0);
 587 #ifndef PRODUCT
 588   if (PrintCFGToFile) {
 589     _cfg_printer_output = new CFGPrinterOutput(this);
 590   }
 591 #endif
 592   compile_method();
 593   if (bailed_out()) {
 594     _env->record_method_not_compilable(bailout_msg(), !TieredCompilation);
 595     if (is_profiling()) {


< prev index next >