author | minqi |
Wed, 14 Oct 2015 08:12:33 -0700 | |
changeset 33209 | 43d7a2139756 |
parent 24476 | 912595db2e75 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
33209 | 2 |
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
25 |
package sun.jvm.hotspot.oops; |
|
26 |
||
17362
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
27 |
import java.io.PrintStream; |
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
28 |
import java.util.Observable; |
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
29 |
import java.util.Observer; |
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
30 |
|
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
31 |
import sun.jvm.hotspot.code.NMethod; |
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
32 |
import sun.jvm.hotspot.debugger.Address; |
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
33 |
import sun.jvm.hotspot.interpreter.OopMapCacheEntry; |
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
34 |
import sun.jvm.hotspot.runtime.SignatureConverter; |
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
35 |
import sun.jvm.hotspot.runtime.VM; |
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
36 |
import sun.jvm.hotspot.runtime.VMObjectFactory; |
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
37 |
import sun.jvm.hotspot.types.AddressField; |
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
38 |
import sun.jvm.hotspot.types.Type; |
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
39 |
import sun.jvm.hotspot.types.TypeDataBase; |
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
40 |
import sun.jvm.hotspot.types.WrongTypeException; |
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
41 |
import sun.jvm.hotspot.utilities.Assert; |
1 | 42 |
|
43 |
// A Method represents a Java method |
|
44 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
45 |
public class Method extends Metadata { |
1 | 46 |
static { |
47 |
VM.registerVMInitializedObserver(new Observer() { |
|
48 |
public void update(Observable o, Object data) { |
|
49 |
initialize(VM.getVM().getTypeDataBase()); |
|
50 |
} |
|
51 |
}); |
|
52 |
} |
|
53 |
||
54 |
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { |
|
33209 | 55 |
type = db.lookupType("Method"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
56 |
constMethod = type.getAddressField("_constMethod"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
57 |
methodData = type.getAddressField("_method_data"); |
17000
11bf92e571a2
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
14745
diff
changeset
|
58 |
methodCounters = type.getAddressField("_method_counters"); |
1 | 59 |
accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0); |
60 |
code = type.getAddressField("_code"); |
|
61 |
vtableIndex = new CIntField(type.getCIntegerField("_vtable_index"), 0); |
|
62 |
||
63 |
/* |
|
64 |
fromCompiledCodeEntryPoint = type.getAddressField("_from_compiled_code_entry_point"); |
|
33209 | 65 |
interpreterEntry = type.getAddressField("_from_interpreted_entry"); |
66 |
*/ |
|
1 | 67 |
|
68 |
objectInitializerName = null; |
|
69 |
classInitializerName = null; |
|
70 |
} |
|
71 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
72 |
public Method(Address addr) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
73 |
super(addr); |
1 | 74 |
} |
75 |
||
76 |
public boolean isMethod() { return true; } |
|
77 |
||
33209 | 78 |
// Not a Method field, used to keep type. |
79 |
private static Type type; |
|
80 |
||
1 | 81 |
// Fields |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
82 |
private static AddressField constMethod; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
83 |
private static AddressField methodData; |
17000
11bf92e571a2
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
14745
diff
changeset
|
84 |
private static AddressField methodCounters; |
1 | 85 |
private static CIntField accessFlags; |
86 |
private static CIntField vtableIndex; |
|
87 |
||
88 |
private static AddressField code; |
|
33209 | 89 |
/* |
90 |
private static AddressCField fromCompiledCodeEntryPoint; |
|
91 |
private static AddressField interpreterEntry; |
|
92 |
*/ |
|
93 |
||
1 | 94 |
|
95 |
// constant method names - <init>, <clinit> |
|
96 |
// Initialized lazily to avoid initialization ordering dependencies between Method and SymbolTable |
|
97 |
private static Symbol objectInitializerName; |
|
98 |
private static Symbol classInitializerName; |
|
99 |
private static Symbol objectInitializerName() { |
|
100 |
if (objectInitializerName == null) { |
|
101 |
objectInitializerName = VM.getVM().getSymbolTable().probe("<init>"); |
|
102 |
} |
|
103 |
return objectInitializerName; |
|
104 |
} |
|
105 |
private static Symbol classInitializerName() { |
|
106 |
if (classInitializerName == null) { |
|
107 |
classInitializerName = VM.getVM().getSymbolTable().probe("<clinit>"); |
|
108 |
} |
|
109 |
return classInitializerName; |
|
110 |
} |
|
111 |
||
112 |
||
113 |
// Accessors for declared fields |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
114 |
public ConstMethod getConstMethod() { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
115 |
Address addr = constMethod.getValue(getAddress()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
116 |
return (ConstMethod) VMObjectFactory.newObject(ConstMethod.class, addr); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
117 |
} |
12937
0032fb2caff6
7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents:
10547
diff
changeset
|
118 |
public ConstantPool getConstants() { |
0032fb2caff6
7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents:
10547
diff
changeset
|
119 |
return getConstMethod().getConstants(); |
0032fb2caff6
7172967: Eliminate constMethod's _method backpointer to methodOop.
jiangli
parents:
10547
diff
changeset
|
120 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
121 |
public MethodData getMethodData() { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
122 |
Address addr = methodData.getValue(getAddress()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
123 |
return (MethodData) VMObjectFactory.newObject(MethodData.class, addr); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
124 |
} |
17000
11bf92e571a2
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
14745
diff
changeset
|
125 |
public MethodCounters getMethodCounters() { |
11bf92e571a2
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
14745
diff
changeset
|
126 |
Address addr = methodCounters.getValue(getAddress()); |
11bf92e571a2
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
14745
diff
changeset
|
127 |
return (MethodCounters) VMObjectFactory.newObject(MethodCounters.class, addr); |
11bf92e571a2
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
14745
diff
changeset
|
128 |
} |
1 | 129 |
/** WARNING: this is in words, not useful in this system; use getObjectSize() instead */ |
14586
1262473e8fc1
8003848: Make ConstMethod::generic_signature_index optional and move Method::_max_stack to ConstMethod.
jiangli
parents:
14477
diff
changeset
|
130 |
public long getMaxStack() { return getConstMethod().getMaxStack(); } |
14745
03904dd8649b
8004076: Move _max_locals and _size_of_parameters to ConstMethod for better sharing.
jiangli
parents:
14586
diff
changeset
|
131 |
public long getMaxLocals() { return getConstMethod().getMaxLocals(); } |
03904dd8649b
8004076: Move _max_locals and _size_of_parameters to ConstMethod for better sharing.
jiangli
parents:
14586
diff
changeset
|
132 |
public long getSizeOfParameters() { return getConstMethod().getSizeOfParameters(); } |
1 | 133 |
public long getNameIndex() { return getConstMethod().getNameIndex(); } |
134 |
public long getSignatureIndex() { return getConstMethod().getSignatureIndex(); } |
|
135 |
public long getGenericSignatureIndex() { return getConstMethod().getGenericSignatureIndex(); } |
|
136 |
public long getAccessFlags() { return accessFlags.getValue(this); } |
|
137 |
public long getCodeSize() { return getConstMethod().getCodeSize(); } |
|
138 |
public long getVtableIndex() { return vtableIndex.getValue(this); } |
|
17362
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
139 |
public long getInvocationCount() { |
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
140 |
MethodCounters mc = getMethodCounters(); |
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
141 |
return mc == null ? 0 : mc.getInvocationCounter(); |
1 | 142 |
} |
17362
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
143 |
public long getBackedgeCount() { |
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
144 |
MethodCounters mc = getMethodCounters(); |
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
145 |
return mc == null ? 0 : mc.getBackedgeCounter(); |
10547 | 146 |
} |
1 | 147 |
|
148 |
// get associated compiled native method, if available, else return null. |
|
149 |
public NMethod getNativeMethod() { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
150 |
Address addr = code.getValue(getAddress()); |
1 | 151 |
return (NMethod) VMObjectFactory.newObject(NMethod.class, addr); |
152 |
} |
|
153 |
||
154 |
// Convenience routine |
|
155 |
public AccessFlags getAccessFlagsObj() { |
|
156 |
return new AccessFlags(getAccessFlags()); |
|
157 |
} |
|
158 |
||
159 |
/** Get a bytecode or breakpoint at the given bci */ |
|
160 |
public int getBytecodeOrBPAt(int bci) { |
|
161 |
return getConstMethod().getBytecodeOrBPAt(bci); |
|
162 |
} |
|
163 |
||
164 |
/** Fetch the original non-breakpoint bytecode at the specified |
|
165 |
bci. It is required that there is currently a bytecode at this |
|
166 |
bci. */ |
|
167 |
public int getOrigBytecodeAt(int bci) { |
|
14391
df0a1573d5bd
8000725: NPG: method_holder() and pool_holder() and pool_holder field should be InstanceKlass
coleenp
parents:
13728
diff
changeset
|
168 |
BreakpointInfo bp = getMethodHolder().getBreakpoints(); |
1 | 169 |
for (; bp != null; bp = bp.getNext()) { |
170 |
if (bp.match(this, bci)) { |
|
171 |
return bp.getOrigBytecode(); |
|
172 |
} |
|
173 |
} |
|
174 |
System.err.println("Requested bci " + bci); |
|
175 |
for (; bp != null; bp = bp.getNext()) { |
|
176 |
System.err.println("Breakpoint at bci " + bp.getBCI() + ", bytecode " + |
|
177 |
bp.getOrigBytecode()); |
|
178 |
} |
|
179 |
Assert.that(false, "Should not reach here"); |
|
180 |
return -1; // not reached |
|
181 |
} |
|
182 |
||
183 |
public byte getBytecodeByteArg(int bci) { |
|
184 |
return getConstMethod().getBytecodeByteArg(bci); |
|
185 |
} |
|
186 |
||
187 |
/** Fetches a 16-bit big-endian ("Java ordered") value from the |
|
188 |
bytecode stream */ |
|
189 |
public short getBytecodeShortArg(int bci) { |
|
190 |
return getConstMethod().getBytecodeShortArg(bci); |
|
191 |
} |
|
192 |
||
10251
71b8938a2821
7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents:
8921
diff
changeset
|
193 |
/** Fetches a 16-bit native ordered value from the |
71b8938a2821
7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents:
8921
diff
changeset
|
194 |
bytecode stream */ |
71b8938a2821
7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents:
8921
diff
changeset
|
195 |
public short getNativeShortArg(int bci) { |
71b8938a2821
7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents:
8921
diff
changeset
|
196 |
return getConstMethod().getNativeShortArg(bci); |
71b8938a2821
7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents:
8921
diff
changeset
|
197 |
} |
71b8938a2821
7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents:
8921
diff
changeset
|
198 |
|
1 | 199 |
/** Fetches a 32-bit big-endian ("Java ordered") value from the |
200 |
bytecode stream */ |
|
201 |
public int getBytecodeIntArg(int bci) { |
|
202 |
return getConstMethod().getBytecodeIntArg(bci); |
|
203 |
} |
|
204 |
||
10251
71b8938a2821
7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents:
8921
diff
changeset
|
205 |
/** Fetches a 32-bit native ordered value from the |
71b8938a2821
7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents:
8921
diff
changeset
|
206 |
bytecode stream */ |
71b8938a2821
7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents:
8921
diff
changeset
|
207 |
public int getNativeIntArg(int bci) { |
71b8938a2821
7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents:
8921
diff
changeset
|
208 |
return getConstMethod().getNativeIntArg(bci); |
71b8938a2821
7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents:
8921
diff
changeset
|
209 |
} |
71b8938a2821
7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries
never
parents:
8921
diff
changeset
|
210 |
|
1 | 211 |
public byte[] getByteCode() { |
212 |
return getConstMethod().getByteCode(); |
|
213 |
} |
|
214 |
||
215 |
/* |
|
216 |
public Address getCode() { return codeField.getValue(this); } |
|
217 |
public Address getInterpreterEntry() { return interpreterEntryField.getValue(this); } |
|
218 |
public Address getFromCompiledCodeEntryPoint() { return fromCompiledCodeEntryPointField.getValue(this); } |
|
219 |
*/ |
|
220 |
// Accessors |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
5547
diff
changeset
|
221 |
public Symbol getName() { return getConstants().getSymbolAt(getNameIndex()); } |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
5547
diff
changeset
|
222 |
public Symbol getSignature() { return getConstants().getSymbolAt(getSignatureIndex()); } |
1 | 223 |
public Symbol getGenericSignature() { |
224 |
long index = getGenericSignatureIndex(); |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
5547
diff
changeset
|
225 |
return (index != 0L) ? getConstants().getSymbolAt(index) : null; |
1 | 226 |
} |
227 |
||
228 |
// Method holder (the Klass holding this method) |
|
14391
df0a1573d5bd
8000725: NPG: method_holder() and pool_holder() and pool_holder field should be InstanceKlass
coleenp
parents:
13728
diff
changeset
|
229 |
public InstanceKlass getMethodHolder() { return getConstants().getPoolHolder(); } |
1 | 230 |
|
231 |
// Access flags |
|
232 |
public boolean isPublic() { return getAccessFlagsObj().isPublic(); } |
|
233 |
public boolean isPrivate() { return getAccessFlagsObj().isPrivate(); } |
|
234 |
public boolean isProtected() { return getAccessFlagsObj().isProtected(); } |
|
235 |
public boolean isPackagePrivate() { AccessFlags af = getAccessFlagsObj(); |
|
236 |
return (!af.isPublic() && !af.isPrivate() && !af.isProtected()); } |
|
237 |
public boolean isStatic() { return getAccessFlagsObj().isStatic(); } |
|
238 |
public boolean isFinal() { return getAccessFlagsObj().isFinal(); } |
|
239 |
public boolean isSynchronized() { return getAccessFlagsObj().isSynchronized(); } |
|
240 |
public boolean isBridge() { return getAccessFlagsObj().isBridge(); } |
|
241 |
public boolean isVarArgs() { return getAccessFlagsObj().isVarArgs(); } |
|
242 |
public boolean isNative() { return getAccessFlagsObj().isNative(); } |
|
243 |
public boolean isAbstract() { return getAccessFlagsObj().isAbstract(); } |
|
244 |
public boolean isStrict() { return getAccessFlagsObj().isStrict(); } |
|
245 |
public boolean isSynthetic() { return getAccessFlagsObj().isSynthetic(); } |
|
246 |
||
247 |
public boolean isConstructor() { |
|
248 |
return (!isStatic()) && getName().equals(objectInitializerName()); |
|
249 |
} |
|
250 |
||
251 |
public boolean isStaticInitializer() { |
|
252 |
return isStatic() && getName().equals(classInitializerName()); |
|
253 |
} |
|
254 |
||
255 |
public boolean isObsolete() { |
|
256 |
return getAccessFlagsObj().isObsolete(); |
|
257 |
} |
|
258 |
||
259 |
public OopMapCacheEntry getMaskFor(int bci) { |
|
260 |
OopMapCacheEntry entry = new OopMapCacheEntry(); |
|
261 |
entry.fill(this, bci); |
|
262 |
return entry; |
|
263 |
} |
|
264 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
265 |
public long getSize() { |
33209 | 266 |
return type.getSize() + (isNative() ? 2: 0); |
1 | 267 |
} |
268 |
||
269 |
public void printValueOn(PrintStream tty) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
270 |
tty.print("Method " + getName().asString() + getSignature().asString() + "@" + getAddress()); |
1 | 271 |
} |
272 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13282
diff
changeset
|
273 |
public void iterateFields(MetadataVisitor visitor) { |
1 | 274 |
visitor.doCInt(accessFlags, true); |
275 |
} |
|
276 |
||
277 |
public boolean hasLineNumberTable() { |
|
278 |
return getConstMethod().hasLineNumberTable(); |
|
279 |
} |
|
280 |
||
281 |
public int getLineNumberFromBCI(int bci) { |
|
282 |
return getConstMethod().getLineNumberFromBCI(bci); |
|
283 |
} |
|
284 |
||
285 |
public LineNumberTableElement[] getLineNumberTable() { |
|
286 |
return getConstMethod().getLineNumberTable(); |
|
287 |
} |
|
288 |
||
289 |
public boolean hasLocalVariableTable() { |
|
290 |
return getConstMethod().hasLocalVariableTable(); |
|
291 |
} |
|
292 |
||
293 |
/** Should only be called if table is present */ |
|
294 |
public LocalVariableTableElement[] getLocalVariableTable() { |
|
295 |
return getConstMethod().getLocalVariableTable(); |
|
296 |
} |
|
297 |
||
298 |
public Symbol getLocalVariableName(int bci, int slot) { |
|
299 |
if (! hasLocalVariableTable()) { |
|
300 |
return null; |
|
301 |
} |
|
302 |
||
303 |
LocalVariableTableElement[] locals = getLocalVariableTable(); |
|
304 |
for (int l = 0; l < locals.length; l++) { |
|
305 |
LocalVariableTableElement local = locals[l]; |
|
306 |
if ((bci >= local.getStartBCI()) && |
|
307 |
(bci < (local.getStartBCI() + local.getLength())) && |
|
308 |
slot == local.getSlot()) { |
|
309 |
return getConstants().getSymbolAt(local.getNameCPIndex()); |
|
310 |
} |
|
311 |
} |
|
312 |
||
313 |
return null; |
|
314 |
} |
|
315 |
||
13282
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
316 |
public boolean hasExceptionTable() { |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
317 |
return getConstMethod().hasExceptionTable(); |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
318 |
} |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
319 |
|
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
320 |
public ExceptionTableElement[] getExceptionTable() { |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
321 |
return getConstMethod().getExceptionTable(); |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
322 |
} |
9872915dd78d
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
12937
diff
changeset
|
323 |
|
1 | 324 |
public boolean hasCheckedExceptions() { |
325 |
return getConstMethod().hasCheckedExceptions(); |
|
326 |
} |
|
327 |
||
328 |
/** Should only be called if table is present */ |
|
329 |
public CheckedExceptionElement[] getCheckedExceptions() { |
|
330 |
return getConstMethod().getCheckedExceptions(); |
|
331 |
} |
|
332 |
||
333 |
/** Returns name and signature in external form for debugging |
|
334 |
purposes */ |
|
335 |
public String externalNameAndSignature() { |
|
336 |
final StringBuffer buf = new StringBuffer(); |
|
337 |
buf.append(getMethodHolder().getName().asString()); |
|
338 |
buf.append("."); |
|
339 |
buf.append(getName().asString()); |
|
340 |
buf.append("("); |
|
341 |
new SignatureConverter(getSignature(), buf).iterateParameters(); |
|
342 |
buf.append(")"); |
|
343 |
return buf.toString().replace('/', '.'); |
|
344 |
} |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14391
diff
changeset
|
345 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14391
diff
changeset
|
346 |
public void dumpReplayData(PrintStream out) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14391
diff
changeset
|
347 |
NMethod nm = getNativeMethod(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14391
diff
changeset
|
348 |
int code_size = 0; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14391
diff
changeset
|
349 |
if (nm != null) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14391
diff
changeset
|
350 |
code_size = (int)nm.codeEnd().minus(nm.getVerifiedEntryPoint()); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14391
diff
changeset
|
351 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14391
diff
changeset
|
352 |
Klass holder = getMethodHolder(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14391
diff
changeset
|
353 |
out.println("ciMethod " + |
24476
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
17362
diff
changeset
|
354 |
nameAsAscii() + " " + |
17362
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
355 |
getInvocationCount() + " " + |
d30ac6d6d655
8013591: compiler/ciReplay/TestSA.sh fails in nightly
sla
parents:
17000
diff
changeset
|
356 |
getBackedgeCount() + " " + |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14391
diff
changeset
|
357 |
interpreterInvocationCount() + " " + |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14391
diff
changeset
|
358 |
interpreterThrowoutCount() + " " + |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14391
diff
changeset
|
359 |
code_size); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14391
diff
changeset
|
360 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
14391
diff
changeset
|
361 |
|
10547 | 362 |
public int interpreterThrowoutCount() { |
17000
11bf92e571a2
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
14745
diff
changeset
|
363 |
return getMethodCounters().interpreterThrowoutCount(); |
10547 | 364 |
} |
365 |
||
366 |
public int interpreterInvocationCount() { |
|
17000
11bf92e571a2
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
14745
diff
changeset
|
367 |
return getMethodCounters().interpreterInvocationCount(); |
10547 | 368 |
} |
24476
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
17362
diff
changeset
|
369 |
|
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
17362
diff
changeset
|
370 |
public String nameAsAscii() { |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
17362
diff
changeset
|
371 |
return getMethodHolder().getName().asString() + " " + |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
17362
diff
changeset
|
372 |
OopUtilities.escapeString(getName().asString()) + " " + |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
17362
diff
changeset
|
373 |
getSignature().asString(); |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
17362
diff
changeset
|
374 |
} |
1 | 375 |
} |