Mercurial > hg > graal-jvmci-8
annotate agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java @ 3388:a80577f854f9
7045513: JSR 292 inlining causes crashes in methodHandleWalk.cpp
Reviewed-by: jrose
author | never |
---|---|
date | Tue, 17 May 2011 19:11:51 -0700 |
parents | 3e8fbc61cee8 |
children | 7588156f5cf9 |
rev | line source |
---|---|
0 | 1 /* |
3388
a80577f854f9
7045513: JSR 292 inlining causes crashes in methodHandleWalk.cpp
never
parents:
1748
diff
changeset
|
2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 package sun.jvm.hotspot.code; | |
26 | |
27 import java.io.*; | |
28 import java.util.*; | |
29 | |
30 import sun.jvm.hotspot.asm.x86.*; | |
31 import sun.jvm.hotspot.compiler.*; | |
32 import sun.jvm.hotspot.debugger.*; | |
33 import sun.jvm.hotspot.runtime.*; | |
34 import sun.jvm.hotspot.types.*; | |
35 import sun.jvm.hotspot.utilities.*; | |
36 | |
37 public class CodeBlob extends VMObject { | |
38 private static AddressField nameField; | |
39 private static CIntegerField sizeField; | |
40 private static CIntegerField headerSizeField; | |
41 private static CIntegerField relocationSizeField; | |
1748 | 42 private static CIntegerField contentOffsetField; |
43 private static CIntegerField codeOffsetField; | |
0 | 44 private static CIntegerField frameCompleteOffsetField; |
45 private static CIntegerField dataOffsetField; | |
46 private static CIntegerField frameSizeField; | |
47 private static AddressField oopMapsField; | |
48 | |
49 // Only used by server compiler on x86; computed over in SA rather | |
50 // than relying on computation in target VM | |
51 private static final int NOT_YET_COMPUTED = -2; | |
52 private static final int UNDEFINED = -1; | |
53 private int linkOffset = NOT_YET_COMPUTED; | |
54 private static int matcherInterpreterFramePointerReg; | |
55 | |
56 static { | |
57 VM.registerVMInitializedObserver(new Observer() { | |
58 public void update(Observable o, Object data) { | |
59 initialize(VM.getVM().getTypeDataBase()); | |
60 } | |
61 }); | |
62 } | |
63 | |
64 private static void initialize(TypeDataBase db) { | |
65 Type type = db.lookupType("CodeBlob"); | |
66 | |
67 nameField = type.getAddressField("_name"); | |
68 sizeField = type.getCIntegerField("_size"); | |
69 headerSizeField = type.getCIntegerField("_header_size"); | |
70 relocationSizeField = type.getCIntegerField("_relocation_size"); | |
71 frameCompleteOffsetField = type.getCIntegerField("_frame_complete_offset"); | |
1748 | 72 contentOffsetField = type.getCIntegerField("_content_offset"); |
73 codeOffsetField = type.getCIntegerField("_code_offset"); | |
0 | 74 dataOffsetField = type.getCIntegerField("_data_offset"); |
75 frameSizeField = type.getCIntegerField("_frame_size"); | |
76 oopMapsField = type.getAddressField("_oop_maps"); | |
77 | |
78 if (VM.getVM().isServerCompiler()) { | |
79 matcherInterpreterFramePointerReg = | |
80 db.lookupIntConstant("Matcher::interpreter_frame_pointer_reg").intValue(); | |
81 } | |
82 } | |
83 | |
84 public CodeBlob(Address addr) { | |
85 super(addr); | |
86 } | |
87 | |
88 // Typing | |
89 public boolean isBufferBlob() { return false; } | |
90 public boolean isNMethod() { return false; } | |
91 public boolean isRuntimeStub() { return false; } | |
92 public boolean isDeoptimizationStub() { return false; } | |
93 public boolean isUncommonTrapStub() { return false; } | |
94 public boolean isExceptionStub() { return false; } | |
95 public boolean isSafepointStub() { return false; } | |
3388
a80577f854f9
7045513: JSR 292 inlining causes crashes in methodHandleWalk.cpp
never
parents:
1748
diff
changeset
|
96 public boolean isRicochetBlob() { return false; } |
a80577f854f9
7045513: JSR 292 inlining causes crashes in methodHandleWalk.cpp
never
parents:
1748
diff
changeset
|
97 public boolean isAdapterBlob() { return false; } |
0 | 98 |
99 // Fine grain nmethod support: isNmethod() == isJavaMethod() || isNativeMethod() || isOSRMethod() | |
100 public boolean isJavaMethod() { return false; } | |
101 public boolean isNativeMethod() { return false; } | |
102 /** On-Stack Replacement method */ | |
103 public boolean isOSRMethod() { return false; } | |
104 | |
105 // Boundaries | |
106 public Address headerBegin() { | |
107 return addr; | |
108 } | |
109 | |
110 public Address headerEnd() { | |
111 return addr.addOffsetTo(headerSizeField.getValue(addr)); | |
112 } | |
113 | |
114 // FIXME: add RelocInfo | |
115 // public RelocInfo relocationBegin(); | |
116 // public RelocInfo relocationEnd(); | |
117 | |
1748 | 118 public Address contentBegin() { |
119 return headerBegin().addOffsetTo(contentOffsetField.getValue(addr)); | |
0 | 120 } |
121 | |
1748 | 122 public Address contentEnd() { |
123 return headerBegin().addOffsetTo(dataOffsetField.getValue(addr)); | |
124 } | |
125 | |
126 public Address codeBegin() { | |
127 return headerBegin().addOffsetTo(contentOffsetField.getValue(addr)); | |
128 } | |
129 | |
130 public Address codeEnd() { | |
0 | 131 return headerBegin().addOffsetTo(dataOffsetField.getValue(addr)); |
132 } | |
133 | |
134 public Address dataBegin() { | |
135 return headerBegin().addOffsetTo(dataOffsetField.getValue(addr)); | |
136 } | |
137 | |
138 public Address dataEnd() { | |
139 return headerBegin().addOffsetTo(sizeField.getValue(addr)); | |
140 } | |
141 | |
142 // Offsets | |
1748 | 143 public int getRelocationOffset() { return (int) headerSizeField .getValue(addr); } |
144 public int getContentOffset() { return (int) contentOffsetField.getValue(addr); } | |
145 public int getCodeOffset() { return (int) codeOffsetField .getValue(addr); } | |
146 public int getDataOffset() { return (int) dataOffsetField .getValue(addr); } | |
0 | 147 |
148 // Sizes | |
1748 | 149 public int getSize() { return (int) sizeField .getValue(addr); } |
150 public int getHeaderSize() { return (int) headerSizeField.getValue(addr); } | |
0 | 151 // FIXME: add getRelocationSize() |
1748 | 152 public int getContentSize() { return (int) contentEnd().minus(contentBegin()); } |
153 public int getCodeSize() { return (int) codeEnd() .minus(codeBegin()); } | |
154 public int getDataSize() { return (int) dataEnd() .minus(dataBegin()); } | |
0 | 155 |
156 // Containment | |
1748 | 157 public boolean blobContains(Address addr) { return headerBegin() .lessThanOrEqual(addr) && dataEnd() .greaterThan(addr); } |
0 | 158 // FIXME: add relocationContains |
1748 | 159 public boolean contentContains(Address addr) { return contentBegin().lessThanOrEqual(addr) && contentEnd().greaterThan(addr); } |
160 public boolean codeContains(Address addr) { return codeBegin() .lessThanOrEqual(addr) && codeEnd() .greaterThan(addr); } | |
161 public boolean dataContains(Address addr) { return dataBegin() .lessThanOrEqual(addr) && dataEnd() .greaterThan(addr); } | |
162 public boolean contains(Address addr) { return contentContains(addr); } | |
163 public boolean isFrameCompleteAt(Address a) { return codeContains(a) && a.minus(codeBegin()) >= frameCompleteOffsetField.getValue(addr); } | |
0 | 164 |
165 // Reclamation support (really only used by the nmethods, but in order to get asserts to work | |
166 // in the CodeCache they are defined virtual here) | |
167 public boolean isZombie() { return false; } | |
168 public boolean isLockedByVM() { return false; } | |
169 | |
170 /** OopMap for frame; can return null if none available */ | |
171 public OopMapSet getOopMaps() { | |
172 Address oopMapsAddr = oopMapsField.getValue(addr); | |
173 if (oopMapsAddr == null) { | |
174 return null; | |
175 } | |
176 return new OopMapSet(oopMapsAddr); | |
177 } | |
178 // FIXME: not yet implementable | |
179 // void set_oop_maps(OopMapSet* p); | |
180 | |
181 public OopMap getOopMapForReturnAddress(Address returnAddress, boolean debugging) { | |
182 Address pc = returnAddress; | |
183 if (Assert.ASSERTS_ENABLED) { | |
184 Assert.that(getOopMaps() != null, "nope"); | |
185 } | |
1748 | 186 return getOopMaps().findMapAtOffset(pc.minus(codeBegin()), debugging); |
0 | 187 } |
188 | |
189 // virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, void f(oop*)) { ShouldNotReachHere(); } | |
190 // FIXME; | |
191 | |
192 /** NOTE: this returns a size in BYTES in this system! */ | |
193 public long getFrameSize() { | |
194 return VM.getVM().getAddressSize() * frameSizeField.getValue(addr); | |
195 } | |
196 | |
197 // Returns true, if the next frame is responsible for GC'ing oops passed as arguments | |
198 public boolean callerMustGCArguments(JavaThread thread) { return false; } | |
199 | |
200 public String getName() { | |
201 return CStringUtilities.getString(nameField.getValue(addr)); | |
202 } | |
203 | |
204 // FIXME: NOT FINISHED | |
205 | |
206 // FIXME: add more accessors | |
207 | |
208 public void print() { | |
209 printOn(System.out); | |
210 } | |
211 | |
212 public void printOn(PrintStream tty) { | |
213 tty.print(getName()); | |
214 printComponentsOn(tty); | |
215 } | |
216 | |
217 protected void printComponentsOn(PrintStream tty) { | |
1748 | 218 tty.println(" content: [" + contentBegin() + ", " + contentEnd() + "), " + |
219 " code: [" + codeBegin() + ", " + codeEnd() + "), " + | |
0 | 220 " data: [" + dataBegin() + ", " + dataEnd() + "), " + |
221 " frame size: " + getFrameSize()); | |
222 } | |
223 } |