comparison src/share/vm/code/nmethod.cpp @ 14733:b10e42998d01

nmethod: fix -XX:+PrintNMethodStatistics
author Bernhard Urban <bernhard.urban@jku.at>
date Tue, 25 Mar 2014 16:38:01 +0100
parents 92aa6797d639
children 4ca6dc0799b6
comparison
equal deleted inserted replaced
14732:56621a6eed29 14733:b10e42998d01
103 // NMethod statistics 103 // NMethod statistics
104 // They are printed under various flags, including: 104 // They are printed under various flags, including:
105 // PrintC1Statistics, PrintOptoStatistics, LogVMOutput, and LogCompilation. 105 // PrintC1Statistics, PrintOptoStatistics, LogVMOutput, and LogCompilation.
106 // (In the latter two cases, they like other stats are printed to the log only.) 106 // (In the latter two cases, they like other stats are printed to the log only.)
107 107
108 #ifndef PRODUCT
109 // These variables are put into one block to reduce relocations 108 // These variables are put into one block to reduce relocations
110 // and make it simpler to print from the debugger. 109 // and make it simpler to print from the debugger.
111 struct java_nmethod_stats_struct { 110 struct java_nmethod_stats_struct {
112 int nmethod_count; 111 int nmethod_count;
113 int total_size; 112 int total_size;
231 #endif 230 #endif
232 { 231 {
233 unknown_java_nmethod_stats.note_nmethod(nm); 232 unknown_java_nmethod_stats.note_nmethod(nm);
234 } 233 }
235 } 234 }
236 #endif
237 235
238 //--------------------------------------------------------------------------------- 236 //---------------------------------------------------------------------------------
239 237
240 238
241 ExceptionCache::ExceptionCache(Handle exception, address pc, address handler) { 239 ExceptionCache::ExceptionCache(Handle exception, address pc, address handler) {
534 nm = new (native_nmethod_size) nmethod(method(), native_nmethod_size, 532 nm = new (native_nmethod_size) nmethod(method(), native_nmethod_size,
535 compile_id, &offsets, 533 compile_id, &offsets,
536 code_buffer, frame_size, 534 code_buffer, frame_size,
537 basic_lock_owner_sp_offset, 535 basic_lock_owner_sp_offset,
538 basic_lock_sp_offset, oop_maps); 536 basic_lock_sp_offset, oop_maps);
539 NOT_PRODUCT(if (nm != NULL) note_java_nmethod(nm)); 537 if (nm != NULL) note_java_nmethod(nm);
540 if (PrintAssembly && nm != NULL) { 538 if (PrintAssembly && nm != NULL) {
541 Disassembler::decode(nm); 539 Disassembler::decode(nm);
542 } 540 }
543 } 541 }
544 // verify nmethod 542 // verify nmethod
570 offsets.set_value(CodeOffsets::Frame_Complete, frame_complete); 568 offsets.set_value(CodeOffsets::Frame_Complete, frame_complete);
571 569
572 nm = new (nmethod_size) nmethod(method(), nmethod_size, 570 nm = new (nmethod_size) nmethod(method(), nmethod_size,
573 &offsets, code_buffer, frame_size); 571 &offsets, code_buffer, frame_size);
574 572
575 NOT_PRODUCT(if (nm != NULL) note_java_nmethod(nm)); 573 if (nm != NULL) note_java_nmethod(nm);
576 if (PrintAssembly && nm != NULL) { 574 if (PrintAssembly && nm != NULL) {
577 Disassembler::decode(nm); 575 Disassembler::decode(nm);
578 } 576 }
579 } 577 }
580 // verify nmethod 578 // verify nmethod
650 } 648 }
651 649
652 // record this nmethod as dependent on this klass 650 // record this nmethod as dependent on this klass
653 InstanceKlass::cast(klass)->add_dependent_nmethod(nm); 651 InstanceKlass::cast(klass)->add_dependent_nmethod(nm);
654 } 652 }
655 NOT_PRODUCT(if (nm != NULL) note_java_nmethod(nm)); 653 if (nm != NULL) note_java_nmethod(nm);
656 if (PrintAssembly || CompilerOracle::has_option_string(method, "PrintAssembly")) { 654 if (PrintAssembly || CompilerOracle::has_option_string(method, "PrintAssembly")) {
657 Disassembler::decode(nm); 655 Disassembler::decode(nm);
658 } 656 }
659 } 657 }
660 } 658 }
3056 } 3054 }
3057 3055
3058 void nmethod::print_nul_chk_table() { 3056 void nmethod::print_nul_chk_table() {
3059 ImplicitExceptionTable(this).print(code_begin()); 3057 ImplicitExceptionTable(this).print(code_begin());
3060 } 3058 }
3059 #endif // PRODUCT
3061 3060
3062 void nmethod::print_statistics() { 3061 void nmethod::print_statistics() {
3063 ttyLocker ttyl; 3062 ttyLocker ttyl;
3064 if (xtty != NULL) xtty->head("statistics type='nmethod'"); 3063 if (xtty != NULL) xtty->head("statistics type='nmethod'");
3065 native_nmethod_stats.print_native_nmethod_stats(); 3064 native_nmethod_stats.print_native_nmethod_stats();
3076 DebugInformationRecorder::print_statistics(); 3075 DebugInformationRecorder::print_statistics();
3077 pc_nmethod_stats.print_pc_stats(); 3076 pc_nmethod_stats.print_pc_stats();
3078 Dependencies::print_statistics(); 3077 Dependencies::print_statistics();
3079 if (xtty != NULL) xtty->tail("statistics"); 3078 if (xtty != NULL) xtty->tail("statistics");
3080 } 3079 }
3081 #endif // PRODUCT