Mercurial > hg > truffle
annotate graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethodData.java @ 21562:47bebae7454f
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 28 May 2015 21:58:33 +0200 |
parents | 48c1ebd24120 |
children |
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 */ |
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
|
23 package com.oracle.jvmci.hotspot; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
24 |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21411
diff
changeset
|
25 import static com.oracle.jvmci.common.UnsafeAccess.*; |
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
|
26 import static com.oracle.jvmci.hotspot.HotSpotJVMCIRuntime.*; |
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
|
27 import static java.lang.String.*; |
4470
b7ec250cd29c
fixes after merge
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4467
diff
changeset
|
28 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
29 import java.util.*; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
30 |
18574
37d88a4af2ab
removed references to HotSpotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18548
diff
changeset
|
31 import sun.misc.*; |
37d88a4af2ab
removed references to HotSpotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18548
diff
changeset
|
32 |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
33 import com.oracle.jvmci.hotspot.HotSpotMethodDataAccessor.Tag; |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
34 import com.oracle.jvmci.meta.*; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
35 import com.oracle.jvmci.meta.JavaMethodProfile.ProfiledMethod; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
36 import com.oracle.jvmci.meta.JavaTypeProfile.ProfiledType; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
37 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
38 /** |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
39 * 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
|
40 */ |
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:
19717
diff
changeset
|
41 public final class HotSpotMethodData { |
4444 | 42 |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
43 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
|
44 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
|
45 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
|
46 |
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
|
47 // sorted by tag |
13182 | 48 // @formatter:off |
49 private static final HotSpotMethodDataAccessor[] PROFILE_DATA_ACCESSORS = { | |
50 null, | |
51 new BitData(), | |
52 new CounterData(), | |
53 new JumpData(), | |
54 new TypeCheckData(), | |
55 new VirtualCallData(), | |
56 new RetData(), | |
57 new BranchData(), | |
58 new MultiBranchData(), | |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
59 new ArgInfoData(), |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
60 null, // call_type_data_tag |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
61 null, // virtual_call_type_data_tag |
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
62 null, // parameters_type_data_tag |
18041
52b4284cb496
Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16616
diff
changeset
|
63 null, // speculative_trap_data_tag |
13182 | 64 }; |
65 // @formatter:on | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
66 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
67 /** |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
68 * 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
|
69 */ |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
70 private final long metaspaceMethodData; |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
71 |
18222
a8cff27ca2e1
converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18167
diff
changeset
|
72 public HotSpotMethodData(long metaspaceMethodData) { |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
73 this.metaspaceMethodData = metaspaceMethodData; |
13241 | 74 } |
75 | |
76 /** | |
77 * @return value of the MethodData::_data_size field | |
78 */ | |
79 private int normalDataSize() { | |
80 return unsafe.getInt(metaspaceMethodData + config.methodDataDataSize); | |
81 } | |
82 | |
83 /** | |
84 * Returns the size of the extra data records. This method does the same calculation as | |
85 * 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
|
86 * |
13241 | 87 * @return size of extra data records |
88 */ | |
89 private int extraDataSize() { | |
90 final int extraDataBase = config.methodDataOopDataOffset + normalDataSize(); | |
91 final int extraDataLimit = unsafe.getInt(metaspaceMethodData + config.methodDataSize); | |
92 return extraDataLimit - extraDataBase; | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
93 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
94 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
95 public boolean hasNormalData() { |
13241 | 96 return normalDataSize() > 0; |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
97 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
98 |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
99 public boolean hasExtraData() { |
13241 | 100 return extraDataSize() > 0; |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
101 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
102 |
4476
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4470
diff
changeset
|
103 public int getExtraDataBeginOffset() { |
13241 | 104 return normalDataSize(); |
4476
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4470
diff
changeset
|
105 } |
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4470
diff
changeset
|
106 |
4444 | 107 public boolean isWithin(int position) { |
13241 | 108 return position >= 0 && position < normalDataSize() + extraDataSize(); |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
109 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
110 |
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
|
111 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
|
112 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
|
113 int reasonIndex = metaAccess.convertDeoptReason(reason); |
7159
3fbde10a77b0
replaced usage of Unsafe.get<kind>(Object object, long offset) where object == null with Unsafe.get<kind>(long address)
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
114 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
|
115 } |
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5061
diff
changeset
|
116 |
13216
51e97f88c771
Profile deoptimizations of OSR methods separately.
Roland Schatz <roland.schatz@oracle.com>
parents:
13182
diff
changeset
|
117 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
|
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); |
13216
51e97f88c771
Profile deoptimizations of OSR methods separately.
Roland Schatz <roland.schatz@oracle.com>
parents:
13182
diff
changeset
|
120 return unsafe.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + config.deoptReasonOSROffset + reasonIndex) & 0xFF; |
51e97f88c771
Profile deoptimizations of OSR methods separately.
Roland Schatz <roland.schatz@oracle.com>
parents:
13182
diff
changeset
|
121 } |
51e97f88c771
Profile deoptimizations of OSR methods separately.
Roland Schatz <roland.schatz@oracle.com>
parents:
13182
diff
changeset
|
122 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
123 public HotSpotMethodDataAccessor getNormalData(int position) { |
13241 | 124 if (position >= normalDataSize()) { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
125 return null; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
126 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
127 |
4476
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4470
diff
changeset
|
128 HotSpotMethodDataAccessor result = getData(position); |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
129 assert result != null : "NO_DATA tag is not allowed"; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
130 return result; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
131 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
132 |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
133 public HotSpotMethodDataAccessor getExtraData(int position) { |
13241 | 134 if (position >= normalDataSize() + extraDataSize()) { |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
135 return null; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
136 } |
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
|
137 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
|
138 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
|
139 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
|
140 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
141 return data; |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
142 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
143 |
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
|
144 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
|
145 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
|
146 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
|
147 } 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
|
148 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
|
149 } |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
150 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
151 |
4476
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4470
diff
changeset
|
152 private HotSpotMethodDataAccessor getData(int position) { |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
153 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
|
154 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
|
155 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
|
156 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
|
157 return accessor; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
158 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
159 |
4444 | 160 private int readUnsignedByte(int position, int offsetInBytes) { |
161 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); | |
7159
3fbde10a77b0
replaced usage of Unsafe.get<kind>(Object object, long offset) where object == null with Unsafe.get<kind>(long address)
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
162 return unsafe.getByte(metaspaceMethodData + fullOffsetInBytes) & 0xFF; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
163 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
164 |
4444 | 165 private int readUnsignedShort(int position, int offsetInBytes) { |
166 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); | |
7159
3fbde10a77b0
replaced usage of Unsafe.get<kind>(Object object, long offset) where object == null with Unsafe.get<kind>(long address)
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
167 return unsafe.getShort(metaspaceMethodData + fullOffsetInBytes) & 0xFFFF; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
168 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
169 |
11212
3718acd022db
fix HotSpotMethodData to read the correct values on little and big endian
twisti
parents:
9928
diff
changeset
|
170 /** |
3718acd022db
fix HotSpotMethodData to read the correct values on little and big endian
twisti
parents:
9928
diff
changeset
|
171 * Since the values are stored in cells (platform words) this method uses |
18574
37d88a4af2ab
removed references to HotSpotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18548
diff
changeset
|
172 * {@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
|
173 */ |
4444 | 174 private long readUnsignedInt(int position, int offsetInBytes) { |
175 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); | |
18548
5851c17b571e
removed usages of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18301
diff
changeset
|
176 return unsafe.getAddress(metaspaceMethodData + fullOffsetInBytes) & 0xFFFFFFFFL; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
177 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
178 |
4444 | 179 private int readUnsignedIntAsSignedInt(int position, int offsetInBytes) { |
180 long value = readUnsignedInt(position, offsetInBytes); | |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
181 return truncateLongToInt(value); |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
182 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
183 |
11212
3718acd022db
fix HotSpotMethodData to read the correct values on little and big endian
twisti
parents:
9928
diff
changeset
|
184 /** |
3718acd022db
fix HotSpotMethodData to read the correct values on little and big endian
twisti
parents:
9928
diff
changeset
|
185 * Since the values are stored in cells (platform words) this method uses |
18574
37d88a4af2ab
removed references to HotSpotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18548
diff
changeset
|
186 * {@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
|
187 */ |
4444 | 188 private int readInt(int position, int offsetInBytes) { |
189 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); | |
18548
5851c17b571e
removed usages of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18301
diff
changeset
|
190 return (int) unsafe.getAddress(metaspaceMethodData + fullOffsetInBytes); |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
191 } |
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
192 |
7037
dd81042f4eb1
added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
6950
diff
changeset
|
193 private long readWord(int position, int offsetInBytes) { |
4444 | 194 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); |
18548
5851c17b571e
removed usages of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18301
diff
changeset
|
195 return unsafe.getAddress(metaspaceMethodData + fullOffsetInBytes); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
196 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
197 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
198 private static int truncateLongToInt(long value) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
199 return value > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) value; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
200 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
201 |
4444 | 202 private static int computeFullOffset(int position, int offsetInBytes) { |
203 return config.methodDataOopDataOffset + position + offsetInBytes; | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
204 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
205 |
4444 | 206 private static int cellIndexToOffset(int cells) { |
207 return config.dataLayoutHeaderSize + cellsToBytes(cells); | |
208 } | |
209 | |
210 private static int cellsToBytes(int cells) { | |
211 return cells * config.dataLayoutCellSize; | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
212 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
213 |
13769
af344056124f
Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13312
diff
changeset
|
214 /** |
af344056124f
Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13312
diff
changeset
|
215 * 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
|
216 * 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
|
217 */ |
af344056124f
Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13312
diff
changeset
|
218 public boolean isProfileMature() { |
af344056124f
Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13312
diff
changeset
|
219 return runtime().getCompilerToVM().isMature(metaspaceMethodData); |
af344056124f
Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13312
diff
changeset
|
220 } |
af344056124f
Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13312
diff
changeset
|
221 |
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
|
222 @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
|
223 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
|
224 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
|
225 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
|
226 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
|
227 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
|
228 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
|
229 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
|
230 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
|
231 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
|
232 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
|
233 } |
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 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
|
235 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
|
236 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
|
237 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
|
238 } |
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 } |
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 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
241 if (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
|
242 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
|
243 HotSpotMethodDataAccessor data; |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
244 while ((data = 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
|
245 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
|
246 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
|
247 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
248 int bci = data.getBCI(this, pos); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
249 sb.append(String.format("%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
|
250 sb.append(data.appendTo(new StringBuilder(), this, pos).toString().replace(nl, nlIndent)); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
251 pos = pos + data.getSize(this, pos); |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
252 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
253 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
254 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
255 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
|
256 } |
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 |
4447 | 258 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
|
259 |
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
|
260 /** |
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
|
261 * 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
|
262 */ |
8616
d343737786fe
changed profiling of exceptions so that the ExceptionSeen flag also works without GRAALVM
Christian Haeubl <haeubl@ssw.jku.at>
parents:
8610
diff
changeset
|
263 private static final int EXCEPTIONS_MASK = 0x2; |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
264 |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
265 private final Tag tag; |
4444 | 266 private final int staticSize; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
267 |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
268 protected AbstractMethodData(Tag tag, int staticSize) { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
269 this.tag = tag; |
4444 | 270 this.staticSize = staticSize; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
271 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
272 |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
273 public Tag getTag() { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
274 return tag; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
275 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
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 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
|
278 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
|
279 return Tag.getEnum(tag); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
280 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
281 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
282 @Override |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
283 public int getBCI(HotSpotMethodData data, int position) { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
284 return data.readUnsignedShort(position, config.dataLayoutBCIOffset); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
285 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
286 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
287 @Override |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
288 public int getSize(HotSpotMethodData data, int position) { |
4444 | 289 return staticSize + getDynamicSize(data, position); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
290 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
291 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
292 @Override |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
293 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
|
294 return TriState.get((getFlags(data, position) & EXCEPTIONS_MASK) != 0); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
295 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
296 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
297 @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
|
298 public JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position) { |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
299 return null; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
300 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
301 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
302 @Override |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
303 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
|
304 return null; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
305 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
306 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
307 @Override |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
308 public double getBranchTakenProbability(HotSpotMethodData data, int position) { |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
309 return -1; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
310 } |
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 @Override |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
313 public double[] getSwitchProbabilities(HotSpotMethodData data, int position) { |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
314 return null; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
315 } |
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 @Override |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
318 public int getExecutionCount(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
319 return -1; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
320 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
321 |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
322 @Override |
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
323 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
|
324 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
|
325 } |
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
326 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
327 protected int getFlags(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
328 return data.readUnsignedByte(position, config.dataLayoutFlagsOffset); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
329 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
330 |
18548
5851c17b571e
removed usages of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18301
diff
changeset
|
331 /** |
5851c17b571e
removed usages of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18301
diff
changeset
|
332 * @param data |
5851c17b571e
removed usages of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18301
diff
changeset
|
333 * @param position |
5851c17b571e
removed usages of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18301
diff
changeset
|
334 */ |
5851c17b571e
removed usages of HotSPotGraalRuntime.unsafeReadWord()
Doug Simon <doug.simon@oracle.com>
parents:
18301
diff
changeset
|
335 protected int getDynamicSize(HotSpotMethodData data, int position) { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
336 return 0; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
337 } |
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
|
338 |
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
|
339 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
|
340 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
341 |
4447 | 342 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
|
343 |
4444 | 344 private static final int NO_DATA_SIZE = cellIndexToOffset(0); |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
345 |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
346 private final TriState exceptionSeen; |
4527
a0cca63cd366
fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4526
diff
changeset
|
347 |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
348 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
|
349 super(Tag.No, NO_DATA_SIZE); |
4527
a0cca63cd366
fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4526
diff
changeset
|
350 this.exceptionSeen = exceptionSeen; |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
351 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
352 |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
353 @Override |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
354 public int getBCI(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
355 return -1; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
356 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
357 |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
358 @Override |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
359 public TriState getExceptionSeen(HotSpotMethodData data, int position) { |
4527
a0cca63cd366
fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4526
diff
changeset
|
360 return exceptionSeen; |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
361 } |
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
|
362 |
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
13139
diff
changeset
|
363 @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
|
364 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
|
365 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
|
366 } |
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 |
4447 | 369 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
|
370 |
4444 | 371 private static final int BIT_DATA_SIZE = cellIndexToOffset(0); |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
372 private static final int BIT_DATA_NULL_SEEN_FLAG = 0x01; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
373 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
374 private BitData() { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
375 super(Tag.BitData, BIT_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
376 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
377 |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
378 protected BitData(Tag tag, int staticSize) { |
4444 | 379 super(tag, staticSize); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
380 } |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
381 |
8610
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
382 @Override |
5407d1dd6450
API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7556
diff
changeset
|
383 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
|
384 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
|
385 } |
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
|
386 |
70e6bb85d802
cleaned up HotSpotMethodData tracing a little and enabled it when -Dgraal.traceMethodDataFilter=true
Doug Simon <doug.simon@oracle.com>
parents:
13139
diff
changeset
|
387 @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
|
388 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
|
389 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
|
390 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
391 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
392 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
393 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
|
394 |
4444 | 395 private static final int COUNTER_DATA_SIZE = cellIndexToOffset(1); |
396 private static final int COUNTER_DATA_COUNT_OFFSET = cellIndexToOffset(0); | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
397 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
398 public CounterData() { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
399 super(Tag.CounterData, COUNTER_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
400 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
401 |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
402 protected CounterData(Tag tag, int staticSize) { |
4444 | 403 super(tag, staticSize); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
404 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
405 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
406 @Override |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
407 public int getExecutionCount(HotSpotMethodData data, int position) { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
408 return getCounterValue(data, position); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
409 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
410 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
411 protected int getCounterValue(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
412 return data.readUnsignedIntAsSignedInt(position, COUNTER_DATA_COUNT_OFFSET); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
413 } |
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
|
414 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
415 @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
|
416 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
|
417 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
|
418 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
419 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
420 |
4447 | 421 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
|
422 |
4444 | 423 private static final int JUMP_DATA_SIZE = cellIndexToOffset(2); |
424 protected static final int TAKEN_COUNT_OFFSET = cellIndexToOffset(0); | |
425 protected static final int TAKEN_DISPLACEMENT_OFFSET = cellIndexToOffset(1); | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
426 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
427 public JumpData() { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
428 super(Tag.JumpData, JUMP_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
429 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
430 |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
431 protected JumpData(Tag tag, int staticSize) { |
4444 | 432 super(tag, staticSize); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
433 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
434 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
435 @Override |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
436 public double getBranchTakenProbability(HotSpotMethodData data, int position) { |
5039
f3d2447db2d9
added detection for endless recompilation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4564
diff
changeset
|
437 return getExecutionCount(data, position) != 0 ? 1 : 0; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
438 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
439 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
440 @Override |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
441 public int getExecutionCount(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
442 return data.readUnsignedIntAsSignedInt(position, TAKEN_COUNT_OFFSET); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
443 } |
4452
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
444 |
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
445 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
|
446 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
|
447 } |
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
|
448 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
449 @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
|
450 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
|
451 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
|
452 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
453 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
454 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
455 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
|
456 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
|
457 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
|
458 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
|
459 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
|
460 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
461 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
|
462 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
|
463 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
|
464 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
|
465 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
|
466 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
467 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
468 |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
469 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
|
470 |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
471 protected static final int TYPE_DATA_ROW_SIZE = cellsToBytes(2); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
472 |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
473 protected static final int NONPROFILED_COUNT_OFFSET = cellIndexToOffset(1); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
474 protected static final int TYPE_DATA_FIRST_TYPE_OFFSET = cellIndexToOffset(2); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
475 protected static final int TYPE_DATA_FIRST_TYPE_COUNT_OFFSET = cellIndexToOffset(3); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
476 |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
477 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
|
478 super(tag, staticSize); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
479 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
480 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
481 @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
|
482 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
|
483 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
|
484 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
485 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
486 private RawItemProfile<ResolvedJavaType> getRawTypeProfile(HotSpotMethodData data, int position) { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
487 int typeProfileWidth = config.typeProfileWidth; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
488 |
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
|
489 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
|
490 long[] counts = new long[typeProfileWidth]; |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
491 long totalCount = 0; |
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
492 int entries = 0; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
493 |
16616
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
494 outer: 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
|
495 long receiverKlass = data.readWord(position, getTypeOffset(i)); |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
496 if (receiverKlass != 0) { |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18222
diff
changeset
|
497 HotSpotResolvedObjectTypeImpl klass = HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(receiverKlass); |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
498 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
|
499 /* |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
500 * 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
|
501 * 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
|
502 * rational. |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
503 */ |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
504 for (int j = 0; j < entries; j++) { |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
505 if (types[j].equals(klass)) { |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
506 totalCount += count; |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
507 counts[j] += count; |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
508 continue outer; |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
509 } |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
510 } |
29404eec7ced
eliminate duplicate entries from profile data
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16480
diff
changeset
|
511 types[entries] = klass; |
4447 | 512 totalCount += count; |
513 counts[entries] = count; | |
514 entries++; | |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
515 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
516 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
517 |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
518 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
|
519 return new RawItemProfile<>(entries, types, counts, totalCount); |
4447 | 520 } |
521 | |
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
|
522 protected abstract long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position); |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
523 |
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
|
524 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
|
525 if (profile.entries <= 0 || profile.totalCount <= 0) { |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
526 return null; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
527 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
528 |
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
|
529 ProfiledType[] ptypes = new ProfiledType[profile.entries]; |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
530 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
|
531 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
|
532 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
|
533 p = p / profile.totalCount; |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
534 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
|
535 ptypes[i] = new ProfiledType(profile.items[i], p); |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
536 } |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
537 |
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
|
538 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
|
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 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
|
541 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
|
542 return new JavaTypeProfile(nullSeen, notRecordedTypeProbability, ptypes); |
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 |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
545 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
|
546 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
|
547 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
548 |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
549 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
|
550 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
|
551 } |
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
|
552 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
553 @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
|
554 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
|
555 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
|
556 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
|
557 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
|
558 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
|
559 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
|
560 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
|
561 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
|
562 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
|
563 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
564 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
|
565 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
566 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
567 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
568 private static class TypeCheckData extends AbstractTypeData { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7391
diff
changeset
|
569 |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
570 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
|
571 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
572 public TypeCheckData() { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
573 super(Tag.ReceiverTypeData, TYPE_CHECK_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
574 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
575 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
576 @Override |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
577 public int getExecutionCount(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
578 return -1; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
579 } |
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
|
580 |
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
|
581 @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
|
582 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
|
583 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
|
584 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
585 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
586 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
587 private static class VirtualCallData extends AbstractTypeData { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7391
diff
changeset
|
588 |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
589 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
|
590 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
|
591 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
|
592 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
593 public VirtualCallData() { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
594 super(Tag.VirtualCallData, VIRTUAL_CALL_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
595 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
596 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
597 @Override |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
598 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
|
599 final int typeProfileWidth = config.typeProfileWidth; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
600 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
601 long total = 0; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
602 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
|
603 total += data.readUnsignedInt(position, getTypeCountOffset(i)); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
604 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
605 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
606 total += getCounterValue(data, position); |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
607 return truncateLongToInt(total); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
608 } |
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
|
609 |
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
|
610 @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
|
611 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
|
612 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
|
613 } |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
614 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
615 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
|
616 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
|
617 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
618 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
619 @Override |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
620 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
|
621 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
|
622 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
623 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
624 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
|
625 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
|
626 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
627 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
|
628 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
|
629 long totalCount = 0; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
630 int entries = 0; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
631 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
632 for (int i = 0; i < profileWidth; i++) { |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
633 long method = data.readWord(position, getMethodOffset(i)); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
634 if (method != 0) { |
18222
a8cff27ca2e1
converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18167
diff
changeset
|
635 methods[entries] = HotSpotResolvedJavaMethodImpl.fromMetaspace(method); |
9760
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
636 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
|
637 totalCount += count; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
638 counts[entries] = count; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
639 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
640 entries++; |
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 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
644 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
|
645 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
|
646 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
647 |
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
|
648 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
|
649 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
|
650 return null; |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
651 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
652 |
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
|
653 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
|
654 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
|
655 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
|
656 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
|
657 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
|
658 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
|
659 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
|
660 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
661 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
662 Arrays.sort(pmethods); |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
663 |
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
|
664 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
|
665 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
|
666 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
|
667 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
668 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
669 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
|
670 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
|
671 } |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
672 |
c76b43ed5089
Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9289
diff
changeset
|
673 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
|
674 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
|
675 } |
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
|
676 |
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 @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
|
678 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
|
679 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
|
680 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
|
681 for (int i = 0; i < profile.entries; i++) { |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
682 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
|
683 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
|
684 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
685 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
|
686 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
687 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
688 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
689 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
|
690 |
4444 | 691 private static final int RET_DATA_ROW_SIZE = cellsToBytes(3); |
692 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
|
693 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
694 public RetData() { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
695 super(Tag.RetData, RET_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
696 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
697 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
698 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
699 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
|
700 |
4444 | 701 private static final int BRANCH_DATA_SIZE = cellIndexToOffset(3); |
702 private static final int NOT_TAKEN_COUNT_OFFSET = cellIndexToOffset(2); | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
703 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
704 public BranchData() { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
705 super(Tag.BranchData, BRANCH_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
706 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
707 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
708 @Override |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
709 public double getBranchTakenProbability(HotSpotMethodData data, int position) { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
710 long takenCount = data.readUnsignedInt(position, TAKEN_COUNT_OFFSET); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
711 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
|
712 long total = takenCount + notTakenCount; |
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
713 |
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
|
714 return total <= 0 ? -1 : takenCount / (double) total; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
715 } |
4444 | 716 |
717 @Override | |
718 public int getExecutionCount(HotSpotMethodData data, int position) { | |
719 long count = data.readUnsignedInt(position, TAKEN_COUNT_OFFSET) + data.readUnsignedInt(position, NOT_TAKEN_COUNT_OFFSET); | |
720 return truncateLongToInt(count); | |
721 } | |
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
|
722 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
723 @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
|
724 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
|
725 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
|
726 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
|
727 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
|
728 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
|
729 } |
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 |
4447 | 732 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
|
733 |
4444 | 734 private static final int ARRAY_DATA_LENGTH_OFFSET = cellIndexToOffset(0); |
735 protected static final int ARRAY_DATA_START_OFFSET = cellIndexToOffset(1); | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
736 |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
737 public ArrayData(Tag tag, int staticSize) { |
4444 | 738 super(tag, staticSize); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
739 } |
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 @Override |
4444 | 742 protected int getDynamicSize(HotSpotMethodData data, int position) { |
743 return cellsToBytes(getLength(data, position)); | |
4439
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 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
746 protected static int getLength(HotSpotMethodData data, int position) { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
747 return data.readInt(position, ARRAY_DATA_LENGTH_OFFSET); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
748 } |
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
|
749 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
750 @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
|
751 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
|
752 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
|
753 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
754 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
755 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
756 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
|
757 |
4444 | 758 private static final int MULTI_BRANCH_DATA_SIZE = cellIndexToOffset(1); |
759 private static final int MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS = 2; | |
760 private static final int MULTI_BRANCH_DATA_ROW_SIZE = cellsToBytes(MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS); | |
761 private static final int MULTI_BRANCH_DATA_FIRST_COUNT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(0); | |
762 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
|
763 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
764 public MultiBranchData() { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
765 super(Tag.MultiBranchData, MULTI_BRANCH_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
766 } |
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 @Override |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
769 public double[] getSwitchProbabilities(HotSpotMethodData data, int position) { |
4444 | 770 int arrayLength = getLength(data, position); |
771 assert arrayLength > 0 : "switch must have at least the default case"; | |
772 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
|
773 |
4444 | 774 int length = arrayLength / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS; |
775 long totalCount = 0; | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
776 double[] result = new double[length]; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
777 |
4447 | 778 // default case is first in HotSpot but last for the compiler |
779 long count = readCount(data, position, 0); | |
4446 | 780 totalCount += count; |
781 result[length - 1] = count; | |
782 | |
783 for (int i = 1; i < length; i++) { | |
4447 | 784 count = readCount(data, position, i); |
4444 | 785 totalCount += count; |
4446 | 786 result[i - 1] = count; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
787 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
788 |
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
|
789 if (totalCount <= 0) { |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
790 return null; |
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
791 } else { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
792 for (int i = 0; i < length; i++) { |
4444 | 793 result[i] = result[i] / totalCount; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
794 } |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
795 return result; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
796 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
797 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
798 |
4447 | 799 private static long readCount(HotSpotMethodData data, int position, int i) { |
800 int offset; | |
801 long count; | |
802 offset = getCountOffset(i); | |
803 count = data.readUnsignedInt(position, offset); | |
804 return count; | |
805 } | |
806 | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
807 @Override |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
808 public int getExecutionCount(HotSpotMethodData data, int position) { |
4444 | 809 int arrayLength = getLength(data, position); |
810 assert arrayLength > 0 : "switch must have at least the default case"; | |
811 assert arrayLength % MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS == 0 : "array must have full rows"; | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
812 |
4444 | 813 int length = arrayLength / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS; |
814 long totalCount = 0; | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
815 for (int i = 0; i < length; i++) { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
816 int offset = getCountOffset(i); |
4444 | 817 totalCount += data.readUnsignedInt(position, offset); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
818 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
819 |
4444 | 820 return truncateLongToInt(totalCount); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
821 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
822 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
823 private static int getCountOffset(int index) { |
4444 | 824 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
|
825 } |
4452
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
826 |
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
827 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
|
828 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
|
829 } |
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
|
830 |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
831 @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
|
832 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
|
833 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
|
834 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
|
835 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
|
836 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
|
837 } |
f9d908fb3492
added toString() to HotSpotMethodData to assist with debugging low-level profile data reading
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
838 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
|
839 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
840 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
841 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
842 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
|
843 |
4444 | 844 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
|
845 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
846 public ArgInfoData() { |
14706
579a2a124c95
add HotSpotMethodDataAccessor.Tag enum and dummy entries to PROFILE_DATA_ACCESSORS for new profile types
twisti
parents:
14543
diff
changeset
|
847 super(Tag.ArgInfoData, ARG_INFO_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
848 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
849 } |
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
|
850 |
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
|
851 public void setCompiledIRSize(int size) { |
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
|
852 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
|
853 } |
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
|
854 |
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
|
855 public int getCompiledIRSize() { |
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
|
856 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
|
857 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
858 } |