comparison src/share/vm/code/nmethod.cpp @ 9922:7bd4a69b4ce1

Added #ifdefs to nmethod statistics.
author Christian Haeubl <haeubl@ssw.jku.at>
date Tue, 21 May 2013 11:36:13 +0200
parents cf0e31151830
children 07e76b6fcc38
comparison
equal deleted inserted replaced
9921:26785bb7006d 9922:7bd4a69b4ce1
122 // NMethod statistics 122 // NMethod statistics
123 // They are printed under various flags, including: 123 // They are printed under various flags, including:
124 // PrintC1Statistics, PrintOptoStatistics, LogVMOutput, and LogCompilation. 124 // PrintC1Statistics, PrintOptoStatistics, LogVMOutput, and LogCompilation.
125 // (In the latter two cases, they like other stats are printed to the log only.) 125 // (In the latter two cases, they like other stats are printed to the log only.)
126 126
127 #if !defined(PRODUCT) || defined(GRAAL)
128 #define NOT_PRODUCT_OR_GRAAL(code) code
129
127 // These variables are put into one block to reduce relocations 130 // These variables are put into one block to reduce relocations
128 // and make it simpler to print from the debugger. 131 // and make it simpler to print from the debugger.
129 static 132 static
130 struct nmethod_stats_struct { 133 struct nmethod_stats_struct {
131 int nmethod_count; 134 int nmethod_count;
211 pc_desc_queries, pc_desc_approx, 214 pc_desc_queries, pc_desc_approx,
212 pc_desc_repeats, pc_desc_hits, 215 pc_desc_repeats, pc_desc_hits,
213 pc_desc_tests, pc_desc_searches, pc_desc_adds); 216 pc_desc_tests, pc_desc_searches, pc_desc_adds);
214 } 217 }
215 } nmethod_stats; 218 } nmethod_stats;
216 219 #else // !PRODUCT || GRAAL
220 #define NOT_PRODUCT_OR_GRAAL(code)
221 #endif // !PRODUCT || GRAAL
217 222
218 //--------------------------------------------------------------------------------- 223 //---------------------------------------------------------------------------------
219 224
220 225
221 ExceptionCache::ExceptionCache(Handle exception, address pc, address handler) { 226 ExceptionCache::ExceptionCache(Handle exception, address pc, address handler) {
517 nm = new (native_nmethod_size) nmethod(method(), native_nmethod_size, 522 nm = new (native_nmethod_size) nmethod(method(), native_nmethod_size,
518 compile_id, &offsets, 523 compile_id, &offsets,
519 code_buffer, frame_size, 524 code_buffer, frame_size,
520 basic_lock_owner_sp_offset, 525 basic_lock_owner_sp_offset,
521 basic_lock_sp_offset, oop_maps); 526 basic_lock_sp_offset, oop_maps);
522 if (nm != NULL) nmethod_stats.note_native_nmethod(nm); 527 NOT_PRODUCT_OR_GRAAL(if (nm != NULL) nmethod_stats.note_native_nmethod(nm));
523 if (PrintAssembly && nm != NULL) 528 if (PrintAssembly && nm != NULL)
524 Disassembler::decode(nm); 529 Disassembler::decode(nm);
525 } 530 }
526 } 531 }
527 // verify nmethod 532 // verify nmethod
554 offsets.set_value(CodeOffsets::Frame_Complete, frame_complete); 559 offsets.set_value(CodeOffsets::Frame_Complete, frame_complete);
555 560
556 nm = new (nmethod_size) nmethod(method(), nmethod_size, 561 nm = new (nmethod_size) nmethod(method(), nmethod_size,
557 &offsets, code_buffer, frame_size); 562 &offsets, code_buffer, frame_size);
558 563
559 if (nm != NULL) nmethod_stats.note_nmethod(nm); 564 NOT_PRODUCT_OR_GRAAL(if (nm != NULL) nmethod_stats.note_nmethod(nm));
560 if (PrintAssembly && nm != NULL) 565 if (PrintAssembly && nm != NULL)
561 Disassembler::decode(nm); 566 Disassembler::decode(nm);
562 } 567 }
563 } 568 }
564 // verify nmethod 569 // verify nmethod
638 643
639 // record this nmethod as dependent on this klass 644 // record this nmethod as dependent on this klass
640 InstanceKlass::cast(klass)->add_dependent_nmethod(nm); 645 InstanceKlass::cast(klass)->add_dependent_nmethod(nm);
641 } 646 }
642 } 647 }
643 if (nm != NULL) nmethod_stats.note_nmethod(nm); 648 NOT_PRODUCT_OR_GRAAL(if (nm != NULL) nmethod_stats.note_nmethod(nm));
644 if (PrintAssembly && nm != NULL) 649 if (PrintAssembly && nm != NULL)
645 Disassembler::decode(nm); 650 Disassembler::decode(nm);
646 } 651 }
647 652
648 // verify nmethod 653 // verify nmethod
3017 } 3022 }
3018 3023
3019 #endif // PRODUCT 3024 #endif // PRODUCT
3020 3025
3021 void nmethod::print_statistics() { 3026 void nmethod::print_statistics() {
3027 #if !defined(PRODUCT) || defined(GRAAL)
3022 ttyLocker ttyl; 3028 ttyLocker ttyl;
3023 if (xtty != NULL) xtty->head("statistics type='nmethod'"); 3029 if (xtty != NULL) xtty->head("statistics type='nmethod'");
3024 nmethod_stats.print_native_nmethod_stats(); 3030 nmethod_stats.print_native_nmethod_stats();
3025 nmethod_stats.print_nmethod_stats(); 3031 nmethod_stats.print_nmethod_stats();
3026 DebugInformationRecorder::print_statistics(); 3032 DebugInformationRecorder::print_statistics();
3027 nmethod_stats.print_pc_stats(); 3033 nmethod_stats.print_pc_stats();
3028 Dependencies::print_statistics(); 3034 Dependencies::print_statistics();
3029 if (xtty != NULL) xtty->tail("statistics"); 3035 if (xtty != NULL) xtty->tail("statistics");
3030 } 3036 #endif
3037 }
3038
3039 #undef NOT_PRODUCT_OR_GRAAL