annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/jvmci/HotSpotProfilingInfo.java @ 21548:f4b3a6dadb44

moved Receiver inner class from MethodIdMap to InvocationPlugin (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Tue, 26 May 2015 11:19:50 +0200
parents a04dfbf81bc4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
1 /*
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
4 *
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
8 *
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
13 * accompanied this code).
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
14 *
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
18 *
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
21 * questions.
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
22 */
21545
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
23 package com.oracle.graal.hotspot.jvmci;
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
24
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5506
diff changeset
25 import com.oracle.graal.api.meta.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
26 import com.oracle.graal.debug.*;
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
27
21411
082417ac43e4 removed com.oracle.graal.hotspot.server and uses of Serializable it depended upon (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 18867
diff changeset
28 public final class HotSpotProfilingInfo implements ProfilingInfo, HotSpotProxified {
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
29
4561
35ca3ade314d enabled nmethod statistics for product build
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4553
diff changeset
30 private static final DebugMetric metricInsufficentSpace = Debug.metric("InsufficientSpaceForProfilingData");
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
31
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
32 private final HotSpotMethodData methodData;
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
33 private final HotSpotResolvedJavaMethod method;
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
34
13769
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
35 private boolean isMature;
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
36 private int position;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
37 private int hintPosition;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
38 private int hintBCI;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
39 private HotSpotMethodDataAccessor dataAccessor;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
40
13217
210f58e992a1 Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents: 13216
diff changeset
41 private boolean includeNormal;
210f58e992a1 Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents: 13216
diff changeset
42 private boolean includeOSR;
210f58e992a1 Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents: 13216
diff changeset
43
210f58e992a1 Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents: 13216
diff changeset
44 public HotSpotProfilingInfo(HotSpotMethodData methodData, HotSpotResolvedJavaMethod method, boolean includeNormal, boolean includeOSR) {
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
45 this.methodData = methodData;
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
46 this.method = method;
13217
210f58e992a1 Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents: 13216
diff changeset
47 this.includeNormal = includeNormal;
210f58e992a1 Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents: 13216
diff changeset
48 this.includeOSR = includeOSR;
13769
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
49 this.isMature = methodData.isProfileMature();
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
50 hintPosition = 0;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
51 hintBCI = -1;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
52 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
53
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
54 @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: 5719
diff changeset
55 public int getCodeSize() {
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
56 return method.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: 5321
diff changeset
57 }
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: 5321
diff changeset
58
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: 5321
diff changeset
59 @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: 5530
diff changeset
60 public JavaTypeProfile getTypeProfile(int bci) {
13769
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
61 if (!isMature) {
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
62 return null;
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
63 }
4450
d585b608bd78 more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4447
diff changeset
64 findBCI(bci, false);
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
65 return dataAccessor.getTypeProfile(methodData, position);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
66 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
67
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
68 @Override
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8610
diff changeset
69 public JavaMethodProfile getMethodProfile(int bci) {
13769
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
70 if (!isMature) {
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
71 return null;
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
72 }
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8610
diff changeset
73 findBCI(bci, false);
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8610
diff changeset
74 return dataAccessor.getMethodProfile(methodData, position);
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8610
diff changeset
75 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8610
diff changeset
76
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8610
diff changeset
77 @Override
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
78 public double getBranchTakenProbability(int bci) {
13769
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
79 if (!isMature) {
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
80 return -1;
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
81 }
4450
d585b608bd78 more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4447
diff changeset
82 findBCI(bci, false);
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
83 return dataAccessor.getBranchTakenProbability(methodData, position);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
84 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
85
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
86 @Override
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
87 public double[] getSwitchProbabilities(int bci) {
13769
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
88 if (!isMature) {
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
89 return null;
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
90 }
4450
d585b608bd78 more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4447
diff changeset
91 findBCI(bci, false);
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
92 return dataAccessor.getSwitchProbabilities(methodData, position);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
93 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
94
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
95 @Override
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7530
diff changeset
96 public TriState getExceptionSeen(int bci) {
4450
d585b608bd78 more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4447
diff changeset
97 findBCI(bci, true);
4457
5acf4a974e4a fixed framestate for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4450
diff changeset
98 return dataAccessor.getExceptionSeen(methodData, position);
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
99 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
100
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
101 @Override
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7530
diff changeset
102 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
103 findBCI(bci, false);
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7530
diff changeset
104 return dataAccessor.getNullSeen(methodData, position);
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7530
diff changeset
105 }
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7530
diff changeset
106
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7530
diff changeset
107 @Override
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
108 public int getExecutionCount(int bci) {
13769
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
109 if (!isMature) {
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
110 return -1;
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
111 }
4450
d585b608bd78 more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4447
diff changeset
112 findBCI(bci, false);
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
113 return dataAccessor.getExecutionCount(methodData, position);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
114 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
115
5114
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5061
diff changeset
116 @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: 5530
diff changeset
117 public int getDeoptimizationCount(DeoptimizationReason reason) {
13217
210f58e992a1 Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents: 13216
diff changeset
118 int count = 0;
210f58e992a1 Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents: 13216
diff changeset
119 if (includeNormal) {
210f58e992a1 Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents: 13216
diff changeset
120 count += methodData.getDeoptimizationCount(reason);
210f58e992a1 Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents: 13216
diff changeset
121 }
210f58e992a1 Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents: 13216
diff changeset
122 if (includeOSR) {
210f58e992a1 Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents: 13216
diff changeset
123 count += methodData.getOSRDeoptimizationCount(reason);
210f58e992a1 Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents: 13216
diff changeset
124 }
210f58e992a1 Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents: 13216
diff changeset
125 return count;
5114
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5061
diff changeset
126 }
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5061
diff changeset
127
4450
d585b608bd78 more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4447
diff changeset
128 private void findBCI(int targetBCI, boolean searchExtraData) {
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
129 assert targetBCI >= 0 : "invalid BCI";
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
130
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
131 if (methodData.hasNormalData()) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
132 int currentPosition = targetBCI < hintBCI ? 0 : hintPosition;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
133 HotSpotMethodDataAccessor currentAccessor;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
134 while ((currentAccessor = methodData.getNormalData(currentPosition)) != null) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
135 int currentBCI = currentAccessor.getBCI(methodData, currentPosition);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
136 if (currentBCI == targetBCI) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
137 normalDataFound(currentAccessor, currentPosition, currentBCI);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
138 return;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
139 } else if (currentBCI > targetBCI) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
140 break;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
141 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
142 currentPosition = currentPosition + currentAccessor.getSize(methodData, currentPosition);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
143 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
144 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
145
4527
a0cca63cd366 fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4476
diff changeset
146 boolean exceptionPossiblyNotRecorded = false;
4450
d585b608bd78 more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4447
diff changeset
147 if (searchExtraData && methodData.hasExtraData()) {
4476
00efac2934d3 methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4457
diff changeset
148 int currentPosition = methodData.getExtraDataBeginOffset();
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
149 HotSpotMethodDataAccessor currentAccessor;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
150 while ((currentAccessor = methodData.getExtraData(currentPosition)) != null) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
151 int currentBCI = currentAccessor.getBCI(methodData, currentPosition);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
152 if (currentBCI == targetBCI) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
153 extraDataFound(currentAccessor, currentPosition);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
154 return;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
155 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
156 currentPosition = currentPosition + currentAccessor.getSize(methodData, currentPosition);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
157 }
4527
a0cca63cd366 fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4476
diff changeset
158
4553
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4527
diff changeset
159 if (!methodData.isWithin(currentPosition)) {
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4527
diff changeset
160 exceptionPossiblyNotRecorded = true;
4561
35ca3ade314d enabled nmethod statistics for product build
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4553
diff changeset
161 metricInsufficentSpace.increment();
4553
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4527
diff changeset
162 }
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
163 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
164
4527
a0cca63cd366 fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4476
diff changeset
165 noDataFound(exceptionPossiblyNotRecorded);
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
166 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
167
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
168 private void normalDataFound(HotSpotMethodDataAccessor data, int pos, int bci) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
169 setCurrentData(data, pos);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
170 this.hintPosition = position;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
171 this.hintBCI = bci;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
172 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
173
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
174 private void extraDataFound(HotSpotMethodDataAccessor data, int pos) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
175 setCurrentData(data, pos);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
176 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
177
4564
8fc6920e064b avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4561
diff changeset
178 private void noDataFound(boolean exceptionPossiblyNotRecorded) {
8fc6920e064b avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4561
diff changeset
179 HotSpotMethodDataAccessor accessor = HotSpotMethodData.getNoDataAccessor(exceptionPossiblyNotRecorded);
4527
a0cca63cd366 fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4476
diff changeset
180 setCurrentData(accessor, -1);
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
181 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
182
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
183 private void setCurrentData(HotSpotMethodDataAccessor dataAccessor, int position) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
184 this.dataAccessor = dataAccessor;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
185 this.position = position;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
186 }
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: 5321
diff changeset
187
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: 5321
diff changeset
188 @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
189 public boolean isMature() {
13769
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
190 return isMature;
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
191 }
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
192
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
193 public void ignoreMature() {
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
194 isMature = true;
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
195 }
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
196
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
197 @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: 5321
diff changeset
198 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
199 return "HotSpotProfilingInfo<" + 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: 5321
diff changeset
200 }
13769
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
201
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
202 @Override
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
203 public void setMature() {
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
204 isMature = true;
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13217
diff changeset
205 }
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
206
21545
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
207 /**
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
208 * {@code MethodData::_jvmci_ir_size} (currently) supports at most one JVMCI compiler IR type
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
209 * which will be determined by the first JVMCI compiler that calls
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
210 * {@link #setCompilerIRSize(Class, int)}.
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
211 */
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
212 private static volatile Class<?> supportedCompilerIRType;
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
213
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
214 @Override
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
215 public boolean setCompilerIRSize(Class<?> irType, int size) {
21545
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
216 if (supportedCompilerIRType == null) {
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
217 synchronized (HotSpotProfilingInfo.class) {
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
218 if (supportedCompilerIRType == null) {
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
219 supportedCompilerIRType = irType;
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
220 }
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
221 }
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
222 }
21545
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
223 if (supportedCompilerIRType != irType) {
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
224 return false;
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
225 }
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
226 methodData.setCompiledIRSize(size);
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
227 return true;
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
228 }
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
229
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
230 @Override
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
231 public int getCompilerIRSize(Class<?> irType) {
21545
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
232 if (irType == supportedCompilerIRType) {
a04dfbf81bc4 removed dependency from JVMCI class HotSpotProfilingInfo to non-JVMCI class StructuredGraph (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
233 return methodData.getCompiledIRSize();
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
234 }
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
235 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
236 }
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
237 }