< 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   // Dump compilation data to replay it.
403   if (_directive->DumpReplayOption) {
404     env()->dump_replay_data(env()->compile_id());

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   );
431 }
432 
433 
434 void Compilation::compile_method() {
435   {
436     PhaseTraceTime timeit(_t_setup);
437 
438     // setup compilation
439     initialize();
440   }
441 
442   if (!method()->can_be_compiled()) {
443     // Prevent race condition 6328518.
444     // This can happen if the method is obsolete or breakpointed.
445     bailout("Bailing out because method is not compilable");
446     return;
447   }
448 
449   if (_env->jvmti_can_hotswap_or_post_breakpoint()) {

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

566 , _install_code(install_code)
567 , _bailout_msg(NULL)
568 , _exception_info_list(NULL)
569 , _allocator(NULL)
570 , _code(buffer_blob)
571 , _has_access_indexed(false)
572 , _interpreter_frame_size(0)

573 , _current_instruction(NULL)
574 #ifndef PRODUCT
575 , _last_instruction_printed(NULL)
576 , _cfg_printer_output(NULL)
577 #endif // PRODUCT
578 {
579   PhaseTraceTime timeit(_t_compile);
580   _arena = Thread::current()->resource_area();
581   _env->set_compiler_data(this);
582   _exception_info_list = new ExceptionInfoList();
583   _implicit_exception_table.set_size(0);
584 #ifndef PRODUCT
585   if (PrintCFGToFile) {
586     _cfg_printer_output = new CFGPrinterOutput(this);
587   }
588 #endif
589   compile_method();
590   if (bailed_out()) {
591     _env->record_method_not_compilable(bailout_msg());
592     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   // Dump compilation data to replay it.
408   if (_directive->DumpReplayOption) {
409     env()->dump_replay_data(env()->compile_id());

414     return emit_code_body();
415   }
416 }
417 
418 void Compilation::install_code(int frame_size) {
419   // frame_size is in 32-bit words so adjust it intptr_t words
420   assert(frame_size == frame_map()->framesize(), "must match");
421   assert(in_bytes(frame_map()->framesize_in_bytes()) % sizeof(intptr_t) == 0, "must be at least pointer aligned");
422   _env->register_method(
423     method(),
424     osr_bci(),
425     &_offsets,
426     in_bytes(_frame_map->sp_offset_for_orig_pc()),
427     code(),
428     in_bytes(frame_map()->framesize_in_bytes()) / sizeof(intptr_t),
429     debug_info_recorder()->_oopmaps,
430     exception_handler_table(),
431     implicit_exception_table(),
432     compiler(),
433     has_unsafe_access(),
434     SharedRuntime::is_wide_vector(max_vector_size()),
435     has_monitors(),
436     _immediate_oops_patched
437   );
438 }
439 
440 
441 void Compilation::compile_method() {
442   {
443     PhaseTraceTime timeit(_t_setup);
444 
445     // setup compilation
446     initialize();
447   }
448 
449   if (!method()->can_be_compiled()) {
450     // Prevent race condition 6328518.
451     // This can happen if the method is obsolete or breakpointed.
452     bailout("Bailing out because method is not compilable");
453     return;
454   }
455 
456   if (_env->jvmti_can_hotswap_or_post_breakpoint()) {

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