Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java @ 23677:eb166b568645
Merge
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Thu, 09 Jun 2016 18:58:09 -0700 |
parents | 4b58c92e939b |
children | 9e1235406b59 |
rev | line source |
---|---|
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
1 /* |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
4439
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 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22582
diff
changeset
|
23 package jdk.vm.ci.hotspot; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
24 |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22562
diff
changeset
|
25 import static java.lang.String.format; |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22582
diff
changeset
|
26 import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22582
diff
changeset
|
27 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22582
diff
changeset
|
28 import static jdk.vm.ci.hotspot.HotSpotVMConfig.config; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22582
diff
changeset
|
29 import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; |
4470
b7ec250cd29c
fixes after merge
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4467
diff
changeset
|
30 |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22562
diff
changeset
|
31 import java.util.Arrays; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
32 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22582
diff
changeset
|
33 import jdk.vm.ci.hotspot.HotSpotMethodDataAccessor.Tag; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22582
diff
changeset
|
34 import jdk.vm.ci.meta.DeoptimizationReason; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22582
diff
changeset
|
35 import jdk.vm.ci.meta.JavaMethodProfile; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22582
diff
changeset
|
36 import jdk.vm.ci.meta.JavaMethodProfile.ProfiledMethod; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22582
diff
changeset
|
37 import jdk.vm.ci.meta.JavaTypeProfile; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22582
diff
changeset
|
38 import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22582
diff
changeset
|
39 import jdk.vm.ci.meta.ResolvedJavaMethod; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22582
diff
changeset
|
40 import jdk.vm.ci.meta.ResolvedJavaType; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22582
diff
changeset
|
41 import jdk.vm.ci.meta.TriState; |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22562
diff
changeset
|
42 import sun.misc.Unsafe; |
18567
37d88a4af2ab
removed references to HotSpotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18546
diff
changeset
|
43 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
44 /** |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
45 * Access to a HotSpot MethodData structure (defined in methodData.hpp). |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
46 */ |
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:
19724
diff
changeset
|
47 public final class HotSpotMethodData { |
4444 | 48 |
22581
3884a98ebcde
consistently use HotSpotVMConfig.config() for static access to the HotSpotVMConfig instance
Doug Simon <doug.simon@oracle.com>
parents:
22573
diff
changeset
|
49 private static final HotSpotVMConfig config = config(); |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
50 private static final HotSpotMethodDataAccessor NO_DATA_NO_EXCEPTION_ACCESSOR = new NoMethodData(TriState.FALSE); |
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
51 private static final HotSpotMethodDataAccessor NO_DATA_EXCEPTION_POSSIBLY_NOT_RECORDED_ACCESSOR = new NoMethodData(TriState.UNKNOWN); |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
52 |
4448
9e8e92c3ff17
first parts for inlining multiple methods, added Simplifiable to switch nodes, some documentation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4447
diff
changeset
|
53 // sorted by tag |
13182 | 54 // @formatter:off |
55 private static final HotSpotMethodDataAccessor[] PROFILE_DATA_ACCESSORS = { | |
56 null, | |
57 new BitData(), | |
58 new CounterData(), | |
59 new JumpData(), | |
22572
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
60 new ReceiverTypeData(), |
13182 | 61 new VirtualCallData(), |
62 new RetData(), | |
63 new BranchData(), | |
64 new MultiBranchData(), | |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
65 new ArgInfoData(), |
22573
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
66 new UnknownProfileData(Tag.CallTypeData), |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
67 new VirtualCallTypeData(), |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
68 new UnknownProfileData(Tag.ParametersTypeData), |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
69 new UnknownProfileData(Tag.SpeculativeTrapData), |
13182 | 70 }; |
71 // @formatter:on | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
72 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
73 /** |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
74 * Reference to the C++ MethodData object. |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
75 */ |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
76 private final long metaspaceMethodData; |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
77 @SuppressWarnings("unused") private final HotSpotResolvedJavaMethodImpl method; |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
78 |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
79 public HotSpotMethodData(long metaspaceMethodData, HotSpotResolvedJavaMethodImpl method) { |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
80 this.metaspaceMethodData = metaspaceMethodData; |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
81 this.method = method; |
13241 | 82 } |
83 | |
84 /** | |
85 * @return value of the MethodData::_data_size field | |
86 */ | |
87 private int normalDataSize() { | |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
88 return UNSAFE.getInt(metaspaceMethodData + config.methodDataDataSize); |
13241 | 89 } |
90 | |
91 /** | |
92 * Returns the size of the extra data records. This method does the same calculation as | |
93 * MethodData::extra_data_size(). | |
16479
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
15291
diff
changeset
|
94 * |
13241 | 95 * @return size of extra data records |
96 */ | |
97 private int extraDataSize() { | |
98 final int extraDataBase = config.methodDataOopDataOffset + normalDataSize(); | |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
99 final int extraDataLimit = UNSAFE.getInt(metaspaceMethodData + config.methodDataSize); |
13241 | 100 return extraDataLimit - extraDataBase; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
101 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
102 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
103 public boolean hasNormalData() { |
13241 | 104 return normalDataSize() > 0; |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
105 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
106 |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
107 public boolean hasExtraData() { |
13241 | 108 return extraDataSize() > 0; |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
109 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
110 |
4476
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4470
diff
changeset
|
111 public int getExtraDataBeginOffset() { |
13241 | 112 return normalDataSize(); |
4476
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4470
diff
changeset
|
113 } |
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4470
diff
changeset
|
114 |
4444 | 115 public boolean isWithin(int position) { |
13241 | 116 return position >= 0 && position < normalDataSize() + extraDataSize(); |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
117 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
118 |
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:
5534
diff
changeset
|
119 public int getDeoptimizationCount(DeoptimizationReason reason) { |
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:
21411
diff
changeset
|
120 HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) runtime().getHostJVMCIBackend().getMetaAccess(); |
18301
0f41072d8bbc
moved use of HotSpotMetaAccessProvider to locations on the "local" side of remote compilation
Doug Simon <doug.simon@oracle.com>
parents:
18223
diff
changeset
|
121 int reasonIndex = metaAccess.convertDeoptReason(reason); |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
122 return UNSAFE.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + reasonIndex) & 0xFF; |
5114
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5061
diff
changeset
|
123 } |
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5061
diff
changeset
|
124 |
13216
51e97f88c771
Profile deoptimizations of OSR methods separately.
Roland Schatz <roland.schatz@oracle.com>
parents:
13182
diff
changeset
|
125 public int getOSRDeoptimizationCount(DeoptimizationReason reason) { |
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:
21411
diff
changeset
|
126 HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) runtime().getHostJVMCIBackend().getMetaAccess(); |
18301
0f41072d8bbc
moved use of HotSpotMetaAccessProvider to locations on the "local" side of remote compilation
Doug Simon <doug.simon@oracle.com>
parents:
18223
diff
changeset
|
127 int reasonIndex = metaAccess.convertDeoptReason(reason); |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
128 return UNSAFE.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + config.deoptReasonOSROffset + reasonIndex) & 0xFF; |
13216
51e97f88c771
Profile deoptimizations of OSR methods separately.
Roland Schatz <roland.schatz@oracle.com>
parents:
13182
diff
changeset
|
129 } |
51e97f88c771
Profile deoptimizations of OSR methods separately.
Roland Schatz <roland.schatz@oracle.com>
parents:
13182
diff
changeset
|
130 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
131 public HotSpotMethodDataAccessor getNormalData(int position) { |
13241 | 132 if (position >= normalDataSize()) { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
133 return null; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
134 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
135 |
4476
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4470
diff
changeset
|
136 HotSpotMethodDataAccessor result = getData(position); |
22573
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
137 final Tag tag = AbstractMethodData.readTag(this, position); |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
138 assert result != null : "NO_DATA tag is not allowed " + tag; |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
139 return result; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
140 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
141 |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
142 public HotSpotMethodDataAccessor getExtraData(int position) { |
13241 | 143 if (position >= normalDataSize() + extraDataSize()) { |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
144 return null; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
145 } |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
146 HotSpotMethodDataAccessor data = getData(position); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
147 if (data != null) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
148 return data; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
149 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
150 return data; |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
151 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
152 |
4564
8fc6920e064b
avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4552
diff
changeset
|
153 public static HotSpotMethodDataAccessor getNoDataAccessor(boolean exceptionPossiblyNotRecorded) { |
8fc6920e064b
avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4552
diff
changeset
|
154 if (exceptionPossiblyNotRecorded) { |
8fc6920e064b
avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4552
diff
changeset
|
155 return NO_DATA_EXCEPTION_POSSIBLY_NOT_RECORDED_ACCESSOR; |
8fc6920e064b
avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4552
diff
changeset
|
156 } else { |
8fc6920e064b
avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4552
diff
changeset
|
157 return NO_DATA_NO_EXCEPTION_ACCESSOR; |
8fc6920e064b
avoid recursive inlining, escape analysis does no longer restart inlining with level 0, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4552
diff
changeset
|
158 } |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
159 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
160 |
4476
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4470
diff
changeset
|
161 private HotSpotMethodDataAccessor getData(int position) { |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
162 assert position >= 0 : "out of bounds"; |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
163 final Tag tag = AbstractMethodData.readTag(this, position); |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
164 HotSpotMethodDataAccessor accessor = PROFILE_DATA_ACCESSORS[tag.getValue()]; |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
165 assert accessor == null || accessor.getTag() == tag : "wrong data accessor " + accessor + " for tag " + tag; |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
166 return accessor; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
167 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
168 |
4444 | 169 private int readUnsignedByte(int position, int offsetInBytes) { |
170 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); | |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
171 return UNSAFE.getByte(metaspaceMethodData + fullOffsetInBytes) & 0xFF; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
172 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
173 |
4444 | 174 private int readUnsignedShort(int position, int offsetInBytes) { |
175 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); | |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
176 return UNSAFE.getShort(metaspaceMethodData + fullOffsetInBytes) & 0xFFFF; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
177 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
178 |
11212
3718acd022db
fix HotSpotMethodData to read the correct values on little and big endian
twisti
parents:
9928
diff
changeset
|
179 /** |
3718acd022db
fix HotSpotMethodData to read the correct values on little and big endian
twisti
parents:
9928
diff
changeset
|
180 * Since the values are stored in cells (platform words) this method uses |
18567
37d88a4af2ab
removed references to HotSpotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18546
diff
changeset
|
181 * {@link Unsafe#getAddress} to read the right value on both little and big endian machines. |
11212
3718acd022db
fix HotSpotMethodData to read the correct values on little and big endian
twisti
parents:
9928
diff
changeset
|
182 */ |
4444 | 183 private long readUnsignedInt(int position, int offsetInBytes) { |
184 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); | |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
185 return UNSAFE.getAddress(metaspaceMethodData + fullOffsetInBytes) & 0xFFFFFFFFL; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
186 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
187 |
4444 | 188 private int readUnsignedIntAsSignedInt(int position, int offsetInBytes) { |
189 long value = readUnsignedInt(position, offsetInBytes); | |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
190 return truncateLongToInt(value); |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
191 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
192 |
11212
3718acd022db
fix HotSpotMethodData to read the correct values on little and big endian
twisti
parents:
9928
diff
changeset
|
193 /** |
3718acd022db
fix HotSpotMethodData to read the correct values on little and big endian
twisti
parents:
9928
diff
changeset
|
194 * Since the values are stored in cells (platform words) this method uses |
18567
37d88a4af2ab
removed references to HotSpotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18546
diff
changeset
|
195 * {@link Unsafe#getAddress} to read the right value on both little and big endian machines. |
11212
3718acd022db
fix HotSpotMethodData to read the correct values on little and big endian
twisti
parents:
9928
diff
changeset
|
196 */ |
4444 | 197 private int readInt(int position, int offsetInBytes) { |
198 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); | |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
199 return (int) UNSAFE.getAddress(metaspaceMethodData + fullOffsetInBytes); |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
200 } |
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
201 |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
202 private HotSpotResolvedJavaMethod readMethod(int position, int offsetInBytes) { |
4444 | 203 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
204 return compilerToVM().getResolvedJavaMethod(null, metaspaceMethodData + fullOffsetInBytes); |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
205 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
206 |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
207 private HotSpotResolvedObjectTypeImpl readKlass(int position, int offsetInBytes) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
208 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); |
22582
232c53e17ea0
added CompilerToVM.compilerToVM() for static access to the CompilerToVM instance
Doug Simon <doug.simon@oracle.com>
parents:
22581
diff
changeset
|
209 return compilerToVM().getResolvedJavaType(null, metaspaceMethodData + fullOffsetInBytes, false); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
210 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
211 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
212 private static int truncateLongToInt(long value) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
213 return value > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) value; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
214 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
215 |
4444 | 216 private static int computeFullOffset(int position, int offsetInBytes) { |
217 return config.methodDataOopDataOffset + position + offsetInBytes; | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
218 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
219 |
4444 | 220 private static int cellIndexToOffset(int cells) { |
221 return config.dataLayoutHeaderSize + cellsToBytes(cells); | |
222 } | |
223 | |
224 private static int cellsToBytes(int cells) { | |
225 return cells * config.dataLayoutCellSize; | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
226 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
227 |
13769
af344056124f
Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13312
diff
changeset
|
228 /** |
af344056124f
Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13312
diff
changeset
|
229 * Returns whether profiling ran long enough that the profile information is mature. Other |
af344056124f
Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13312
diff
changeset
|
230 * informational data will still be valid even if the profile isn't mature. |
af344056124f
Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13312
diff
changeset
|
231 */ |
af344056124f
Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13312
diff
changeset
|
232 public boolean isProfileMature() { |
af344056124f
Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13312
diff
changeset
|
233 return runtime().getCompilerToVM().isMature(metaspaceMethodData); |
af344056124f
Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13312
diff
changeset
|
234 } |
af344056124f
Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13312
diff
changeset
|
235 |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
236 @Override |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
237 public String toString() { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
238 StringBuilder sb = new StringBuilder(); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
239 String nl = String.format("%n"); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
240 String nlIndent = String.format("%n%38s", ""); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
241 if (hasNormalData()) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
242 int pos = 0; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
243 HotSpotMethodDataAccessor data; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
244 while ((data = getNormalData(pos)) != null) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
245 if (pos != 0) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
246 sb.append(nl); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
247 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
248 int bci = data.getBCI(this, pos); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
249 sb.append(String.format("%-6d bci: %-6d%-20s", pos, bci, data.getClass().getSimpleName())); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
250 sb.append(data.appendTo(new StringBuilder(), this, pos).toString().replace(nl, nlIndent)); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
251 pos = pos + data.getSize(this, pos); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
252 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
253 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
254 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
255 if (hasExtraData()) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
256 int pos = getExtraDataBeginOffset(); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
257 HotSpotMethodDataAccessor data; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
258 while ((data = getExtraData(pos)) != null) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
259 if (pos == getExtraDataBeginOffset()) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
260 sb.append(nl).append("--- Extra data:"); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
261 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
262 int bci = data.getBCI(this, pos); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
263 sb.append(String.format("%n%-6d bci: %-6d%-20s", pos, bci, data.getClass().getSimpleName())); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
264 sb.append(data.appendTo(new StringBuilder(), this, pos).toString().replace(nl, nlIndent)); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
265 pos = pos + data.getSize(this, pos); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
266 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
267 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
268 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
269 return sb.toString(); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
270 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
271 |
4447 | 272 private abstract static class AbstractMethodData implements HotSpotMethodDataAccessor { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7391
diff
changeset
|
273 |
7154
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7084
diff
changeset
|
274 /** |
13164
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
13139
diff
changeset
|
275 * Corresponds to {@code exception_seen_flag}. |
7154
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7084
diff
changeset
|
276 */ |
22572
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
277 private static final int EXCEPTIONS_MASK = 1 << config.bitDataExceptionSeenFlag; |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
278 |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
279 private final Tag tag; |
22573
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
280 protected final int staticSize; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
281 |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
282 protected AbstractMethodData(Tag tag, int staticSize) { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
283 this.tag = tag; |
4444 | 284 this.staticSize = staticSize; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
285 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
286 |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
287 public Tag getTag() { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
288 return tag; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
289 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
290 |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
291 public static Tag readTag(HotSpotMethodData data, int position) { |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
292 final int tag = data.readUnsignedByte(position, config.dataLayoutTagOffset); |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
293 return Tag.getEnum(tag); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
294 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
295 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
296 @Override |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
297 public int getBCI(HotSpotMethodData data, int position) { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
298 return data.readUnsignedShort(position, config.dataLayoutBCIOffset); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
299 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
300 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
301 @Override |
22573
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
302 public final int getSize(HotSpotMethodData data, int position) { |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
303 int size = staticSize + getDynamicSize(data, position); |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
304 // Sanity check against VM |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
305 int vmSize = HotSpotJVMCIRuntime.runtime().compilerToVm.methodDataProfileDataSize(data.metaspaceMethodData, position); |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
306 assert size == vmSize : size + " != " + vmSize; |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
307 return size; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
308 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
309 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
310 @Override |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
311 public 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:
7556
diff
changeset
|
312 return TriState.get((getFlags(data, position) & EXCEPTIONS_MASK) != 0); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
313 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
314 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
315 @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:
5534
diff
changeset
|
316 public JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position) { |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
317 return null; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
318 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
319 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
320 @Override |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
321 public JavaMethodProfile getMethodProfile(HotSpotMethodData data, int position) { |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
322 return null; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
323 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
324 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
325 @Override |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
326 public double getBranchTakenProbability(HotSpotMethodData data, int position) { |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
327 return -1; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
328 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
329 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
330 @Override |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
331 public double[] getSwitchProbabilities(HotSpotMethodData data, int position) { |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
332 return null; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
333 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
334 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
335 @Override |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
336 public int getExecutionCount(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
337 return -1; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
338 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
339 |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
340 @Override |
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
341 public TriState getNullSeen(HotSpotMethodData data, int position) { |
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
342 return TriState.UNKNOWN; |
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
343 } |
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
344 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
345 protected int getFlags(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
346 return data.readUnsignedByte(position, config.dataLayoutFlagsOffset); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
347 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
348 |
18546
5851c17b571e
removed usages of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18301
diff
changeset
|
349 /** |
5851c17b571e
removed usages of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18301
diff
changeset
|
350 * @param data |
5851c17b571e
removed usages of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18301
diff
changeset
|
351 * @param position |
5851c17b571e
removed usages of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18301
diff
changeset
|
352 */ |
5851c17b571e
removed usages of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18301
diff
changeset
|
353 protected int getDynamicSize(HotSpotMethodData data, int position) { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
354 return 0; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
355 } |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
356 |
13164
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
13139
diff
changeset
|
357 public abstract StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
358 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
359 |
4447 | 360 private static class NoMethodData extends AbstractMethodData { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7391
diff
changeset
|
361 |
4444 | 362 private static final int NO_DATA_SIZE = cellIndexToOffset(0); |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
363 |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
364 private final TriState exceptionSeen; |
4527
a0cca63cd366
fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4526
diff
changeset
|
365 |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
366 protected NoMethodData(TriState exceptionSeen) { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
367 super(Tag.No, NO_DATA_SIZE); |
4527
a0cca63cd366
fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4526
diff
changeset
|
368 this.exceptionSeen = exceptionSeen; |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
369 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
370 |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
371 @Override |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
372 public int getBCI(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
373 return -1; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
374 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
375 |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
376 @Override |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
377 public TriState getExceptionSeen(HotSpotMethodData data, int position) { |
4527
a0cca63cd366
fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4526
diff
changeset
|
378 return exceptionSeen; |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
379 } |
13164
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
13139
diff
changeset
|
380 |
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
13139
diff
changeset
|
381 @Override |
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
13139
diff
changeset
|
382 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { |
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
13139
diff
changeset
|
383 return sb; |
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
13139
diff
changeset
|
384 } |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
385 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
386 |
4447 | 387 private static class BitData extends AbstractMethodData { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7391
diff
changeset
|
388 |
4444 | 389 private static final int BIT_DATA_SIZE = cellIndexToOffset(0); |
22572
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
390 private static final int BIT_DATA_NULL_SEEN_FLAG = 1 << config.bitDataNullSeenFlag; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
391 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
392 private BitData() { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
393 super(Tag.BitData, BIT_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
394 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
395 |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
396 protected BitData(Tag tag, int staticSize) { |
4444 | 397 super(tag, staticSize); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
398 } |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
399 |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
400 @Override |
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
401 public TriState getNullSeen(HotSpotMethodData data, int position) { |
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
402 return TriState.get((getFlags(data, position) & BIT_DATA_NULL_SEEN_FLAG) != 0); |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
403 } |
13164
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
13139
diff
changeset
|
404 |
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
13139
diff
changeset
|
405 @Override |
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
13139
diff
changeset
|
406 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { |
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
13139
diff
changeset
|
407 return sb.append(format("exception_seen(%s)", getExceptionSeen(data, pos))); |
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
13139
diff
changeset
|
408 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
409 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
410 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
411 private static class CounterData extends BitData { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7391
diff
changeset
|
412 |
4444 | 413 private static final int COUNTER_DATA_SIZE = cellIndexToOffset(1); |
22572
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
414 private static final int COUNTER_DATA_COUNT_OFFSET = cellIndexToOffset(config.methodDataCountOffset); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
415 |
23297
4b58c92e939b
remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents:
22672
diff
changeset
|
416 CounterData() { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
417 super(Tag.CounterData, COUNTER_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
418 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
419 |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
420 protected CounterData(Tag tag, int staticSize) { |
4444 | 421 super(tag, staticSize); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
422 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
423 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
424 @Override |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
425 public int getExecutionCount(HotSpotMethodData data, int position) { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
426 return getCounterValue(data, position); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
427 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
428 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
429 protected int getCounterValue(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
430 return data.readUnsignedIntAsSignedInt(position, COUNTER_DATA_COUNT_OFFSET); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
431 } |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
432 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
433 @Override |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
434 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { |
13312
323d99404728
added missing exception_seen and null_seen info info when formatting some profile data as strings
Doug Simon <doug.simon@oracle.com>
parents:
13259
diff
changeset
|
435 return sb.append(format("count(%d) null_seen(%s) exception_seen(%s)", getCounterValue(data, pos), getNullSeen(data, pos), getExceptionSeen(data, pos))); |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
436 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
437 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
438 |
4447 | 439 private static class JumpData extends AbstractMethodData { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7391
diff
changeset
|
440 |
4444 | 441 private static final int JUMP_DATA_SIZE = cellIndexToOffset(2); |
22572
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
442 protected static final int TAKEN_COUNT_OFFSET = cellIndexToOffset(config.jumpDataTakenOffset); |
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
443 protected static final int TAKEN_DISPLACEMENT_OFFSET = cellIndexToOffset(config.jumpDataDisplacementOffset); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
444 |
23297
4b58c92e939b
remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents:
22672
diff
changeset
|
445 JumpData() { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
446 super(Tag.JumpData, JUMP_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
447 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
448 |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
449 protected JumpData(Tag tag, int staticSize) { |
4444 | 450 super(tag, staticSize); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
451 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
452 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
453 @Override |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
454 public double getBranchTakenProbability(HotSpotMethodData data, int position) { |
5039
f3d2447db2d9
added detection for endless recompilation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4564
diff
changeset
|
455 return getExecutionCount(data, position) != 0 ? 1 : 0; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
456 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
457 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
458 @Override |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
459 public int getExecutionCount(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
460 return data.readUnsignedIntAsSignedInt(position, TAKEN_COUNT_OFFSET); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
461 } |
4452
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
462 |
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
463 public int getTakenDisplacement(HotSpotMethodData data, int position) { |
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
464 return data.readInt(position, TAKEN_DISPLACEMENT_OFFSET); |
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
465 } |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
466 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
467 @Override |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
468 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { |
13164
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
13139
diff
changeset
|
469 return sb.append(format("taken(%d) displacement(%d)", getExecutionCount(data, pos), getTakenDisplacement(data, pos))); |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
470 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
471 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
472 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
473 static class RawItemProfile<T> { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
474 final int entries; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
475 final T[] items; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
476 final long[] counts; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
477 final long totalCount; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
478 |
23297
4b58c92e939b
remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents:
22672
diff
changeset
|
479 RawItemProfile(int entries, T[] items, long[] counts, long totalCount) { |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
480 this.entries = entries; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
481 this.items = items; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
482 this.counts = counts; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
483 this.totalCount = totalCount; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
484 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
485 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
486 |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
487 private abstract static class AbstractTypeData extends CounterData { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7391
diff
changeset
|
488 |
22572
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
489 protected static final int TYPE_DATA_ROW_SIZE = cellsToBytes(config.receiverTypeDataReceiverTypeRowCellCount); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
490 |
22572
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
491 protected static final int NONPROFILED_COUNT_OFFSET = cellIndexToOffset(config.receiverTypeDataNonprofiledCountOffset); |
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
492 protected static final int TYPE_DATA_FIRST_TYPE_OFFSET = cellIndexToOffset(config.receiverTypeDataReceiver0Offset); |
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
493 protected static final int TYPE_DATA_FIRST_TYPE_COUNT_OFFSET = cellIndexToOffset(config.receiverTypeDataCount0Offset); |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
494 |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
495 protected AbstractTypeData(Tag tag, int staticSize) { |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
496 super(tag, staticSize); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
497 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
498 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
499 @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:
5534
diff
changeset
|
500 public JavaTypeProfile getTypeProfile(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:
12456
diff
changeset
|
501 return createTypeProfile(getNullSeen(data, position), getRawTypeProfile(data, position)); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
502 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
503 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
504 private RawItemProfile<ResolvedJavaType> getRawTypeProfile(HotSpotMethodData data, int position) { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
505 int typeProfileWidth = config.typeProfileWidth; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
506 |
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:
5534
diff
changeset
|
507 ResolvedJavaType[] types = new ResolvedJavaType[typeProfileWidth]; |
5335
439ca5ecc7dc
types profiles are now sorted in descending order of each profiled type's probability
Doug Simon <doug.simon@oracle.com>
parents:
5321
diff
changeset
|
508 long[] counts = new long[typeProfileWidth]; |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
509 long totalCount = 0; |
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
510 int entries = 0; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
511 |
16616
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
512 outer: for (int i = 0; i < typeProfileWidth; i++) { |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
513 HotSpotResolvedObjectTypeImpl receiverKlass = data.readKlass(position, getTypeOffset(i)); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
514 if (receiverKlass != null) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
515 HotSpotResolvedObjectTypeImpl klass = receiverKlass; |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
516 long count = data.readUnsignedInt(position, getTypeCountOffset(i)); |
16616
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
517 /* |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
518 * Because of races in the profile collection machinery it's possible for a |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
519 * class to appear multiple times so merge them to make the profile look |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
520 * rational. |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
521 */ |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
522 for (int j = 0; j < entries; j++) { |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
523 if (types[j].equals(klass)) { |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
524 totalCount += count; |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
525 counts[j] += count; |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
526 continue outer; |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
527 } |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
528 } |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
529 types[entries] = klass; |
4447 | 530 totalCount += count; |
531 counts[entries] = count; | |
532 entries++; | |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
533 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
534 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
535 |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
536 totalCount += getTypesNotRecordedExecutionCount(data, position); |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
537 return new RawItemProfile<>(entries, types, counts, totalCount); |
4447 | 538 } |
539 | |
7154
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7084
diff
changeset
|
540 protected abstract long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position); |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
541 |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
542 private static JavaTypeProfile createTypeProfile(TriState nullSeen, RawItemProfile<ResolvedJavaType> profile) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
543 if (profile.entries <= 0 || profile.totalCount <= 0) { |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
544 return null; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
545 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
546 |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
547 ProfiledType[] ptypes = new ProfiledType[profile.entries]; |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
548 double totalProbability = 0.0; |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
549 for (int i = 0; i < profile.entries; i++) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
550 double p = profile.counts[i]; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
551 p = p / profile.totalCount; |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
552 totalProbability += p; |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
553 ptypes[i] = new ProfiledType(profile.items[i], p); |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
554 } |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
555 |
5335
439ca5ecc7dc
types profiles are now sorted in descending order of each profiled type's probability
Doug Simon <doug.simon@oracle.com>
parents:
5321
diff
changeset
|
556 Arrays.sort(ptypes); |
439ca5ecc7dc
types profiles are now sorted in descending order of each profiled type's probability
Doug Simon <doug.simon@oracle.com>
parents:
5321
diff
changeset
|
557 |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
558 double notRecordedTypeProbability = profile.entries < config.typeProfileWidth ? 0.0 : Math.min(1.0, Math.max(0.0, 1.0 - totalProbability)); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
559 assert notRecordedTypeProbability == 0 || profile.entries == config.typeProfileWidth; |
8659
bc7bb895e359
incorporated null-seen information into JavaTypeProfile
Doug Simon <doug.simon@oracle.com>
parents:
8616
diff
changeset
|
560 return new JavaTypeProfile(nullSeen, notRecordedTypeProbability, ptypes); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
561 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
562 |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
563 private static int getTypeOffset(int row) { |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
564 return TYPE_DATA_FIRST_TYPE_OFFSET + row * TYPE_DATA_ROW_SIZE; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
565 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
566 |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
567 protected static int getTypeCountOffset(int row) { |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
568 return TYPE_DATA_FIRST_TYPE_COUNT_OFFSET + row * TYPE_DATA_ROW_SIZE; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
569 } |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
570 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
571 @Override |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
572 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
573 RawItemProfile<ResolvedJavaType> profile = getRawTypeProfile(data, pos); |
13164
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
13139
diff
changeset
|
574 TriState nullSeen = getNullSeen(data, pos); |
13312
323d99404728
added missing exception_seen and null_seen info info when formatting some profile data as strings
Doug Simon <doug.simon@oracle.com>
parents:
13259
diff
changeset
|
575 TriState exceptionSeen = getExceptionSeen(data, pos); |
323d99404728
added missing exception_seen and null_seen info info when formatting some profile data as strings
Doug Simon <doug.simon@oracle.com>
parents:
13259
diff
changeset
|
576 sb.append(format("count(%d) null_seen(%s) exception_seen(%s) nonprofiled_count(%d) entries(%d)", getCounterValue(data, pos), nullSeen, exceptionSeen, |
323d99404728
added missing exception_seen and null_seen info info when formatting some profile data as strings
Doug Simon <doug.simon@oracle.com>
parents:
13259
diff
changeset
|
577 getTypesNotRecordedExecutionCount(data, pos), profile.entries)); |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
578 for (int i = 0; i < profile.entries; i++) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
579 long count = profile.counts[i]; |
16479
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
15291
diff
changeset
|
580 sb.append(format("%n %s (%d, %4.2f)", profile.items[i].toJavaName(), count, (double) count / profile.totalCount)); |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
581 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
582 return sb; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
583 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
584 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
585 |
22572
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
586 private static class ReceiverTypeData extends AbstractTypeData { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7391
diff
changeset
|
587 |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
588 private static final int TYPE_CHECK_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * config.typeProfileWidth; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
589 |
23297
4b58c92e939b
remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents:
22672
diff
changeset
|
590 ReceiverTypeData() { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
591 super(Tag.ReceiverTypeData, TYPE_CHECK_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
592 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
593 |
22572
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
594 protected ReceiverTypeData(Tag tag, int staticSize) { |
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
595 super(tag, staticSize); |
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
596 } |
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
597 |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
598 @Override |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
599 public int getExecutionCount(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
600 return -1; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
601 } |
7154
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7084
diff
changeset
|
602 |
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7084
diff
changeset
|
603 @Override |
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7084
diff
changeset
|
604 protected long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position) { |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
605 return data.readUnsignedIntAsSignedInt(position, NONPROFILED_COUNT_OFFSET); |
7154
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7084
diff
changeset
|
606 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
607 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
608 |
22572
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
609 private static class VirtualCallData extends ReceiverTypeData { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7391
diff
changeset
|
610 |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
611 private static final int VIRTUAL_CALL_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * (config.typeProfileWidth + config.methodProfileWidth); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
612 private static final int VIRTUAL_CALL_DATA_FIRST_METHOD_OFFSET = TYPE_DATA_FIRST_TYPE_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
613 private static final int VIRTUAL_CALL_DATA_FIRST_METHOD_COUNT_OFFSET = TYPE_DATA_FIRST_TYPE_COUNT_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
614 |
23297
4b58c92e939b
remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents:
22672
diff
changeset
|
615 VirtualCallData() { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
616 super(Tag.VirtualCallData, VIRTUAL_CALL_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
617 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
618 |
22573
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
619 protected VirtualCallData(Tag tag, int staticSize) { |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
620 super(tag, staticSize); |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
621 } |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
622 |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
623 @Override |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
624 public int getExecutionCount(HotSpotMethodData data, int position) { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
625 final int typeProfileWidth = config.typeProfileWidth; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
626 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
627 long total = 0; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
628 for (int i = 0; i < typeProfileWidth; i++) { |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
629 total += data.readUnsignedInt(position, getTypeCountOffset(i)); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
630 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
631 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
632 total += getCounterValue(data, position); |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
633 return truncateLongToInt(total); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
634 } |
7154
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7084
diff
changeset
|
635 |
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7084
diff
changeset
|
636 @Override |
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7084
diff
changeset
|
637 protected long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position) { |
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7084
diff
changeset
|
638 return getCounterValue(data, position); |
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7084
diff
changeset
|
639 } |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
640 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
641 private static long getMethodsNotRecordedExecutionCount(HotSpotMethodData data, int position) { |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
642 return data.readUnsignedIntAsSignedInt(position, NONPROFILED_COUNT_OFFSET); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
643 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
644 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
645 @Override |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
646 public JavaMethodProfile getMethodProfile(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:
12456
diff
changeset
|
647 return createMethodProfile(getRawMethodProfile(data, position)); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
648 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
649 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
650 private static RawItemProfile<ResolvedJavaMethod> getRawMethodProfile(HotSpotMethodData data, int position) { |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
651 int profileWidth = config.methodProfileWidth; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
652 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
653 ResolvedJavaMethod[] methods = new ResolvedJavaMethod[profileWidth]; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
654 long[] counts = new long[profileWidth]; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
655 long totalCount = 0; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
656 int entries = 0; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
657 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
658 for (int i = 0; i < profileWidth; i++) { |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
659 HotSpotResolvedJavaMethod method = data.readMethod(position, getMethodOffset(i)); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
660 if (method != null) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
661 methods[entries] = method; |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
662 long count = data.readUnsignedInt(position, getMethodCountOffset(i)); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
663 totalCount += count; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
664 counts[entries] = count; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
665 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
666 entries++; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
667 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
668 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
669 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
670 totalCount += getMethodsNotRecordedExecutionCount(data, position); |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
671 return new RawItemProfile<>(entries, methods, counts, totalCount); |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
672 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
673 |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
674 private static JavaMethodProfile createMethodProfile(RawItemProfile<ResolvedJavaMethod> profile) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
675 if (profile.entries <= 0 || profile.totalCount <= 0) { |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
676 return null; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
677 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
678 |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
679 ProfiledMethod[] pmethods = new ProfiledMethod[profile.entries]; |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
680 double totalProbability = 0.0; |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
681 for (int i = 0; i < profile.entries; i++) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
682 double p = profile.counts[i]; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
683 p = p / profile.totalCount; |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
684 totalProbability += p; |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
685 pmethods[i] = new ProfiledMethod(profile.items[i], p); |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
686 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
687 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
688 Arrays.sort(pmethods); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
689 |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
690 double notRecordedMethodProbability = profile.entries < config.methodProfileWidth ? 0.0 : Math.min(1.0, Math.max(0.0, 1.0 - totalProbability)); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
691 assert notRecordedMethodProbability == 0 || profile.entries == config.methodProfileWidth; |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
692 return new JavaMethodProfile(notRecordedMethodProbability, pmethods); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
693 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
694 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
695 private static int getMethodOffset(int row) { |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
696 return VIRTUAL_CALL_DATA_FIRST_METHOD_OFFSET + row * TYPE_DATA_ROW_SIZE; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
697 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
698 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
699 private static int getMethodCountOffset(int row) { |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
700 return VIRTUAL_CALL_DATA_FIRST_METHOD_COUNT_OFFSET + row * TYPE_DATA_ROW_SIZE; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
701 } |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
702 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
703 @Override |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
704 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
705 RawItemProfile<ResolvedJavaMethod> profile = getRawMethodProfile(data, pos); |
13164
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
13139
diff
changeset
|
706 super.appendTo(sb.append(format("exception_seen(%s) ", getExceptionSeen(data, pos))), data, pos).append(format("%nmethod_entries(%d)", profile.entries)); |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
707 for (int i = 0; i < profile.entries; i++) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
708 long count = profile.counts[i]; |
16480
10c12d09a8d2
moved format(String format, JavaMethod method) from MetaUtil to be a default method in JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
16479
diff
changeset
|
709 sb.append(format("%n %s (%d, %4.2f)", profile.items[i].format("%H.%n(%p)"), count, (double) count / profile.totalCount)); |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
710 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
711 return sb; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
712 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
713 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
714 |
22573
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
715 private static class VirtualCallTypeData extends VirtualCallData { |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
716 |
23297
4b58c92e939b
remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents:
22672
diff
changeset
|
717 VirtualCallTypeData() { |
22573
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
718 super(Tag.VirtualCallTypeData, 0); |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
719 } |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
720 |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
721 @Override |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
722 protected int getDynamicSize(HotSpotMethodData data, int position) { |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
723 assert staticSize == 0; |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
724 return HotSpotJVMCIRuntime.runtime().compilerToVm.methodDataProfileDataSize(data.metaspaceMethodData, position); |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
725 } |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
726 } |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
727 |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
728 private static class RetData extends CounterData { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7391
diff
changeset
|
729 |
4444 | 730 private static final int RET_DATA_ROW_SIZE = cellsToBytes(3); |
731 private static final int RET_DATA_SIZE = cellIndexToOffset(1) + RET_DATA_ROW_SIZE * config.bciProfileWidth; | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
732 |
23297
4b58c92e939b
remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents:
22672
diff
changeset
|
733 RetData() { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
734 super(Tag.RetData, RET_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
735 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
736 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
737 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
738 private static class BranchData extends JumpData { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7391
diff
changeset
|
739 |
4444 | 740 private static final int BRANCH_DATA_SIZE = cellIndexToOffset(3); |
22572
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
741 private static final int NOT_TAKEN_COUNT_OFFSET = cellIndexToOffset(config.branchDataNotTakenOffset); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
742 |
23297
4b58c92e939b
remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents:
22672
diff
changeset
|
743 BranchData() { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
744 super(Tag.BranchData, BRANCH_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
745 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
746 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
747 @Override |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
748 public double getBranchTakenProbability(HotSpotMethodData data, int position) { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
749 long takenCount = data.readUnsignedInt(position, TAKEN_COUNT_OFFSET); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
750 long notTakenCount = data.readUnsignedInt(position, NOT_TAKEN_COUNT_OFFSET); |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
751 long total = takenCount + notTakenCount; |
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
752 |
9928
a9311ec68721
Avoid graph caching if immature or no profiling information was used for graph building.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9864
diff
changeset
|
753 return total <= 0 ? -1 : takenCount / (double) total; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
754 } |
4444 | 755 |
756 @Override | |
757 public int getExecutionCount(HotSpotMethodData data, int position) { | |
758 long count = data.readUnsignedInt(position, TAKEN_COUNT_OFFSET) + data.readUnsignedInt(position, NOT_TAKEN_COUNT_OFFSET); | |
759 return truncateLongToInt(count); | |
760 } | |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
761 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
762 @Override |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
763 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
764 long taken = data.readUnsignedInt(pos, TAKEN_COUNT_OFFSET); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
765 long notTaken = data.readUnsignedInt(pos, NOT_TAKEN_COUNT_OFFSET); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
766 double takenProbability = getBranchTakenProbability(data, pos); |
13164
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
13139
diff
changeset
|
767 return sb.append(format("taken(%d, %4.2f) not_taken(%d, %4.2f) displacement(%d)", taken, takenProbability, notTaken, 1.0D - takenProbability, getTakenDisplacement(data, pos))); |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
768 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
769 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
770 |
4447 | 771 private static class ArrayData extends AbstractMethodData { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7391
diff
changeset
|
772 |
22572
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
773 private static final int ARRAY_DATA_LENGTH_OFFSET = cellIndexToOffset(config.arrayDataArrayLenOffset); |
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
774 protected static final int ARRAY_DATA_START_OFFSET = cellIndexToOffset(config.arrayDataArrayStartOffset); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
775 |
23297
4b58c92e939b
remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents:
22672
diff
changeset
|
776 ArrayData(Tag tag, int staticSize) { |
4444 | 777 super(tag, staticSize); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
778 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
779 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
780 @Override |
4444 | 781 protected int getDynamicSize(HotSpotMethodData data, int position) { |
782 return cellsToBytes(getLength(data, position)); | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
783 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
784 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
785 protected static int getLength(HotSpotMethodData data, int position) { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
786 return data.readInt(position, ARRAY_DATA_LENGTH_OFFSET); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
787 } |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
788 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
789 @Override |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
790 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
791 return sb.append(format("length(%d)", getLength(data, pos))); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
792 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
793 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
794 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
795 private static class MultiBranchData extends ArrayData { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7391
diff
changeset
|
796 |
4444 | 797 private static final int MULTI_BRANCH_DATA_SIZE = cellIndexToOffset(1); |
22572
c3b49e9d0f48
HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
798 private static final int MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS = config.multiBranchDataPerCaseCellCount; |
4444 | 799 private static final int MULTI_BRANCH_DATA_ROW_SIZE = cellsToBytes(MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS); |
800 private static final int MULTI_BRANCH_DATA_FIRST_COUNT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(0); | |
801 private static final int MULTI_BRANCH_DATA_FIRST_DISPLACEMENT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(1); | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
802 |
23297
4b58c92e939b
remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents:
22672
diff
changeset
|
803 MultiBranchData() { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
804 super(Tag.MultiBranchData, MULTI_BRANCH_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
805 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
806 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
807 @Override |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
808 public double[] getSwitchProbabilities(HotSpotMethodData data, int position) { |
4444 | 809 int arrayLength = getLength(data, position); |
810 assert arrayLength > 0 : "switch must have at least the default case"; | |
811 assert arrayLength % MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS == 0 : "array must have full rows"; | |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
812 |
4444 | 813 int length = arrayLength / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS; |
814 long totalCount = 0; | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
815 double[] result = new double[length]; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
816 |
4447 | 817 // default case is first in HotSpot but last for the compiler |
818 long count = readCount(data, position, 0); | |
4446 | 819 totalCount += count; |
820 result[length - 1] = count; | |
821 | |
822 for (int i = 1; i < length; i++) { | |
4447 | 823 count = readCount(data, position, i); |
4444 | 824 totalCount += count; |
4446 | 825 result[i - 1] = count; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
826 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
827 |
9928
a9311ec68721
Avoid graph caching if immature or no profiling information was used for graph building.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9864
diff
changeset
|
828 if (totalCount <= 0) { |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
829 return null; |
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
830 } else { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
831 for (int i = 0; i < length; i++) { |
4444 | 832 result[i] = result[i] / totalCount; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
833 } |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
834 return result; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
835 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
836 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
837 |
4447 | 838 private static long readCount(HotSpotMethodData data, int position, int i) { |
839 int offset; | |
840 long count; | |
841 offset = getCountOffset(i); | |
842 count = data.readUnsignedInt(position, offset); | |
843 return count; | |
844 } | |
845 | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
846 @Override |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
847 public int getExecutionCount(HotSpotMethodData data, int position) { |
4444 | 848 int arrayLength = getLength(data, position); |
849 assert arrayLength > 0 : "switch must have at least the default case"; | |
850 assert arrayLength % MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS == 0 : "array must have full rows"; | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
851 |
4444 | 852 int length = arrayLength / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS; |
853 long totalCount = 0; | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
854 for (int i = 0; i < length; i++) { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
855 int offset = getCountOffset(i); |
4444 | 856 totalCount += data.readUnsignedInt(position, offset); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
857 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
858 |
4444 | 859 return truncateLongToInt(totalCount); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
860 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
861 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
862 private static int getCountOffset(int index) { |
4444 | 863 return MULTI_BRANCH_DATA_FIRST_COUNT_OFFSET + index * MULTI_BRANCH_DATA_ROW_SIZE; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
864 } |
4452
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
865 |
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
866 private static int getDisplacementOffset(int index) { |
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
867 return MULTI_BRANCH_DATA_FIRST_DISPLACEMENT_OFFSET + index * MULTI_BRANCH_DATA_ROW_SIZE; |
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
868 } |
13139
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
869 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
870 @Override |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
871 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
872 int entries = getLength(data, pos) / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
873 sb.append(format("entries(%d)", entries)); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
874 for (int i = 0; i < entries; i++) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
875 sb.append(format("%n %d: count(%d) displacement(%d)", i, data.readUnsignedInt(pos, getCountOffset(i)), data.readUnsignedInt(pos, getDisplacementOffset(i)))); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
876 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
877 return sb; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
878 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
879 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
880 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
881 private static class ArgInfoData extends ArrayData { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7391
diff
changeset
|
882 |
4444 | 883 private static final int ARG_INFO_DATA_SIZE = cellIndexToOffset(1); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
884 |
23297
4b58c92e939b
remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents:
22672
diff
changeset
|
885 ArgInfoData() { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
886 super(Tag.ArgInfoData, ARG_INFO_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
887 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
888 } |
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
|
889 |
22573
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
890 private static class UnknownProfileData extends AbstractMethodData { |
23297
4b58c92e939b
remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents:
22672
diff
changeset
|
891 UnknownProfileData(Tag tag) { |
22573
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
892 super(tag, 0); |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
893 } |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
894 |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
895 @Override |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
896 protected int getDynamicSize(HotSpotMethodData data, int position) { |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
897 assert staticSize == 0; |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
898 return HotSpotJVMCIRuntime.runtime().compilerToVm.methodDataProfileDataSize(data.metaspaceMethodData, position); |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
899 } |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
900 |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
901 @Override |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
902 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
903 // TODO Auto-generated method stub |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
904 return null; |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
905 } |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
906 } |
be44a5efeaff
HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22572
diff
changeset
|
907 |
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:
21411
diff
changeset
|
908 public void setCompiledIRSize(int size) { |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
909 UNSAFE.putInt(metaspaceMethodData + config.methodDataIRSizeOffset, size); |
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
|
910 } |
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
|
911 |
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:
21411
diff
changeset
|
912 public int getCompiledIRSize() { |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
913 return UNSAFE.getInt(metaspaceMethodData + config.methodDataIRSizeOffset); |
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
|
914 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
915 } |