src/os/solaris/dtrace/jhelper.d

Wed, 25 Aug 2010 05:27:54 -0700

author
twisti
date
Wed, 25 Aug 2010 05:27:54 -0700
changeset 2103
3e8fbc61cee8
parent 1907
c18cbe5936b8
child 2497
3582bf76420e
permissions
-rw-r--r--

6978355: renaming for 6961697
Summary: This is the renaming part of 6961697 to keep the actual changes small for review.
Reviewed-by: kvn, never

duke@435 1 /*
trims@1907 2 * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 /* This file is auto-generated */
duke@435 26 #include "JvmOffsetsIndex.h"
duke@435 27
duke@435 28 #define DEBUG
duke@435 29
duke@435 30 #ifdef DEBUG
duke@435 31 #define MARK_LINE this->line = __LINE__
duke@435 32 #else
duke@435 33 #define MARK_LINE
duke@435 34 #endif
duke@435 35
duke@435 36 #ifdef _LP64
duke@435 37 #define STACK_BIAS 0x7ff
duke@435 38 #define pointer uint64_t
duke@435 39 #else
duke@435 40 #define STACK_BIAS 0
duke@435 41 #define pointer uint32_t
duke@435 42 #endif
duke@435 43
duke@435 44 extern pointer __JvmOffsets;
duke@435 45
duke@435 46 extern pointer __1cJCodeCacheF_heap_;
duke@435 47 extern pointer __1cIUniverseP_methodKlassObj_;
duke@435 48 extern pointer __1cIUniverseO_collectedHeap_;
kvn@1077 49 extern pointer __1cIUniverseL_narrow_oop_;
kvn@1077 50 #ifdef _LP64
kvn@1077 51 extern pointer UseCompressedOops;
kvn@1077 52 #endif
duke@435 53
duke@435 54 extern pointer __1cHnmethodG__vtbl_;
duke@435 55 extern pointer __1cKBufferBlobG__vtbl_;
duke@435 56
duke@435 57 #define copyin_ptr(ADDR) *(pointer*) copyin((pointer) (ADDR), sizeof(pointer))
duke@435 58 #define copyin_uchar(ADDR) *(uchar_t*) copyin((pointer) (ADDR), sizeof(uchar_t))
duke@435 59 #define copyin_uint16(ADDR) *(uint16_t*) copyin((pointer) (ADDR), sizeof(uint16_t))
duke@435 60 #define copyin_uint32(ADDR) *(uint32_t*) copyin((pointer) (ADDR), sizeof(uint32_t))
duke@435 61 #define copyin_int32(ADDR) *(int32_t*) copyin((pointer) (ADDR), sizeof(int32_t))
kvn@1077 62 #define copyin_uint8(ADDR) *(uint8_t*) copyin((pointer) (ADDR), sizeof(uint8_t))
duke@435 63
duke@435 64 #define SAME(x) x
duke@435 65 #define copyin_offset(JVM_CONST) JVM_CONST = \
duke@435 66 copyin_int32(JvmOffsetsPtr + SAME(IDX_)JVM_CONST * sizeof(int32_t))
duke@435 67
duke@435 68 int init_done;
duke@435 69
duke@435 70 dtrace:helper:ustack:
duke@435 71 {
duke@435 72 MARK_LINE;
duke@435 73 this->done = 0;
duke@435 74 /*
duke@435 75 * TBD:
duke@435 76 * Here we initialize init_done, otherwise jhelper does not work.
duke@435 77 * Therefore, copyin_offset() statements work multiple times now.
duke@435 78 * There is a hope we could avoid it in the future, and so,
duke@435 79 * this initialization can be removed.
duke@435 80 */
duke@435 81 init_done = 0;
duke@435 82 this->error = (char *) NULL;
duke@435 83 this->result = (char *) NULL;
duke@435 84 this->methodOop = 0;
duke@435 85 this->codecache = 0;
duke@435 86 this->klass = (pointer) NULL;
duke@435 87 this->vtbl = (pointer) NULL;
duke@435 88 this->suffix = '\0';
duke@435 89 }
duke@435 90
duke@435 91 dtrace:helper:ustack:
duke@435 92 {
duke@435 93 MARK_LINE;
duke@435 94 /* Initialization of JvmOffsets constants */
duke@435 95 JvmOffsetsPtr = (pointer) &``__JvmOffsets;
duke@435 96 }
duke@435 97
duke@435 98 dtrace:helper:ustack:
duke@435 99 /!init_done && !this->done/
duke@435 100 {
duke@435 101 MARK_LINE;
duke@435 102 init_done = 1;
duke@435 103
duke@435 104 copyin_offset(COMPILER);
duke@435 105 copyin_offset(OFFSET_CollectedHeap_reserved);
duke@435 106 copyin_offset(OFFSET_MemRegion_start);
duke@435 107 copyin_offset(OFFSET_MemRegion_word_size);
duke@435 108 copyin_offset(SIZE_HeapWord);
duke@435 109
duke@435 110 copyin_offset(OFFSET_interpreter_frame_method);
duke@435 111 copyin_offset(OFFSET_Klass_name);
duke@435 112 copyin_offset(OFFSET_constantPoolOopDesc_pool_holder);
duke@435 113
duke@435 114 copyin_offset(OFFSET_HeapBlockHeader_used);
coleenp@548 115 copyin_offset(OFFSET_oopDesc_metadata);
duke@435 116
duke@435 117 copyin_offset(OFFSET_symbolOopDesc_length);
duke@435 118 copyin_offset(OFFSET_symbolOopDesc_body);
duke@435 119
duke@435 120 copyin_offset(OFFSET_methodOopDesc_constMethod);
duke@435 121 copyin_offset(OFFSET_methodOopDesc_constants);
duke@435 122 copyin_offset(OFFSET_constMethodOopDesc_name_index);
duke@435 123 copyin_offset(OFFSET_constMethodOopDesc_signature_index);
duke@435 124
duke@435 125 copyin_offset(OFFSET_CodeHeap_memory);
duke@435 126 copyin_offset(OFFSET_CodeHeap_segmap);
duke@435 127 copyin_offset(OFFSET_CodeHeap_log2_segment_size);
duke@435 128
duke@435 129 copyin_offset(OFFSET_VirtualSpace_low);
duke@435 130 copyin_offset(OFFSET_VirtualSpace_high);
duke@435 131
duke@435 132 copyin_offset(OFFSET_CodeBlob_name);
duke@435 133
duke@435 134 copyin_offset(OFFSET_nmethod_method);
duke@435 135 copyin_offset(SIZE_HeapBlockHeader);
duke@435 136 copyin_offset(SIZE_oopDesc);
duke@435 137 copyin_offset(SIZE_constantPoolOopDesc);
duke@435 138
kvn@1077 139 copyin_offset(OFFSET_NarrowOopStruct_base);
kvn@1077 140 copyin_offset(OFFSET_NarrowOopStruct_shift);
kvn@1077 141
duke@435 142 /*
duke@435 143 * The PC to translate is in arg0.
duke@435 144 */
duke@435 145 this->pc = arg0;
duke@435 146
duke@435 147 /*
duke@435 148 * The methodOopPtr is in %l2 on SPARC. This can be found at
duke@435 149 * offset 8 from the frame pointer on 32-bit processes.
duke@435 150 */
duke@435 151 #if defined(__sparc)
duke@435 152 this->methodOopPtr = copyin_ptr(arg1 + 2 * sizeof(pointer) + STACK_BIAS);
duke@435 153 #elif defined(__i386) || defined(__amd64)
duke@435 154 this->methodOopPtr = copyin_ptr(arg1 + OFFSET_interpreter_frame_method);
duke@435 155 #else
duke@435 156 #error "Don't know architecture"
duke@435 157 #endif
duke@435 158
duke@435 159 this->Universe_methodKlassOop = copyin_ptr(&``__1cIUniverseP_methodKlassObj_);
duke@435 160 this->CodeCache_heap_address = copyin_ptr(&``__1cJCodeCacheF_heap_);
duke@435 161
duke@435 162 /* Reading volatile values */
kvn@1077 163 #ifdef _LP64
kvn@1077 164 this->Use_Compressed_Oops = copyin_uint8(&``UseCompressedOops);
kvn@1077 165 #else
kvn@1077 166 this->Use_Compressed_Oops = 0;
kvn@1077 167 #endif
kvn@1077 168
kvn@1077 169 this->Universe_narrow_oop_base = copyin_ptr(&``__1cIUniverseL_narrow_oop_ +
kvn@1077 170 OFFSET_NarrowOopStruct_base);
kvn@1077 171 this->Universe_narrow_oop_shift = copyin_int32(&``__1cIUniverseL_narrow_oop_ +
kvn@1077 172 OFFSET_NarrowOopStruct_shift);
kvn@1077 173
duke@435 174 this->CodeCache_low = copyin_ptr(this->CodeCache_heap_address +
duke@435 175 OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_low);
duke@435 176
duke@435 177 this->CodeCache_high = copyin_ptr(this->CodeCache_heap_address +
duke@435 178 OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_high);
duke@435 179
duke@435 180 this->CodeCache_segmap_low = copyin_ptr(this->CodeCache_heap_address +
duke@435 181 OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_low);
duke@435 182
duke@435 183 this->CodeCache_segmap_high = copyin_ptr(this->CodeCache_heap_address +
duke@435 184 OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_high);
duke@435 185
duke@435 186 this->CodeHeap_log2_segment_size = copyin_uint32(
duke@435 187 this->CodeCache_heap_address + OFFSET_CodeHeap_log2_segment_size);
duke@435 188
duke@435 189 /*
duke@435 190 * Get Java heap bounds
duke@435 191 */
duke@435 192 this->Universe_collectedHeap = copyin_ptr(&``__1cIUniverseO_collectedHeap_);
duke@435 193 this->heap_start = copyin_ptr(this->Universe_collectedHeap +
duke@435 194 OFFSET_CollectedHeap_reserved +
duke@435 195 OFFSET_MemRegion_start);
duke@435 196 this->heap_size = SIZE_HeapWord *
duke@435 197 copyin_ptr(this->Universe_collectedHeap +
duke@435 198 OFFSET_CollectedHeap_reserved +
duke@435 199 OFFSET_MemRegion_word_size
duke@435 200 );
duke@435 201 this->heap_end = this->heap_start + this->heap_size;
duke@435 202 }
duke@435 203
duke@435 204 dtrace:helper:ustack:
duke@435 205 /!this->done &&
duke@435 206 this->CodeCache_low <= this->pc && this->pc < this->CodeCache_high/
duke@435 207 {
duke@435 208 MARK_LINE;
duke@435 209 this->codecache = 1;
duke@435 210
duke@435 211 /*
duke@435 212 * Find start.
duke@435 213 */
duke@435 214 this->segment = (this->pc - this->CodeCache_low) >>
duke@435 215 this->CodeHeap_log2_segment_size;
duke@435 216 this->block = this->CodeCache_segmap_low;
duke@435 217 this->tag = copyin_uchar(this->block + this->segment);
duke@435 218 "second";
duke@435 219 }
duke@435 220
duke@435 221 dtrace:helper:ustack:
duke@435 222 /!this->done && this->codecache && this->tag > 0/
duke@435 223 {
duke@435 224 MARK_LINE;
duke@435 225 this->tag = copyin_uchar(this->block + this->segment);
duke@435 226 this->segment = this->segment - this->tag;
duke@435 227 }
duke@435 228
duke@435 229 dtrace:helper:ustack:
duke@435 230 /!this->done && this->codecache && this->tag > 0/
duke@435 231 {
duke@435 232 MARK_LINE;
duke@435 233 this->tag = copyin_uchar(this->block + this->segment);
duke@435 234 this->segment = this->segment - this->tag;
duke@435 235 }
duke@435 236
duke@435 237 dtrace:helper:ustack:
duke@435 238 /!this->done && this->codecache && this->tag > 0/
duke@435 239 {
duke@435 240 MARK_LINE;
duke@435 241 this->tag = copyin_uchar(this->block + this->segment);
duke@435 242 this->segment = this->segment - this->tag;
duke@435 243 }
duke@435 244
duke@435 245 dtrace:helper:ustack:
duke@435 246 /!this->done && this->codecache && this->tag > 0/
duke@435 247 {
duke@435 248 MARK_LINE;
duke@435 249 this->tag = copyin_uchar(this->block + this->segment);
duke@435 250 this->segment = this->segment - this->tag;
duke@435 251 }
duke@435 252
duke@435 253 dtrace:helper:ustack:
duke@435 254 /!this->done && this->codecache && this->tag > 0/
duke@435 255 {
duke@435 256 MARK_LINE;
duke@435 257 this->tag = copyin_uchar(this->block + this->segment);
duke@435 258 this->segment = this->segment - this->tag;
duke@435 259 }
duke@435 260
duke@435 261 dtrace:helper:ustack:
duke@435 262 /!this->done && this->codecache && this->tag > 0/
duke@435 263 {
duke@435 264 MARK_LINE;
duke@435 265 this->error = "<couldn't find start>";
duke@435 266 this->done = 1;
duke@435 267 }
duke@435 268
duke@435 269 dtrace:helper:ustack:
duke@435 270 /!this->done && this->codecache/
duke@435 271 {
duke@435 272 MARK_LINE;
duke@435 273 this->block = this->CodeCache_low +
duke@435 274 (this->segment << this->CodeHeap_log2_segment_size);
duke@435 275 this->used = copyin_uint32(this->block + OFFSET_HeapBlockHeader_used);
duke@435 276 }
duke@435 277
duke@435 278 dtrace:helper:ustack:
duke@435 279 /!this->done && this->codecache && !this->used/
duke@435 280 {
duke@435 281 MARK_LINE;
duke@435 282 this->error = "<block not in use>";
duke@435 283 this->done = 1;
duke@435 284 }
duke@435 285
duke@435 286 dtrace:helper:ustack:
duke@435 287 /!this->done && this->codecache/
duke@435 288 {
duke@435 289 MARK_LINE;
duke@435 290 this->start = this->block + SIZE_HeapBlockHeader;
duke@435 291 this->vtbl = copyin_ptr(this->start);
duke@435 292
duke@435 293 this->nmethod_vtbl = (pointer) &``__1cHnmethodG__vtbl_;
duke@435 294 this->BufferBlob_vtbl = (pointer) &``__1cKBufferBlobG__vtbl_;
duke@435 295 }
duke@435 296
duke@435 297 dtrace:helper:ustack:
duke@435 298 /!this->done && this->vtbl == this->nmethod_vtbl/
duke@435 299 {
duke@435 300 MARK_LINE;
duke@435 301 this->methodOopPtr = copyin_ptr(this->start + OFFSET_nmethod_method);
duke@435 302 this->suffix = '*';
duke@435 303 this->methodOop = 1;
duke@435 304 }
duke@435 305
duke@435 306 dtrace:helper:ustack:
duke@435 307 /!this->done && this->vtbl == this->BufferBlob_vtbl/
duke@435 308 {
duke@435 309 MARK_LINE;
duke@435 310 this->name = copyin_ptr(this->start + OFFSET_CodeBlob_name);
duke@435 311 }
duke@435 312
duke@435 313 dtrace:helper:ustack:
duke@435 314 /!this->done && this->vtbl == this->BufferBlob_vtbl &&
kvn@1077 315 this->Use_Compressed_Oops == 0 &&
duke@435 316 this->methodOopPtr > this->heap_start && this->methodOopPtr < this->heap_end/
duke@435 317 {
duke@435 318 MARK_LINE;
coleenp@548 319 this->klass = copyin_ptr(this->methodOopPtr + OFFSET_oopDesc_metadata);
coleenp@548 320 this->methodOop = this->klass == this->Universe_methodKlassOop;
coleenp@548 321 this->done = !this->methodOop;
coleenp@548 322 }
coleenp@548 323
coleenp@548 324 dtrace:helper:ustack:
coleenp@548 325 /!this->done && this->vtbl == this->BufferBlob_vtbl &&
kvn@1077 326 this->Use_Compressed_Oops != 0 &&
coleenp@548 327 this->methodOopPtr > this->heap_start && this->methodOopPtr < this->heap_end/
coleenp@548 328 {
coleenp@548 329 MARK_LINE;
coleenp@548 330 /*
coleenp@548 331 * Read compressed pointer and decode heap oop, same as oop.inline.hpp
coleenp@548 332 */
coleenp@548 333 this->cklass = copyin_uint32(this->methodOopPtr + OFFSET_oopDesc_metadata);
kvn@1077 334 this->klass = (uint64_t)((uintptr_t)this->Universe_narrow_oop_base +
kvn@1077 335 ((uintptr_t)this->cklass << this->Universe_narrow_oop_shift));
duke@435 336 this->methodOop = this->klass == this->Universe_methodKlassOop;
duke@435 337 this->done = !this->methodOop;
duke@435 338 }
duke@435 339
duke@435 340 dtrace:helper:ustack:
duke@435 341 /!this->done && !this->methodOop/
duke@435 342 {
duke@435 343 MARK_LINE;
duke@435 344 this->name = copyin_ptr(this->start + OFFSET_CodeBlob_name);
duke@435 345 this->result = this->name != 0 ? copyinstr(this->name) : "<CodeBlob>";
duke@435 346 this->done = 1;
duke@435 347 }
duke@435 348
duke@435 349 dtrace:helper:ustack:
duke@435 350 /!this->done && this->methodOop/
duke@435 351 {
duke@435 352 MARK_LINE;
duke@435 353 this->constMethod = copyin_ptr(this->methodOopPtr +
duke@435 354 OFFSET_methodOopDesc_constMethod);
duke@435 355
duke@435 356 this->nameIndex = copyin_uint16(this->constMethod +
duke@435 357 OFFSET_constMethodOopDesc_name_index);
duke@435 358
duke@435 359 this->signatureIndex = copyin_uint16(this->constMethod +
duke@435 360 OFFSET_constMethodOopDesc_signature_index);
duke@435 361
duke@435 362 this->constantPool = copyin_ptr(this->methodOopPtr +
duke@435 363 OFFSET_methodOopDesc_constants);
duke@435 364
duke@435 365 this->nameSymbol = copyin_ptr(this->constantPool +
duke@435 366 this->nameIndex * sizeof (pointer) + SIZE_constantPoolOopDesc);
duke@435 367
duke@435 368 this->nameSymbolLength = copyin_uint16(this->nameSymbol +
duke@435 369 OFFSET_symbolOopDesc_length);
duke@435 370
duke@435 371 this->signatureSymbol = copyin_ptr(this->constantPool +
duke@435 372 this->signatureIndex * sizeof (pointer) + SIZE_constantPoolOopDesc);
duke@435 373
duke@435 374 this->signatureSymbolLength = copyin_uint16(this->signatureSymbol +
duke@435 375 OFFSET_symbolOopDesc_length);
duke@435 376
duke@435 377 this->klassPtr = copyin_ptr(this->constantPool +
duke@435 378 OFFSET_constantPoolOopDesc_pool_holder);
duke@435 379
duke@435 380 this->klassSymbol = copyin_ptr(this->klassPtr +
duke@435 381 OFFSET_Klass_name + SIZE_oopDesc);
duke@435 382
duke@435 383 this->klassSymbolLength = copyin_uint16(this->klassSymbol +
duke@435 384 OFFSET_symbolOopDesc_length);
duke@435 385
duke@435 386 /*
duke@435 387 * Enough for three strings, plus the '.', plus the trailing '\0'.
duke@435 388 */
duke@435 389 this->result = (char *) alloca(this->klassSymbolLength +
duke@435 390 this->nameSymbolLength +
duke@435 391 this->signatureSymbolLength + 2 + 1);
duke@435 392
duke@435 393 copyinto(this->klassSymbol + OFFSET_symbolOopDesc_body,
duke@435 394 this->klassSymbolLength, this->result);
duke@435 395
duke@435 396 /*
duke@435 397 * Add the '.' between the class and the name.
duke@435 398 */
duke@435 399 this->result[this->klassSymbolLength] = '.';
duke@435 400
duke@435 401 copyinto(this->nameSymbol + OFFSET_symbolOopDesc_body,
duke@435 402 this->nameSymbolLength,
duke@435 403 this->result + this->klassSymbolLength + 1);
duke@435 404
duke@435 405 copyinto(this->signatureSymbol + OFFSET_symbolOopDesc_body,
duke@435 406 this->signatureSymbolLength,
duke@435 407 this->result + this->klassSymbolLength +
duke@435 408 this->nameSymbolLength + 1);
duke@435 409
duke@435 410 /*
duke@435 411 * Now we need to add a trailing '\0' and possibly a tag character.
duke@435 412 */
duke@435 413 this->result[this->klassSymbolLength + 1 +
duke@435 414 this->nameSymbolLength +
duke@435 415 this->signatureSymbolLength] = this->suffix;
duke@435 416 this->result[this->klassSymbolLength + 2 +
duke@435 417 this->nameSymbolLength +
duke@435 418 this->signatureSymbolLength] = '\0';
duke@435 419
duke@435 420 this->done = 1;
duke@435 421 }
duke@435 422
duke@435 423 dtrace:helper:ustack:
duke@435 424 /this->done && this->error == (char *) NULL/
duke@435 425 {
duke@435 426 this->result;
duke@435 427 }
duke@435 428
duke@435 429 dtrace:helper:ustack:
duke@435 430 /this->done && this->error != (char *) NULL/
duke@435 431 {
duke@435 432 this->error;
duke@435 433 }
duke@435 434
duke@435 435 dtrace:helper:ustack:
duke@435 436 /!this->done && this->codecache/
duke@435 437 {
duke@435 438 this->done = 1;
duke@435 439 "error";
duke@435 440 }
duke@435 441
duke@435 442
duke@435 443 dtrace:helper:ustack:
duke@435 444 /!this->done/
duke@435 445 {
duke@435 446 NULL;
duke@435 447 }

mercurial