Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java @ 6950:41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
fixed issue when intrinsifying Class.getModifiers() for primitive classes
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 14 Nov 2012 11:28:02 +0100 |
parents | 2463eb24b644 |
children | dd81042f4eb1 |
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 */ |
5548
8872bc0eebdf
Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
23 package com.oracle.graal.hotspot.meta; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
24 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
25 import static com.oracle.graal.graph.FieldIntrospection.*; |
4470
b7ec250cd29c
fixes after merge
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4467
diff
changeset
|
26 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
27 import java.util.*; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
28 |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5506
diff
changeset
|
29 import com.oracle.graal.api.meta.*; |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6525
diff
changeset
|
30 import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType; |
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6525
diff
changeset
|
31 import com.oracle.graal.api.meta.ProfilingInfo.ExceptionSeen; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
32 import com.oracle.graal.hotspot.*; |
6525
2c913b643422
rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents:
5775
diff
changeset
|
33 import com.oracle.graal.phases.*; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
34 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
35 /** |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
36 * 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
|
37 */ |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
38 public final class HotSpotMethodData extends CompilerObject { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
39 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
40 private static final long serialVersionUID = -8873133496591225071L; |
4444 | 41 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
42 private static final HotSpotVMConfig config = HotSpotGraalRuntime.getInstance().getConfig(); |
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
|
43 private static final HotSpotMethodDataAccessor NO_DATA_NO_EXCEPTION_ACCESSOR = new NoMethodData(ExceptionSeen.FALSE); |
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
|
44 private static final HotSpotMethodDataAccessor NO_DATA_EXCEPTION_POSSIBLY_NOT_RECORDED_ACCESSOR = new NoMethodData(ExceptionSeen.NOT_SUPPORTED); |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
45 |
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
|
46 // sorted by tag |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
47 private static final HotSpotMethodDataAccessor[] PROFILE_DATA_ACCESSORS = { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
48 null, new BitData(), new CounterData(), new JumpData(), |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
49 new TypeCheckData(), new VirtualCallData(), new RetData(), |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
50 new BranchData(), new MultiBranchData(), new ArgInfoData() |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
51 }; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
52 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
53 /** |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
54 * 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
|
55 */ |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
56 private final long metaspaceMethodData; |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
57 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
58 private int normalDataSize; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
59 private int extraDataSize; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
60 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
61 HotSpotMethodData(long metaspaceMethodData) { |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
62 this.metaspaceMethodData = metaspaceMethodData; |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
63 HotSpotGraalRuntime.getInstance().getCompilerToVM().initializeMethodData(metaspaceMethodData, this); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
64 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
65 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
66 public boolean hasNormalData() { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
67 return normalDataSize > 0; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
68 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
69 |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
70 public boolean hasExtraData() { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
71 return extraDataSize > 0; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
72 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
73 |
4476
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4470
diff
changeset
|
74 public int getExtraDataBeginOffset() { |
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4470
diff
changeset
|
75 return normalDataSize; |
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4470
diff
changeset
|
76 } |
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4470
diff
changeset
|
77 |
4444 | 78 public boolean isWithin(int position) { |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
79 return position >= 0 && position < normalDataSize + extraDataSize; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
80 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
81 |
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
|
82 public int getDeoptimizationCount(DeoptimizationReason reason) { |
5534
e0f7a49129f2
Renamed HotSpotCompilerImpl => HotSpotGraalRuntime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5530
diff
changeset
|
83 int reasonIndex = HotSpotGraalRuntime.getInstance().getRuntime().convertDeoptReason(reason); |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
84 return unsafe.getByte(null, 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
|
85 } |
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5061
diff
changeset
|
86 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
87 public HotSpotMethodDataAccessor getNormalData(int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
88 if (position >= normalDataSize) { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
89 return null; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
90 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
91 |
4476
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4470
diff
changeset
|
92 HotSpotMethodDataAccessor result = getData(position); |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
93 assert result != null : "NO_DATA tag is not allowed"; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
94 return result; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
95 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
96 |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
97 public HotSpotMethodDataAccessor getExtraData(int position) { |
4552
bc14f8e7d5ed
fixed another endless recompilation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4551
diff
changeset
|
98 if (position >= normalDataSize + extraDataSize) { |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
99 return null; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
100 } |
4476
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4470
diff
changeset
|
101 return getData(position); |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
102 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
103 |
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
|
104 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
|
105 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
|
106 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
|
107 } 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
|
108 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
|
109 } |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
110 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
111 |
4476
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4470
diff
changeset
|
112 private HotSpotMethodDataAccessor getData(int position) { |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
113 assert position >= 0 : "out of bounds"; |
4476
00efac2934d3
methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4470
diff
changeset
|
114 int tag = AbstractMethodData.readTag(this, position); |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
115 assert tag >= 0 && tag < PROFILE_DATA_ACCESSORS.length : "illegal tag"; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
116 return PROFILE_DATA_ACCESSORS[tag]; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
117 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
118 |
4444 | 119 private int readUnsignedByte(int position, int offsetInBytes) { |
120 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); | |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
121 return unsafe.getByte(null, metaspaceMethodData + fullOffsetInBytes) & 0xFF; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
122 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
123 |
4444 | 124 private int readUnsignedShort(int position, int offsetInBytes) { |
125 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); | |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
126 return unsafe.getShort(null, metaspaceMethodData + fullOffsetInBytes) & 0xFFFF; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
127 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
128 |
4444 | 129 private long readUnsignedInt(int position, int offsetInBytes) { |
130 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); | |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
131 return unsafe.getInt(null, metaspaceMethodData + fullOffsetInBytes) & 0xFFFFFFFFL; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
132 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
133 |
4444 | 134 private int readUnsignedIntAsSignedInt(int position, int offsetInBytes) { |
135 long value = readUnsignedInt(position, offsetInBytes); | |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
136 return truncateLongToInt(value); |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
137 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
138 |
4444 | 139 private int readInt(int position, int offsetInBytes) { |
140 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); | |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
141 return unsafe.getInt(null, metaspaceMethodData + fullOffsetInBytes); |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
142 } |
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
143 |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
144 private long readLong(int position, int offsetInBytes) { |
4444 | 145 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
146 return unsafe.getLong(null, metaspaceMethodData + fullOffsetInBytes); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
147 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
148 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
149 private static int truncateLongToInt(long value) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
150 return value > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) value; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
151 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
152 |
4444 | 153 private static int computeFullOffset(int position, int offsetInBytes) { |
154 return config.methodDataOopDataOffset + position + offsetInBytes; | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
155 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
156 |
4444 | 157 private static int cellIndexToOffset(int cells) { |
158 return config.dataLayoutHeaderSize + cellsToBytes(cells); | |
159 } | |
160 | |
161 private static int cellsToBytes(int cells) { | |
162 return cells * config.dataLayoutCellSize; | |
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 |
4447 | 165 private abstract static class AbstractMethodData implements HotSpotMethodDataAccessor { |
4467
ed73455e9c03
fixed endless recompiles
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4457
diff
changeset
|
166 private static final int EXCEPTIONS_MASK = 0x80; |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
167 |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
168 private final int tag; |
4444 | 169 private final int staticSize; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
170 |
4447 | 171 protected AbstractMethodData(int tag, int staticSize) { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
172 this.tag = tag; |
4444 | 173 this.staticSize = staticSize; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
174 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
175 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
176 public int getTag() { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
177 return tag; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
178 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
179 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
180 public static int readTag(HotSpotMethodData data, int position) { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
181 return data.readUnsignedByte(position, config.dataLayoutTagOffset); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
182 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
183 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
184 @Override |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
185 public int getBCI(HotSpotMethodData data, int position) { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
186 return data.readUnsignedShort(position, config.dataLayoutBCIOffset); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
187 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
188 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
189 @Override |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
190 public int getSize(HotSpotMethodData data, int position) { |
4444 | 191 return staticSize + getDynamicSize(data, position); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
192 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
193 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
194 @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
|
195 public ExceptionSeen getExceptionSeen(HotSpotMethodData data, int position) { |
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
|
196 return ExceptionSeen.get((getFlags(data, position) & EXCEPTIONS_MASK) != 0); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
197 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
198 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
199 @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
|
200 public JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position) { |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
201 return null; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
202 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
203 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
204 @Override |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
205 public double getBranchTakenProbability(HotSpotMethodData data, int position) { |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
206 return -1; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
207 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
208 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
209 @Override |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
210 public double[] getSwitchProbabilities(HotSpotMethodData data, int position) { |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
211 return null; |
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 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
214 @Override |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
215 public int getExecutionCount(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
216 return -1; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
217 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
218 |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
219 protected int getFlags(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
220 return data.readUnsignedByte(position, config.dataLayoutFlagsOffset); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
221 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
222 |
4444 | 223 protected int getDynamicSize(@SuppressWarnings("unused") HotSpotMethodData data, @SuppressWarnings("unused") int position) { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
224 return 0; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
225 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
226 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
227 |
4447 | 228 private static class NoMethodData extends AbstractMethodData { |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
229 private static final int NO_DATA_TAG = 0; |
4444 | 230 private static final int NO_DATA_SIZE = cellIndexToOffset(0); |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
231 |
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
|
232 private final ExceptionSeen exceptionSeen; |
4527
a0cca63cd366
fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4526
diff
changeset
|
233 |
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
|
234 protected NoMethodData(ExceptionSeen exceptionSeen) { |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
235 super(NO_DATA_TAG, NO_DATA_SIZE); |
4527
a0cca63cd366
fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4526
diff
changeset
|
236 this.exceptionSeen = exceptionSeen; |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
237 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
238 |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
239 @Override |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
240 public int getBCI(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
241 return -1; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
242 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
243 |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
244 |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
245 @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
|
246 public ExceptionSeen getExceptionSeen(HotSpotMethodData data, int position) { |
4527
a0cca63cd366
fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4526
diff
changeset
|
247 return exceptionSeen; |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
248 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
249 } |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
250 |
4447 | 251 private static class BitData extends AbstractMethodData { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
252 private static final int BIT_DATA_TAG = 1; |
4444 | 253 private static final int BIT_DATA_SIZE = cellIndexToOffset(0); |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
254 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
|
255 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
256 private BitData() { |
4444 | 257 super(BIT_DATA_TAG, BIT_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
258 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
259 |
4444 | 260 protected BitData(int tag, int staticSize) { |
261 super(tag, staticSize); | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
262 } |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
263 |
4452
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
264 @SuppressWarnings("unused") |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
265 public boolean getNullSeen(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
266 return (getFlags(data, position) & BIT_DATA_NULL_SEEN_FLAG) != 0; |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
267 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
268 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
269 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
270 private static class CounterData extends BitData { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
271 private static final int COUNTER_DATA_TAG = 2; |
4444 | 272 private static final int COUNTER_DATA_SIZE = cellIndexToOffset(1); |
273 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
|
274 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
275 public CounterData() { |
4444 | 276 super(COUNTER_DATA_TAG, COUNTER_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
277 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
278 |
4444 | 279 protected CounterData(int tag, int staticSize) { |
280 super(tag, staticSize); | |
4439
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 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
283 @Override |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
284 public int getExecutionCount(HotSpotMethodData data, int position) { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
285 return getCounterValue(data, position); |
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 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
288 protected int getCounterValue(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
289 return data.readUnsignedIntAsSignedInt(position, COUNTER_DATA_COUNT_OFFSET); |
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 |
4447 | 293 private static class JumpData extends AbstractMethodData { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
294 private static final int JUMP_DATA_TAG = 3; |
4444 | 295 private static final int JUMP_DATA_SIZE = cellIndexToOffset(2); |
296 protected static final int TAKEN_COUNT_OFFSET = cellIndexToOffset(0); | |
297 protected static final int TAKEN_DISPLACEMENT_OFFSET = cellIndexToOffset(1); | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
298 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
299 public JumpData() { |
4444 | 300 super(JUMP_DATA_TAG, JUMP_DATA_SIZE); |
4439
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 |
4444 | 303 protected JumpData(int tag, int staticSize) { |
304 super(tag, staticSize); | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
305 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
306 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
307 @Override |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
308 public double getBranchTakenProbability(HotSpotMethodData data, int position) { |
5039
f3d2447db2d9
added detection for endless recompilation
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4564
diff
changeset
|
309 return getExecutionCount(data, position) != 0 ? 1 : 0; |
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 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
313 public int getExecutionCount(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
314 return data.readUnsignedIntAsSignedInt(position, TAKEN_COUNT_OFFSET); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
315 } |
4452
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
316 |
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
317 @SuppressWarnings("unused") |
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
318 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
|
319 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
|
320 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
321 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
322 |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
323 private abstract static class AbstractTypeData extends CounterData { |
4444 | 324 private static final int RECEIVER_TYPE_DATA_ROW_SIZE = cellsToBytes(2); |
325 private static final int RECEIVER_TYPE_DATA_SIZE = cellIndexToOffset(1) + RECEIVER_TYPE_DATA_ROW_SIZE * config.typeProfileWidth; | |
326 private static final int RECEIVER_TYPE_DATA_FIRST_RECEIVER_OFFSET = cellIndexToOffset(1); | |
327 private static final int RECEIVER_TYPE_DATA_FIRST_COUNT_OFFSET = cellIndexToOffset(2); | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
328 |
4444 | 329 protected AbstractTypeData(int tag) { |
330 super(tag, RECEIVER_TYPE_DATA_SIZE); | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
331 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
332 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
333 @Override |
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
|
334 public JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position) { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
335 int typeProfileWidth = config.typeProfileWidth; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
336 |
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
|
337 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
|
338 long[] counts = new long[typeProfileWidth]; |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
339 long totalCount = 0; |
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
340 int entries = 0; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
341 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
342 for (int i = 0; i < typeProfileWidth; i++) { |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
343 long receiverKlass = data.readLong(position, getReceiverOffset(i)); |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
344 if (receiverKlass != 0) { |
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
345 types[entries] = HotSpotResolvedJavaType.fromMetaspaceKlass(receiverKlass); |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
346 |
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
347 long count = data.readUnsignedInt(position, getCountOffset(i)); |
4447 | 348 totalCount += count; |
349 counts[entries] = count; | |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
350 |
4447 | 351 entries++; |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
352 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
353 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
354 |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
355 totalCount += getTypesNotRecordedExecutionCount(data, position); |
5775
2c088af17e59
Removed left over Ri* prefixed identifiers
Doug Simon <doug.simon@oracle.com>
parents:
5548
diff
changeset
|
356 return createTypeProfile(types, counts, totalCount, entries); |
4447 | 357 } |
358 | |
4526
0e1f15ec0e94
fixed profiling of typechecks
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4476
diff
changeset
|
359 protected long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position) { |
0e1f15ec0e94
fixed profiling of typechecks
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4476
diff
changeset
|
360 // checkcast/aastore/instanceof profiling in the HotSpot template-based interpreter was adjusted so that the counter |
0e1f15ec0e94
fixed profiling of typechecks
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4476
diff
changeset
|
361 // is incremented to indicate the polymorphic case instead of decrementing it for failed type checks |
0e1f15ec0e94
fixed profiling of typechecks
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4476
diff
changeset
|
362 return getCounterValue(data, position); |
0e1f15ec0e94
fixed profiling of typechecks
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4476
diff
changeset
|
363 } |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
364 |
5775
2c088af17e59
Removed left over Ri* prefixed identifiers
Doug Simon <doug.simon@oracle.com>
parents:
5548
diff
changeset
|
365 private static JavaTypeProfile createTypeProfile(ResolvedJavaType[] types, long[] counts, long totalCount, int entries) { |
4551
a7a16015e47f
changed profiling maturity so that profiling information is used more likely
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4527
diff
changeset
|
366 if (entries <= 0 || totalCount < GraalOptions.MatureExecutionsTypeProfile) { |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
367 return null; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
368 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
369 |
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
|
370 ProfiledType[] ptypes = new ProfiledType[entries]; |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
371 double totalProbability = 0.0; |
4444 | 372 for (int i = 0; i < entries; i++) { |
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
|
373 double p = counts[i]; |
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
|
374 p = p / totalCount; |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
375 totalProbability += p; |
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
|
376 ptypes[i] = new ProfiledType(types[i], p); |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
377 } |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
378 |
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
|
379 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
|
380 |
4456
f4c82dd4619e
inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4455
diff
changeset
|
381 double notRecordedTypeProbability = entries < config.typeProfileWidth ? 0.0 : Math.min(1.0, Math.max(0.0, 1.0 - totalProbability)); |
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
|
382 return new JavaTypeProfile(notRecordedTypeProbability, ptypes); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
383 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
384 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
385 private static int getReceiverOffset(int row) { |
4444 | 386 return RECEIVER_TYPE_DATA_FIRST_RECEIVER_OFFSET + row * RECEIVER_TYPE_DATA_ROW_SIZE; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
387 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
388 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
389 protected static int getCountOffset(int row) { |
4444 | 390 return RECEIVER_TYPE_DATA_FIRST_COUNT_OFFSET + row * RECEIVER_TYPE_DATA_ROW_SIZE; |
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 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
394 private static class TypeCheckData extends AbstractTypeData { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
395 private static final int RECEIVER_TYPE_DATA_TAG = 4; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
396 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
397 public TypeCheckData() { |
4444 | 398 super(RECEIVER_TYPE_DATA_TAG); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
399 } |
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 @Override |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
402 public int getExecutionCount(HotSpotMethodData data, int position) { |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
403 return -1; |
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 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
407 private static class VirtualCallData extends AbstractTypeData { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
408 private static final int VIRTUAL_CALL_DATA_TAG = 5; |
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 public VirtualCallData() { |
4444 | 411 super(VIRTUAL_CALL_DATA_TAG); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
412 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
413 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
414 @Override |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
415 public int getExecutionCount(HotSpotMethodData data, int position) { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
416 int typeProfileWidth = config.typeProfileWidth; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
417 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
418 long total = 0; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
419 for (int i = 0; i < typeProfileWidth; i++) { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
420 total += data.readUnsignedInt(position, getCountOffset(i)); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
421 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
422 |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
423 total += getCounterValue(data, position); |
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
424 return truncateLongToInt(total); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
425 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
426 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
427 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
428 private static class RetData extends CounterData { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
429 private static final int RET_DATA_TAG = 6; |
4444 | 430 private static final int RET_DATA_ROW_SIZE = cellsToBytes(3); |
431 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
|
432 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
433 public RetData() { |
4444 | 434 super(RET_DATA_TAG, RET_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
435 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
436 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
437 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
438 private static class BranchData extends JumpData { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
439 private static final int BRANCH_DATA_TAG = 7; |
4444 | 440 private static final int BRANCH_DATA_SIZE = cellIndexToOffset(3); |
441 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
|
442 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
443 public BranchData() { |
4444 | 444 super(BRANCH_DATA_TAG, BRANCH_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
445 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
446 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
447 @Override |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
448 public double getBranchTakenProbability(HotSpotMethodData data, int position) { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
449 long takenCount = data.readUnsignedInt(position, TAKEN_COUNT_OFFSET); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
450 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
|
451 long total = takenCount + notTakenCount; |
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
452 |
4551
a7a16015e47f
changed profiling maturity so that profiling information is used more likely
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4527
diff
changeset
|
453 if (total < GraalOptions.MatureExecutionsBranch) { |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
454 return -1; |
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
455 } else { |
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
456 return takenCount / (double) total; |
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
457 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
458 } |
4444 | 459 |
460 @Override | |
461 public int getExecutionCount(HotSpotMethodData data, int position) { | |
462 long count = data.readUnsignedInt(position, TAKEN_COUNT_OFFSET) + data.readUnsignedInt(position, NOT_TAKEN_COUNT_OFFSET); | |
463 return truncateLongToInt(count); | |
464 } | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
465 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
466 |
4447 | 467 private static class ArrayData extends AbstractMethodData { |
4444 | 468 private static final int ARRAY_DATA_LENGTH_OFFSET = cellIndexToOffset(0); |
469 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
|
470 |
4444 | 471 public ArrayData(int tag, int staticSize) { |
472 super(tag, staticSize); | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
473 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
474 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
475 @Override |
4444 | 476 protected int getDynamicSize(HotSpotMethodData data, int position) { |
477 return cellsToBytes(getLength(data, position)); | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
478 } |
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 protected static int getLength(HotSpotMethodData data, int position) { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
481 return data.readInt(position, ARRAY_DATA_LENGTH_OFFSET); |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
482 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
483 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
484 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
485 private static class MultiBranchData extends ArrayData { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
486 private static final int MULTI_BRANCH_DATA_TAG = 8; |
4444 | 487 private static final int MULTI_BRANCH_DATA_SIZE = cellIndexToOffset(1); |
488 private static final int MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS = 2; | |
489 private static final int MULTI_BRANCH_DATA_ROW_SIZE = cellsToBytes(MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS); | |
490 private static final int MULTI_BRANCH_DATA_FIRST_COUNT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(0); | |
491 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
|
492 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
493 public MultiBranchData() { |
4444 | 494 super(MULTI_BRANCH_DATA_TAG, MULTI_BRANCH_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
495 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
496 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
497 @Override |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
498 public double[] getSwitchProbabilities(HotSpotMethodData data, int position) { |
4444 | 499 int arrayLength = getLength(data, position); |
500 assert arrayLength > 0 : "switch must have at least the default case"; | |
501 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
|
502 |
4444 | 503 int length = arrayLength / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS; |
504 long totalCount = 0; | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
505 double[] result = new double[length]; |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
506 |
4447 | 507 // default case is first in HotSpot but last for the compiler |
508 long count = readCount(data, position, 0); | |
4446 | 509 totalCount += count; |
510 result[length - 1] = count; | |
511 | |
512 for (int i = 1; i < length; i++) { | |
4447 | 513 count = readCount(data, position, i); |
4444 | 514 totalCount += count; |
4446 | 515 result[i - 1] = count; |
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 |
4551
a7a16015e47f
changed profiling maturity so that profiling information is used more likely
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4527
diff
changeset
|
518 if (totalCount < GraalOptions.MatureExecutionsPerSwitchCase * length) { |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
519 return null; |
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
520 } else { |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
521 for (int i = 0; i < length; i++) { |
4444 | 522 result[i] = result[i] / totalCount; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
523 } |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4440
diff
changeset
|
524 return result; |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
525 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
526 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
527 |
4447 | 528 private static long readCount(HotSpotMethodData data, int position, int i) { |
529 int offset; | |
530 long count; | |
531 offset = getCountOffset(i); | |
532 count = data.readUnsignedInt(position, offset); | |
533 return count; | |
534 } | |
535 | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
536 @Override |
4440
271220b49abc
profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
537 public int getExecutionCount(HotSpotMethodData data, int position) { |
4444 | 538 int arrayLength = getLength(data, position); |
539 assert arrayLength > 0 : "switch must have at least the default case"; | |
540 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
|
541 |
4444 | 542 int length = arrayLength / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS; |
543 long totalCount = 0; | |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
544 for (int i = 0; i < length; i++) { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
545 int offset = getCountOffset(i); |
4444 | 546 totalCount += data.readUnsignedInt(position, offset); |
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 |
4444 | 549 return truncateLongToInt(totalCount); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
550 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
551 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
552 private static int getCountOffset(int index) { |
4444 | 553 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
|
554 } |
4452
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
555 |
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
556 @SuppressWarnings("unused") |
b225da954a32
inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4448
diff
changeset
|
557 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
|
558 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
|
559 } |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
560 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
561 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
562 private static class ArgInfoData extends ArrayData { |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
563 private static final int ARG_INFO_DATA_TAG = 9; |
4444 | 564 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
|
565 |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
566 public ArgInfoData() { |
4444 | 567 super(ARG_INFO_DATA_TAG, ARG_INFO_DATA_SIZE); |
4439
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
568 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
569 } |
f7251c729b31
profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
570 } |