Mercurial > hg > truffle
annotate src/os/solaris/dtrace/jhelper.d @ 497:7aadaf46ecd7
Merge
author | jmasa |
---|---|
date | Fri, 19 Dec 2008 12:15:34 -0800 |
parents | d1605aabd0a1 |
children | 660978a2a31a |
rev | line source |
---|---|
0 | 1 /* |
196 | 2 * Copyright 2003-2008 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 /* This file is auto-generated */ | |
26 #include "JvmOffsetsIndex.h" | |
27 | |
28 #define DEBUG | |
29 | |
30 #ifdef DEBUG | |
31 #define MARK_LINE this->line = __LINE__ | |
32 #else | |
33 #define MARK_LINE | |
34 #endif | |
35 | |
36 #ifdef _LP64 | |
37 #define STACK_BIAS 0x7ff | |
38 #define pointer uint64_t | |
39 #else | |
40 #define STACK_BIAS 0 | |
41 #define pointer uint32_t | |
42 #endif | |
43 | |
44 extern pointer __JvmOffsets; | |
45 | |
46 extern pointer __1cJCodeCacheF_heap_; | |
47 extern pointer __1cIUniverseP_methodKlassObj_; | |
48 extern pointer __1cIUniverseO_collectedHeap_; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
49 extern pointer __1cIUniverseK_heap_base_; |
0 | 50 |
51 extern pointer __1cHnmethodG__vtbl_; | |
52 extern pointer __1cKBufferBlobG__vtbl_; | |
53 | |
54 #define copyin_ptr(ADDR) *(pointer*) copyin((pointer) (ADDR), sizeof(pointer)) | |
55 #define copyin_uchar(ADDR) *(uchar_t*) copyin((pointer) (ADDR), sizeof(uchar_t)) | |
56 #define copyin_uint16(ADDR) *(uint16_t*) copyin((pointer) (ADDR), sizeof(uint16_t)) | |
57 #define copyin_uint32(ADDR) *(uint32_t*) copyin((pointer) (ADDR), sizeof(uint32_t)) | |
58 #define copyin_int32(ADDR) *(int32_t*) copyin((pointer) (ADDR), sizeof(int32_t)) | |
59 | |
60 #define SAME(x) x | |
61 #define copyin_offset(JVM_CONST) JVM_CONST = \ | |
62 copyin_int32(JvmOffsetsPtr + SAME(IDX_)JVM_CONST * sizeof(int32_t)) | |
63 | |
64 int init_done; | |
65 | |
66 dtrace:helper:ustack: | |
67 { | |
68 MARK_LINE; | |
69 this->done = 0; | |
70 /* | |
71 * TBD: | |
72 * Here we initialize init_done, otherwise jhelper does not work. | |
73 * Therefore, copyin_offset() statements work multiple times now. | |
74 * There is a hope we could avoid it in the future, and so, | |
75 * this initialization can be removed. | |
76 */ | |
77 init_done = 0; | |
78 this->error = (char *) NULL; | |
79 this->result = (char *) NULL; | |
80 this->methodOop = 0; | |
81 this->codecache = 0; | |
82 this->klass = (pointer) NULL; | |
83 this->vtbl = (pointer) NULL; | |
84 this->suffix = '\0'; | |
85 } | |
86 | |
87 dtrace:helper:ustack: | |
88 { | |
89 MARK_LINE; | |
90 /* Initialization of JvmOffsets constants */ | |
91 JvmOffsetsPtr = (pointer) &``__JvmOffsets; | |
92 } | |
93 | |
94 dtrace:helper:ustack: | |
95 /!init_done && !this->done/ | |
96 { | |
97 MARK_LINE; | |
98 init_done = 1; | |
99 | |
100 copyin_offset(COMPILER); | |
101 copyin_offset(OFFSET_CollectedHeap_reserved); | |
102 copyin_offset(OFFSET_MemRegion_start); | |
103 copyin_offset(OFFSET_MemRegion_word_size); | |
104 copyin_offset(SIZE_HeapWord); | |
105 | |
106 copyin_offset(OFFSET_interpreter_frame_method); | |
107 copyin_offset(OFFSET_Klass_name); | |
108 copyin_offset(OFFSET_constantPoolOopDesc_pool_holder); | |
109 | |
110 copyin_offset(OFFSET_HeapBlockHeader_used); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
111 copyin_offset(OFFSET_oopDesc_metadata); |
0 | 112 |
113 copyin_offset(OFFSET_symbolOopDesc_length); | |
114 copyin_offset(OFFSET_symbolOopDesc_body); | |
115 | |
116 copyin_offset(OFFSET_methodOopDesc_constMethod); | |
117 copyin_offset(OFFSET_methodOopDesc_constants); | |
118 copyin_offset(OFFSET_constMethodOopDesc_name_index); | |
119 copyin_offset(OFFSET_constMethodOopDesc_signature_index); | |
120 | |
121 copyin_offset(OFFSET_CodeHeap_memory); | |
122 copyin_offset(OFFSET_CodeHeap_segmap); | |
123 copyin_offset(OFFSET_CodeHeap_log2_segment_size); | |
124 | |
125 copyin_offset(OFFSET_VirtualSpace_low); | |
126 copyin_offset(OFFSET_VirtualSpace_high); | |
127 | |
128 copyin_offset(OFFSET_CodeBlob_name); | |
129 | |
130 copyin_offset(OFFSET_nmethod_method); | |
131 copyin_offset(SIZE_HeapBlockHeader); | |
132 copyin_offset(SIZE_oopDesc); | |
133 copyin_offset(SIZE_constantPoolOopDesc); | |
134 | |
135 /* | |
136 * The PC to translate is in arg0. | |
137 */ | |
138 this->pc = arg0; | |
139 | |
140 /* | |
141 * The methodOopPtr is in %l2 on SPARC. This can be found at | |
142 * offset 8 from the frame pointer on 32-bit processes. | |
143 */ | |
144 #if defined(__sparc) | |
145 this->methodOopPtr = copyin_ptr(arg1 + 2 * sizeof(pointer) + STACK_BIAS); | |
146 #elif defined(__i386) || defined(__amd64) | |
147 this->methodOopPtr = copyin_ptr(arg1 + OFFSET_interpreter_frame_method); | |
148 #else | |
149 #error "Don't know architecture" | |
150 #endif | |
151 | |
152 this->Universe_methodKlassOop = copyin_ptr(&``__1cIUniverseP_methodKlassObj_); | |
153 this->CodeCache_heap_address = copyin_ptr(&``__1cJCodeCacheF_heap_); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
154 this->Universe_heap_base = copyin_ptr(&``__1cIUniverseK_heap_base_); |
0 | 155 |
156 /* Reading volatile values */ | |
157 this->CodeCache_low = copyin_ptr(this->CodeCache_heap_address + | |
158 OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_low); | |
159 | |
160 this->CodeCache_high = copyin_ptr(this->CodeCache_heap_address + | |
161 OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_high); | |
162 | |
163 this->CodeCache_segmap_low = copyin_ptr(this->CodeCache_heap_address + | |
164 OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_low); | |
165 | |
166 this->CodeCache_segmap_high = copyin_ptr(this->CodeCache_heap_address + | |
167 OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_high); | |
168 | |
169 this->CodeHeap_log2_segment_size = copyin_uint32( | |
170 this->CodeCache_heap_address + OFFSET_CodeHeap_log2_segment_size); | |
171 | |
172 /* | |
173 * Get Java heap bounds | |
174 */ | |
175 this->Universe_collectedHeap = copyin_ptr(&``__1cIUniverseO_collectedHeap_); | |
176 this->heap_start = copyin_ptr(this->Universe_collectedHeap + | |
177 OFFSET_CollectedHeap_reserved + | |
178 OFFSET_MemRegion_start); | |
179 this->heap_size = SIZE_HeapWord * | |
180 copyin_ptr(this->Universe_collectedHeap + | |
181 OFFSET_CollectedHeap_reserved + | |
182 OFFSET_MemRegion_word_size | |
183 ); | |
184 this->heap_end = this->heap_start + this->heap_size; | |
185 } | |
186 | |
187 dtrace:helper:ustack: | |
188 /!this->done && | |
189 this->CodeCache_low <= this->pc && this->pc < this->CodeCache_high/ | |
190 { | |
191 MARK_LINE; | |
192 this->codecache = 1; | |
193 | |
194 /* | |
195 * Find start. | |
196 */ | |
197 this->segment = (this->pc - this->CodeCache_low) >> | |
198 this->CodeHeap_log2_segment_size; | |
199 this->block = this->CodeCache_segmap_low; | |
200 this->tag = copyin_uchar(this->block + this->segment); | |
201 "second"; | |
202 } | |
203 | |
204 dtrace:helper:ustack: | |
205 /!this->done && this->codecache && this->tag > 0/ | |
206 { | |
207 MARK_LINE; | |
208 this->tag = copyin_uchar(this->block + this->segment); | |
209 this->segment = this->segment - this->tag; | |
210 } | |
211 | |
212 dtrace:helper:ustack: | |
213 /!this->done && this->codecache && this->tag > 0/ | |
214 { | |
215 MARK_LINE; | |
216 this->tag = copyin_uchar(this->block + this->segment); | |
217 this->segment = this->segment - this->tag; | |
218 } | |
219 | |
220 dtrace:helper:ustack: | |
221 /!this->done && this->codecache && this->tag > 0/ | |
222 { | |
223 MARK_LINE; | |
224 this->tag = copyin_uchar(this->block + this->segment); | |
225 this->segment = this->segment - this->tag; | |
226 } | |
227 | |
228 dtrace:helper:ustack: | |
229 /!this->done && this->codecache && this->tag > 0/ | |
230 { | |
231 MARK_LINE; | |
232 this->tag = copyin_uchar(this->block + this->segment); | |
233 this->segment = this->segment - this->tag; | |
234 } | |
235 | |
236 dtrace:helper:ustack: | |
237 /!this->done && this->codecache && this->tag > 0/ | |
238 { | |
239 MARK_LINE; | |
240 this->tag = copyin_uchar(this->block + this->segment); | |
241 this->segment = this->segment - this->tag; | |
242 } | |
243 | |
244 dtrace:helper:ustack: | |
245 /!this->done && this->codecache && this->tag > 0/ | |
246 { | |
247 MARK_LINE; | |
248 this->error = "<couldn't find start>"; | |
249 this->done = 1; | |
250 } | |
251 | |
252 dtrace:helper:ustack: | |
253 /!this->done && this->codecache/ | |
254 { | |
255 MARK_LINE; | |
256 this->block = this->CodeCache_low + | |
257 (this->segment << this->CodeHeap_log2_segment_size); | |
258 this->used = copyin_uint32(this->block + OFFSET_HeapBlockHeader_used); | |
259 } | |
260 | |
261 dtrace:helper:ustack: | |
262 /!this->done && this->codecache && !this->used/ | |
263 { | |
264 MARK_LINE; | |
265 this->error = "<block not in use>"; | |
266 this->done = 1; | |
267 } | |
268 | |
269 dtrace:helper:ustack: | |
270 /!this->done && this->codecache/ | |
271 { | |
272 MARK_LINE; | |
273 this->start = this->block + SIZE_HeapBlockHeader; | |
274 this->vtbl = copyin_ptr(this->start); | |
275 | |
276 this->nmethod_vtbl = (pointer) &``__1cHnmethodG__vtbl_; | |
277 this->BufferBlob_vtbl = (pointer) &``__1cKBufferBlobG__vtbl_; | |
278 } | |
279 | |
280 dtrace:helper:ustack: | |
281 /!this->done && this->vtbl == this->nmethod_vtbl/ | |
282 { | |
283 MARK_LINE; | |
284 this->methodOopPtr = copyin_ptr(this->start + OFFSET_nmethod_method); | |
285 this->suffix = '*'; | |
286 this->methodOop = 1; | |
287 } | |
288 | |
289 dtrace:helper:ustack: | |
290 /!this->done && this->vtbl == this->BufferBlob_vtbl/ | |
291 { | |
292 MARK_LINE; | |
293 this->name = copyin_ptr(this->start + OFFSET_CodeBlob_name); | |
294 } | |
295 | |
296 dtrace:helper:ustack: | |
297 /!this->done && this->vtbl == this->BufferBlob_vtbl && | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
298 this->Universe_heap_base == NULL && |
0 | 299 this->methodOopPtr > this->heap_start && this->methodOopPtr < this->heap_end/ |
300 { | |
301 MARK_LINE; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
302 this->klass = copyin_ptr(this->methodOopPtr + OFFSET_oopDesc_metadata); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
303 this->methodOop = this->klass == this->Universe_methodKlassOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
304 this->done = !this->methodOop; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
305 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
306 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
307 dtrace:helper:ustack: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
308 /!this->done && this->vtbl == this->BufferBlob_vtbl && |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
309 this->Universe_heap_base != NULL && |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
310 this->methodOopPtr > this->heap_start && this->methodOopPtr < this->heap_end/ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
311 { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
312 MARK_LINE; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
313 /* |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
314 * Read compressed pointer and decode heap oop, same as oop.inline.hpp |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
315 */ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
316 this->cklass = copyin_uint32(this->methodOopPtr + OFFSET_oopDesc_metadata); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
317 this->klass = (uint64_t)((uintptr_t)this->Universe_heap_base + |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
318 ((uintptr_t)this->cklass << 3)); |
0 | 319 this->methodOop = this->klass == this->Universe_methodKlassOop; |
320 this->done = !this->methodOop; | |
321 } | |
322 | |
323 dtrace:helper:ustack: | |
324 /!this->done && !this->methodOop/ | |
325 { | |
326 MARK_LINE; | |
327 this->name = copyin_ptr(this->start + OFFSET_CodeBlob_name); | |
328 this->result = this->name != 0 ? copyinstr(this->name) : "<CodeBlob>"; | |
329 this->done = 1; | |
330 } | |
331 | |
332 dtrace:helper:ustack: | |
333 /!this->done && this->methodOop/ | |
334 { | |
335 MARK_LINE; | |
336 this->constMethod = copyin_ptr(this->methodOopPtr + | |
337 OFFSET_methodOopDesc_constMethod); | |
338 | |
339 this->nameIndex = copyin_uint16(this->constMethod + | |
340 OFFSET_constMethodOopDesc_name_index); | |
341 | |
342 this->signatureIndex = copyin_uint16(this->constMethod + | |
343 OFFSET_constMethodOopDesc_signature_index); | |
344 | |
345 this->constantPool = copyin_ptr(this->methodOopPtr + | |
346 OFFSET_methodOopDesc_constants); | |
347 | |
348 this->nameSymbol = copyin_ptr(this->constantPool + | |
349 this->nameIndex * sizeof (pointer) + SIZE_constantPoolOopDesc); | |
350 | |
351 this->nameSymbolLength = copyin_uint16(this->nameSymbol + | |
352 OFFSET_symbolOopDesc_length); | |
353 | |
354 this->signatureSymbol = copyin_ptr(this->constantPool + | |
355 this->signatureIndex * sizeof (pointer) + SIZE_constantPoolOopDesc); | |
356 | |
357 this->signatureSymbolLength = copyin_uint16(this->signatureSymbol + | |
358 OFFSET_symbolOopDesc_length); | |
359 | |
360 this->klassPtr = copyin_ptr(this->constantPool + | |
361 OFFSET_constantPoolOopDesc_pool_holder); | |
362 | |
363 this->klassSymbol = copyin_ptr(this->klassPtr + | |
364 OFFSET_Klass_name + SIZE_oopDesc); | |
365 | |
366 this->klassSymbolLength = copyin_uint16(this->klassSymbol + | |
367 OFFSET_symbolOopDesc_length); | |
368 | |
369 /* | |
370 * Enough for three strings, plus the '.', plus the trailing '\0'. | |
371 */ | |
372 this->result = (char *) alloca(this->klassSymbolLength + | |
373 this->nameSymbolLength + | |
374 this->signatureSymbolLength + 2 + 1); | |
375 | |
376 copyinto(this->klassSymbol + OFFSET_symbolOopDesc_body, | |
377 this->klassSymbolLength, this->result); | |
378 | |
379 /* | |
380 * Add the '.' between the class and the name. | |
381 */ | |
382 this->result[this->klassSymbolLength] = '.'; | |
383 | |
384 copyinto(this->nameSymbol + OFFSET_symbolOopDesc_body, | |
385 this->nameSymbolLength, | |
386 this->result + this->klassSymbolLength + 1); | |
387 | |
388 copyinto(this->signatureSymbol + OFFSET_symbolOopDesc_body, | |
389 this->signatureSymbolLength, | |
390 this->result + this->klassSymbolLength + | |
391 this->nameSymbolLength + 1); | |
392 | |
393 /* | |
394 * Now we need to add a trailing '\0' and possibly a tag character. | |
395 */ | |
396 this->result[this->klassSymbolLength + 1 + | |
397 this->nameSymbolLength + | |
398 this->signatureSymbolLength] = this->suffix; | |
399 this->result[this->klassSymbolLength + 2 + | |
400 this->nameSymbolLength + | |
401 this->signatureSymbolLength] = '\0'; | |
402 | |
403 this->done = 1; | |
404 } | |
405 | |
406 dtrace:helper:ustack: | |
407 /this->done && this->error == (char *) NULL/ | |
408 { | |
409 this->result; | |
410 } | |
411 | |
412 dtrace:helper:ustack: | |
413 /this->done && this->error != (char *) NULL/ | |
414 { | |
415 this->error; | |
416 } | |
417 | |
418 dtrace:helper:ustack: | |
419 /!this->done && this->codecache/ | |
420 { | |
421 this->done = 1; | |
422 "error"; | |
423 } | |
424 | |
425 | |
426 dtrace:helper:ustack: | |
427 /!this->done/ | |
428 { | |
429 NULL; | |
430 } |