Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotProfilingInfo.java @ 5321:12c63380e7ff
removed empty javadoc for generated serialVersionUID fields
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 30 Apr 2012 13:25:59 +0200 |
parents | dad1ac9dba7d |
children | 4c3d953f8131 |
rev | line source |
---|---|
4446 | 1 /* |
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
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 | |
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 */ | |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.hotspot.ri; |
4446 | 24 |
25 import com.oracle.max.cri.ri.*; | |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
26 import com.oracle.graal.debug.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
27 import com.oracle.graal.hotspot.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
28 import com.oracle.graal.hotspot.Compiler; |
4446 | 29 |
30 | |
31 public final class HotSpotProfilingInfo extends CompilerObject implements RiProfilingInfo { | |
32 | |
33 private static final long serialVersionUID = -8307682725047864875L; | |
4561
35ca3ade314d
enabled nmethod statistics for product build
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4553
diff
changeset
|
34 private static final DebugMetric metricInsufficentSpace = Debug.metric("InsufficientSpaceForProfilingData"); |
4446 | 35 |
36 private int position; | |
37 private int hintPosition; | |
38 private int hintBCI; | |
39 private HotSpotMethodDataAccessor dataAccessor; | |
40 private HotSpotMethodData methodData; | |
41 | |
42 public HotSpotProfilingInfo(Compiler compiler, HotSpotMethodData methodData) { | |
43 super(compiler); | |
44 this.methodData = methodData; | |
45 hintPosition = 0; | |
46 hintBCI = -1; | |
47 } | |
48 | |
49 @Override | |
50 public RiTypeProfile getTypeProfile(int bci) { | |
4450
d585b608bd78
more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4447
diff
changeset
|
51 findBCI(bci, false); |
4446 | 52 return dataAccessor.getTypeProfile(methodData, position); |
53 } | |
54 | |
55 @Override | |
56 public double getBranchTakenProbability(int bci) { | |
4450
d585b608bd78
more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4447
diff
changeset
|
57 findBCI(bci, false); |
4446 | 58 return dataAccessor.getBranchTakenProbability(methodData, position); |
59 } | |
60 | |
61 @Override | |
62 public double[] getSwitchProbabilities(int bci) { | |
4450
d585b608bd78
more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4447
diff
changeset
|
63 findBCI(bci, false); |
4446 | 64 return dataAccessor.getSwitchProbabilities(methodData, position); |
65 } | |
66 | |
67 @Override | |
4527
a0cca63cd366
fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4476
diff
changeset
|
68 public RiExceptionSeen getExceptionSeen(int bci) { |
4450
d585b608bd78
more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4447
diff
changeset
|
69 findBCI(bci, true); |
4457
5acf4a974e4a
fixed framestate for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4450
diff
changeset
|
70 return dataAccessor.getExceptionSeen(methodData, position); |
4446 | 71 } |
72 | |
73 @Override | |
74 public int getExecutionCount(int bci) { | |
4450
d585b608bd78
more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4447
diff
changeset
|
75 findBCI(bci, false); |
4446 | 76 return dataAccessor.getExecutionCount(methodData, position); |
77 } | |
78 | |
5114
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5061
diff
changeset
|
79 @Override |
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5061
diff
changeset
|
80 public int getDeoptimizationCount(RiDeoptReason reason) { |
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5061
diff
changeset
|
81 return methodData.getDeoptimizationCount(reason); |
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5061
diff
changeset
|
82 } |
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5061
diff
changeset
|
83 |
4450
d585b608bd78
more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4447
diff
changeset
|
84 private void findBCI(int targetBCI, boolean searchExtraData) { |
4446 | 85 assert targetBCI >= 0 : "invalid BCI"; |
86 | |
87 if (methodData.hasNormalData()) { | |
88 int currentPosition = targetBCI < hintBCI ? 0 : hintPosition; | |
89 HotSpotMethodDataAccessor currentAccessor; | |
90 while ((currentAccessor = methodData.getNormalData(currentPosition)) != null) { | |
91 int currentBCI = currentAccessor.getBCI(methodData, currentPosition); | |
92 if (currentBCI == targetBCI) { | |
93 normalDataFound(currentAccessor, currentPosition, currentBCI); | |
94 return; | |
95 } else if (currentBCI > targetBCI) { | |
96 break; | |
97 } | |
98 currentPosition = currentPosition + currentAccessor.getSize(methodData, currentPosition); | |
99 } | |
100 } | |
101 | |
4527
a0cca63cd366
fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4476
diff
changeset
|
102 boolean exceptionPossiblyNotRecorded = false; |
4450
d585b608bd78
more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4447
diff
changeset
|
103 if (searchExtraData && methodData.hasExtraData()) { |
4476
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4457
diff
changeset
|
104 int currentPosition = methodData.getExtraDataBeginOffset(); |
4446 | 105 HotSpotMethodDataAccessor currentAccessor; |
106 while ((currentAccessor = methodData.getExtraData(currentPosition)) != null) { | |
107 int currentBCI = currentAccessor.getBCI(methodData, currentPosition); | |
108 if (currentBCI == targetBCI) { | |
109 extraDataFound(currentAccessor, currentPosition); | |
110 return; | |
111 } | |
112 currentPosition = currentPosition + currentAccessor.getSize(methodData, currentPosition); | |
113 } | |
4527
a0cca63cd366
fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4476
diff
changeset
|
114 |
4553
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4527
diff
changeset
|
115 if (!methodData.isWithin(currentPosition)) { |
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4527
diff
changeset
|
116 exceptionPossiblyNotRecorded = true; |
4561
35ca3ade314d
enabled nmethod statistics for product build
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4553
diff
changeset
|
117 metricInsufficentSpace.increment(); |
4553
7d0d849abf80
added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4527
diff
changeset
|
118 } |
4446 | 119 } |
120 | |
4527
a0cca63cd366
fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4476
diff
changeset
|
121 noDataFound(exceptionPossiblyNotRecorded); |
4446 | 122 } |
123 | |
124 private void normalDataFound(HotSpotMethodDataAccessor data, int pos, int bci) { | |
125 setCurrentData(data, pos); | |
126 this.hintPosition = position; | |
127 this.hintBCI = bci; | |
128 } | |
129 | |
130 private void extraDataFound(HotSpotMethodDataAccessor data, int pos) { | |
131 setCurrentData(data, pos); | |
132 } | |
133 | |
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
|
134 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
|
135 HotSpotMethodDataAccessor accessor = HotSpotMethodData.getNoDataAccessor(exceptionPossiblyNotRecorded); |
4527
a0cca63cd366
fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4476
diff
changeset
|
136 setCurrentData(accessor, -1); |
4446 | 137 } |
138 | |
139 private void setCurrentData(HotSpotMethodDataAccessor dataAccessor, int position) { | |
140 this.dataAccessor = dataAccessor; | |
141 this.position = position; | |
142 } | |
143 } |