Mercurial > hg > truffle
annotate graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethodDataAccessor.java @ 21556:48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 27 May 2015 00:36:16 +0200 |
parents | 9579a3c62a9e |
children | f5b549811bac |
rev | line source |
---|---|
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
1 /* |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
4 * |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
8 * |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
14 * |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
18 * |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
21 * questions. |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
22 */ |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19717
diff
changeset
|
23 package com.oracle.jvmci.hotspot; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
24 |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19717
diff
changeset
|
25 import static com.oracle.jvmci.hotspot.HotSpotJVMCIRuntime.*; |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
26 |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
27 import com.oracle.jvmci.meta.*; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
28 |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
29 |
4448
9e8e92c3ff17
first parts for inlining multiple methods, added Simplifiable to switch nodes, some documentation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4441
diff
changeset
|
30 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
31 * Interface for accessor objects that encapsulate the logic for accessing the different kinds of |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
32 * data in a HotSpot methodDataOop. This interface is similar to the interface {@link ProfilingInfo} |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
33 * , but most methods require a MethodDataObject and the exact position within the methodData. |
4448
9e8e92c3ff17
first parts for inlining multiple methods, added Simplifiable to switch nodes, some documentation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4441
diff
changeset
|
34 */ |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
35 public interface HotSpotMethodDataAccessor { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
36 |
4448
9e8e92c3ff17
first parts for inlining multiple methods, added Simplifiable to switch nodes, some documentation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4441
diff
changeset
|
37 /** |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
38 * {@code DataLayout} tag values. |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
39 */ |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
40 enum Tag { |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
41 No(config().dataLayoutNoTag), |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
42 BitData(config().dataLayoutBitDataTag), |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
43 CounterData(config().dataLayoutCounterDataTag), |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
44 JumpData(config().dataLayoutJumpDataTag), |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
45 ReceiverTypeData(config().dataLayoutReceiverTypeDataTag), |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
46 VirtualCallData(config().dataLayoutVirtualCallDataTag), |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
47 RetData(config().dataLayoutRetDataTag), |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
48 BranchData(config().dataLayoutBranchDataTag), |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
49 MultiBranchData(config().dataLayoutMultiBranchDataTag), |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
50 ArgInfoData(config().dataLayoutArgInfoDataTag), |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
51 CallTypeData(config().dataLayoutCallTypeDataTag), |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
52 VirtualCallTypeData(config().dataLayoutVirtualCallTypeDataTag), |
18041
52b4284cb496
Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15193
diff
changeset
|
53 ParametersTypeData(config().dataLayoutParametersTypeDataTag), |
52b4284cb496
Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15193
diff
changeset
|
54 SpeculativeTrapData(config().dataLayoutSpeculativeTrapDataTag); |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
55 |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
56 private final int value; |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
57 |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
58 private Tag(int value) { |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
59 this.value = value; |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
60 } |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
61 |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
62 public int getValue() { |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
63 return value; |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
64 } |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
65 |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
66 private static HotSpotVMConfig config() { |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
67 return runtime().getConfig(); |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
68 } |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
69 |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
70 public static Tag getEnum(int value) { |
19395
a306749d3e86
Lookup Tag based on index in enum value array.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18041
diff
changeset
|
71 Tag result = values()[value]; |
a306749d3e86
Lookup Tag based on index in enum value array.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18041
diff
changeset
|
72 assert value == result.value; |
a306749d3e86
Lookup Tag based on index in enum value array.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18041
diff
changeset
|
73 return result; |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
74 } |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
75 } |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
76 |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
77 /** |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
78 * Returns the {@link Tag} stored in the LayoutData header. |
14909 | 79 * |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
80 * @return tag stored in the LayoutData header |
4448
9e8e92c3ff17
first parts for inlining multiple methods, added Simplifiable to switch nodes, some documentation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4441
diff
changeset
|
81 */ |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
13139
diff
changeset
|
82 Tag getTag(); |
4448
9e8e92c3ff17
first parts for inlining multiple methods, added Simplifiable to switch nodes, some documentation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4441
diff
changeset
|
83 |
9e8e92c3ff17
first parts for inlining multiple methods, added Simplifiable to switch nodes, some documentation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4441
diff
changeset
|
84 /** |
9e8e92c3ff17
first parts for inlining multiple methods, added Simplifiable to switch nodes, some documentation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4441
diff
changeset
|
85 * Returns the BCI stored in the LayoutData header. |
14909 | 86 * |
14906 | 87 * @return An integer ≥ 0 and ≤ Short.MAX_VALUE, or -1 if not supported. |
4448
9e8e92c3ff17
first parts for inlining multiple methods, added Simplifiable to switch nodes, some documentation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4441
diff
changeset
|
88 */ |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
89 int getBCI(HotSpotMethodData data, int position); |
4448
9e8e92c3ff17
first parts for inlining multiple methods, added Simplifiable to switch nodes, some documentation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4441
diff
changeset
|
90 |
9e8e92c3ff17
first parts for inlining multiple methods, added Simplifiable to switch nodes, some documentation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4441
diff
changeset
|
91 /** |
9e8e92c3ff17
first parts for inlining multiple methods, added Simplifiable to switch nodes, some documentation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4441
diff
changeset
|
92 * Computes the size for the specific data at the given position. |
14909 | 93 * |
14906 | 94 * @return An integer > 0. |
4448
9e8e92c3ff17
first parts for inlining multiple methods, added Simplifiable to switch nodes, some documentation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4441
diff
changeset
|
95 */ |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
96 int getSize(HotSpotMethodData data, int position); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
97 |
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:
5507
diff
changeset
|
98 JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
99 |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8610
diff
changeset
|
100 JavaMethodProfile getMethodProfile(HotSpotMethodData data, int position); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8610
diff
changeset
|
101 |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
102 double getBranchTakenProbability(HotSpotMethodData data, int position); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
103 |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
104 double[] getSwitchProbabilities(HotSpotMethodData data, int position); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
105 |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7530
diff
changeset
|
106 TriState getExceptionSeen(HotSpotMethodData data, int position); |
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7530
diff
changeset
|
107 |
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7530
diff
changeset
|
108 TriState getNullSeen(HotSpotMethodData data, int position); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
109 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
110 int getExecutionCount(HotSpotMethodData data, int position); |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
9760
diff
changeset
|
111 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
9760
diff
changeset
|
112 StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
113 } |