changeset 42040 | 70ec5a09a0d5 |
parent 41715 | 296ff044b943 |
child 42064 | a530dbabe64f |
42039:db627462f2c9 | 42040:70ec5a09a0d5 |
---|---|
80 |
80 |
81 #define DTRACE_METHOD_UNLOAD_PROBE(method) |
81 #define DTRACE_METHOD_UNLOAD_PROBE(method) |
82 |
82 |
83 #endif |
83 #endif |
84 |
84 |
85 bool nmethod::is_compiled_by_c1() const { |
|
86 if (compiler() == NULL) { |
|
87 return false; |
|
88 } |
|
89 return compiler()->is_c1(); |
|
90 } |
|
91 bool nmethod::is_compiled_by_jvmci() const { |
|
92 if (compiler() == NULL || method() == NULL) return false; // can happen during debug printing |
|
93 if (is_native_method()) return false; |
|
94 return compiler()->is_jvmci(); |
|
95 } |
|
96 bool nmethod::is_compiled_by_c2() const { |
|
97 if (compiler() == NULL) { |
|
98 return false; |
|
99 } |
|
100 return compiler()->is_c2(); |
|
101 } |
|
102 bool nmethod::is_compiled_by_shark() const { |
|
103 if (compiler() == NULL) { |
|
104 return false; |
|
105 } |
|
106 return compiler()->is_shark(); |
|
107 } |
|
108 |
|
109 |
|
110 |
|
111 //--------------------------------------------------------------------------------- |
85 //--------------------------------------------------------------------------------- |
112 // NMethod statistics |
86 // NMethod statistics |
113 // They are printed under various flags, including: |
87 // They are printed under various flags, including: |
114 // PrintC1Statistics, PrintOptoStatistics, LogVMOutput, and LogCompilation. |
88 // PrintC1Statistics, PrintOptoStatistics, LogVMOutput, and LogCompilation. |
115 // (In the latter two cases, they like other stats are printed to the log only.) |
89 // (In the latter two cases, they like other stats are printed to the log only.) |
438 _unloading_next = NULL; |
412 _unloading_next = NULL; |
439 } else { |
413 } else { |
440 _scavenge_root_link = NULL; |
414 _scavenge_root_link = NULL; |
441 } |
415 } |
442 _scavenge_root_state = 0; |
416 _scavenge_root_state = 0; |
443 _compiler = NULL; |
|
444 #if INCLUDE_RTM_OPT |
417 #if INCLUDE_RTM_OPT |
445 _rtm_state = NoRTM; |
418 _rtm_state = NoRTM; |
446 #endif |
419 #endif |
447 #if INCLUDE_JVMCI |
420 #if INCLUDE_JVMCI |
448 _jvmci_installed_code = NULL; |
421 _jvmci_installed_code = NULL; |
466 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); |
439 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); |
467 int native_nmethod_size = CodeBlob::allocation_size(code_buffer, sizeof(nmethod)); |
440 int native_nmethod_size = CodeBlob::allocation_size(code_buffer, sizeof(nmethod)); |
468 CodeOffsets offsets; |
441 CodeOffsets offsets; |
469 offsets.set_value(CodeOffsets::Verified_Entry, vep_offset); |
442 offsets.set_value(CodeOffsets::Verified_Entry, vep_offset); |
470 offsets.set_value(CodeOffsets::Frame_Complete, frame_complete); |
443 offsets.set_value(CodeOffsets::Frame_Complete, frame_complete); |
471 nm = new (native_nmethod_size, CompLevel_none) nmethod(method(), native_nmethod_size, |
444 nm = new (native_nmethod_size, CompLevel_none) nmethod(method(), compiler_none, native_nmethod_size, |
472 compile_id, &offsets, |
445 compile_id, &offsets, |
473 code_buffer, frame_size, |
446 code_buffer, frame_size, |
474 basic_lock_owner_sp_offset, |
447 basic_lock_owner_sp_offset, |
475 basic_lock_sp_offset, oop_maps); |
448 basic_lock_sp_offset, oop_maps); |
476 NOT_PRODUCT(if (nm != NULL) native_nmethod_stats.note_native_nmethod(nm)); |
449 NOT_PRODUCT(if (nm != NULL) native_nmethod_stats.note_native_nmethod(nm)); |
516 + round_to(handler_table->size_in_bytes(), oopSize) |
489 + round_to(handler_table->size_in_bytes(), oopSize) |
517 + round_to(nul_chk_table->size_in_bytes(), oopSize) |
490 + round_to(nul_chk_table->size_in_bytes(), oopSize) |
518 + round_to(debug_info->data_size() , oopSize); |
491 + round_to(debug_info->data_size() , oopSize); |
519 |
492 |
520 nm = new (nmethod_size, comp_level) |
493 nm = new (nmethod_size, comp_level) |
521 nmethod(method(), nmethod_size, compile_id, entry_bci, offsets, |
494 nmethod(method(), compiler->type(), nmethod_size, compile_id, entry_bci, offsets, |
522 orig_pc_offset, debug_info, dependencies, code_buffer, frame_size, |
495 orig_pc_offset, debug_info, dependencies, code_buffer, frame_size, |
523 oop_maps, |
496 oop_maps, |
524 handler_table, |
497 handler_table, |
525 nul_chk_table, |
498 nul_chk_table, |
526 compiler, |
499 compiler, |
567 } |
540 } |
568 |
541 |
569 // For native wrappers |
542 // For native wrappers |
570 nmethod::nmethod( |
543 nmethod::nmethod( |
571 Method* method, |
544 Method* method, |
545 CompilerType type, |
|
572 int nmethod_size, |
546 int nmethod_size, |
573 int compile_id, |
547 int compile_id, |
574 CodeOffsets* offsets, |
548 CodeOffsets* offsets, |
575 CodeBuffer* code_buffer, |
549 CodeBuffer* code_buffer, |
576 int frame_size, |
550 int frame_size, |
577 ByteSize basic_lock_owner_sp_offset, |
551 ByteSize basic_lock_owner_sp_offset, |
578 ByteSize basic_lock_sp_offset, |
552 ByteSize basic_lock_sp_offset, |
579 OopMapSet* oop_maps ) |
553 OopMapSet* oop_maps ) |
580 : CompiledMethod(method, "native nmethod", nmethod_size, sizeof(nmethod), code_buffer, offsets->value(CodeOffsets::Frame_Complete), frame_size, oop_maps, false), |
554 : CompiledMethod(method, "native nmethod", type, nmethod_size, sizeof(nmethod), code_buffer, offsets->value(CodeOffsets::Frame_Complete), frame_size, oop_maps, false), |
581 _native_receiver_sp_offset(basic_lock_owner_sp_offset), |
555 _native_receiver_sp_offset(basic_lock_owner_sp_offset), |
582 _native_basic_lock_sp_offset(basic_lock_sp_offset) |
556 _native_basic_lock_sp_offset(basic_lock_sp_offset) |
583 { |
557 { |
584 { |
558 { |
585 int scopes_data_offset = 0; |
559 int scopes_data_offset = 0; |
664 return CodeCache::allocate(nmethod_size, CodeCache::get_code_blob_type(comp_level)); |
638 return CodeCache::allocate(nmethod_size, CodeCache::get_code_blob_type(comp_level)); |
665 } |
639 } |
666 |
640 |
667 nmethod::nmethod( |
641 nmethod::nmethod( |
668 Method* method, |
642 Method* method, |
643 CompilerType type, |
|
669 int nmethod_size, |
644 int nmethod_size, |
670 int compile_id, |
645 int compile_id, |
671 int entry_bci, |
646 int entry_bci, |
672 CodeOffsets* offsets, |
647 CodeOffsets* offsets, |
673 int orig_pc_offset, |
648 int orig_pc_offset, |
683 #if INCLUDE_JVMCI |
658 #if INCLUDE_JVMCI |
684 , Handle installed_code, |
659 , Handle installed_code, |
685 Handle speculation_log |
660 Handle speculation_log |
686 #endif |
661 #endif |
687 ) |
662 ) |
688 : CompiledMethod(method, "nmethod", nmethod_size, sizeof(nmethod), code_buffer, offsets->value(CodeOffsets::Frame_Complete), frame_size, oop_maps, false), |
663 : CompiledMethod(method, "nmethod", type, nmethod_size, sizeof(nmethod), code_buffer, offsets->value(CodeOffsets::Frame_Complete), frame_size, oop_maps, false), |
689 _native_receiver_sp_offset(in_ByteSize(-1)), |
664 _native_receiver_sp_offset(in_ByteSize(-1)), |
690 _native_basic_lock_sp_offset(in_ByteSize(-1)) |
665 _native_basic_lock_sp_offset(in_ByteSize(-1)) |
691 { |
666 { |
692 assert(debug_info->oop_recorder() == code_buffer->oop_recorder(), "shared OR"); |
667 assert(debug_info->oop_recorder() == code_buffer->oop_recorder(), "shared OR"); |
693 { |
668 { |
699 |
674 |
700 init_defaults(); |
675 init_defaults(); |
701 _entry_bci = entry_bci; |
676 _entry_bci = entry_bci; |
702 _compile_id = compile_id; |
677 _compile_id = compile_id; |
703 _comp_level = comp_level; |
678 _comp_level = comp_level; |
704 _compiler = compiler; |
|
705 _orig_pc_offset = orig_pc_offset; |
679 _orig_pc_offset = orig_pc_offset; |
706 _hotness_counter = NMethodSweeper::hotness_counter_reset_val(); |
680 _hotness_counter = NMethodSweeper::hotness_counter_reset_val(); |
707 |
681 |
708 // Section offsets |
682 // Section offsets |
709 _consts_offset = content_offset() + code_buffer->total_offset_of(code_buffer->consts()); |
683 _consts_offset = content_offset() + code_buffer->total_offset_of(code_buffer->consts()); |
801 // output should be embedded in some other element. |
775 // output should be embedded in some other element. |
802 void nmethod::log_identity(xmlStream* log) const { |
776 void nmethod::log_identity(xmlStream* log) const { |
803 log->print(" compile_id='%d'", compile_id()); |
777 log->print(" compile_id='%d'", compile_id()); |
804 const char* nm_kind = compile_kind(); |
778 const char* nm_kind = compile_kind(); |
805 if (nm_kind != NULL) log->print(" compile_kind='%s'", nm_kind); |
779 if (nm_kind != NULL) log->print(" compile_kind='%s'", nm_kind); |
806 if (compiler() != NULL) { |
780 log->print(" compiler='%s'", compiler_name()); |
807 log->print(" compiler='%s'", compiler()->name()); |
|
808 } |
|
809 if (TieredCompilation) { |
781 if (TieredCompilation) { |
810 log->print(" level='%d'", comp_level()); |
782 log->print(" level='%d'", comp_level()); |
811 } |
783 } |
812 } |
784 } |
813 |
785 |