6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/classLoader.hpp"
27 #include "classfile/stringTable.hpp"
28 #include "classfile/systemDictionary.hpp"
29 #include "code/codeCache.hpp"
30 #include "compiler/compileBroker.hpp"
31 #include "compiler/compilerOracle.hpp"
32 #include "gc/shared/genCollectedHeap.hpp"
33 #include "interpreter/bytecodeHistogram.hpp"
34 #if INCLUDE_JVMCI
35 #include "jvmci/jvmciCompiler.hpp"
36 #include "jvmci/jvmciRuntime.hpp"
37 #endif
38 #include "logging/log.hpp"
39 #include "memory/oopFactory.hpp"
40 #include "memory/resourceArea.hpp"
41 #include "memory/universe.hpp"
42 #include "oops/constantPool.hpp"
43 #include "oops/generateOopMap.hpp"
44 #include "oops/instanceKlass.hpp"
45 #include "oops/instanceOop.hpp"
70 #include "utilities/dtrace.hpp"
71 #include "utilities/globalDefinitions.hpp"
72 #include "utilities/histogram.hpp"
73 #include "utilities/macros.hpp"
74 #include "utilities/vmError.hpp"
75 #if INCLUDE_ALL_GCS
76 #include "gc/cms/concurrentMarkSweepThread.hpp"
77 #include "gc/parallel/psScavenge.hpp"
78 #endif // INCLUDE_ALL_GCS
79 #ifdef COMPILER1
80 #include "c1/c1_Compiler.hpp"
81 #include "c1/c1_Runtime1.hpp"
82 #endif
83 #ifdef COMPILER2
84 #include "code/compiledIC.hpp"
85 #include "compiler/methodLiveness.hpp"
86 #include "opto/compile.hpp"
87 #include "opto/indexSet.hpp"
88 #include "opto/runtime.hpp"
89 #endif
90 #include "aot/aotLoader.hpp"
91
92 GrowableArray<Method*>* collected_profiled_methods;
93
94 int compare_methods(Method** a, Method** b) {
95 // %%% there can be 32-bit overflow here
96 return ((*b)->invocation_count() + (*b)->compiled_invocation_count())
97 - ((*a)->invocation_count() + (*a)->compiled_invocation_count());
98 }
99
100 void collect_profiled_methods(Method* m) {
101 Thread* thread = Thread::current();
102 // This HandleMark prevents a huge amount of handles from being added
103 // to the metadata_handles() array on the thread.
104 HandleMark hm(thread);
105 methodHandle mh(thread, m);
106 if ((m->method_data() != NULL) &&
107 (PrintMethodData || CompilerOracle::should_print(mh))) {
108 collected_profiled_methods->push(m);
109 }
110 }
|
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "aot/aotLoader.hpp"
27 #include "classfile/classLoader.hpp"
28 #include "classfile/stringTable.hpp"
29 #include "classfile/systemDictionary.hpp"
30 #include "code/codeCache.hpp"
31 #include "compiler/compileBroker.hpp"
32 #include "compiler/compilerOracle.hpp"
33 #include "gc/shared/genCollectedHeap.hpp"
34 #include "interpreter/bytecodeHistogram.hpp"
35 #if INCLUDE_JVMCI
36 #include "jvmci/jvmciCompiler.hpp"
37 #include "jvmci/jvmciRuntime.hpp"
38 #endif
39 #include "logging/log.hpp"
40 #include "memory/oopFactory.hpp"
41 #include "memory/resourceArea.hpp"
42 #include "memory/universe.hpp"
43 #include "oops/constantPool.hpp"
44 #include "oops/generateOopMap.hpp"
45 #include "oops/instanceKlass.hpp"
46 #include "oops/instanceOop.hpp"
71 #include "utilities/dtrace.hpp"
72 #include "utilities/globalDefinitions.hpp"
73 #include "utilities/histogram.hpp"
74 #include "utilities/macros.hpp"
75 #include "utilities/vmError.hpp"
76 #if INCLUDE_ALL_GCS
77 #include "gc/cms/concurrentMarkSweepThread.hpp"
78 #include "gc/parallel/psScavenge.hpp"
79 #endif // INCLUDE_ALL_GCS
80 #ifdef COMPILER1
81 #include "c1/c1_Compiler.hpp"
82 #include "c1/c1_Runtime1.hpp"
83 #endif
84 #ifdef COMPILER2
85 #include "code/compiledIC.hpp"
86 #include "compiler/methodLiveness.hpp"
87 #include "opto/compile.hpp"
88 #include "opto/indexSet.hpp"
89 #include "opto/runtime.hpp"
90 #endif
91
92 GrowableArray<Method*>* collected_profiled_methods;
93
94 int compare_methods(Method** a, Method** b) {
95 // %%% there can be 32-bit overflow here
96 return ((*b)->invocation_count() + (*b)->compiled_invocation_count())
97 - ((*a)->invocation_count() + (*a)->compiled_invocation_count());
98 }
99
100 void collect_profiled_methods(Method* m) {
101 Thread* thread = Thread::current();
102 // This HandleMark prevents a huge amount of handles from being added
103 // to the metadata_handles() array on the thread.
104 HandleMark hm(thread);
105 methodHandle mh(thread, m);
106 if ((m->method_data() != NULL) &&
107 (PrintMethodData || CompilerOracle::should_print(mh))) {
108 collected_profiled_methods->push(m);
109 }
110 }
|