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 has_scoped_access(),
432 _immediate_oops_patched
433 );
434 }
435
436
437 void Compilation::compile_method() {
438
439 {
440 PhaseTraceTime timeit(_t_setup);
441
442 // setup compilation
443 initialize();
444 CHECK_BAILOUT();
445
446 }
447
448 if (!method()->can_be_compiled()) {
449 // Prevent race condition 6328518.
450 // This can happen if the method is obsolete or breakpointed.
451 bailout("Bailing out because method is not compilable");
452 return;
457 dependency_recorder()->assert_evol_method(method());
458 }
459
460 if (env()->break_at_compile()) {
461 BREAKPOINT;
462 }
463
464 #ifndef PRODUCT
465 if (PrintCFGToFile) {
466 CFGPrinter::print_compilation(this);
467 }
468 #endif
469
470 // compile method
471 int frame_size = compile_java_method();
472
473 // bailout if method couldn't be compiled
474 // Note: make sure we mark the method as not compilable!
475 CHECK_BAILOUT();
476
477 if (should_install_code()) {
478 // install code
479 PhaseTraceTime timeit(_t_codeinstall);
480 install_code(frame_size);
481 }
482
483 if (log() != nullptr) // Print code cache state into compiler log
484 log()->code_cache_state();
485
486 }
487
488
489 void Compilation::generate_exception_handler_table() {
490 // Generate an ExceptionHandlerTable from the exception handler
491 // information accumulated during the compilation.
492 ExceptionInfoList* info_list = exception_info_list();
493
494 if (info_list->length() == 0) {
495 return;
496 }
497
498 // allocate some arrays for use by the collection code.
|
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 false, // has_clinit_barriers
429 false, // for_preload
430 has_unsafe_access(),
431 SharedRuntime::is_wide_vector(max_vector_size()),
432 has_monitors(),
433 has_scoped_access(),
434 _immediate_oops_patched,
435 should_install_code()
436 );
437 }
438
439
440 void Compilation::compile_method() {
441
442 {
443 PhaseTraceTime timeit(_t_setup);
444
445 // setup compilation
446 initialize();
447 CHECK_BAILOUT();
448
449 }
450
451 if (!method()->can_be_compiled()) {
452 // Prevent race condition 6328518.
453 // This can happen if the method is obsolete or breakpointed.
454 bailout("Bailing out because method is not compilable");
455 return;
460 dependency_recorder()->assert_evol_method(method());
461 }
462
463 if (env()->break_at_compile()) {
464 BREAKPOINT;
465 }
466
467 #ifndef PRODUCT
468 if (PrintCFGToFile) {
469 CFGPrinter::print_compilation(this);
470 }
471 #endif
472
473 // compile method
474 int frame_size = compile_java_method();
475
476 // bailout if method couldn't be compiled
477 // Note: make sure we mark the method as not compilable!
478 CHECK_BAILOUT();
479
480 { // install code
481 PhaseTraceTime timeit(_t_codeinstall);
482 install_code(frame_size);
483 }
484
485 if (log() != nullptr) // Print code cache state into compiler log
486 log()->code_cache_state();
487
488 }
489
490
491 void Compilation::generate_exception_handler_table() {
492 // Generate an ExceptionHandlerTable from the exception handler
493 // information accumulated during the compilation.
494 ExceptionInfoList* info_list = exception_info_list();
495
496 if (info_list->length() == 0) {
497 return;
498 }
499
500 // allocate some arrays for use by the collection code.
|