changeset 6454:c98ef93bfe9a

8043063: Code aging should allocate MethodCounters when flushing a method Summary: Make sure that MethodCounters are present when the method is flushed for the first time to switch on code aging Reviewed-by: kvn
author iveresov
date Wed, 14 May 2014 14:28:09 -0700
parents 3624b11235ba
children 466b58fa837b 75e1ec763270 d064d7b9d93b
files src/share/vm/runtime/sweeper.cpp
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/runtime/sweeper.cpp	Wed May 14 12:09:13 2014 -0400
+++ b/src/share/vm/runtime/sweeper.cpp	Wed May 14 14:28:09 2014 -0700
@@ -615,6 +615,11 @@
       // flat profiles). Check the age counter for possible data.
       if (UseCodeAging && make_not_entrant && (nm->is_compiled_by_c2() || nm->is_compiled_by_c1())) {
         MethodCounters* mc = nm->method()->method_counters();
+        if (mc == NULL) {
+          // Sometimes we can get here without MethodCounters. For example if we run with -Xcomp.
+          // Try to allocate them.
+          mc = Method::build_method_counters(nm->method(), Thread::current());
+        }
         if (mc != NULL) {
           // Snapshot the value as it's changed concurrently
           int age = mc->nmethod_age();