annotate graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DefaultProfilingInfo.java @ 16490:cac0a7d1c325

moved profileToString(ProfilingInfo info, ResolvedJavaMethod method, String sep) from MetaUtil to be a default method in ProfilingInfo
author Doug Simon <doug.simon@oracle.com>
date Thu, 10 Jul 2014 23:56:39 +0200
parents 12eaf1a47a90
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5105
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
1 /*
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
4 *
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
8 *
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
13 * accompanied this code).
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
14 *
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
18 *
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
21 * questions.
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
22 */
5721
0b517fac113e renamed BaseProfilingInfo to DefaultProfilingInfo and moved it to com.oracle.graal.api.meta
Doug Simon <doug.simon@oracle.com>
parents: 5719
diff changeset
23 package com.oracle.graal.api.meta;
5105
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
24
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
25 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
26 * An implementation of {@link ProfilingInfo} that can used in the absence of real profile
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
27 * information.
5105
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
28 */
5721
0b517fac113e renamed BaseProfilingInfo to DefaultProfilingInfo and moved it to com.oracle.graal.api.meta
Doug Simon <doug.simon@oracle.com>
parents: 5719
diff changeset
29 public final class DefaultProfilingInfo implements ProfilingInfo {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5721
diff changeset
30
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7530
diff changeset
31 private static final ProfilingInfo[] NO_PROFILING_INFO = new ProfilingInfo[]{new DefaultProfilingInfo(TriState.TRUE), new DefaultProfilingInfo(TriState.FALSE),
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7530
diff changeset
32 new DefaultProfilingInfo(TriState.UNKNOWN)};
5105
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
33
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7530
diff changeset
34 private final TriState exceptionSeen;
5105
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
35
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7530
diff changeset
36 DefaultProfilingInfo(TriState exceptionSeen) {
5105
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
37 this.exceptionSeen = exceptionSeen;
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
38 }
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
39
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
40 @Override
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5721
diff changeset
41 public int getCodeSize() {
5346
4c3d953f8131 added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents: 5114
diff changeset
42 return 0;
4c3d953f8131 added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents: 5114
diff changeset
43 }
4c3d953f8131 added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents: 5114
diff changeset
44
4c3d953f8131 added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents: 5114
diff changeset
45 @Override
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5510
diff changeset
46 public JavaTypeProfile getTypeProfile(int bci) {
5105
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
47 return null;
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
48 }
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
49
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
50 @Override
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8610
diff changeset
51 public JavaMethodProfile getMethodProfile(int bci) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8610
diff changeset
52 return null;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8610
diff changeset
53 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8610
diff changeset
54
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8610
diff changeset
55 @Override
5105
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
56 public double getBranchTakenProbability(int bci) {
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
57 return -1;
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
58 }
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
59
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
60 @Override
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
61 public double[] getSwitchProbabilities(int bci) {
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
62 return null;
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
63 }
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
64
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
65 @Override
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7530
diff changeset
66 public TriState getExceptionSeen(int bci) {
5105
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
67 return exceptionSeen;
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
68 }
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
69
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
70 @Override
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7530
diff changeset
71 public TriState getNullSeen(int bci) {
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7530
diff changeset
72 return TriState.UNKNOWN;
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7530
diff changeset
73 }
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7530
diff changeset
74
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7530
diff changeset
75 @Override
5105
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
76 public int getExecutionCount(int bci) {
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
77 return -1;
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
78 }
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
79
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7530
diff changeset
80 public static ProfilingInfo get(TriState exceptionSeen) {
5105
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
81 return NO_PROFILING_INFO[exceptionSeen.ordinal()];
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
82 }
5114
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5105
diff changeset
83
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5105
diff changeset
84 @Override
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5510
diff changeset
85 public int getDeoptimizationCount(DeoptimizationReason reason) {
5114
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5105
diff changeset
86 return 0;
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5105
diff changeset
87 }
5346
4c3d953f8131 added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents: 5114
diff changeset
88
4c3d953f8131 added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents: 5114
diff changeset
89 @Override
9928
a9311ec68721 Avoid graph caching if immature or no profiling information was used for graph building.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9760
diff changeset
90 public boolean isMature() {
a9311ec68721 Avoid graph caching if immature or no profiling information was used for graph building.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9760
diff changeset
91 return false;
a9311ec68721 Avoid graph caching if immature or no profiling information was used for graph building.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9760
diff changeset
92 }
a9311ec68721 Avoid graph caching if immature or no profiling information was used for graph building.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9760
diff changeset
93
a9311ec68721 Avoid graph caching if immature or no profiling information was used for graph building.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9760
diff changeset
94 @Override
5346
4c3d953f8131 added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents: 5114
diff changeset
95 public String toString() {
16490
cac0a7d1c325 moved profileToString(ProfilingInfo info, ResolvedJavaMethod method, String sep) from MetaUtil to be a default method in ProfilingInfo
Doug Simon <doug.simon@oracle.com>
parents: 14543
diff changeset
96 return "BaseProfilingInfo<" + this.toString(null, "; ") + ">";
5346
4c3d953f8131 added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents: 5114
diff changeset
97 }
13769
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 9928
diff changeset
98
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 9928
diff changeset
99 public void setMature() {
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 9928
diff changeset
100 // Do nothing
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 9928
diff changeset
101 }
14543
12eaf1a47a90 removed ResolvedJavaMethod.getCompilerStorage(); moved last compiled graph node count into profiling info (i.e. MethodData metadata)
Doug Simon <doug.simon@oracle.com>
parents: 13769
diff changeset
102
12eaf1a47a90 removed ResolvedJavaMethod.getCompilerStorage(); moved last compiled graph node count into profiling info (i.e. MethodData metadata)
Doug Simon <doug.simon@oracle.com>
parents: 13769
diff changeset
103 public boolean setCompilerIRSize(Class<?> irType, int nodeCount) {
12eaf1a47a90 removed ResolvedJavaMethod.getCompilerStorage(); moved last compiled graph node count into profiling info (i.e. MethodData metadata)
Doug Simon <doug.simon@oracle.com>
parents: 13769
diff changeset
104 return false;
12eaf1a47a90 removed ResolvedJavaMethod.getCompilerStorage(); moved last compiled graph node count into profiling info (i.e. MethodData metadata)
Doug Simon <doug.simon@oracle.com>
parents: 13769
diff changeset
105 }
12eaf1a47a90 removed ResolvedJavaMethod.getCompilerStorage(); moved last compiled graph node count into profiling info (i.e. MethodData metadata)
Doug Simon <doug.simon@oracle.com>
parents: 13769
diff changeset
106
12eaf1a47a90 removed ResolvedJavaMethod.getCompilerStorage(); moved last compiled graph node count into profiling info (i.e. MethodData metadata)
Doug Simon <doug.simon@oracle.com>
parents: 13769
diff changeset
107 public int getCompilerIRSize(Class<?> irType) {
12eaf1a47a90 removed ResolvedJavaMethod.getCompilerStorage(); moved last compiled graph node count into profiling info (i.e. MethodData metadata)
Doug Simon <doug.simon@oracle.com>
parents: 13769
diff changeset
108 return -1;
12eaf1a47a90 removed ResolvedJavaMethod.getCompilerStorage(); moved last compiled graph node count into profiling info (i.e. MethodData metadata)
Doug Simon <doug.simon@oracle.com>
parents: 13769
diff changeset
109 }
5105
95b8a32a7cc3 preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
110 }