annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java @ 8610:5407d1dd6450

API to access nullness profiling information for instanceof, checkcast, and aastore increased maximum interpreter code size to support Java debugging on Windows
author Christian Haeubl <haeubl@ssw.jku.at>
date Wed, 27 Mar 2013 10:36:57 +0100
parents 630ea5001e33
children d343737786fe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
1 /*
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
4 *
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
8 *
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
13 * accompanied this code).
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
14 *
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
18 *
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
21 * questions.
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
22 */
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.*;
7037
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 6950
diff changeset
26 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
4470
b7ec250cd29c fixes after merge
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4467
diff changeset
27
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
28 import java.util.*;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
29
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5506
diff changeset
30 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
31 import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType;
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
32 import com.oracle.graal.api.meta.ProfilingInfo.TriState;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
33 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
34 import com.oracle.graal.phases.*;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
35
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
36 /**
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
37 * 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
38 */
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
39 public final class HotSpotMethodData extends CompilerObject {
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
40
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
41 private static final long serialVersionUID = -8873133496591225071L;
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
42
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
43 private static final HotSpotVMConfig config = HotSpotGraalRuntime.getInstance().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
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7391
diff changeset
48 private static final HotSpotMethodDataAccessor[] PROFILE_DATA_ACCESSORS = {null, new BitData(), new CounterData(), new JumpData(), new TypeCheckData(), new VirtualCallData(), new RetData(),
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7391
diff changeset
49 new BranchData(), new MultiBranchData(), new ArgInfoData()};
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
50
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
51 /**
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
52 * 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
53 */
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
54 private final long metaspaceMethodData;
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
55
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
56 private int normalDataSize;
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
57 private int extraDataSize;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
58
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
59 HotSpotMethodData(long metaspaceMethodData) {
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
60 this.metaspaceMethodData = metaspaceMethodData;
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
61 HotSpotGraalRuntime.getInstance().getCompilerToVM().initializeMethodData(metaspaceMethodData, this);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
62 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
63
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
64 public boolean hasNormalData() {
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
65 return normalDataSize > 0;
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
66 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
67
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
68 public boolean hasExtraData() {
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
69 return extraDataSize > 0;
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
70 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
71
4476
00efac2934d3 methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4470
diff changeset
72 public int getExtraDataBeginOffset() {
00efac2934d3 methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4470
diff changeset
73 return normalDataSize;
00efac2934d3 methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4470
diff changeset
74 }
00efac2934d3 methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4470
diff changeset
75
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
76 public boolean isWithin(int position) {
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
77 return position >= 0 && position < normalDataSize + extraDataSize;
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
78 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
79
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
80 public int getDeoptimizationCount(DeoptimizationReason reason) {
5534
e0f7a49129f2 Renamed HotSpotCompilerImpl => HotSpotGraalRuntime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5530
diff changeset
81 int reasonIndex = HotSpotGraalRuntime.getInstance().getRuntime().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
82 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
83 }
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5061
diff changeset
84
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
85 public HotSpotMethodDataAccessor getNormalData(int position) {
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
86 if (position >= normalDataSize) {
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
87 return null;
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
88 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
89
4476
00efac2934d3 methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4470
diff changeset
90 HotSpotMethodDataAccessor result = getData(position);
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
91 assert result != null : "NO_DATA tag is not allowed";
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
92 return result;
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
93 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
94
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
95 public HotSpotMethodDataAccessor getExtraData(int position) {
4552
bc14f8e7d5ed fixed another endless recompilation
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4551
diff changeset
96 if (position >= normalDataSize + extraDataSize) {
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
97 return null;
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
98 }
4476
00efac2934d3 methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4470
diff changeset
99 return getData(position);
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
100 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
101
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
102 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
103 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
104 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
105 } 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
106 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
107 }
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
108 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
109
4476
00efac2934d3 methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4470
diff changeset
110 private HotSpotMethodDataAccessor getData(int position) {
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
111 assert position >= 0 : "out of bounds";
4476
00efac2934d3 methodData bugfix
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4470
diff changeset
112 int tag = AbstractMethodData.readTag(this, position);
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
113 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
114 return PROFILE_DATA_ACCESSORS[tag];
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
115 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
116
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
117 private int readUnsignedByte(int position, int offsetInBytes) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
118 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
119 return unsafe.getByte(metaspaceMethodData + fullOffsetInBytes) & 0xFF;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
120 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
121
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
122 private int readUnsignedShort(int position, int offsetInBytes) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
123 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
124 return unsafe.getShort(metaspaceMethodData + fullOffsetInBytes) & 0xFFFF;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
125 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
126
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
127 private long readUnsignedInt(int position, int offsetInBytes) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
128 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
129 return unsafe.getInt(metaspaceMethodData + fullOffsetInBytes) & 0xFFFFFFFFL;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
130 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
131
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
132 private int readUnsignedIntAsSignedInt(int position, int offsetInBytes) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
133 long value = readUnsignedInt(position, offsetInBytes);
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
134 return truncateLongToInt(value);
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
135 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
136
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
137 private int readInt(int position, int offsetInBytes) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
138 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
139 return unsafe.getInt(metaspaceMethodData + fullOffsetInBytes);
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
140 }
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
141
7037
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 6950
diff changeset
142 private long readWord(int position, int offsetInBytes) {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
143 long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
7037
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 6950
diff changeset
144 return unsafeReadWord(metaspaceMethodData + fullOffsetInBytes);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
145 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
146
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
147 private static int truncateLongToInt(long value) {
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
148 return value > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) value;
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
149 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
150
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
151 private static int computeFullOffset(int position, int offsetInBytes) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
152 return config.methodDataOopDataOffset + position + offsetInBytes;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
153 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
154
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
155 private static int cellIndexToOffset(int cells) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
156 return config.dataLayoutHeaderSize + cellsToBytes(cells);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
157 }
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
158
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
159 private static int cellsToBytes(int cells) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
160 return cells * config.dataLayoutCellSize;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
161 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
162
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
163 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
164
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
165 /**
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
166 * Corresponds to DS_RECOMPILE_BIT defined in deoptimization.cpp.
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
167 */
4467
ed73455e9c03 fixed endless recompiles
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4457
diff changeset
168 private static final int EXCEPTIONS_MASK = 0x80;
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
169
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
170 private final int tag;
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
171 private final int staticSize;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
172
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
173 protected AbstractMethodData(int tag, int staticSize) {
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
174 this.tag = tag;
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
175 this.staticSize = staticSize;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
176 }
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 public int getTag() {
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
179 return tag;
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
180 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
181
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
182 public static int readTag(HotSpotMethodData data, int position) {
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
183 return data.readUnsignedByte(position, config.dataLayoutTagOffset);
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
184 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
185
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
186 @Override
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
187 public int getBCI(HotSpotMethodData data, int position) {
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
188 return data.readUnsignedShort(position, config.dataLayoutBCIOffset);
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
189 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
190
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
191 @Override
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
192 public int getSize(HotSpotMethodData data, int position) {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
193 return staticSize + getDynamicSize(data, position);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
194 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
195
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
196 @Override
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
197 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
198 return TriState.get((getFlags(data, position) & EXCEPTIONS_MASK) != 0);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
199 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
200
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
201 @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
202 public JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position) {
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
203 return null;
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
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
206 @Override
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
207 public double getBranchTakenProbability(HotSpotMethodData data, int position) {
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
208 return -1;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
209 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
210
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
211 @Override
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
212 public double[] getSwitchProbabilities(HotSpotMethodData data, int position) {
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
213 return null;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
214 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
215
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
216 @Override
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
217 public int getExecutionCount(HotSpotMethodData data, int position) {
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
218 return -1;
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
219 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
220
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
221 @Override
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
222 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
223 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
224 }
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
225
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
226 protected int getFlags(HotSpotMethodData data, int position) {
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
227 return data.readUnsignedByte(position, config.dataLayoutFlagsOffset);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
228 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
229
7556
630ea5001e33 Modified formatter settings to not insert line break after annotation on parameters.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
230 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
231 return 0;
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
232 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
233 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
234
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
235 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
236
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
237 private static final int NO_DATA_TAG = 0;
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
238 private static final int NO_DATA_SIZE = cellIndexToOffset(0);
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
239
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
240 private final TriState exceptionSeen;
4527
a0cca63cd366 fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4526
diff changeset
241
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
242 protected NoMethodData(TriState exceptionSeen) {
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
243 super(NO_DATA_TAG, NO_DATA_SIZE);
4527
a0cca63cd366 fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4526
diff changeset
244 this.exceptionSeen = exceptionSeen;
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
245 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
246
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
247 @Override
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
248 public int getBCI(HotSpotMethodData data, int position) {
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
249 return -1;
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
250 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
251
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
252 @Override
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
253 public TriState getExceptionSeen(HotSpotMethodData data, int position) {
4527
a0cca63cd366 fixed exceptionSeen profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4526
diff changeset
254 return exceptionSeen;
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
255 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
256 }
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
257
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
258 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
259
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
260 private static final int BIT_DATA_TAG = 1;
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
261 private static final int BIT_DATA_SIZE = cellIndexToOffset(0);
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
262 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
263
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
264 private BitData() {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
265 super(BIT_DATA_TAG, BIT_DATA_SIZE);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
266 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
267
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
268 protected BitData(int tag, int staticSize) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
269 super(tag, staticSize);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
270 }
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
271
8610
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
272 @Override
5407d1dd6450 API to access nullness profiling information for instanceof, checkcast, and aastore
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7556
diff changeset
273 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
274 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
275 }
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
276 }
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 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
279
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
280 private static final int COUNTER_DATA_TAG = 2;
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
281 private static final int COUNTER_DATA_SIZE = cellIndexToOffset(1);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
282 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
283
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
284 public CounterData() {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
285 super(COUNTER_DATA_TAG, COUNTER_DATA_SIZE);
4439
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
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
288 protected CounterData(int tag, int staticSize) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
289 super(tag, staticSize);
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
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
293 public int getExecutionCount(HotSpotMethodData data, int position) {
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
294 return getCounterValue(data, position);
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
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
297 protected int getCounterValue(HotSpotMethodData data, int position) {
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
298 return data.readUnsignedIntAsSignedInt(position, COUNTER_DATA_COUNT_OFFSET);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
299 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
300 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
301
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
302 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
303
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
304 private static final int JUMP_DATA_TAG = 3;
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
305 private static final int JUMP_DATA_SIZE = cellIndexToOffset(2);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
306 protected static final int TAKEN_COUNT_OFFSET = cellIndexToOffset(0);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
307 protected static final int TAKEN_DISPLACEMENT_OFFSET = cellIndexToOffset(1);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
308
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
309 public JumpData() {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
310 super(JUMP_DATA_TAG, JUMP_DATA_SIZE);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
311 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
312
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
313 protected JumpData(int tag, int staticSize) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
314 super(tag, staticSize);
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
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
318 public double getBranchTakenProbability(HotSpotMethodData data, int position) {
5039
f3d2447db2d9 added detection for endless recompilation
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4564
diff changeset
319 return getExecutionCount(data, position) != 0 ? 1 : 0;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
320 }
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 @Override
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
323 public int getExecutionCount(HotSpotMethodData data, int position) {
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
324 return data.readUnsignedIntAsSignedInt(position, TAKEN_COUNT_OFFSET);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
325 }
4452
b225da954a32 inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4448
diff changeset
326
b225da954a32 inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4448
diff changeset
327 @SuppressWarnings("unused")
b225da954a32 inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4448
diff changeset
328 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
329 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
330 }
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
4456
f4c82dd4619e inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4455
diff changeset
333 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
334
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
335 private static final int RECEIVER_TYPE_DATA_ROW_SIZE = cellsToBytes(2);
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
336 private static final int RECEIVER_TYPE_DATA_SIZE = cellIndexToOffset(2) + RECEIVER_TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
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
337 protected static final int NONPROFILED_RECEIVER_COUNT_OFFSET = cellIndexToOffset(1);
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
338 private static final int RECEIVER_TYPE_DATA_FIRST_RECEIVER_OFFSET = cellIndexToOffset(2);
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
339 private static final int RECEIVER_TYPE_DATA_FIRST_COUNT_OFFSET = cellIndexToOffset(3);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
340
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
341 protected AbstractTypeData(int tag) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
342 super(tag, RECEIVER_TYPE_DATA_SIZE);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
343 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
344
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
345 @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
346 public JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position) {
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
347 int typeProfileWidth = config.typeProfileWidth;
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
348
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
349 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
350 long[] counts = new long[typeProfileWidth];
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
351 long totalCount = 0;
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
352 int entries = 0;
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 for (int i = 0; i < typeProfileWidth; i++) {
7037
dd81042f4eb1 added unit tests for ResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents: 6950
diff changeset
355 long receiverKlass = data.readWord(position, getReceiverOffset(i));
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
356 if (receiverKlass != 0) {
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7037
diff changeset
357 types[entries] = HotSpotResolvedObjectType.fromMetaspaceKlass(receiverKlass);
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
358 long count = data.readUnsignedInt(position, getCountOffset(i));
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
359 totalCount += count;
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
360 counts[entries] = count;
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
361
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
362 entries++;
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
363 }
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
364 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
365
4456
f4c82dd4619e inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4455
diff changeset
366 totalCount += getTypesNotRecordedExecutionCount(data, position);
5775
2c088af17e59 Removed left over Ri* prefixed identifiers
Doug Simon <doug.simon@oracle.com>
parents: 5548
diff changeset
367 return createTypeProfile(types, counts, totalCount, entries);
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
368 }
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
369
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
370 protected abstract long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position);
4456
f4c82dd4619e inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4455
diff changeset
371
5775
2c088af17e59 Removed left over Ri* prefixed identifiers
Doug Simon <doug.simon@oracle.com>
parents: 5548
diff changeset
372 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
373 if (entries <= 0 || totalCount < GraalOptions.MatureExecutionsTypeProfile) {
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
374 return null;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
375 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
376
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
377 ProfiledType[] ptypes = new ProfiledType[entries];
4456
f4c82dd4619e inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4455
diff changeset
378 double totalProbability = 0.0;
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
379 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
380 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
381 p = p / totalCount;
4456
f4c82dd4619e inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4455
diff changeset
382 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
383 ptypes[i] = new ProfiledType(types[i], p);
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
384 }
4456
f4c82dd4619e inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4455
diff changeset
385
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
386 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
387
4456
f4c82dd4619e inlining bugfixes and cleanup
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4455
diff changeset
388 double notRecordedTypeProbability = entries < config.typeProfileWidth ? 0.0 : Math.min(1.0, Math.max(0.0, 1.0 - totalProbability));
7391
36dafe48bc38 added relevance-based inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7159
diff changeset
389 assert notRecordedTypeProbability == 0 || entries == config.typeProfileWidth;
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
390 return new JavaTypeProfile(notRecordedTypeProbability, ptypes);
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 int getReceiverOffset(int row) {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
394 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
395 }
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 protected static int getCountOffset(int row) {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
398 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
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
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
402 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
403
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
404 private static final int RECEIVER_TYPE_DATA_TAG = 4;
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 public TypeCheckData() {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
407 super(RECEIVER_TYPE_DATA_TAG);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
408 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
409
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
410 @Override
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
411 public int getExecutionCount(HotSpotMethodData data, int position) {
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
412 return -1;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
413 }
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
414
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
415 @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
416 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
417 return data.readUnsignedIntAsSignedInt(position, NONPROFILED_RECEIVER_COUNT_OFFSET);
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
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
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
421 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
422
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
423 private static final int VIRTUAL_CALL_DATA_TAG = 5;
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
424
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
425 public VirtualCallData() {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
426 super(VIRTUAL_CALL_DATA_TAG);
4439
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
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
429 @Override
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
430 public int getExecutionCount(HotSpotMethodData data, int position) {
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
431 int typeProfileWidth = config.typeProfileWidth;
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 long total = 0;
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
434 for (int i = 0; i < typeProfileWidth; i++) {
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
435 total += data.readUnsignedInt(position, getCountOffset(i));
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
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
438 total += getCounterValue(data, position);
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
439 return truncateLongToInt(total);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
440 }
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
441
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
442 @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
443 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
444 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
445 }
4439
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
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
448 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
449
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
450 private static final int RET_DATA_TAG = 6;
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
451 private static final int RET_DATA_ROW_SIZE = cellsToBytes(3);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
452 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
453
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
454 public RetData() {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
455 super(RET_DATA_TAG, RET_DATA_SIZE);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
456 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
457 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
458
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
459 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
460
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
461 private static final int BRANCH_DATA_TAG = 7;
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
462 private static final int BRANCH_DATA_SIZE = cellIndexToOffset(3);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
463 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
464
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
465 public BranchData() {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
466 super(BRANCH_DATA_TAG, BRANCH_DATA_SIZE);
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
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
469 @Override
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
470 public double getBranchTakenProbability(HotSpotMethodData data, int position) {
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
471 long takenCount = data.readUnsignedInt(position, TAKEN_COUNT_OFFSET);
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
472 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
473 long total = takenCount + notTakenCount;
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
474
4551
a7a16015e47f changed profiling maturity so that profiling information is used more likely
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4527
diff changeset
475 if (total < GraalOptions.MatureExecutionsBranch) {
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
476 return -1;
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
477 } else {
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
478 return takenCount / (double) total;
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
479 }
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
480 }
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
481
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
482 @Override
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
483 public int getExecutionCount(HotSpotMethodData data, int position) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
484 long count = data.readUnsignedInt(position, TAKEN_COUNT_OFFSET) + data.readUnsignedInt(position, NOT_TAKEN_COUNT_OFFSET);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
485 return truncateLongToInt(count);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
486 }
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
487 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
488
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
489 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
490
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
491 private static final int ARRAY_DATA_LENGTH_OFFSET = cellIndexToOffset(0);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
492 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
493
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
494 public ArrayData(int tag, int staticSize) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
495 super(tag, staticSize);
4439
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
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
498 @Override
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
499 protected int getDynamicSize(HotSpotMethodData data, int position) {
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
500 return cellsToBytes(getLength(data, position));
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
501 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
502
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
503 protected static int getLength(HotSpotMethodData data, int position) {
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
504 return data.readInt(position, ARRAY_DATA_LENGTH_OFFSET);
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
505 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
506 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
507
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
508 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
509
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
510 private static final int MULTI_BRANCH_DATA_TAG = 8;
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
511 private static final int MULTI_BRANCH_DATA_SIZE = cellIndexToOffset(1);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
512 private static final int MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS = 2;
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
513 private static final int MULTI_BRANCH_DATA_ROW_SIZE = cellsToBytes(MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
514 private static final int MULTI_BRANCH_DATA_FIRST_COUNT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(0);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
515 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
516
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
517 public MultiBranchData() {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
518 super(MULTI_BRANCH_DATA_TAG, MULTI_BRANCH_DATA_SIZE);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
519 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
520
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
521 @Override
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
522 public double[] getSwitchProbabilities(HotSpotMethodData data, int position) {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
523 int arrayLength = getLength(data, position);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
524 assert arrayLength > 0 : "switch must have at least the default case";
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
525 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
526
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
527 int length = arrayLength / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS;
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
528 long totalCount = 0;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
529 double[] result = new double[length];
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
530
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
531 // default case is first in HotSpot but last for the compiler
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
532 long count = readCount(data, position, 0);
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4444
diff changeset
533 totalCount += count;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4444
diff changeset
534 result[length - 1] = count;
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4444
diff changeset
535
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4444
diff changeset
536 for (int i = 1; i < length; i++) {
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
537 count = readCount(data, position, i);
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
538 totalCount += count;
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4444
diff changeset
539 result[i - 1] = count;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
540 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
541
4551
a7a16015e47f changed profiling maturity so that profiling information is used more likely
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4527
diff changeset
542 if (totalCount < GraalOptions.MatureExecutionsPerSwitchCase * length) {
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
543 return null;
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
544 } else {
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
545 for (int i = 0; i < length; i++) {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
546 result[i] = result[i] / totalCount;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
547 }
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4440
diff changeset
548 return result;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
549 }
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
4447
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
552 private static long readCount(HotSpotMethodData data, int position, int i) {
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
553 int offset;
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
554 long count;
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
555 offset = getCountOffset(i);
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
556 count = data.readUnsignedInt(position, offset);
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
557 return count;
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
558 }
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4446
diff changeset
559
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
560 @Override
4440
271220b49abc profiling info fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
561 public int getExecutionCount(HotSpotMethodData data, int position) {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
562 int arrayLength = getLength(data, position);
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
563 assert arrayLength > 0 : "switch must have at least the default case";
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
564 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
565
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
566 int length = arrayLength / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS;
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
567 long totalCount = 0;
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
568 for (int i = 0; i < length; i++) {
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
569 int offset = getCountOffset(i);
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
570 totalCount += data.readUnsignedInt(position, offset);
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
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
573 return truncateLongToInt(totalCount);
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 private static int getCountOffset(int index) {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
577 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
578 }
4452
b225da954a32 inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4448
diff changeset
579
b225da954a32 inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4448
diff changeset
580 @SuppressWarnings("unused")
b225da954a32 inlining of multiple trival methods at one call site works
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4448
diff changeset
581 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
582 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
583 }
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
584 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
585
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
586 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
587
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
588 private static final int ARG_INFO_DATA_TAG = 9;
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
589 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
590
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
591 public ArgInfoData() {
4444
7d9469b37f1f bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
592 super(ARG_INFO_DATA_TAG, ARG_INFO_DATA_SIZE);
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
593 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
594 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff changeset
595 }