Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/java.cpp @ 6725:da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author | coleenp |
---|---|
date | Sat, 01 Sep 2012 13:25:18 -0400 |
parents | 24b9c7f4cae6 |
children | 9a86ddfc6c8f |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
31 #include "compiler/compilerOracle.hpp" | 31 #include "compiler/compilerOracle.hpp" |
32 #include "interpreter/bytecodeHistogram.hpp" | 32 #include "interpreter/bytecodeHistogram.hpp" |
33 #include "memory/genCollectedHeap.hpp" | 33 #include "memory/genCollectedHeap.hpp" |
34 #include "memory/oopFactory.hpp" | 34 #include "memory/oopFactory.hpp" |
35 #include "memory/universe.hpp" | 35 #include "memory/universe.hpp" |
36 #include "oops/constantPoolOop.hpp" | 36 #include "oops/constantPool.hpp" |
37 #include "oops/generateOopMap.hpp" | 37 #include "oops/generateOopMap.hpp" |
38 #include "oops/instanceKlass.hpp" | 38 #include "oops/instanceKlass.hpp" |
39 #include "oops/instanceKlassKlass.hpp" | |
40 #include "oops/instanceOop.hpp" | 39 #include "oops/instanceOop.hpp" |
41 #include "oops/methodOop.hpp" | 40 #include "oops/method.hpp" |
42 #include "oops/objArrayOop.hpp" | 41 #include "oops/objArrayOop.hpp" |
43 #include "oops/oop.inline.hpp" | 42 #include "oops/oop.inline.hpp" |
44 #include "oops/symbol.hpp" | 43 #include "oops/symbol.hpp" |
45 #include "prims/jvmtiExport.hpp" | 44 #include "prims/jvmtiExport.hpp" |
46 #include "runtime/aprofiler.hpp" | 45 #include "runtime/aprofiler.hpp" |
113 | 112 |
114 #ifndef PRODUCT | 113 #ifndef PRODUCT |
115 | 114 |
116 // Statistics printing (method invocation histogram) | 115 // Statistics printing (method invocation histogram) |
117 | 116 |
118 GrowableArray<methodOop>* collected_invoked_methods; | 117 GrowableArray<Method*>* collected_invoked_methods; |
119 | 118 |
120 void collect_invoked_methods(methodOop m) { | 119 void collect_invoked_methods(Method* m) { |
121 if (m->invocation_count() + m->compiled_invocation_count() >= 1 ) { | 120 if (m->invocation_count() + m->compiled_invocation_count() >= 1 ) { |
122 collected_invoked_methods->push(m); | 121 collected_invoked_methods->push(m); |
123 } | 122 } |
124 } | 123 } |
125 | 124 |
126 | 125 |
127 GrowableArray<methodOop>* collected_profiled_methods; | 126 GrowableArray<Method*>* collected_profiled_methods; |
128 | 127 |
129 void collect_profiled_methods(methodOop m) { | 128 void collect_profiled_methods(Method* m) { |
130 methodHandle mh(Thread::current(), m); | 129 Thread* thread = Thread::current(); |
130 // This HandleMark prevents a huge amount of handles from being added | |
131 // to the metadata_handles() array on the thread. | |
132 HandleMark hm(thread); | |
133 methodHandle mh(thread, m); | |
131 if ((m->method_data() != NULL) && | 134 if ((m->method_data() != NULL) && |
132 (PrintMethodData || CompilerOracle::should_print(mh))) { | 135 (PrintMethodData || CompilerOracle::should_print(mh))) { |
133 collected_profiled_methods->push(m); | 136 collected_profiled_methods->push(m); |
134 } | 137 } |
135 } | 138 } |
136 | 139 |
137 | 140 |
138 int compare_methods(methodOop* a, methodOop* b) { | 141 int compare_methods(Method** a, Method** b) { |
139 // %%% there can be 32-bit overflow here | 142 // %%% there can be 32-bit overflow here |
140 return ((*b)->invocation_count() + (*b)->compiled_invocation_count()) | 143 return ((*b)->invocation_count() + (*b)->compiled_invocation_count()) |
141 - ((*a)->invocation_count() + (*a)->compiled_invocation_count()); | 144 - ((*a)->invocation_count() + (*a)->compiled_invocation_count()); |
142 } | 145 } |
143 | 146 |
144 | 147 |
145 void print_method_invocation_histogram() { | 148 void print_method_invocation_histogram() { |
146 ResourceMark rm; | 149 ResourceMark rm; |
147 HandleMark hm; | 150 HandleMark hm; |
148 collected_invoked_methods = new GrowableArray<methodOop>(1024); | 151 collected_invoked_methods = new GrowableArray<Method*>(1024); |
149 SystemDictionary::methods_do(collect_invoked_methods); | 152 SystemDictionary::methods_do(collect_invoked_methods); |
150 collected_invoked_methods->sort(&compare_methods); | 153 collected_invoked_methods->sort(&compare_methods); |
151 // | 154 // |
152 tty->cr(); | 155 tty->cr(); |
153 tty->print_cr("Histogram Over MethodOop Invocation Counters (cutoff = %d):", MethodHistogramCutoff); | 156 tty->print_cr("Histogram Over MethodOop Invocation Counters (cutoff = %d):", MethodHistogramCutoff); |
154 tty->cr(); | 157 tty->cr(); |
155 tty->print_cr("____Count_(I+C)____Method________________________Module_________________"); | 158 tty->print_cr("____Count_(I+C)____Method________________________Module_________________"); |
156 unsigned total = 0, int_total = 0, comp_total = 0, static_total = 0, final_total = 0, | 159 unsigned total = 0, int_total = 0, comp_total = 0, static_total = 0, final_total = 0, |
157 synch_total = 0, nativ_total = 0, acces_total = 0; | 160 synch_total = 0, nativ_total = 0, acces_total = 0; |
158 for (int index = 0; index < collected_invoked_methods->length(); index++) { | 161 for (int index = 0; index < collected_invoked_methods->length(); index++) { |
159 methodOop m = collected_invoked_methods->at(index); | 162 Method* m = collected_invoked_methods->at(index); |
160 int c = m->invocation_count() + m->compiled_invocation_count(); | 163 int c = m->invocation_count() + m->compiled_invocation_count(); |
161 if (c >= MethodHistogramCutoff) m->print_invocation_count(); | 164 if (c >= MethodHistogramCutoff) m->print_invocation_count(); |
162 int_total += m->invocation_count(); | 165 int_total += m->invocation_count(); |
163 comp_total += m->compiled_invocation_count(); | 166 comp_total += m->compiled_invocation_count(); |
164 if (m->is_final()) final_total += c; | 167 if (m->is_final()) final_total += c; |
183 } | 186 } |
184 | 187 |
185 void print_method_profiling_data() { | 188 void print_method_profiling_data() { |
186 ResourceMark rm; | 189 ResourceMark rm; |
187 HandleMark hm; | 190 HandleMark hm; |
188 collected_profiled_methods = new GrowableArray<methodOop>(1024); | 191 collected_profiled_methods = new GrowableArray<Method*>(1024); |
189 SystemDictionary::methods_do(collect_profiled_methods); | 192 SystemDictionary::methods_do(collect_profiled_methods); |
190 collected_profiled_methods->sort(&compare_methods); | 193 collected_profiled_methods->sort(&compare_methods); |
191 | 194 |
192 int count = collected_profiled_methods->length(); | 195 int count = collected_profiled_methods->length(); |
193 if (count > 0) { | 196 if (count > 0) { |
194 for (int index = 0; index < count; index++) { | 197 for (int index = 0; index < count; index++) { |
195 methodOop m = collected_profiled_methods->at(index); | 198 Method* m = collected_profiled_methods->at(index); |
196 ttyLocker ttyl; | 199 ttyLocker ttyl; |
197 tty->print_cr("------------------------------------------------------------------------"); | 200 tty->print_cr("------------------------------------------------------------------------"); |
198 //m->print_name(tty); | 201 //m->print_name(tty); |
199 m->print_invocation_count(); | 202 m->print_invocation_count(); |
200 tty->cr(); | 203 tty->cr(); |
483 | 486 |
484 // Print GC/heap related information. | 487 // Print GC/heap related information. |
485 if (PrintGCDetails) { | 488 if (PrintGCDetails) { |
486 Universe::print(); | 489 Universe::print(); |
487 AdaptiveSizePolicyOutput(0); | 490 AdaptiveSizePolicyOutput(0); |
491 if (Verbose) { | |
492 ClassLoaderDataGraph::dump_on(gclog_or_tty); | |
493 } | |
488 } | 494 } |
489 | 495 |
490 | 496 |
491 if (Arguments::has_alloc_profile()) { | 497 if (Arguments::has_alloc_profile()) { |
492 HandleMark hm; | 498 HandleMark hm; |