annotate graal/com.oracle.max.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotProfilingInfo.java @ 5060:4ed4295ce15f

Update import statements.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 08 Mar 2012 19:11:12 +0100
parents ed559a528128
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 */
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
23 package com.oracle.graal.hotspot.ri;
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
24
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
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
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
29
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
30
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
31 public final class HotSpotProfilingInfo extends CompilerObject implements RiProfilingInfo {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
32
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
33 /**
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
34 *
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
35 */
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
36 private static final long serialVersionUID = -8307682725047864875L;
4561
35ca3ade314d enabled nmethod statistics for product build
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4553
diff changeset
37 private static final DebugMetric metricInsufficentSpace = Debug.metric("InsufficientSpaceForProfilingData");
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
38
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
39 private int position;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
40 private int hintPosition;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
41 private int hintBCI;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
42 private HotSpotMethodDataAccessor dataAccessor;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
43 private HotSpotMethodData methodData;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
44
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
45 public HotSpotProfilingInfo(Compiler compiler, HotSpotMethodData methodData) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
46 super(compiler);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
47 this.methodData = methodData;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
48 hintPosition = 0;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
49 hintBCI = -1;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
50 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
51
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
52 @Override
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
53 public RiTypeProfile getTypeProfile(int bci) {
4450
d585b608bd78 more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4447
diff changeset
54 findBCI(bci, false);
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
55 return dataAccessor.getTypeProfile(methodData, position);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
56 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
57
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
58 @Override
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
59 public double getBranchTakenProbability(int bci) {
4450
d585b608bd78 more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4447
diff changeset
60 findBCI(bci, false);
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
61 return dataAccessor.getBranchTakenProbability(methodData, position);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
62 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
63
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
64 @Override
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
65 public double[] getSwitchProbabilities(int bci) {
4450
d585b608bd78 more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4447
diff changeset
66 findBCI(bci, false);
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
67 return dataAccessor.getSwitchProbabilities(methodData, position);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
68 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
69
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
70 @Override
4527
a0cca63cd366 fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4476
diff changeset
71 public RiExceptionSeen getExceptionSeen(int bci) {
4450
d585b608bd78 more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4447
diff changeset
72 findBCI(bci, true);
4457
5acf4a974e4a fixed framestate for inlining multiple methods
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4450
diff changeset
73 return dataAccessor.getExceptionSeen(methodData, position);
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
74 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
75
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
76 @Override
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
77 public int getExecutionCount(int bci) {
4450
d585b608bd78 more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4447
diff changeset
78 findBCI(bci, false);
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
79 return dataAccessor.getExecutionCount(methodData, position);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
80 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
81
4450
d585b608bd78 more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4447
diff changeset
82 private void findBCI(int targetBCI, boolean searchExtraData) {
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
83 assert targetBCI >= 0 : "invalid BCI";
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
84
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
85 if (methodData.hasNormalData()) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
86 int currentPosition = targetBCI < hintBCI ? 0 : hintPosition;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
87 HotSpotMethodDataAccessor currentAccessor;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
88 while ((currentAccessor = methodData.getNormalData(currentPosition)) != null) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
89 int currentBCI = currentAccessor.getBCI(methodData, currentPosition);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
90 if (currentBCI == targetBCI) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
91 normalDataFound(currentAccessor, currentPosition, currentBCI);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
92 return;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
93 } else if (currentBCI > targetBCI) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
94 break;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
95 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
96 currentPosition = currentPosition + currentAccessor.getSize(methodData, currentPosition);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
97 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
98 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
99
4527
a0cca63cd366 fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4476
diff changeset
100 boolean exceptionPossiblyNotRecorded = false;
4450
d585b608bd78 more efficient methodData access
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4447
diff changeset
101 if (searchExtraData && methodData.hasExtraData()) {
4476
00efac2934d3 methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4457
diff changeset
102 int currentPosition = methodData.getExtraDataBeginOffset();
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
103 HotSpotMethodDataAccessor currentAccessor;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
104 while ((currentAccessor = methodData.getExtraData(currentPosition)) != null) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
105 int currentBCI = currentAccessor.getBCI(methodData, currentPosition);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
106 if (currentBCI == targetBCI) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
107 extraDataFound(currentAccessor, currentPosition);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
108 return;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
109 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
110 currentPosition = currentPosition + currentAccessor.getSize(methodData, currentPosition);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
111 }
4527
a0cca63cd366 fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4476
diff changeset
112
4553
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4527
diff changeset
113 if (!methodData.isWithin(currentPosition)) {
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4527
diff changeset
114 exceptionPossiblyNotRecorded = true;
4561
35ca3ade314d enabled nmethod statistics for product build
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4553
diff changeset
115 metricInsufficentSpace.increment();
4553
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4527
diff changeset
116 }
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
117 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
118
4527
a0cca63cd366 fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4476
diff changeset
119 noDataFound(exceptionPossiblyNotRecorded);
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
120 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
121
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
122 private void normalDataFound(HotSpotMethodDataAccessor data, int pos, int bci) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
123 setCurrentData(data, pos);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
124 this.hintPosition = position;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
125 this.hintBCI = bci;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
126 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
127
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
128 private void extraDataFound(HotSpotMethodDataAccessor data, int pos) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
129 setCurrentData(data, pos);
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
130 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
131
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
132 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
133 HotSpotMethodDataAccessor accessor = HotSpotMethodData.getNoDataAccessor(exceptionPossiblyNotRecorded);
4527
a0cca63cd366 fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4476
diff changeset
134 setCurrentData(accessor, -1);
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
135 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
136
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
137 private void setCurrentData(HotSpotMethodDataAccessor dataAccessor, int position) {
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
138 this.dataAccessor = dataAccessor;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
139 this.position = position;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
140 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
141 }