< 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, bool install_code, 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 , _install_code(install_code)
562 , _bailout_msg(NULL)
563 , _exception_info_list(NULL)
564 , _allocator(NULL)
565 , _code(buffer_blob)
566 , _has_access_indexed(false)
567 , _interpreter_frame_size(0)

568 , _current_instruction(NULL)
569 #ifndef PRODUCT
570 , _last_instruction_printed(NULL)
571 , _cfg_printer_output(NULL)
572 #endif // PRODUCT
573 {
574   PhaseTraceTime timeit(_t_compile);
575   _arena = Thread::current()->resource_area();
576   _env->set_compiler_data(this);
577   _exception_info_list = new ExceptionInfoList();
578   _implicit_exception_table.set_size(0);
579 #ifndef PRODUCT
580   if (PrintCFGToFile) {
581     _cfg_printer_output = new CFGPrinterOutput(this);
582   }
583 #endif
584   compile_method();
585   if (bailed_out()) {
586     _env->record_method_not_compilable(bailout_msg());
587     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, bool install_code, 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 , _install_code(install_code)
570 , _bailout_msg(NULL)
571 , _exception_info_list(NULL)
572 , _allocator(NULL)
573 , _code(buffer_blob)
574 , _has_access_indexed(false)
575 , _interpreter_frame_size(0)
576 , _immediate_oops_patched(0)
577 , _current_instruction(NULL)
578 #ifndef PRODUCT
579 , _last_instruction_printed(NULL)
580 , _cfg_printer_output(NULL)
581 #endif // PRODUCT
582 {
583   PhaseTraceTime timeit(_t_compile);
584   _arena = Thread::current()->resource_area();
585   _env->set_compiler_data(this);
586   _exception_info_list = new ExceptionInfoList();
587   _implicit_exception_table.set_size(0);
588 #ifndef PRODUCT
589   if (PrintCFGToFile) {
590     _cfg_printer_output = new CFGPrinterOutput(this);
591   }
592 #endif
593   compile_method();
594   if (bailed_out()) {
595     _env->record_method_not_compilable(bailout_msg());
596     if (is_profiling()) {
< prev index next >