hotspot/src/share/vm/ci/ciMethod.cpp
changeset 17000 11bf92e571a2
parent 16617 6235d2c7549f
child 17383 3665c0901a0d
--- a/hotspot/src/share/vm/ci/ciMethod.cpp	Thu Apr 04 21:15:43 2013 -0700
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp	Tue Apr 09 17:17:41 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -905,6 +905,20 @@
 }
 
 // ------------------------------------------------------------------
+// ciMethod::ensure_method_counters
+//
+address ciMethod::ensure_method_counters() {
+  check_is_loaded();
+  VM_ENTRY_MARK;
+  methodHandle mh(THREAD, get_Method());
+  MethodCounters *counter = mh->method_counters();
+  if (counter == NULL) {
+    counter = Method::build_method_counters(mh(), CHECK_AND_CLEAR_NULL);
+  }
+  return (address)counter;
+}
+
+// ------------------------------------------------------------------
 // ciMethod::should_exclude
 //
 // Should this method be excluded from compilation?
@@ -1191,13 +1205,14 @@
   ASSERT_IN_VM;
   ResourceMark rm;
   Method* method = get_Method();
+  MethodCounters* mcs = method->method_counters();
   Klass*  holder = method->method_holder();
   st->print_cr("ciMethod %s %s %s %d %d %d %d %d",
                holder->name()->as_quoted_ascii(),
                method->name()->as_quoted_ascii(),
                method->signature()->as_quoted_ascii(),
-               method->invocation_counter()->raw_counter(),
-               method->backedge_counter()->raw_counter(),
+               mcs == NULL ? 0 : mcs->invocation_counter()->raw_counter(),
+               mcs == NULL ? 0 : mcs->backedge_counter()->raw_counter(),
                interpreter_invocation_count(),
                interpreter_throwout_count(),
                _instructions_size);