changeset 9922:7bd4a69b4ce1

Added #ifdefs to nmethod statistics.
author Christian Haeubl <haeubl@ssw.jku.at>
date Tue, 21 May 2013 11:36:13 +0200
parents 26785bb7006d
children 89cbd0119dc5
files src/share/vm/code/nmethod.cpp
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/code/nmethod.cpp	Tue May 21 10:34:18 2013 +0200
+++ b/src/share/vm/code/nmethod.cpp	Tue May 21 11:36:13 2013 +0200
@@ -124,6 +124,9 @@
 //   PrintC1Statistics, PrintOptoStatistics, LogVMOutput, and LogCompilation.
 // (In the latter two cases, they like other stats are printed to the log only.)
 
+#if !defined(PRODUCT) || defined(GRAAL)
+#define NOT_PRODUCT_OR_GRAAL(code) code
+
 // These variables are put into one block to reduce relocations
 // and make it simpler to print from the debugger.
 static
@@ -213,7 +216,9 @@
                   pc_desc_tests, pc_desc_searches, pc_desc_adds);
   }
 } nmethod_stats;
-
+#else // !PRODUCT || GRAAL
+#define NOT_PRODUCT_OR_GRAAL(code)
+#endif // !PRODUCT || GRAAL
 
 //---------------------------------------------------------------------------------
 
@@ -519,7 +524,7 @@
                                              code_buffer, frame_size,
                                              basic_lock_owner_sp_offset,
                                              basic_lock_sp_offset, oop_maps);
-      if (nm != NULL)  nmethod_stats.note_native_nmethod(nm);
+      NOT_PRODUCT_OR_GRAAL(if (nm != NULL)  nmethod_stats.note_native_nmethod(nm));
       if (PrintAssembly && nm != NULL)
         Disassembler::decode(nm);
     }
@@ -556,7 +561,7 @@
       nm = new (nmethod_size) nmethod(method(), nmethod_size,
                                       &offsets, code_buffer, frame_size);
 
-      if (nm != NULL)  nmethod_stats.note_nmethod(nm);
+      NOT_PRODUCT_OR_GRAAL(if (nm != NULL)  nmethod_stats.note_nmethod(nm));
       if (PrintAssembly && nm != NULL)
         Disassembler::decode(nm);
     }
@@ -640,7 +645,7 @@
         InstanceKlass::cast(klass)->add_dependent_nmethod(nm);
       }
     }
-    if (nm != NULL)  nmethod_stats.note_nmethod(nm);
+    NOT_PRODUCT_OR_GRAAL(if (nm != NULL)  nmethod_stats.note_nmethod(nm));
     if (PrintAssembly && nm != NULL)
       Disassembler::decode(nm);
   }
@@ -3019,6 +3024,7 @@
 #endif // PRODUCT
 
 void nmethod::print_statistics() {
+#if !defined(PRODUCT) || defined(GRAAL)
   ttyLocker ttyl;
   if (xtty != NULL)  xtty->head("statistics type='nmethod'");
   nmethod_stats.print_native_nmethod_stats();
@@ -3027,4 +3033,7 @@
   nmethod_stats.print_pc_stats();
   Dependencies::print_statistics();
   if (xtty != NULL)  xtty->tail("statistics");
+#endif
 }
+
+#undef NOT_PRODUCT_OR_GRAAL