417 PhaseTraceTime timeit(_t_codeemit);
418 return emit_code_body();
419 }
420 }
421
422 void Compilation::install_code(int frame_size) {
423 // frame_size is in 32-bit words so adjust it intptr_t words
424 assert(frame_size == frame_map()->framesize(), "must match");
425 assert(in_bytes(frame_map()->framesize_in_bytes()) % sizeof(intptr_t) == 0, "must be at least pointer aligned");
426 _env->register_method(
427 method(),
428 osr_bci(),
429 &_offsets,
430 in_bytes(_frame_map->sp_offset_for_orig_pc()),
431 code(),
432 in_bytes(frame_map()->framesize_in_bytes()) / sizeof(intptr_t),
433 debug_info_recorder()->_oopmaps,
434 exception_handler_table(),
435 implicit_exception_table(),
436 compiler(),
437 has_unsafe_access(),
438 SharedRuntime::is_wide_vector(max_vector_size()),
439 has_monitors(),
440 _immediate_oops_patched
441 );
442 }
443
444
445 void Compilation::compile_method() {
446
447 {
448 PhaseTraceTime timeit(_t_setup);
449
450 // setup compilation
451 initialize();
452 CHECK_BAILOUT();
453
454 }
455
456 if (!method()->can_be_compiled()) {
457 // Prevent race condition 6328518.
458 // This can happen if the method is obsolete or breakpointed.
459 bailout("Bailing out because method is not compilable");
460 return;
465 dependency_recorder()->assert_evol_method(method());
466 }
467
468 if (env()->break_at_compile()) {
469 BREAKPOINT;
470 }
471
472 #ifndef PRODUCT
473 if (PrintCFGToFile) {
474 CFGPrinter::print_compilation(this);
475 }
476 #endif
477
478 // compile method
479 int frame_size = compile_java_method();
480
481 // bailout if method couldn't be compiled
482 // Note: make sure we mark the method as not compilable!
483 CHECK_BAILOUT();
484
485 if (should_install_code()) {
486 // install code
487 PhaseTraceTime timeit(_t_codeinstall);
488 install_code(frame_size);
489 }
490
491 if (log() != nullptr) // Print code cache state into compiler log
492 log()->code_cache_state();
493
494 }
495
496
497 void Compilation::generate_exception_handler_table() {
498 // Generate an ExceptionHandlerTable from the exception handler
499 // information accumulated during the compilation.
500 ExceptionInfoList* info_list = exception_info_list();
501
502 if (info_list->length() == 0) {
503 return;
504 }
505
506 // allocate some arrays for use by the collection code.
|
417 PhaseTraceTime timeit(_t_codeemit);
418 return emit_code_body();
419 }
420 }
421
422 void Compilation::install_code(int frame_size) {
423 // frame_size is in 32-bit words so adjust it intptr_t words
424 assert(frame_size == frame_map()->framesize(), "must match");
425 assert(in_bytes(frame_map()->framesize_in_bytes()) % sizeof(intptr_t) == 0, "must be at least pointer aligned");
426 _env->register_method(
427 method(),
428 osr_bci(),
429 &_offsets,
430 in_bytes(_frame_map->sp_offset_for_orig_pc()),
431 code(),
432 in_bytes(frame_map()->framesize_in_bytes()) / sizeof(intptr_t),
433 debug_info_recorder()->_oopmaps,
434 exception_handler_table(),
435 implicit_exception_table(),
436 compiler(),
437 false, // has_clinit_barriers
438 false, // for_preload
439 has_unsafe_access(),
440 SharedRuntime::is_wide_vector(max_vector_size()),
441 has_monitors(),
442 _immediate_oops_patched,
443 should_install_code()
444 );
445 }
446
447
448 void Compilation::compile_method() {
449
450 {
451 PhaseTraceTime timeit(_t_setup);
452
453 // setup compilation
454 initialize();
455 CHECK_BAILOUT();
456
457 }
458
459 if (!method()->can_be_compiled()) {
460 // Prevent race condition 6328518.
461 // This can happen if the method is obsolete or breakpointed.
462 bailout("Bailing out because method is not compilable");
463 return;
468 dependency_recorder()->assert_evol_method(method());
469 }
470
471 if (env()->break_at_compile()) {
472 BREAKPOINT;
473 }
474
475 #ifndef PRODUCT
476 if (PrintCFGToFile) {
477 CFGPrinter::print_compilation(this);
478 }
479 #endif
480
481 // compile method
482 int frame_size = compile_java_method();
483
484 // bailout if method couldn't be compiled
485 // Note: make sure we mark the method as not compilable!
486 CHECK_BAILOUT();
487
488 { // install code
489 PhaseTraceTime timeit(_t_codeinstall);
490 install_code(frame_size);
491 }
492
493 if (log() != nullptr) // Print code cache state into compiler log
494 log()->code_cache_state();
495
496 }
497
498
499 void Compilation::generate_exception_handler_table() {
500 // Generate an ExceptionHandlerTable from the exception handler
501 // information accumulated during the compilation.
502 ExceptionInfoList* info_list = exception_info_list();
503
504 if (info_list->length() == 0) {
505 return;
506 }
507
508 // allocate some arrays for use by the collection code.
|