1 |
diff -r c728621e76f2 tapset/jstack.stp.in |
2 |
--- tapset/jstack-1.8.0.stp.in Mon Jun 02 18:41:24 2014 +0100 |
3 |
+++ tapset/jstack-1.8.0.stp.in Sat Jun 14 00:21:14 2014 +0900 |
4 |
@@ -45,11 +45,7 @@ |
5 |
semantic error: failed to retrieve location attribute for local |
6 |
*/ |
7 |
|
8 |
-global Universe_methodKlassObj; |
9 |
-global Universe_collectedHeap; |
10 |
-global HeapWordSize; |
11 |
global CodeCache_heap; |
12 |
-global NarrowOopStruct; |
13 |
|
14 |
global sp_register; |
15 |
global fp_register; |
16 |
@@ -57,9 +53,8 @@ |
17 |
global ptr_size; |
18 |
global ptr_mask; |
19 |
|
20 |
-global constantPoolOopDesc_size; |
21 |
+global constantPool_size; |
22 |
global HeapBlock_Header_size; |
23 |
-global oopDesc_size; |
24 |
|
25 |
global vm_inited; |
26 |
|
27 |
@@ -67,26 +62,6 @@ |
28 |
in a bare function and vm_init_end seems a good place to use. */ |
29 |
probe hotspot.vm_init_end |
30 |
{ |
31 |
- // The parent/type oop for a methodOop. |
32 |
- Universe_methodKlassObj[pid()] = %( systemtap_v >= "1.8" |
33 |
- %? @var("_methodKlassObj@universe.cpp") |
34 |
- %: $_methodKlassObj %); |
35 |
- |
36 |
- /** |
37 |
- * The Universe class holds some of the interesting statics for |
38 |
- * introspection into HotSpot. The CollectedHeap |
39 |
- * (Universe::_collectedHeap) is an abstraction of a java heap for Hotspot |
40 |
- * it contains a _reserved MemRegion which represents a contigous |
41 |
- * region of the address space consisting of HeapWords (which just |
42 |
- * have one field member char *i). |
43 |
- * |
44 |
- * Note that we access it through its "short name" _collectedHeap. |
45 |
- */ |
46 |
- Universe_collectedHeap[pid()] = %( systemtap_v >= "1.8" |
47 |
- %? @var("_collectedHeap@universe.cpp") |
48 |
- %: $_collectedHeap %); |
49 |
- HeapWordSize[pid()] = $HeapWordSize; |
50 |
- |
51 |
/** |
52 |
* The CodeCache class contains the static CodeHeap _heap that |
53 |
* is malloced at the start of the vm run and holds all generated |
54 |
@@ -107,17 +82,6 @@ |
55 |
%? @var("_heap@codeCache.cpp") |
56 |
%: $_heap %); |
57 |
|
58 |
- /** |
59 |
- * Does target process use CompressedOops ? |
60 |
- */ |
61 |
- NarrowOopStruct[pid()] = 0; |
62 |
- %( systemtap_v >= "1.8" |
63 |
- %? if (@var("UseCompressedOops@globals.cpp")) |
64 |
- NarrowOopStruct[pid()] = &@var("_narrow_oop@universe.cpp"); |
65 |
- %: if($UseCompressedOops) |
66 |
- NarrowOopStruct[pid()] = $_narrow_oop; |
67 |
- %) |
68 |
- |
69 |
// Should really check arch of user space (for 32bit jvm on 64bit kernel). |
70 |
%( arch == "i386" %? |
71 |
sp_register = "esp"; |
72 |
@@ -136,22 +100,17 @@ |
73 |
|
74 |
// Pretend we have an array at address zero and take address of second |
75 |
// element and we have the size. |
76 |
- constantPoolOopDesc_size = &@cast(0, "constantPoolOopDesc")[1]; |
77 |
+ constantPool_size = &@cast(0, "ConstantPool")[1]; |
78 |
|
79 |
// Really should get from dwarf: @size("HeapBlock::Header"), @size("oopDesc") |
80 |
HeapBlock_Header_size = 2 * ptr_size; |
81 |
- oopDesc_size = 2 * ptr_size; |
82 |
|
83 |
vm_inited[pid()] = 1; |
84 |
} |
85 |
|
86 |
probe hotspot.vm_shutdown |
87 |
{ |
88 |
- delete(Universe_methodKlassObj[pid()]); |
89 |
- delete(Universe_collectedHeap[pid()]); |
90 |
- delete(HeapWordSize[pid()]); |
91 |
delete(CodeCache_heap[pid()]); |
92 |
- delete(NarrowOopStruct[pid()]); |
93 |
delete(vm_inited[pid()]); |
94 |
} |
95 |
|
96 |
@@ -262,15 +221,7 @@ |
97 |
return frame; |
98 |
} |
99 |
|
100 |
- // Extract heap and code bounds. |
101 |
- heap_start = @cast(Universe_collectedHeap[pid()], |
102 |
- "CollectedHeap", |
103 |
- "@ABS_SERVER_LIBJVM_SO@")->_reserved->_start; |
104 |
- heap_size = HeapWordSize[pid()] * @cast(Universe_collectedHeap[pid()], |
105 |
- "CollectedHeap", |
106 |
- "@ABS_SERVER_LIBJVM_SO@")->_reserved->_word_size; |
107 |
- heap_end = heap_start + heap_size; |
108 |
- |
109 |
+ // Extract code bounds. |
110 |
CodeCache_low = @cast(CodeCache_heap[pid()], "CodeHeap", |
111 |
"@ABS_SERVER_LIBJVM_SO@")->_memory->_low; |
112 |
CodeCache_high = @cast(CodeCache_heap[pid()], "CodeHeap", |
113 |
@@ -351,105 +302,69 @@ |
114 |
// For the interpreter (and other code blobs) it is on the |
115 |
// stack relative to the frame pointer. |
116 |
if (blob_name == "nmethod") |
117 |
- methodOopPtr = @cast(blob, "nmethod", |
118 |
+ methodPtr = @cast(blob, "nmethod", |
119 |
"@ABS_SERVER_LIBJVM_SO@")->_method |
120 |
else |
121 |
- methodOopPtr = user_long(fp + (-3 * ptr_size)) & ptr_mask |
122 |
- |
123 |
- // Start optimistic. A methodOop is only valid if it was |
124 |
- // heap allocated. And if the "type class" oop equals the |
125 |
- // Universe::methodKlassObj. |
126 |
- if (heap_start > methodOopPtr || methodOopPtr >= heap_end) |
127 |
- isMethodOop = 0 |
128 |
- else |
129 |
- { |
130 |
- if (NarrowOopStruct[pid()]) |
131 |
- { |
132 |
- methodOopKlass = @cast(methodOopPtr, "methodOopDesc", |
133 |
- "@ABS_SERVER_LIBJVM_SO@")->_metadata->_compressed_klass; |
134 |
- methodOopKlass = (@cast(NarrowOopStruct[pid()], |
135 |
- "NarrowOopStruct", |
136 |
- "@ABS_SERVER_LIBJVM_SO@")->_base |
137 |
- + (methodOopKlass |
138 |
- << @cast(NarrowOopStruct[pid()], |
139 |
- "NarrowOopStruct", |
140 |
- "@ABS_SERVER_LIBJVM_SO@")->_shift)); |
141 |
- } |
142 |
- else |
143 |
- methodOopKlass = @cast(methodOopPtr, "methodOopDesc", |
144 |
- "@ABS_SERVER_LIBJVM_SO@")->_metadata->_klass; |
145 |
+ methodPtr = user_long(fp + (-3 * ptr_size)) & ptr_mask |
146 |
|
147 |
- isMethodOop = (methodOopKlass == Universe_methodKlassObj[pid()]); |
148 |
- } |
149 |
+ // The java class is the holder of the constants (strings) |
150 |
+ // that describe the method and signature. This constant pool |
151 |
+ // contains symbolic information that describe the properties |
152 |
+ // of the class. The indexes for methods and signaturates in |
153 |
+ // the constant pool are Symbols that contain utf8 |
154 |
+ // strings (plus lenghts). (We could also sanity check that |
155 |
+ // the tag value is correct [CONSTANT_String = 8]). |
156 |
+ // Note that the class name uses '/' instead of '.' as |
157 |
+ // package name separator and that the method signature is |
158 |
+ // encoded as a method descriptor string. Both of which we |
159 |
+ // don't demangle here. |
160 |
+ constMethod = @cast(methodPtr, "Method", |
161 |
+ "@ABS_SERVER_LIBJVM_SO@")->_constMethod; |
162 |
+ constantPool = @cast(constMethod, "ConstMethod", |
163 |
+ "@ABS_SERVER_LIBJVM_SO@")->_constants; |
164 |
+ constantPool_base = constantPool + constantPool_size; |
165 |
+ |
166 |
+ klass = @cast(constantPool, "ConstantPool", |
167 |
+ "@ABS_SERVER_LIBJVM_SO@")->_pool_holder; |
168 |
+ klassSymbol = @cast(klass, "Klass", |
169 |
+ "@ABS_SERVER_LIBJVM_SO@")->_name; |
170 |
+ klassName = &@cast(klassSymbol, "Symbol", |
171 |
+ "@ABS_SERVER_LIBJVM_SO@")->_body[0]; |
172 |
+ klassLength = @cast(klassSymbol, "Symbol", |
173 |
+ "@ABS_SERVER_LIBJVM_SO@")->_length; |
174 |
+ |
175 |
+ methodIndex = @cast(constMethod, "ConstMethod", |
176 |
+ "@ABS_SERVER_LIBJVM_SO@")->_name_index; |
177 |
+ methodSymbol = user_long(constantPool_base + (methodIndex * ptr_size)); |
178 |
+ methodName = &@cast(methodSymbol, "Symbol", |
179 |
+ "@ABS_SERVER_LIBJVM_SO@")->_body[0]; |
180 |
+ methodLength = @cast(methodSymbol, "Symbol", |
181 |
+ "@ABS_SERVER_LIBJVM_SO@")->_length; |
182 |
|
183 |
- if (isMethodOop) |
184 |
+ if (log_sig) |
185 |
{ |
186 |
- // The java class is the holder of the constants (strings) |
187 |
- // that describe the method and signature. This constant pool |
188 |
- // contains symbolic information that describe the properties |
189 |
- // of the class. The indexes for methods and signaturates in |
190 |
- // the constant pool are Symbols that contain utf8 |
191 |
- // strings (plus lenghts). (We could also sanity check that |
192 |
- // the tag value is correct [CONSTANT_String = 8]). |
193 |
- // Note that the class name uses '/' instead of '.' as |
194 |
- // package name separator and that the method signature is |
195 |
- // encoded as a method descriptor string. Both of which we |
196 |
- // don't demangle here. |
197 |
- constantPoolOopDesc = @cast(methodOopPtr, "methodOopDesc", |
198 |
- "@ABS_SERVER_LIBJVM_SO@")->_constants; |
199 |
- constantPoolOop_base = constantPoolOopDesc + constantPoolOopDesc_size; |
200 |
- |
201 |
- klassPtr = @cast(constantPoolOopDesc, "constantPoolOopDesc", |
202 |
- "@ABS_SERVER_LIBJVM_SO@")->_pool_holder; |
203 |
- klassSymbol = @cast(klassPtr + oopDesc_size, "Klass", |
204 |
- "@ABS_SERVER_LIBJVM_SO@")->_name; |
205 |
- klassName = &@cast(klassSymbol, "Symbol", |
206 |
- "@ABS_SERVER_LIBJVM_SO@")->_body[0]; |
207 |
- klassLength = @cast(klassSymbol, "Symbol", |
208 |
- "@ABS_SERVER_LIBJVM_SO@")->_length; |
209 |
- |
210 |
- methodIndex = @cast(methodOopPtr, "methodOopDesc", |
211 |
- "@ABS_SERVER_LIBJVM_SO@")->_constMethod->_name_index; |
212 |
- methodOopDesc = user_long(constantPoolOop_base + (methodIndex * ptr_size)) - 1; |
213 |
- methodName = &@cast(methodOopDesc, "Symbol", |
214 |
- "@ABS_SERVER_LIBJVM_SO@")->_body[0]; |
215 |
- methodLength = @cast(methodOopDesc, "Symbol", |
216 |
- "@ABS_SERVER_LIBJVM_SO@")->_length; |
217 |
- |
218 |
- if (log_sig) |
219 |
- { |
220 |
- sigIndex = @cast(methodOopPtr, "methodOopDesc", |
221 |
- "@ABS_SERVER_LIBJVM_SO@")->_constMethod->_signature_index; |
222 |
- sigOopDesc = user_long(constantPoolOop_base |
223 |
- + (sigIndex * ptr_size)) - 1; |
224 |
- sigName = &@cast(sigOopDesc, "Symbol", |
225 |
- "@ABS_SERVER_LIBJVM_SO@")->_body[0]; |
226 |
- sigLength = @cast(sigOopDesc, "Symbol", |
227 |
- "@ABS_SERVER_LIBJVM_SO@")->_length; |
228 |
- sig = user_string_n(sigName, sigLength); |
229 |
- } |
230 |
- else |
231 |
- sig = ""; |
232 |
- |
233 |
- code_name = (log_native |
234 |
- ? sprintf("<%s@0x%x>", |
235 |
- str_replace(blob_name, " ", "_"), pc) |
236 |
- : ""); |
237 |
- |
238 |
- frame = sprintf("%s.%s%s%s", |
239 |
- user_string_n(klassName, klassLength), |
240 |
- user_string_n(methodName, methodLength), |
241 |
- sig, code_name); |
242 |
+ sigIndex = @cast(constMethod, "ConstMethod", |
243 |
+ "@ABS_SERVER_LIBJVM_SO@")->_signature_index; |
244 |
+ sigSymbol = user_long(constantPool_base |
245 |
+ + (sigIndex * ptr_size)); |
246 |
+ sigName = &@cast(sigSymbol, "Symbol", |
247 |
+ "@ABS_SERVER_LIBJVM_SO@")->_body[0]; |
248 |
+ sigLength = @cast(sigSymbol, "Symbol", |
249 |
+ "@ABS_SERVER_LIBJVM_SO@")->_length; |
250 |
+ sig = user_string_n(sigName, sigLength); |
251 |
} |
252 |
else |
253 |
- { |
254 |
- // This is probably just an internal function, not a java |
255 |
- // method, just print the blob_name and continue. |
256 |
- // fp is probably still trusted. |
257 |
- if (log_native) |
258 |
- frame = sprintf("<%s@0x%x>", |
259 |
- str_replace(blob_name, " ", "_"), pc); |
260 |
- } |
261 |
+ sig = ""; |
262 |
+ |
263 |
+ code_name = (log_native |
264 |
+ ? sprintf("<%s@0x%x>", |
265 |
+ str_replace(blob_name, " ", "_"), pc) |
266 |
+ : ""); |
267 |
+ |
268 |
+ frame = sprintf("%s.%s%s%s", |
269 |
+ user_string_n(klassName, klassLength), |
270 |
+ user_string_n(methodName, methodLength), |
271 |
+ sig, code_name); |
272 |
|
273 |
// We cannot trust the frame pointer of compiled methods. |
274 |
// The server (c2) jit compiler uses the fp register. |