Mercurial > hg > truffle
comparison agent/src/share/classes/sun/jvm/hotspot/oops/RetData.java @ 3939:f6f3bb0ee072
7088955: add C2 IR support to the SA
Reviewed-by: kvn
author | never |
---|---|
date | Sun, 11 Sep 2011 14:48:24 -0700 |
parents | |
children | 79f492f184d0 |
comparison
equal
deleted
inserted
replaced
3938:e6b1331a51d2 | 3939:f6f3bb0ee072 |
---|---|
1 /* | |
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
22 * | |
23 */ | |
24 | |
25 package sun.jvm.hotspot.oops; | |
26 | |
27 import java.io.*; | |
28 import java.util.*; | |
29 import sun.jvm.hotspot.debugger.*; | |
30 import sun.jvm.hotspot.runtime.*; | |
31 import sun.jvm.hotspot.types.*; | |
32 import sun.jvm.hotspot.utilities.*; | |
33 | |
34 // RetData | |
35 // | |
36 // A RetData is used to access profiling information for a ret bytecode. | |
37 // It is composed of a count of the number of times that the ret has | |
38 // been executed, followed by a series of triples of the form | |
39 // (bci, count, di) which count the number of times that some bci was the | |
40 // target of the ret and cache a corresponding data displacement. | |
41 public class RetData extends CounterData { | |
42 | |
43 static final int bci0Offset = counterCellCount; | |
44 static final int count0Offset = bci0Offset + 1; | |
45 static final int displacement0Offset = count0Offset + 1; | |
46 static final int retRowCellCount = (displacement0Offset + 1) - bci0Offset; | |
47 | |
48 public RetData(DataLayout layout) { | |
49 super(layout); | |
50 //assert(layout.tag() == DataLayout.retDataTag, "wrong type"); | |
51 } | |
52 | |
53 static final int noBci = -1; // value of bci when bci1/2 are not in use. | |
54 | |
55 static int staticCellCount() { | |
56 return counterCellCount + MethodData.BciProfileWidth * retRowCellCount; | |
57 } | |
58 | |
59 public int cellCount() { | |
60 return staticCellCount(); | |
61 } | |
62 | |
63 static int rowLimit() { | |
64 return MethodData.BciProfileWidth; | |
65 } | |
66 static int bciCellIndex(int row) { | |
67 return bci0Offset + row * retRowCellCount; | |
68 } | |
69 static int bciCountCellIndex(int row) { | |
70 return count0Offset + row * retRowCellCount; | |
71 } | |
72 static int bciDisplacementCellIndex(int row) { | |
73 return displacement0Offset + row * retRowCellCount; | |
74 } | |
75 | |
76 // Direct accessors | |
77 int bci(int row) { | |
78 return intAt(bciCellIndex(row)); | |
79 } | |
80 int bciCount(int row) { | |
81 return uintAt(bciCountCellIndex(row)); | |
82 } | |
83 int bciDisplacement(int row) { | |
84 return intAt(bciDisplacementCellIndex(row)); | |
85 } | |
86 | |
87 // Code generation support | |
88 static int bciOffset(int row) { | |
89 return cellOffset(bciCellIndex(row)); | |
90 } | |
91 static int bciCountOffset(int row) { | |
92 return cellOffset(bciCountCellIndex(row)); | |
93 } | |
94 static int bciDisplacementOffset(int row) { | |
95 return cellOffset(bciDisplacementCellIndex(row)); | |
96 } | |
97 | |
98 public void printDataOn(PrintStream st) { | |
99 printShared(st, "RetData"); | |
100 int row; | |
101 int entries = 0; | |
102 for (row = 0; row < rowLimit(); row++) { | |
103 if (bci(row) != noBci) entries++; | |
104 } | |
105 st.println("count(" + count() + ") entries(" + entries + ")"); | |
106 for (row = 0; row < rowLimit(); row++) { | |
107 if (bci(row) != noBci) { | |
108 tab(st); | |
109 st.println(" bci(" + bci(row) + ": count(" + bciCount(row) + ") displacement(" + bciDisplacement(row) + "))"); | |
110 } | |
111 } | |
112 } | |
113 } |