hotspot/src/os/solaris/dtrace/jhelper.d

Print this page
rev 611 : Merge
   1 #ifdef USE_PRAGMA_IDENT_SRC
   2 #pragma ident "@(#)jhelper.d    1.25 07/05/05 17:04:38"
   3 #endif
   4 /*
   5  * Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
   6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   7  *
   8  * This code is free software; you can redistribute it and/or modify it
   9  * under the terms of the GNU General Public License version 2 only, as
  10  * published by the Free Software Foundation.
  11  *
  12  * This code is distributed in the hope that it will be useful, but WITHOUT
  13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15  * version 2 for more details (a copy is included in the LICENSE file that
  16  * accompanied this code).
  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  23  * CA 95054 USA or visit www.sun.com if you need additional information or
  24  * have any questions.
  25  *  


  32 
  33 #ifdef DEBUG
  34 #define MARK_LINE this->line = __LINE__
  35 #else
  36 #define MARK_LINE 
  37 #endif
  38 
  39 #ifdef _LP64
  40 #define STACK_BIAS 0x7ff
  41 #define pointer uint64_t
  42 #else
  43 #define STACK_BIAS 0
  44 #define pointer uint32_t
  45 #endif
  46 
  47 extern pointer __JvmOffsets;
  48 
  49 extern pointer __1cJCodeCacheF_heap_;
  50 extern pointer __1cIUniverseP_methodKlassObj_;
  51 extern pointer __1cIUniverseO_collectedHeap_;

  52 
  53 extern pointer __1cHnmethodG__vtbl_;
  54 extern pointer __1cKBufferBlobG__vtbl_;
  55 
  56 #define copyin_ptr(ADDR)    *(pointer*)  copyin((pointer) (ADDR), sizeof(pointer))
  57 #define copyin_uchar(ADDR)  *(uchar_t*)  copyin((pointer) (ADDR), sizeof(uchar_t))
  58 #define copyin_uint16(ADDR) *(uint16_t*) copyin((pointer) (ADDR), sizeof(uint16_t))
  59 #define copyin_uint32(ADDR) *(uint32_t*) copyin((pointer) (ADDR), sizeof(uint32_t))
  60 #define copyin_int32(ADDR)  *(int32_t*)  copyin((pointer) (ADDR), sizeof(int32_t))
  61 
  62 #define SAME(x) x
  63 #define copyin_offset(JVM_CONST)  JVM_CONST = \
  64         copyin_int32(JvmOffsetsPtr + SAME(IDX_)JVM_CONST * sizeof(int32_t))
  65 
  66 int init_done;
  67 
  68 dtrace:helper:ustack:
  69 {
  70   MARK_LINE;
  71   this->done = 0;


  93   JvmOffsetsPtr = (pointer) &``__JvmOffsets;
  94 }
  95 
  96 dtrace:helper:ustack:
  97 /!init_done && !this->done/
  98 {
  99   MARK_LINE;
 100   init_done = 1;
 101 
 102   copyin_offset(COMPILER);
 103   copyin_offset(OFFSET_CollectedHeap_reserved);
 104   copyin_offset(OFFSET_MemRegion_start);
 105   copyin_offset(OFFSET_MemRegion_word_size);
 106   copyin_offset(SIZE_HeapWord);
 107 
 108   copyin_offset(OFFSET_interpreter_frame_method);
 109   copyin_offset(OFFSET_Klass_name);
 110   copyin_offset(OFFSET_constantPoolOopDesc_pool_holder);
 111 
 112   copyin_offset(OFFSET_HeapBlockHeader_used);
 113   copyin_offset(OFFSET_oopDesc_klass);
 114 
 115   copyin_offset(OFFSET_symbolOopDesc_length);
 116   copyin_offset(OFFSET_symbolOopDesc_body);
 117 
 118   copyin_offset(OFFSET_methodOopDesc_constMethod);
 119   copyin_offset(OFFSET_methodOopDesc_constants);
 120   copyin_offset(OFFSET_constMethodOopDesc_name_index);
 121   copyin_offset(OFFSET_constMethodOopDesc_signature_index);
 122 
 123   copyin_offset(OFFSET_CodeHeap_memory);
 124   copyin_offset(OFFSET_CodeHeap_segmap);
 125   copyin_offset(OFFSET_CodeHeap_log2_segment_size);
 126 
 127   copyin_offset(OFFSET_VirtualSpace_low);
 128   copyin_offset(OFFSET_VirtualSpace_high);
 129 
 130   copyin_offset(OFFSET_CodeBlob_name);
 131 
 132   copyin_offset(OFFSET_nmethod_method);
 133   copyin_offset(SIZE_HeapBlockHeader);


 136 
 137   /*
 138    * The PC to translate is in arg0.
 139    */
 140   this->pc = arg0;
 141 
 142   /*
 143    * The methodOopPtr is in %l2 on SPARC.  This can be found at
 144    * offset 8 from the frame pointer on 32-bit processes.
 145    */
 146 #if   defined(__sparc)
 147   this->methodOopPtr = copyin_ptr(arg1 + 2 * sizeof(pointer) + STACK_BIAS);
 148 #elif defined(__i386) || defined(__amd64)
 149   this->methodOopPtr = copyin_ptr(arg1 + OFFSET_interpreter_frame_method);
 150 #else
 151 #error "Don't know architecture"
 152 #endif
 153 
 154   this->Universe_methodKlassOop = copyin_ptr(&``__1cIUniverseP_methodKlassObj_);
 155   this->CodeCache_heap_address = copyin_ptr(&``__1cJCodeCacheF_heap_);

 156 
 157   /* Reading volatile values */
 158   this->CodeCache_low = copyin_ptr(this->CodeCache_heap_address + 
 159       OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_low);
 160 
 161   this->CodeCache_high = copyin_ptr(this->CodeCache_heap_address +
 162       OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_high);
 163 
 164   this->CodeCache_segmap_low = copyin_ptr(this->CodeCache_heap_address +
 165       OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_low);
 166 
 167   this->CodeCache_segmap_high = copyin_ptr(this->CodeCache_heap_address +
 168       OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_high);
 169 
 170   this->CodeHeap_log2_segment_size = copyin_uint32(
 171       this->CodeCache_heap_address + OFFSET_CodeHeap_log2_segment_size);
 172 
 173   /*
 174    * Get Java heap bounds
 175    */


 279 }
 280 
 281 dtrace:helper:ustack:
 282 /!this->done && this->vtbl == this->nmethod_vtbl/
 283 {
 284   MARK_LINE;
 285   this->methodOopPtr = copyin_ptr(this->start + OFFSET_nmethod_method);
 286   this->suffix = '*';
 287   this->methodOop = 1;
 288 }
 289 
 290 dtrace:helper:ustack:
 291 /!this->done && this->vtbl == this->BufferBlob_vtbl/
 292 {
 293   MARK_LINE;
 294   this->name = copyin_ptr(this->start + OFFSET_CodeBlob_name);
 295 }
 296 
 297 dtrace:helper:ustack:
 298 /!this->done && this->vtbl == this->BufferBlob_vtbl &&

 299 this->methodOopPtr > this->heap_start && this->methodOopPtr < this->heap_end/
 300 {
 301   MARK_LINE;
 302   this->klass = copyin_ptr(this->methodOopPtr + OFFSET_oopDesc_klass);
















 303   this->methodOop = this->klass == this->Universe_methodKlassOop;
 304   this->done = !this->methodOop;
 305 }
 306 
 307 dtrace:helper:ustack:
 308 /!this->done && !this->methodOop/
 309 {
 310   MARK_LINE;
 311   this->name = copyin_ptr(this->start + OFFSET_CodeBlob_name);
 312   this->result = this->name != 0 ? copyinstr(this->name) : "<CodeBlob>";
 313   this->done = 1;
 314 }
 315 
 316 dtrace:helper:ustack:
 317 /!this->done && this->methodOop/
 318 {
 319   MARK_LINE;
 320   this->constMethod = copyin_ptr(this->methodOopPtr +
 321       OFFSET_methodOopDesc_constMethod);
 322 


   1 #ifdef USE_PRAGMA_IDENT_SRC
   2 #pragma ident "@(#)jhelper.d    1.25 07/05/05 17:04:38"
   3 #endif
   4 /*
   5  * Copyright 2003-2008 Sun Microsystems, Inc.  All Rights Reserved.
   6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   7  *
   8  * This code is free software; you can redistribute it and/or modify it
   9  * under the terms of the GNU General Public License version 2 only, as
  10  * published by the Free Software Foundation.
  11  *
  12  * This code is distributed in the hope that it will be useful, but WITHOUT
  13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15  * version 2 for more details (a copy is included in the LICENSE file that
  16  * accompanied this code).
  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  23  * CA 95054 USA or visit www.sun.com if you need additional information or
  24  * have any questions.
  25  *  


  32 
  33 #ifdef DEBUG
  34 #define MARK_LINE this->line = __LINE__
  35 #else
  36 #define MARK_LINE 
  37 #endif
  38 
  39 #ifdef _LP64
  40 #define STACK_BIAS 0x7ff
  41 #define pointer uint64_t
  42 #else
  43 #define STACK_BIAS 0
  44 #define pointer uint32_t
  45 #endif
  46 
  47 extern pointer __JvmOffsets;
  48 
  49 extern pointer __1cJCodeCacheF_heap_;
  50 extern pointer __1cIUniverseP_methodKlassObj_;
  51 extern pointer __1cIUniverseO_collectedHeap_;
  52 extern pointer __1cIUniverseK_heap_base_;
  53 
  54 extern pointer __1cHnmethodG__vtbl_;
  55 extern pointer __1cKBufferBlobG__vtbl_;
  56 
  57 #define copyin_ptr(ADDR)    *(pointer*)  copyin((pointer) (ADDR), sizeof(pointer))
  58 #define copyin_uchar(ADDR)  *(uchar_t*)  copyin((pointer) (ADDR), sizeof(uchar_t))
  59 #define copyin_uint16(ADDR) *(uint16_t*) copyin((pointer) (ADDR), sizeof(uint16_t))
  60 #define copyin_uint32(ADDR) *(uint32_t*) copyin((pointer) (ADDR), sizeof(uint32_t))
  61 #define copyin_int32(ADDR)  *(int32_t*)  copyin((pointer) (ADDR), sizeof(int32_t))
  62 
  63 #define SAME(x) x
  64 #define copyin_offset(JVM_CONST)  JVM_CONST = \
  65         copyin_int32(JvmOffsetsPtr + SAME(IDX_)JVM_CONST * sizeof(int32_t))
  66 
  67 int init_done;
  68 
  69 dtrace:helper:ustack:
  70 {
  71   MARK_LINE;
  72   this->done = 0;


  94   JvmOffsetsPtr = (pointer) &``__JvmOffsets;
  95 }
  96 
  97 dtrace:helper:ustack:
  98 /!init_done && !this->done/
  99 {
 100   MARK_LINE;
 101   init_done = 1;
 102 
 103   copyin_offset(COMPILER);
 104   copyin_offset(OFFSET_CollectedHeap_reserved);
 105   copyin_offset(OFFSET_MemRegion_start);
 106   copyin_offset(OFFSET_MemRegion_word_size);
 107   copyin_offset(SIZE_HeapWord);
 108 
 109   copyin_offset(OFFSET_interpreter_frame_method);
 110   copyin_offset(OFFSET_Klass_name);
 111   copyin_offset(OFFSET_constantPoolOopDesc_pool_holder);
 112 
 113   copyin_offset(OFFSET_HeapBlockHeader_used);
 114   copyin_offset(OFFSET_oopDesc_metadata);
 115 
 116   copyin_offset(OFFSET_symbolOopDesc_length);
 117   copyin_offset(OFFSET_symbolOopDesc_body);
 118 
 119   copyin_offset(OFFSET_methodOopDesc_constMethod);
 120   copyin_offset(OFFSET_methodOopDesc_constants);
 121   copyin_offset(OFFSET_constMethodOopDesc_name_index);
 122   copyin_offset(OFFSET_constMethodOopDesc_signature_index);
 123 
 124   copyin_offset(OFFSET_CodeHeap_memory);
 125   copyin_offset(OFFSET_CodeHeap_segmap);
 126   copyin_offset(OFFSET_CodeHeap_log2_segment_size);
 127 
 128   copyin_offset(OFFSET_VirtualSpace_low);
 129   copyin_offset(OFFSET_VirtualSpace_high);
 130 
 131   copyin_offset(OFFSET_CodeBlob_name);
 132 
 133   copyin_offset(OFFSET_nmethod_method);
 134   copyin_offset(SIZE_HeapBlockHeader);


 137 
 138   /*
 139    * The PC to translate is in arg0.
 140    */
 141   this->pc = arg0;
 142 
 143   /*
 144    * The methodOopPtr is in %l2 on SPARC.  This can be found at
 145    * offset 8 from the frame pointer on 32-bit processes.
 146    */
 147 #if   defined(__sparc)
 148   this->methodOopPtr = copyin_ptr(arg1 + 2 * sizeof(pointer) + STACK_BIAS);
 149 #elif defined(__i386) || defined(__amd64)
 150   this->methodOopPtr = copyin_ptr(arg1 + OFFSET_interpreter_frame_method);
 151 #else
 152 #error "Don't know architecture"
 153 #endif
 154 
 155   this->Universe_methodKlassOop = copyin_ptr(&``__1cIUniverseP_methodKlassObj_);
 156   this->CodeCache_heap_address = copyin_ptr(&``__1cJCodeCacheF_heap_);
 157   this->Universe_heap_base = copyin_ptr(&``__1cIUniverseK_heap_base_);
 158 
 159   /* Reading volatile values */
 160   this->CodeCache_low = copyin_ptr(this->CodeCache_heap_address + 
 161       OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_low);
 162 
 163   this->CodeCache_high = copyin_ptr(this->CodeCache_heap_address +
 164       OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_high);
 165 
 166   this->CodeCache_segmap_low = copyin_ptr(this->CodeCache_heap_address +
 167       OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_low);
 168 
 169   this->CodeCache_segmap_high = copyin_ptr(this->CodeCache_heap_address +
 170       OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_high);
 171 
 172   this->CodeHeap_log2_segment_size = copyin_uint32(
 173       this->CodeCache_heap_address + OFFSET_CodeHeap_log2_segment_size);
 174 
 175   /*
 176    * Get Java heap bounds
 177    */


 281 }
 282 
 283 dtrace:helper:ustack:
 284 /!this->done && this->vtbl == this->nmethod_vtbl/
 285 {
 286   MARK_LINE;
 287   this->methodOopPtr = copyin_ptr(this->start + OFFSET_nmethod_method);
 288   this->suffix = '*';
 289   this->methodOop = 1;
 290 }
 291 
 292 dtrace:helper:ustack:
 293 /!this->done && this->vtbl == this->BufferBlob_vtbl/
 294 {
 295   MARK_LINE;
 296   this->name = copyin_ptr(this->start + OFFSET_CodeBlob_name);
 297 }
 298 
 299 dtrace:helper:ustack:
 300 /!this->done && this->vtbl == this->BufferBlob_vtbl &&
 301 this->Universe_heap_base == NULL &&
 302 this->methodOopPtr > this->heap_start && this->methodOopPtr < this->heap_end/
 303 {
 304   MARK_LINE;
 305   this->klass = copyin_ptr(this->methodOopPtr + OFFSET_oopDesc_metadata);
 306   this->methodOop = this->klass == this->Universe_methodKlassOop;
 307   this->done = !this->methodOop;
 308 }
 309 
 310 dtrace:helper:ustack:
 311 /!this->done && this->vtbl == this->BufferBlob_vtbl &&
 312 this->Universe_heap_base != NULL &&
 313 this->methodOopPtr > this->heap_start && this->methodOopPtr < this->heap_end/
 314 {
 315   MARK_LINE;
 316   /*
 317    * Read compressed pointer and  decode heap oop, same as oop.inline.hpp
 318    */
 319   this->cklass = copyin_uint32(this->methodOopPtr + OFFSET_oopDesc_metadata);
 320   this->klass = (uint64_t)((uintptr_t)this->Universe_heap_base +
 321                 ((uintptr_t)this->cklass << 3));
 322   this->methodOop = this->klass == this->Universe_methodKlassOop;
 323   this->done = !this->methodOop;
 324 }
 325 
 326 dtrace:helper:ustack:
 327 /!this->done && !this->methodOop/
 328 {
 329   MARK_LINE;
 330   this->name = copyin_ptr(this->start + OFFSET_CodeBlob_name);
 331   this->result = this->name != 0 ? copyinstr(this->name) : "<CodeBlob>";
 332   this->done = 1;
 333 }
 334 
 335 dtrace:helper:ustack:
 336 /!this->done && this->methodOop/
 337 {
 338   MARK_LINE;
 339   this->constMethod = copyin_ptr(this->methodOopPtr +
 340       OFFSET_methodOopDesc_constMethod);
 341