annotate jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMethodData.java @ 22573:be44a5efeaff

HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Thu, 17 Sep 2015 12:11:28 -0700
parents c3b49e9d0f48
children 3884a98ebcde
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 */
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 21798
diff changeset
23 package jdk.internal.jvmci.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;
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22562
diff changeset
26 import static jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntime.runtime;
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
27 import static jdk.internal.jvmci.hotspot.UnsafeAccess.UNSAFE;
4470
b7ec250cd29c fixes after merge
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
28
22569
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22562
diff changeset
29 import java.util.Arrays;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
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 jdk.internal.jvmci.hotspot.HotSpotMethodDataAccessor.Tag;
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22562
diff changeset
32 import jdk.internal.jvmci.meta.DeoptimizationReason;
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22562
diff changeset
33 import jdk.internal.jvmci.meta.JavaMethodProfile;
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22562
diff changeset
34 import jdk.internal.jvmci.meta.JavaMethodProfile.ProfiledMethod;
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22562
diff changeset
35 import jdk.internal.jvmci.meta.JavaTypeProfile;
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22562
diff changeset
36 import jdk.internal.jvmci.meta.JavaTypeProfile.ProfiledType;
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22562
diff changeset
37 import jdk.internal.jvmci.meta.ResolvedJavaMethod;
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22562
diff changeset
38 import jdk.internal.jvmci.meta.ResolvedJavaType;
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22562
diff changeset
39 import jdk.internal.jvmci.meta.TriState;
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22562
diff changeset
40 import sun.misc.Unsafe;
18567
37d88a4af2ab removed references to HotSpotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents: 18546
diff changeset
41
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
42 /**
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
43 * 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
44 */
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
45 public final class HotSpotMethodData {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
46
12431
7080a96be216 rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents: 12429
diff changeset
47 private static final HotSpotVMConfig config = runtime().getConfig();
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
48 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
49 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
50
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
51 // sorted by tag
13182
599eaf3bc4b2 get DataLayout tags from VM
twisti
parents: 13164
diff changeset
52 // @formatter:off
599eaf3bc4b2 get DataLayout tags from VM
twisti
parents: 13164
diff changeset
53 private static final HotSpotMethodDataAccessor[] PROFILE_DATA_ACCESSORS = {
599eaf3bc4b2 get DataLayout tags from VM
twisti
parents: 13164
diff changeset
54 null,
599eaf3bc4b2 get DataLayout tags from VM
twisti
parents: 13164
diff changeset
55 new BitData(),
599eaf3bc4b2 get DataLayout tags from VM
twisti
parents: 13164
diff changeset
56 new CounterData(),
599eaf3bc4b2 get DataLayout tags from VM
twisti
parents: 13164
diff changeset
57 new JumpData(),
22572
c3b49e9d0f48 HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
58 new ReceiverTypeData(),
13182
599eaf3bc4b2 get DataLayout tags from VM
twisti
parents: 13164
diff changeset
59 new VirtualCallData(),
599eaf3bc4b2 get DataLayout tags from VM
twisti
parents: 13164
diff changeset
60 new RetData(),
599eaf3bc4b2 get DataLayout tags from VM
twisti
parents: 13164
diff changeset
61 new BranchData(),
599eaf3bc4b2 get DataLayout tags from VM
twisti
parents: 13164
diff changeset
62 new MultiBranchData(),
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
63 new ArgInfoData(),
22573
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
64 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
65 new VirtualCallTypeData(),
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.ParametersTypeData),
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
67 new UnknownProfileData(Tag.SpeculativeTrapData),
13182
599eaf3bc4b2 get DataLayout tags from VM
twisti
parents: 13164
diff changeset
68 };
599eaf3bc4b2 get DataLayout tags from VM
twisti
parents: 13164
diff changeset
69 // @formatter:on
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
70
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
71 /**
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
72 * 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
73 */
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
74 private final long metaspaceMethodData;
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
75 @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
76
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
77 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
78 this.metaspaceMethodData = metaspaceMethodData;
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
79 this.method = method;
13241
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
80 }
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
81
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
82 /**
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
83 * @return value of the MethodData::_data_size field
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
84 */
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
85 private int normalDataSize() {
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
86 return UNSAFE.getInt(metaspaceMethodData + config.methodDataDataSize);
13241
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
87 }
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
88
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
89 /**
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
90 * Returns the size of the extra data records. This method does the same calculation as
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
91 * 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
92 *
13241
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
93 * @return size of extra data records
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
94 */
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
95 private int extraDataSize() {
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
96 final int extraDataBase = config.methodDataOopDataOffset + normalDataSize();
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
97 final int extraDataLimit = UNSAFE.getInt(metaspaceMethodData + config.methodDataSize);
13241
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
98 return extraDataLimit - extraDataBase;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
99 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
100
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
101 public boolean hasNormalData() {
13241
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
102 return normalDataSize() > 0;
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
103 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
104
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
105 public boolean hasExtraData() {
13241
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
106 return extraDataSize() > 0;
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
107 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
108
4476
00efac2934d3 methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4470
diff changeset
109 public int getExtraDataBeginOffset() {
13241
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
110 return normalDataSize();
4476
00efac2934d3 methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4470
diff changeset
111 }
00efac2934d3 methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4470
diff changeset
112
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
113 public boolean isWithin(int position) {
13241
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
114 return position >= 0 && position < normalDataSize() + extraDataSize();
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
115 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
116
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
117 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
118 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
119 int reasonIndex = metaAccess.convertDeoptReason(reason);
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
120 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
121 }
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5061
diff changeset
122
13216
51e97f88c771 Profile deoptimizations of OSR methods separately.
Roland Schatz <roland.schatz@oracle.com>
parents: 13182
diff changeset
123 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
124 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
125 int reasonIndex = metaAccess.convertDeoptReason(reason);
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
126 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
127 }
51e97f88c771 Profile deoptimizations of OSR methods separately.
Roland Schatz <roland.schatz@oracle.com>
parents: 13182
diff changeset
128
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
129 public HotSpotMethodDataAccessor getNormalData(int position) {
13241
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
130 if (position >= normalDataSize()) {
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
131 return null;
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
132 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
133
4476
00efac2934d3 methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4470
diff changeset
134 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
135 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
136 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
137 return result;
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
138 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
139
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
140 public HotSpotMethodDataAccessor getExtraData(int position) {
13241
8b5852df0471 remove CompilerToVM.initializeMethodData
twisti
parents: 13216
diff changeset
141 if (position >= normalDataSize() + extraDataSize()) {
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
142 return null;
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
143 }
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
144 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
145 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
146 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
147 }
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;
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
149 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
150
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
151 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
152 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
153 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
154 } 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
155 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
156 }
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
157 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
158
4476
00efac2934d3 methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4470
diff changeset
159 private HotSpotMethodDataAccessor getData(int position) {
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
160 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
161 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
162 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
163 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
164 return accessor;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
165 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
166
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
167 private int readUnsignedByte(int position, int offsetInBytes) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
168 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
169 return UNSAFE.getByte(metaspaceMethodData + fullOffsetInBytes) & 0xFF;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
170 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
171
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
172 private int readUnsignedShort(int position, int offsetInBytes) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
173 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
174 return UNSAFE.getShort(metaspaceMethodData + fullOffsetInBytes) & 0xFFFF;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
175 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
176
11212
3718acd022db fix HotSpotMethodData to read the correct values on little and big endian
twisti
parents: 9928
diff changeset
177 /**
3718acd022db fix HotSpotMethodData to read the correct values on little and big endian
twisti
parents: 9928
diff changeset
178 * 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
179 * {@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
180 */
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
181 private long readUnsignedInt(int position, int offsetInBytes) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
182 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
183 return UNSAFE.getAddress(metaspaceMethodData + fullOffsetInBytes) & 0xFFFFFFFFL;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
184 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
185
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
186 private int readUnsignedIntAsSignedInt(int position, int offsetInBytes) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
187 long value = readUnsignedInt(position, offsetInBytes);
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
188 return truncateLongToInt(value);
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
189 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
190
11212
3718acd022db fix HotSpotMethodData to read the correct values on little and big endian
twisti
parents: 9928
diff changeset
191 /**
3718acd022db fix HotSpotMethodData to read the correct values on little and big endian
twisti
parents: 9928
diff changeset
192 * 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
193 * {@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
194 */
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
195 private int readInt(int position, int offsetInBytes) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
196 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
197 return (int) UNSAFE.getAddress(metaspaceMethodData + fullOffsetInBytes);
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
198 }
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
199
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
200 private HotSpotResolvedJavaMethod readMethod(int position, int offsetInBytes) {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
201 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
22562
28fe5850735e removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents: 22542
diff changeset
202 return runtime().getCompilerToVM().getResolvedJavaMethod(null, metaspaceMethodData + fullOffsetInBytes);
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
203 }
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
204
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
205 private HotSpotResolvedObjectTypeImpl readKlass(int position, int offsetInBytes) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
206 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
22562
28fe5850735e removed HotSpotVMEventListener.completeInitialization; moved implementation of -Djvmci.printconfig=true to JVMCI; moved javadoc to method from static initializer
Doug Simon <doug.simon@oracle.com>
parents: 22542
diff changeset
207 return runtime().getCompilerToVM().getResolvedJavaType(null, metaspaceMethodData + fullOffsetInBytes, false);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
208 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
209
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
210 private static int truncateLongToInt(long value) {
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
211 return value > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) value;
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
212 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
213
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
214 private static int computeFullOffset(int position, int offsetInBytes) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
215 return config.methodDataOopDataOffset + position + offsetInBytes;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
216 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
217
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
218 private static int cellIndexToOffset(int cells) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
219 return config.dataLayoutHeaderSize + cellsToBytes(cells);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
220 }
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
221
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
222 private static int cellsToBytes(int cells) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
223 return cells * config.dataLayoutCellSize;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
224 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
225
13769
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13312
diff changeset
226 /**
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13312
diff changeset
227 * 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
228 * 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
229 */
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13312
diff changeset
230 public boolean isProfileMature() {
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13312
diff changeset
231 return runtime().getCompilerToVM().isMature(metaspaceMethodData);
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13312
diff changeset
232 }
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13312
diff changeset
233
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
234 @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
235 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
236 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
237 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
238 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
239 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
240 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
241 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
242 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
243 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
244 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
245 }
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 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
247 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
248 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
249 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
250 }
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 }
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 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
254 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
255 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
256 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
257 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
258 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
259 }
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 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
261 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
262 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
263 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
264 }
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
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 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
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
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
270 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
271
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
272 /**
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
273 * 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
274 */
22572
c3b49e9d0f48 HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
275 private static final int EXCEPTIONS_MASK = 1 << config.bitDataExceptionSeenFlag;
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
276
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
277 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
278 protected final int staticSize;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
279
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
280 protected AbstractMethodData(Tag tag, int staticSize) {
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
281 this.tag = tag;
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
282 this.staticSize = staticSize;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
283 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
284
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
285 public Tag getTag() {
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
286 return tag;
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
287 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
288
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
289 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
290 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
291 return Tag.getEnum(tag);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
292 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
293
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
294 @Override
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
295 public int getBCI(HotSpotMethodData data, int position) {
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
296 return data.readUnsignedShort(position, config.dataLayoutBCIOffset);
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
297 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
298
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
299 @Override
22573
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
300 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
301 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
302 // 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
303 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
304 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
305 return size;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
306 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
307
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
308 @Override
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
309 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
310 return TriState.get((getFlags(data, position) & EXCEPTIONS_MASK) != 0);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
311 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
312
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
313 @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
314 public JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position) {
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
315 return null;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
316 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
317
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
318 @Override
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
319 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
320 return null;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
321 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
322
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
323 @Override
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
324 public double getBranchTakenProbability(HotSpotMethodData data, int position) {
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
325 return -1;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
326 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
327
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
328 @Override
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
329 public double[] getSwitchProbabilities(HotSpotMethodData data, int position) {
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
330 return null;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
331 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
332
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
333 @Override
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
334 public int getExecutionCount(HotSpotMethodData data, int position) {
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
335 return -1;
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
336 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
337
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
338 @Override
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
339 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
340 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
341 }
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
342
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
343 protected int getFlags(HotSpotMethodData data, int position) {
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
344 return data.readUnsignedByte(position, config.dataLayoutFlagsOffset);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
345 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
346
18546
5851c17b571e removed usages of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents: 18301
diff changeset
347 /**
5851c17b571e removed usages of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents: 18301
diff changeset
348 * @param data
5851c17b571e removed usages of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents: 18301
diff changeset
349 * @param position
5851c17b571e removed usages of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents: 18301
diff changeset
350 */
5851c17b571e removed usages of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents: 18301
diff changeset
351 protected int getDynamicSize(HotSpotMethodData data, int position) {
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
352 return 0;
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
353 }
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
354
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
355 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
356 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
357
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
358 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
359
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
360 private static final int NO_DATA_SIZE = cellIndexToOffset(0);
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
361
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
362 private final TriState exceptionSeen;
4527
a0cca63cd366 fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4526
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 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
365 super(Tag.No, NO_DATA_SIZE);
4527
a0cca63cd366 fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4526
diff changeset
366 this.exceptionSeen = exceptionSeen;
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
367 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
368
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
369 @Override
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
370 public int getBCI(HotSpotMethodData data, int position) {
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
371 return -1;
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
372 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
373
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
374 @Override
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
375 public TriState getExceptionSeen(HotSpotMethodData data, int position) {
4527
a0cca63cd366 fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4526
diff changeset
376 return exceptionSeen;
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
377 }
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
378
70e6bb85d802 cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents: 13139
diff changeset
379 @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
380 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
381 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
382 }
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
383 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
384
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
385 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
386
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
387 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
388 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
389
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
390 private BitData() {
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
391 super(Tag.BitData, BIT_DATA_SIZE);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
392 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
393
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
394 protected BitData(Tag tag, int staticSize) {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
395 super(tag, staticSize);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
396 }
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
397
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
398 @Override
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
399 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
400 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
401 }
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
402
70e6bb85d802 cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents: 13139
diff changeset
403 @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
404 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
405 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
406 }
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
407 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
408
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
409 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
410
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
411 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
412 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
413
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
414 public CounterData() {
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
415 super(Tag.CounterData, COUNTER_DATA_SIZE);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
416 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
417
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
418 protected CounterData(Tag tag, int staticSize) {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
419 super(tag, staticSize);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
420 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
421
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
422 @Override
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
423 public int getExecutionCount(HotSpotMethodData data, int position) {
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
424 return getCounterValue(data, position);
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
425 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
426
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
427 protected int getCounterValue(HotSpotMethodData data, int position) {
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
428 return data.readUnsignedIntAsSignedInt(position, COUNTER_DATA_COUNT_OFFSET);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
429 }
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
430
f9d908fb3492 added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents: 12456
diff changeset
431 @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
432 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
433 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
434 }
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
435 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
436
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
437 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
438
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
439 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
440 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
441 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
442
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
443 public JumpData() {
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
444 super(Tag.JumpData, JUMP_DATA_SIZE);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
445 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
446
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
447 protected JumpData(Tag tag, int staticSize) {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
448 super(tag, staticSize);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
449 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
450
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
451 @Override
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
452 public double getBranchTakenProbability(HotSpotMethodData data, int position) {
5039
f3d2447db2d9 added detection for endless recompilation
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4564
diff changeset
453 return getExecutionCount(data, position) != 0 ? 1 : 0;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
454 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
455
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
456 @Override
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
457 public int getExecutionCount(HotSpotMethodData data, int position) {
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
458 return data.readUnsignedIntAsSignedInt(position, TAKEN_COUNT_OFFSET);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
459 }
4452
b225da954a32 inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4448
diff changeset
460
b225da954a32 inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4448
diff changeset
461 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
462 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
463 }
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
464
f9d908fb3492 added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents: 12456
diff changeset
465 @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
466 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
467 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
468 }
f9d908fb3492 added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents: 12456
diff changeset
469 }
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 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
472 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
473 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
474 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
475 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
476
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 public RawItemProfile(int entries, T[] items, long[] counts, 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 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
479 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
480 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
481 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
482 }
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
483 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
484
4456
f4c82dd4619e inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4455
diff changeset
485 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
486
22572
c3b49e9d0f48 HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
487 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
488
22572
c3b49e9d0f48 HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
489 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
490 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
491 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
492
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
493 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
494 super(tag, staticSize);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
495 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
496
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
497 @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
498 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
499 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
500 }
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
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 private RawItemProfile<ResolvedJavaType> getRawTypeProfile(HotSpotMethodData data, int position) {
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
503 int typeProfileWidth = config.typeProfileWidth;
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
504
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
505 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
506 long[] counts = new long[typeProfileWidth];
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
507 long totalCount = 0;
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
508 int entries = 0;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
509
16616
29404eec7ced eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16480
diff changeset
510 outer: for (int i = 0; i < typeProfileWidth; i++) {
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
511 HotSpotResolvedObjectTypeImpl receiverKlass = data.readKlass(position, getTypeOffset(i));
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
512 if (receiverKlass != null) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
513 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
514 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
515 /*
29404eec7ced eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16480
diff changeset
516 * 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
517 * 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
518 * rational.
29404eec7ced eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16480
diff changeset
519 */
29404eec7ced eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16480
diff changeset
520 for (int j = 0; j < entries; j++) {
29404eec7ced eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16480
diff changeset
521 if (types[j].equals(klass)) {
29404eec7ced eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16480
diff changeset
522 totalCount += count;
29404eec7ced eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16480
diff changeset
523 counts[j] += count;
29404eec7ced eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16480
diff changeset
524 continue outer;
29404eec7ced eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16480
diff changeset
525 }
29404eec7ced eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16480
diff changeset
526 }
29404eec7ced eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16480
diff changeset
527 types[entries] = klass;
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
528 totalCount += count;
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
529 counts[entries] = count;
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
530 entries++;
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
531 }
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
532 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
533
4456
f4c82dd4619e inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4455
diff changeset
534 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
535 return new RawItemProfile<>(entries, types, counts, totalCount);
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
536 }
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
537
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
538 protected abstract long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position);
4456
f4c82dd4619e inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4455
diff changeset
539
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
540 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
541 if (profile.entries <= 0 || profile.totalCount <= 0) {
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
542 return null;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
543 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
544
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
545 ProfiledType[] ptypes = new ProfiledType[profile.entries];
4456
f4c82dd4619e inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4455
diff changeset
546 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
547 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
548 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
549 p = p / profile.totalCount;
4456
f4c82dd4619e inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4455
diff changeset
550 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
551 ptypes[i] = new ProfiledType(profile.items[i], p);
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
552 }
4456
f4c82dd4619e inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4455
diff changeset
553
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
554 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
555
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
556 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
557 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
558 return new JavaTypeProfile(nullSeen, notRecordedTypeProbability, ptypes);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
559 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
560
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
561 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
562 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
563 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
564
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
565 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
566 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
567 }
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
568
f9d908fb3492 added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents: 12456
diff changeset
569 @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
570 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
571 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
572 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
573 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
574 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
575 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
576 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
577 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
578 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
579 }
f9d908fb3492 added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents: 12456
diff changeset
580 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
581 }
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
582 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
583
22572
c3b49e9d0f48 HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
584 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
585
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
586 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
587
22572
c3b49e9d0f48 HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
588 public ReceiverTypeData() {
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
589 super(Tag.ReceiverTypeData, TYPE_CHECK_DATA_SIZE);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
590 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
591
22572
c3b49e9d0f48 HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
592 protected ReceiverTypeData(Tag tag, int staticSize) {
c3b49e9d0f48 HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
593 super(tag, staticSize);
c3b49e9d0f48 HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
594 }
c3b49e9d0f48 HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
595
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
596 @Override
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
597 public int getExecutionCount(HotSpotMethodData data, int position) {
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
598 return -1;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
599 }
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
600
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
601 @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
602 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
603 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
604 }
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
605 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
606
22572
c3b49e9d0f48 HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
607 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
608
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
609 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
610 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
611 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
612
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
613 public VirtualCallData() {
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
614 super(Tag.VirtualCallData, VIRTUAL_CALL_DATA_SIZE);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
615 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
616
22573
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
617 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
618 super(tag, staticSize);
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
619 }
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
620
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
621 @Override
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
622 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
623 final int typeProfileWidth = config.typeProfileWidth;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
624
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
625 long total = 0;
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
626 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
627 total += data.readUnsignedInt(position, getTypeCountOffset(i));
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
628 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
629
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
630 total += getCounterValue(data, position);
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
631 return truncateLongToInt(total);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
632 }
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
633
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
634 @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
635 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
636 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
637 }
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
638
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
639 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
640 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
641 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
642
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
643 @Override
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
644 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
645 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
646 }
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
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 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
649 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
650
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
651 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
652 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
653 long totalCount = 0;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
654 int entries = 0;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
655
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
656 for (int i = 0; i < profileWidth; i++) {
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
657 HotSpotResolvedJavaMethod method = data.readMethod(position, getMethodOffset(i));
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
658 if (method != null) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
659 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
660 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
661 totalCount += count;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
662 counts[entries] = count;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
663
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
664 entries++;
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 }
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 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
669 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
670 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
671
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
672 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
673 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
674 return null;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
675 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
676
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
677 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
678 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
679 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
680 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
681 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
682 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
683 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
684 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
685
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
686 Arrays.sort(pmethods);
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
687
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
688 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
689 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
690 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
691 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
692
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
693 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
694 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
695 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
696
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9289
diff changeset
697 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
698 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
699 }
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
700
f9d908fb3492 added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents: 12456
diff changeset
701 @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
702 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
703 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
704 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
705 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
706 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
707 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
708 }
f9d908fb3492 added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents: 12456
diff changeset
709 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
710 }
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
711 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
712
22573
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
713 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
714
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
715 public VirtualCallTypeData() {
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
716 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
717 }
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
718
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
719 @Override
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
720 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
721 assert staticSize == 0;
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
722 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
723 }
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
724 }
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
725
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
726 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
727
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
728 private static final int RET_DATA_ROW_SIZE = cellsToBytes(3);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
729 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
730
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
731 public RetData() {
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
732 super(Tag.RetData, RET_DATA_SIZE);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
733 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
734 }
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 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
737
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
738 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
739 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
740
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
741 public BranchData() {
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
742 super(Tag.BranchData, BRANCH_DATA_SIZE);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
743 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
744
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
745 @Override
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
746 public double getBranchTakenProbability(HotSpotMethodData data, int position) {
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
747 long takenCount = data.readUnsignedInt(position, TAKEN_COUNT_OFFSET);
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
748 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
749 long total = takenCount + notTakenCount;
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
750
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
751 return total <= 0 ? -1 : takenCount / (double) total;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
752 }
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
753
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
754 @Override
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
755 public int getExecutionCount(HotSpotMethodData data, int position) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
756 long count = data.readUnsignedInt(position, TAKEN_COUNT_OFFSET) + data.readUnsignedInt(position, NOT_TAKEN_COUNT_OFFSET);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
757 return truncateLongToInt(count);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
758 }
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
759
f9d908fb3492 added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents: 12456
diff changeset
760 @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
761 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
762 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
763 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
764 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
765 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
766 }
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
767 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
768
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
769 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
770
22572
c3b49e9d0f48 HotSpotMethodData shouldn't hardcode constants
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
771 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
772 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
773
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
774 public ArrayData(Tag tag, int staticSize) {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
775 super(tag, staticSize);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
776 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
777
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
778 @Override
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
779 protected int getDynamicSize(HotSpotMethodData data, int position) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
780 return cellsToBytes(getLength(data, position));
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
781 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
782
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
783 protected static int getLength(HotSpotMethodData data, int position) {
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
784 return data.readInt(position, ARRAY_DATA_LENGTH_OFFSET);
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
785 }
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
786
f9d908fb3492 added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents: 12456
diff changeset
787 @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
788 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
789 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
790 }
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
791 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
792
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
793 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
794
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
795 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
796 private static final int MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS = config.multiBranchDataPerCaseCellCount;
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
797 private static final int MULTI_BRANCH_DATA_ROW_SIZE = cellsToBytes(MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
798 private static final int MULTI_BRANCH_DATA_FIRST_COUNT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(0);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
799 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
800
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
801 public MultiBranchData() {
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
802 super(Tag.MultiBranchData, MULTI_BRANCH_DATA_SIZE);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
803 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
804
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
805 @Override
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
806 public double[] getSwitchProbabilities(HotSpotMethodData data, int position) {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
807 int arrayLength = getLength(data, position);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
808 assert arrayLength > 0 : "switch must have at least the default case";
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
809 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
810
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
811 int length = arrayLength / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS;
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
812 long totalCount = 0;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
813 double[] result = new double[length];
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
814
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
815 // default case is first in HotSpot but last for the compiler
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
816 long count = readCount(data, position, 0);
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4444
diff changeset
817 totalCount += count;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4444
diff changeset
818 result[length - 1] = count;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4444
diff changeset
819
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4444
diff changeset
820 for (int i = 1; i < length; i++) {
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
821 count = readCount(data, position, i);
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
822 totalCount += count;
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4444
diff changeset
823 result[i - 1] = count;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
824 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
825
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
826 if (totalCount <= 0) {
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
827 return null;
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
828 } else {
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
829 for (int i = 0; i < length; i++) {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
830 result[i] = result[i] / totalCount;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
831 }
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
832 return result;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
833 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
834 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
835
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
836 private static long readCount(HotSpotMethodData data, int position, int i) {
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
837 int offset;
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
838 long count;
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
839 offset = getCountOffset(i);
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
840 count = data.readUnsignedInt(position, offset);
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
841 return count;
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
842 }
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
843
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
844 @Override
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
845 public int getExecutionCount(HotSpotMethodData data, int position) {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
846 int arrayLength = getLength(data, position);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
847 assert arrayLength > 0 : "switch must have at least the default case";
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
848 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
849
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
850 int length = arrayLength / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS;
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
851 long totalCount = 0;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
852 for (int i = 0; i < length; i++) {
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
853 int offset = getCountOffset(i);
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
854 totalCount += data.readUnsignedInt(position, offset);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
855 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
856
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
857 return truncateLongToInt(totalCount);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
858 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
859
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
860 private static int getCountOffset(int index) {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
861 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
862 }
4452
b225da954a32 inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4448
diff changeset
863
b225da954a32 inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4448
diff changeset
864 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
865 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
866 }
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
867
f9d908fb3492 added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents: 12456
diff changeset
868 @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
869 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
870 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
871 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
872 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
873 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
874 }
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 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
876 }
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
877 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
878
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
879 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
880
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
881 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
882
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
883 public ArgInfoData() {
14706
579a2a124c95 add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents: 14543
diff changeset
884 super(Tag.ArgInfoData, ARG_INFO_DATA_SIZE);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
885 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
886 }
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
887
22573
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
888 private static class UnknownProfileData extends AbstractMethodData {
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
889 public UnknownProfileData(Tag tag) {
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
890 super(tag, 0);
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
891 }
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
892
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
893 @Override
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
894 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
895 assert staticSize == 0;
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
896 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
897 }
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
898
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
899 @Override
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
900 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
901 // 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
902 return null;
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
903 }
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
904 }
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22572
diff changeset
905
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
906 public void setCompiledIRSize(int size) {
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
907 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
908 }
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
909
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
910 public int getCompiledIRSize() {
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
911 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
912 }
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
913 }