hotspot/src/share/vm/runtime/java.cpp
changeset 13728 882756847a04
parent 13196 6b399731153b
child 13861 619cff4bfb8b
--- a/hotspot/src/share/vm/runtime/java.cpp	Fri Aug 31 16:39:35 2012 -0700
+++ b/hotspot/src/share/vm/runtime/java.cpp	Sat Sep 01 13:25:18 2012 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -33,12 +33,11 @@
 #include "memory/genCollectedHeap.hpp"
 #include "memory/oopFactory.hpp"
 #include "memory/universe.hpp"
-#include "oops/constantPoolOop.hpp"
+#include "oops/constantPool.hpp"
 #include "oops/generateOopMap.hpp"
 #include "oops/instanceKlass.hpp"
-#include "oops/instanceKlassKlass.hpp"
 #include "oops/instanceOop.hpp"
-#include "oops/methodOop.hpp"
+#include "oops/method.hpp"
 #include "oops/objArrayOop.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/symbol.hpp"
@@ -115,19 +114,23 @@
 
 // Statistics printing (method invocation histogram)
 
-GrowableArray<methodOop>* collected_invoked_methods;
+GrowableArray<Method*>* collected_invoked_methods;
 
-void collect_invoked_methods(methodOop m) {
+void collect_invoked_methods(Method* m) {
   if (m->invocation_count() + m->compiled_invocation_count() >= 1 ) {
     collected_invoked_methods->push(m);
   }
 }
 
 
-GrowableArray<methodOop>* collected_profiled_methods;
+GrowableArray<Method*>* collected_profiled_methods;
 
-void collect_profiled_methods(methodOop m) {
-  methodHandle mh(Thread::current(), m);
+void collect_profiled_methods(Method* m) {
+  Thread* thread = Thread::current();
+  // This HandleMark prevents a huge amount of handles from being added
+  // to the metadata_handles() array on the thread.
+  HandleMark hm(thread);
+  methodHandle mh(thread, m);
   if ((m->method_data() != NULL) &&
       (PrintMethodData || CompilerOracle::should_print(mh))) {
     collected_profiled_methods->push(m);
@@ -135,7 +138,7 @@
 }
 
 
-int compare_methods(methodOop* a, methodOop* b) {
+int compare_methods(Method** a, Method** b) {
   // %%% there can be 32-bit overflow here
   return ((*b)->invocation_count() + (*b)->compiled_invocation_count())
        - ((*a)->invocation_count() + (*a)->compiled_invocation_count());
@@ -145,7 +148,7 @@
 void print_method_invocation_histogram() {
   ResourceMark rm;
   HandleMark hm;
-  collected_invoked_methods = new GrowableArray<methodOop>(1024);
+  collected_invoked_methods = new GrowableArray<Method*>(1024);
   SystemDictionary::methods_do(collect_invoked_methods);
   collected_invoked_methods->sort(&compare_methods);
   //
@@ -156,7 +159,7 @@
   unsigned total = 0, int_total = 0, comp_total = 0, static_total = 0, final_total = 0,
       synch_total = 0, nativ_total = 0, acces_total = 0;
   for (int index = 0; index < collected_invoked_methods->length(); index++) {
-    methodOop m = collected_invoked_methods->at(index);
+    Method* m = collected_invoked_methods->at(index);
     int c = m->invocation_count() + m->compiled_invocation_count();
     if (c >= MethodHistogramCutoff) m->print_invocation_count();
     int_total  += m->invocation_count();
@@ -185,14 +188,14 @@
 void print_method_profiling_data() {
   ResourceMark rm;
   HandleMark hm;
-  collected_profiled_methods = new GrowableArray<methodOop>(1024);
+  collected_profiled_methods = new GrowableArray<Method*>(1024);
   SystemDictionary::methods_do(collect_profiled_methods);
   collected_profiled_methods->sort(&compare_methods);
 
   int count = collected_profiled_methods->length();
   if (count > 0) {
     for (int index = 0; index < count; index++) {
-      methodOop m = collected_profiled_methods->at(index);
+      Method* m = collected_profiled_methods->at(index);
       ttyLocker ttyl;
       tty->print_cr("------------------------------------------------------------------------");
       //m->print_name(tty);
@@ -485,6 +488,9 @@
   if (PrintGCDetails) {
     Universe::print();
     AdaptiveSizePolicyOutput(0);
+    if (Verbose) {
+      ClassLoaderDataGraph::dump_on(gclog_or_tty);
+    }
   }