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