diff src/share/vm/ci/ciReplay.cpp @ 10105:aeaca88565e6

8010862: The Method counter fields used for profiling can be allocated lazily. Summary: Allocate the method's profiling related metadata until they are needed. Reviewed-by: coleenp, roland
author jiangli
date Tue, 09 Apr 2013 17:17:41 -0400
parents 8391fdd36e1f
children e12c9b3740db
line wrap: on
line diff
--- a/src/share/vm/ci/ciReplay.cpp	Thu Apr 04 21:15:43 2013 -0700
+++ b/src/share/vm/ci/ciReplay.cpp	Tue Apr 09 17:17:41 2013 -0400
@@ -920,12 +920,17 @@
     method->print_name(tty);
     tty->cr();
   } else {
+    EXCEPTION_CONTEXT;
+    MethodCounters* mcs = method->method_counters();
     // m->_instructions_size = rec->instructions_size;
     m->_instructions_size = -1;
     m->_interpreter_invocation_count = rec->interpreter_invocation_count;
     m->_interpreter_throwout_count = rec->interpreter_throwout_count;
-    method->invocation_counter()->_counter = rec->invocation_counter;
-    method->backedge_counter()->_counter = rec->backedge_counter;
+    if (mcs == NULL) {
+      mcs = Method::build_method_counters(method, CHECK_AND_CLEAR);
+    }
+    mcs->invocation_counter()->_counter = rec->invocation_counter;
+    mcs->backedge_counter()->_counter = rec->backedge_counter;
   }
 }