Mercurial > hg > truffle
annotate agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java @ 1563:1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
Summary: This moves the oops from Codeblob to nmethod.
Reviewed-by: kvn, never
author | twisti |
---|---|
date | Thu, 20 May 2010 06:34:23 -0700 |
parents | 873ec3787992 |
children | e9ff18c4ace7 |
rev | line source |
---|---|
0 | 1 /* |
1563
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
2 * Copyright 2000-2010 Sun Microsystems, Inc. All Rights Reserved. |
0 | 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.code; | |
26 | |
27 import java.io.*; | |
28 import java.util.*; | |
29 import sun.jvm.hotspot.debugger.*; | |
30 import sun.jvm.hotspot.memory.*; | |
31 import sun.jvm.hotspot.oops.*; | |
32 import sun.jvm.hotspot.runtime.*; | |
33 import sun.jvm.hotspot.types.*; | |
34 import sun.jvm.hotspot.utilities.*; | |
35 | |
36 public class NMethod extends CodeBlob { | |
37 private static long pcDescSize; | |
38 private static CIntegerField zombieInstructionSizeField; | |
39 private static sun.jvm.hotspot.types.OopField methodField; | |
40 /** != InvocationEntryBci if this nmethod is an on-stack replacement method */ | |
41 private static CIntegerField entryBCIField; | |
42 /** To support simple linked-list chaining of nmethods */ | |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
931
diff
changeset
|
43 private static AddressField osrLinkField; |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
931
diff
changeset
|
44 private static AddressField scavengeRootLinkField; |
1040
873ec3787992
6892186: SA does not dump debug info for scalar replaced objects
kvn
parents:
989
diff
changeset
|
45 private static JByteField scavengeRootStateField; |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
931
diff
changeset
|
46 |
0 | 47 /** Offsets for different nmethod parts */ |
48 private static CIntegerField exceptionOffsetField; | |
49 private static CIntegerField deoptOffsetField; | |
50 private static CIntegerField origPCOffsetField; | |
51 private static CIntegerField stubOffsetField; | |
1563
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
52 private static CIntegerField oopsOffsetField; |
0 | 53 private static CIntegerField scopesDataOffsetField; |
54 private static CIntegerField scopesPCsOffsetField; | |
55 private static CIntegerField dependenciesOffsetField; | |
56 private static CIntegerField handlerTableOffsetField; | |
57 private static CIntegerField nulChkTableOffsetField; | |
58 private static CIntegerField nmethodEndOffsetField; | |
59 | |
60 /** Offsets for entry points */ | |
61 /** Entry point with class check */ | |
62 private static AddressField entryPointField; | |
63 /** Entry point without class check */ | |
64 private static AddressField verifiedEntryPointField; | |
65 /** Entry point for on stack replacement */ | |
66 private static AddressField osrEntryPointField; | |
67 | |
68 // FIXME: add access to flags (how?) | |
69 | |
70 /** NMethod Flushing lock (if non-zero, then the nmethod is not removed) */ | |
71 private static JIntField lockCountField; | |
72 | |
73 /** not_entrant method removal. Each mark_sweep pass will update | |
74 this mark to current sweep invocation count if it is seen on the | |
75 stack. An not_entrant method can be removed when there is no | |
76 more activations, i.e., when the _stack_traversal_mark is less than | |
77 current sweep traversal index. */ | |
78 private static CIntegerField stackTraversalMarkField; | |
79 | |
80 static { | |
81 VM.registerVMInitializedObserver(new Observer() { | |
82 public void update(Observable o, Object data) { | |
83 initialize(VM.getVM().getTypeDataBase()); | |
84 } | |
85 }); | |
86 } | |
87 | |
88 private static void initialize(TypeDataBase db) { | |
89 Type type = db.lookupType("nmethod"); | |
90 | |
91 zombieInstructionSizeField = type.getCIntegerField("_zombie_instruction_size"); | |
92 methodField = type.getOopField("_method"); | |
93 entryBCIField = type.getCIntegerField("_entry_bci"); | |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
931
diff
changeset
|
94 osrLinkField = type.getAddressField("_osr_link"); |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
931
diff
changeset
|
95 scavengeRootLinkField = type.getAddressField("_scavenge_root_link"); |
1040
873ec3787992
6892186: SA does not dump debug info for scalar replaced objects
kvn
parents:
989
diff
changeset
|
96 scavengeRootStateField = type.getJByteField("_scavenge_root_state"); |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
931
diff
changeset
|
97 |
0 | 98 exceptionOffsetField = type.getCIntegerField("_exception_offset"); |
99 deoptOffsetField = type.getCIntegerField("_deoptimize_offset"); | |
100 origPCOffsetField = type.getCIntegerField("_orig_pc_offset"); | |
101 stubOffsetField = type.getCIntegerField("_stub_offset"); | |
1563
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
102 oopsOffsetField = type.getCIntegerField("_oops_offset"); |
0 | 103 scopesDataOffsetField = type.getCIntegerField("_scopes_data_offset"); |
104 scopesPCsOffsetField = type.getCIntegerField("_scopes_pcs_offset"); | |
105 dependenciesOffsetField = type.getCIntegerField("_dependencies_offset"); | |
106 handlerTableOffsetField = type.getCIntegerField("_handler_table_offset"); | |
107 nulChkTableOffsetField = type.getCIntegerField("_nul_chk_table_offset"); | |
108 nmethodEndOffsetField = type.getCIntegerField("_nmethod_end_offset"); | |
109 entryPointField = type.getAddressField("_entry_point"); | |
110 verifiedEntryPointField = type.getAddressField("_verified_entry_point"); | |
111 osrEntryPointField = type.getAddressField("_osr_entry_point"); | |
112 lockCountField = type.getJIntField("_lock_count"); | |
113 stackTraversalMarkField = type.getCIntegerField("_stack_traversal_mark"); | |
114 | |
115 pcDescSize = db.lookupType("PcDesc").getSize(); | |
116 } | |
117 | |
118 public NMethod(Address addr) { | |
119 super(addr); | |
120 } | |
121 | |
122 | |
123 // Accessors | |
124 public Address getAddress() { | |
125 return addr; | |
126 } | |
127 | |
128 public Method getMethod() { | |
129 return (Method) VM.getVM().getObjectHeap().newOop(methodField.getValue(addr)); | |
130 } | |
131 | |
132 // Type info | |
133 public boolean isNMethod() { return true; } | |
134 public boolean isJavaMethod() { return !getMethod().isNative(); } | |
135 public boolean isNativeMethod() { return getMethod().isNative(); } | |
136 public boolean isOSRMethod() { return getEntryBCI() != VM.getVM().getInvocationEntryBCI(); } | |
137 | |
138 /** Boundaries for different parts */ | |
139 public Address constantsBegin() { return instructionsBegin(); } | |
140 public Address constantsEnd() { return getEntryPoint(); } | |
141 public Address codeBegin() { return getEntryPoint(); } | |
142 public Address codeEnd() { return headerBegin().addOffsetTo(getStubOffset()); } | |
143 public Address exceptionBegin() { return headerBegin().addOffsetTo(getExceptionOffset()); } | |
144 public Address deoptBegin() { return headerBegin().addOffsetTo(getDeoptOffset()); } | |
145 public Address stubBegin() { return headerBegin().addOffsetTo(getStubOffset()); } | |
1563
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
146 public Address stubEnd() { return headerBegin().addOffsetTo(getOopsOffset()); } |
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
147 public Address oopsBegin() { return headerBegin().addOffsetTo(getOopsOffset()); } |
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
148 public Address oopsEnd() { return headerBegin().addOffsetTo(getScopesDataOffset()); } |
0 | 149 public Address scopesDataBegin() { return headerBegin().addOffsetTo(getScopesDataOffset()); } |
150 public Address scopesDataEnd() { return headerBegin().addOffsetTo(getScopesPCsOffset()); } | |
151 public Address scopesPCsBegin() { return headerBegin().addOffsetTo(getScopesPCsOffset()); } | |
152 public Address scopesPCsEnd() { return headerBegin().addOffsetTo(getDependenciesOffset()); } | |
153 public Address dependenciesBegin() { return headerBegin().addOffsetTo(getDependenciesOffset()); } | |
154 public Address dependenciesEnd() { return headerBegin().addOffsetTo(getHandlerTableOffset()); } | |
155 public Address handlerTableBegin() { return headerBegin().addOffsetTo(getHandlerTableOffset()); } | |
156 public Address handlerTableEnd() { return headerBegin().addOffsetTo(getNulChkTableOffset()); } | |
157 public Address nulChkTableBegin() { return headerBegin().addOffsetTo(getNulChkTableOffset()); } | |
158 public Address nulChkTableEnd() { return headerBegin().addOffsetTo(getNMethodEndOffset()); } | |
159 | |
160 public int constantsSize() { return (int) constantsEnd() .minus(constantsBegin()); } | |
161 public int codeSize() { return (int) codeEnd() .minus(codeBegin()); } | |
162 public int stubSize() { return (int) stubEnd() .minus(stubBegin()); } | |
1563
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
163 public int oopsSize() { return (int) oopsEnd() .minus(oopsBegin()); } |
0 | 164 public int scopesDataSize() { return (int) scopesDataEnd() .minus(scopesDataBegin()); } |
165 public int scopesPCsSize() { return (int) scopesPCsEnd() .minus(scopesPCsBegin()); } | |
166 public int dependenciesSize() { return (int) dependenciesEnd().minus(dependenciesBegin()); } | |
167 public int handlerTableSize() { return (int) handlerTableEnd().minus(handlerTableBegin()); } | |
168 public int nulChkTableSize() { return (int) nulChkTableEnd() .minus(nulChkTableBegin()); } | |
169 public int origPCOffset() { return (int) origPCOffsetField.getValue(addr); } | |
170 | |
171 public int totalSize() { | |
172 return | |
173 constantsSize() + | |
174 codeSize() + | |
175 stubSize() + | |
176 scopesDataSize() + | |
177 scopesPCsSize() + | |
178 dependenciesSize() + | |
179 handlerTableSize() + | |
180 nulChkTableSize(); | |
181 } | |
182 | |
183 public boolean constantsContains (Address addr) { return constantsBegin() .lessThanOrEqual(addr) && constantsEnd() .greaterThan(addr); } | |
184 public boolean codeContains (Address addr) { return codeBegin() .lessThanOrEqual(addr) && codeEnd() .greaterThan(addr); } | |
185 public boolean stubContains (Address addr) { return stubBegin() .lessThanOrEqual(addr) && stubEnd() .greaterThan(addr); } | |
1563
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
186 public boolean oopsContains (Address addr) { return oopsBegin() .lessThanOrEqual(addr) && oopsEnd() .greaterThan(addr); } |
0 | 187 public boolean scopesDataContains (Address addr) { return scopesDataBegin() .lessThanOrEqual(addr) && scopesDataEnd() .greaterThan(addr); } |
188 public boolean scopesPCsContains (Address addr) { return scopesPCsBegin() .lessThanOrEqual(addr) && scopesPCsEnd() .greaterThan(addr); } | |
189 public boolean handlerTableContains(Address addr) { return handlerTableBegin().lessThanOrEqual(addr) && handlerTableEnd().greaterThan(addr); } | |
190 public boolean nulChkTableContains (Address addr) { return nulChkTableBegin() .lessThanOrEqual(addr) && nulChkTableEnd() .greaterThan(addr); } | |
191 | |
192 /** Entry points */ | |
193 public Address getEntryPoint() { return entryPointField.getValue(addr); } | |
194 public Address getVerifiedEntryPoint() { return verifiedEntryPointField.getValue(addr); } | |
195 | |
1563
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
196 /** Support for oops in scopes and relocs. Note: index 0 is reserved for null. */ |
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
197 public OopHandle getOopAt(int index) { |
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
198 if (index == 0) return null; |
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
199 if (Assert.ASSERTS_ENABLED) { |
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
200 Assert.that(index > 0 && index <= oopsSize(), "must be a valid non-zero index"); |
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
201 } |
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
202 return oopsBegin().getOopHandleAt((index - 1) * VM.getVM().getOopSize()); |
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
203 } |
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
204 |
0 | 205 // FIXME: add interpreter_entry_point() |
206 // FIXME: add lazy_interpreter_entry_point() for C2 | |
207 | |
208 // ********** | |
209 // * FIXME: * ADD ACCESS TO FLAGS!!!! | |
210 // ********** | |
211 // public boolean isInUse(); | |
212 // public boolean isAlive(); | |
213 // public boolean isNotEntrant(); | |
214 // public boolean isZombie(); | |
215 | |
216 // ******************************** | |
217 // * MAJOR FIXME: MAJOR HACK HERE * | |
218 // ******************************** | |
219 public boolean isZombie() { return false; } | |
220 | |
221 // public boolean isUnloaded(); | |
222 // public boolean isYoung(); | |
223 // public boolean isOld(); | |
224 // public int age(); | |
225 // public boolean isMarkedForDeoptimization(); | |
226 // public boolean isMarkedForUnloading(); | |
227 // public boolean isMarkedForReclamation(); | |
228 // public int level(); | |
229 // public int version(); | |
230 | |
231 // FIXME: add mutators for above | |
232 // FIXME: add exception cache access? | |
233 | |
234 /** On-stack replacement support */ | |
235 // FIXME: add mutators | |
236 public int getOSREntryBCI() { | |
237 if (Assert.ASSERTS_ENABLED) { | |
238 Assert.that(getEntryBCI() != VM.getVM().getInvocationEntryBCI(), "wrong kind of nmethod"); | |
239 } | |
240 return getEntryBCI(); | |
241 } | |
242 | |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
931
diff
changeset
|
243 public NMethod getOSRLink() { |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
931
diff
changeset
|
244 return (NMethod) VMObjectFactory.newObject(NMethod.class, osrLinkField.getValue(addr)); |
0 | 245 } |
246 | |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
931
diff
changeset
|
247 public NMethod getScavengeRootLink() { |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
931
diff
changeset
|
248 return (NMethod) VMObjectFactory.newObject(NMethod.class, scavengeRootLinkField.getValue(addr)); |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
931
diff
changeset
|
249 } |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
931
diff
changeset
|
250 |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
931
diff
changeset
|
251 public int getScavengeRootState() { |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
931
diff
changeset
|
252 return (int) scavengeRootStateField.getValue(addr); |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
931
diff
changeset
|
253 } |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
931
diff
changeset
|
254 |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
931
diff
changeset
|
255 |
0 | 256 /** Tells whether frames described by this nmethod can be |
257 deoptimized. Note: native wrappers cannot be deoptimized. */ | |
258 public boolean canBeDeoptimized() { return isJavaMethod(); } | |
259 | |
260 // FIXME: add inline cache support | |
261 // FIXME: add flush() | |
262 | |
263 public boolean isLockedByVM() { return lockCountField.getValue(addr) > 0; } | |
264 | |
265 // FIXME: add mark_as_seen_on_stack | |
266 // FIXME: add can_not_entrant_be_converted | |
267 | |
268 // FIXME: add GC support | |
269 // void follow_roots_or_mark_for_unloading(bool unloading_occurred, bool& marked_for_unloading); | |
270 // void follow_root_or_mark_for_unloading(oop* root, bool unloading_occurred, bool& marked_for_unloading); | |
271 // void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, void f(oop*)); | |
272 // void adjust_pointers(); | |
273 | |
274 /** Finds a PCDesc with real-pc equal to "pc" */ | |
275 public PCDesc getPCDescAt(Address pc) { | |
276 // FIXME: consider adding cache like the one down in the VM | |
277 for (Address p = scopesPCsBegin(); p.lessThan(scopesPCsEnd()); p = p.addOffsetTo(pcDescSize)) { | |
278 PCDesc pcDesc = new PCDesc(p); | |
279 if (pcDesc.getRealPC(this).equals(pc)) { | |
280 return pcDesc; | |
281 } | |
282 } | |
283 return null; | |
284 } | |
285 | |
286 /** ScopeDesc for an instruction */ | |
287 public ScopeDesc getScopeDescAt(Address pc) { | |
288 PCDesc pd = getPCDescAt(pc); | |
289 if (Assert.ASSERTS_ENABLED) { | |
290 Assert.that(pd != null, "scope must be present"); | |
291 } | |
1040
873ec3787992
6892186: SA does not dump debug info for scalar replaced objects
kvn
parents:
989
diff
changeset
|
292 return new ScopeDesc(this, pd.getScopeDecodeOffset(), pd.getObjDecodeOffset(), pd.getReexecute()); |
0 | 293 } |
294 | |
295 /** This is only for use by the debugging system, and is only | |
296 intended for use in the topmost frame, where we are not | |
297 guaranteed to be at a PC for which we have a PCDesc. It finds | |
298 the PCDesc with realPC closest to the current PC. */ | |
299 public PCDesc getPCDescNearDbg(Address pc) { | |
300 PCDesc bestGuessPCDesc = null; | |
301 long bestDistance = 0; | |
302 for (Address p = scopesPCsBegin(); p.lessThan(scopesPCsEnd()); p = p.addOffsetTo(pcDescSize)) { | |
303 PCDesc pcDesc = new PCDesc(p); | |
304 // In case pc is null | |
305 long distance = -pcDesc.getRealPC(this).minus(pc); | |
306 if ((bestGuessPCDesc == null) || | |
307 ((distance >= 0) && (distance < bestDistance))) { | |
308 bestGuessPCDesc = pcDesc; | |
309 bestDistance = distance; | |
310 } | |
311 } | |
312 return bestGuessPCDesc; | |
313 } | |
314 | |
315 /** This is only for use by the debugging system, and is only | |
316 intended for use in the topmost frame, where we are not | |
317 guaranteed to be at a PC for which we have a PCDesc. It finds | |
318 the ScopeDesc closest to the current PC. NOTE that this may | |
319 return NULL for compiled methods which don't have any | |
320 ScopeDescs! */ | |
321 public ScopeDesc getScopeDescNearDbg(Address pc) { | |
322 PCDesc pd = getPCDescNearDbg(pc); | |
323 if (pd == null) return null; | |
1040
873ec3787992
6892186: SA does not dump debug info for scalar replaced objects
kvn
parents:
989
diff
changeset
|
324 return new ScopeDesc(this, pd.getScopeDecodeOffset(), pd.getObjDecodeOffset(), pd.getReexecute()); |
0 | 325 } |
326 | |
1040
873ec3787992
6892186: SA does not dump debug info for scalar replaced objects
kvn
parents:
989
diff
changeset
|
327 public Map/*<Address, PCDesc>*/ getSafepoints() { |
873ec3787992
6892186: SA does not dump debug info for scalar replaced objects
kvn
parents:
989
diff
changeset
|
328 Map safepoints = new HashMap(); // Map<Address, PCDesc> |
0 | 329 sun.jvm.hotspot.debugger.Address p = null; |
330 for (p = scopesPCsBegin(); p.lessThan(scopesPCsEnd()); | |
331 p = p.addOffsetTo(pcDescSize)) { | |
332 PCDesc pcDesc = new PCDesc(p); | |
333 sun.jvm.hotspot.debugger.Address pc = pcDesc.getRealPC(this); | |
334 safepoints.put(pc, pcDesc); | |
335 } | |
336 return safepoints; | |
337 } | |
338 | |
339 // FIXME: add getPCOffsetForBCI() | |
340 // FIXME: add embeddedOopAt() | |
341 // FIXME: add isDependentOn() | |
342 // FIXME: add isPatchableAt() | |
343 | |
344 /** Support for code generation. Only here for proof-of-concept. */ | |
345 public static int getEntryPointOffset() { return (int) entryPointField.getOffset(); } | |
346 public static int getVerifiedEntryPointOffset() { return (int) verifiedEntryPointField.getOffset(); } | |
347 public static int getOSREntryPointOffset() { return (int) osrEntryPointField.getOffset(); } | |
348 public static int getEntryBCIOffset() { return (int) entryBCIField.getOffset(); } | |
349 /** NOTE: renamed from "method_offset_in_bytes" */ | |
350 public static int getMethodOffset() { return (int) methodField.getOffset(); } | |
351 | |
352 public void print() { | |
353 printOn(System.out); | |
354 } | |
355 | |
1563
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
356 protected void printComponentsOn(PrintStream tty) { |
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
357 // FIXME: add relocation information |
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
358 tty.println(" instructions: [" + instructionsBegin() + ", " + instructionsEnd() + "), " + |
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
359 " data: [" + dataBegin() + ", " + dataEnd() + "), " + |
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
360 " oops: [" + oopsBegin() + ", " + oopsEnd() + "), " + |
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
361 " frame size: " + getFrameSize()); |
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
362 } |
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
363 |
0 | 364 public String toString() { |
365 Method method = getMethod(); | |
366 return "NMethod for " + | |
367 method.getMethodHolder().getName().asString() + "." + | |
368 method.getName().asString() + method.getSignature().asString() + "==>n" + | |
369 super.toString(); | |
370 } | |
371 | |
372 public String flagsToString() { | |
373 // FIXME need access to flags... | |
374 return ""; | |
375 } | |
376 | |
377 public String getName() { | |
378 Method method = getMethod(); | |
379 return "NMethod for " + | |
380 method.getMethodHolder().getName().asString() + "." + | |
381 method.getName().asString() + | |
382 method.getSignature().asString(); | |
383 } | |
384 | |
385 //-------------------------------------------------------------------------------- | |
386 // Internals only below this point | |
387 // | |
388 | |
389 private int getEntryBCI() { return (int) entryBCIField .getValue(addr); } | |
390 private int getExceptionOffset() { return (int) exceptionOffsetField .getValue(addr); } | |
391 private int getDeoptOffset() { return (int) deoptOffsetField .getValue(addr); } | |
392 private int getStubOffset() { return (int) stubOffsetField .getValue(addr); } | |
1563
1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
twisti
parents:
1040
diff
changeset
|
393 private int getOopsOffset() { return (int) oopsOffsetField .getValue(addr); } |
0 | 394 private int getScopesDataOffset() { return (int) scopesDataOffsetField .getValue(addr); } |
395 private int getScopesPCsOffset() { return (int) scopesPCsOffsetField .getValue(addr); } | |
396 private int getDependenciesOffset() { return (int) dependenciesOffsetField.getValue(addr); } | |
397 private int getHandlerTableOffset() { return (int) handlerTableOffsetField.getValue(addr); } | |
398 private int getNulChkTableOffset() { return (int) nulChkTableOffsetField .getValue(addr); } | |
399 private int getNMethodEndOffset() { return (int) nmethodEndOffsetField .getValue(addr); } | |
400 } |