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