src/os/solaris/dtrace/jhelper.d

Print this page




  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 __1cIUniverseO_collectedHeap_;
  48 
  49 extern pointer __1cHnmethodG__vtbl_;
  50 extern pointer __1cGMethodG__vtbl_;
  51 extern pointer __1cKBufferBlobG__vtbl_;
  52 
  53 #define copyin_ptr(ADDR)    *(pointer*)  copyin((pointer) (ADDR), sizeof(pointer))
  54 #define copyin_uchar(ADDR)  *(uchar_t*)  copyin((pointer) (ADDR), sizeof(uchar_t))
  55 #define copyin_uint16(ADDR) *(uint16_t*) copyin((pointer) (ADDR), sizeof(uint16_t))
  56 #define copyin_uint32(ADDR) *(uint32_t*) copyin((pointer) (ADDR), sizeof(uint32_t))
  57 #define copyin_int32(ADDR)  *(int32_t*)  copyin((pointer) (ADDR), sizeof(int32_t))
  58 #define copyin_uint8(ADDR)  *(uint8_t*)  copyin((pointer) (ADDR), sizeof(uint8_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:


 135   copyin_offset(OFFSET_NarrowPtrStruct_base);
 136   copyin_offset(OFFSET_NarrowPtrStruct_shift);
 137 
 138   /*
 139    * The PC to translate is in arg0.
 140    */
 141   this->pc = arg0;
 142 
 143   /*
 144    * The methodPtr 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->methodPtr = copyin_ptr(arg1 + 2 * sizeof(pointer) + STACK_BIAS);
 149 #elif defined(__i386) || defined(__amd64)
 150   this->methodPtr = copyin_ptr(arg1 + OFFSET_interpreter_frame_method);
 151 #else
 152 #error "Don't know architecture"
 153 #endif
 154 
 155   this->CodeCache_heap_address = copyin_ptr(&``__1cJCodeCacheF_heap_);




















 156 
 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   this->Method_vtbl             = (pointer) &``__1cGMethodG__vtbl_;
 173 
 174   /*
 175    * Get Java heap bounds
 176    */
 177   this->Universe_collectedHeap = copyin_ptr(&``__1cIUniverseO_collectedHeap_);
 178   this->heap_start = copyin_ptr(this->Universe_collectedHeap +
 179       OFFSET_CollectedHeap_reserved +
 180       OFFSET_MemRegion_start);
 181   this->heap_size = SIZE_HeapWord *
 182     copyin_ptr(this->Universe_collectedHeap +
 183         OFFSET_CollectedHeap_reserved +
 184         OFFSET_MemRegion_word_size
 185         );
 186   this->heap_end = this->heap_start + this->heap_size;
 187 }
 188 
 189 dtrace:helper:ustack:
 190 /!this->done &&
 191 this->CodeCache_low <= this->pc && this->pc < this->CodeCache_high/




































 192 {
 193   MARK_LINE;
 194   this->codecache = 1;

 195 
 196   /*
 197    * Find start.
 198    */
 199   this->segment = (this->pc - this->CodeCache_low) >>
 200     this->CodeHeap_log2_segment_size;
 201   this->block = this->CodeCache_segmap_low;
 202   this->tag = copyin_uchar(this->block + this->segment);
 203   "second";
 204 }
 205 
 206 dtrace:helper:ustack:
 207 /!this->done && this->codecache && this->tag > 0/
 208 {
 209   MARK_LINE;
 210   this->tag = copyin_uchar(this->block + this->segment);
 211   this->segment = this->segment - this->tag;
 212 }
 213 
 214 dtrace:helper:ustack:
 215 /!this->done && this->codecache && this->tag > 0/
 216 {
 217   MARK_LINE;
 218   this->tag = copyin_uchar(this->block + this->segment);
 219   this->segment = this->segment - this->tag;
 220 }
 221 




  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 __1cJCodeCacheQ_heap_non_method_;
  47 extern pointer __1cJCodeCacheS_heap_non_profiled_;
  48 extern pointer __1cJCodeCacheO_heap_profiled_;
  49 
  50 extern pointer __1cIUniverseO_collectedHeap_;
  51 
  52 extern pointer __1cHnmethodG__vtbl_;
  53 extern pointer __1cGMethodG__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 #define copyin_uint8(ADDR)  *(uint8_t*)  copyin((pointer) (ADDR), sizeof(uint8_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:


 138   copyin_offset(OFFSET_NarrowPtrStruct_base);
 139   copyin_offset(OFFSET_NarrowPtrStruct_shift);
 140 
 141   /*
 142    * The PC to translate is in arg0.
 143    */
 144   this->pc = arg0;
 145 
 146   /*
 147    * The methodPtr is in %l2 on SPARC.  This can be found at
 148    * offset 8 from the frame pointer on 32-bit processes.
 149    */
 150 #if   defined(__sparc)
 151   this->methodPtr = copyin_ptr(arg1 + 2 * sizeof(pointer) + STACK_BIAS);
 152 #elif defined(__i386) || defined(__amd64)
 153   this->methodPtr = copyin_ptr(arg1 + OFFSET_interpreter_frame_method);
 154 #else
 155 #error "Don't know architecture"
 156 #endif
 157 
 158   /*
 159    *  Non-method heap
 160    */
 161   this->CodeCache_heap0_address = copyin_ptr(&``__1cJCodeCacheQ_heap_non_method_);
 162   
 163   this->Heap0_low = copyin_ptr(this->CodeCache_heap0_address + 
 164       OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_low);
 165 
 166   this->Heap0_high = copyin_ptr(this->CodeCache_heap0_address +
 167       OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_high);
 168 
 169   this->Heap0_segmap_low = copyin_ptr(this->CodeCache_heap0_address +
 170       OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_low);
 171 
 172   this->Heap0_segmap_high = copyin_ptr(this->CodeCache_heap0_address +
 173       OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_high);
 174 
 175   /*
 176    *  Non profiled heap
 177    */
 178   this->CodeCache_heap1_address = copyin_ptr(&``__1cJCodeCacheS_heap_non_profiled_);
 179 
 180   this->Heap1_low = copyin_ptr(this->CodeCache_heap1_address + 
 181       OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_low);
 182 
 183   this->Heap1_high = copyin_ptr(this->CodeCache_heap1_address +
 184       OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_high);
 185 
 186   this->Heap1_segmap_low = copyin_ptr(this->CodeCache_heap1_address +
 187       OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_low);
 188 
 189   this->Heap1_segmap_high = copyin_ptr(this->CodeCache_heap1_address +
 190       OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_high);
 191 
 192   /*
 193    *  Profiled heap
 194    */
 195   this->CodeCache_heap2_address = copyin_ptr(&``__1cJCodeCacheO_heap_profiled_);
 196 
 197   this->Heap2_low = copyin_ptr(this->CodeCache_heap2_address + 
 198       OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_low);
 199 
 200   this->Heap2_high = copyin_ptr(this->CodeCache_heap2_address +
 201       OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_high);
 202 
 203   this->Heap2_segmap_low = copyin_ptr(this->CodeCache_heap2_address +
 204       OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_low);
 205 
 206   this->Heap2_segmap_high = copyin_ptr(this->CodeCache_heap2_address +
 207       OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_high);
 208 
 209   this->CodeHeap_log2_segment_size = copyin_uint32(
 210       this->CodeCache_heap0_address + OFFSET_CodeHeap_log2_segment_size);
 211 
 212   this->Method_vtbl             = (pointer) &``__1cGMethodG__vtbl_;
 213 
 214   /*
 215    * Get Java heap bounds
 216    */
 217   this->Universe_collectedHeap = copyin_ptr(&``__1cIUniverseO_collectedHeap_);
 218   this->heap_start = copyin_ptr(this->Universe_collectedHeap +
 219       OFFSET_CollectedHeap_reserved +
 220       OFFSET_MemRegion_start);
 221   this->heap_size = SIZE_HeapWord *
 222     copyin_ptr(this->Universe_collectedHeap +
 223         OFFSET_CollectedHeap_reserved +
 224         OFFSET_MemRegion_word_size
 225         );
 226   this->heap_end = this->heap_start + this->heap_size;
 227 }
 228 
 229 dtrace:helper:ustack:
 230 /!this->done &&
 231 this->Heap0_low <= this->pc && this->pc < this->Heap0_high/
 232 {
 233   MARK_LINE;
 234   this->codecache = 1;
 235   this->CodeCache_low = this->Heap0_low;
 236 
 237   /*
 238    * Find start in non-method heap.
 239    */
 240   this->segment = (this->pc - this->Heap0_low) >>
 241     this->CodeHeap_log2_segment_size;
 242   this->block = this->Heap0_segmap_low;
 243   this->tag = copyin_uchar(this->block + this->segment);
 244   "second";
 245 }
 246 
 247 dtrace:helper:ustack:
 248 /!this->done &&
 249 this->Heap1_low <= this->pc && this->pc < this->Heap1_high/
 250 {
 251   MARK_LINE;
 252   this->codecache = 1;
 253   this->CodeCache_low = this->Heap1_low;
 254 
 255   /*
 256    * Find start in non profiled heap.
 257    */
 258   this->segment = (this->pc - this->Heap1_low) >>
 259     this->CodeHeap_log2_segment_size;
 260   this->block = this->Heap1_segmap_low;
 261   this->tag = copyin_uchar(this->block + this->segment);
 262   "second";
 263 }
 264 
 265 dtrace:helper:ustack:
 266 /!this->done &&
 267 this->Heap2_low <= this->pc && this->pc < this->Heap2_high/
 268 {
 269   MARK_LINE;
 270   this->codecache = 1;
 271   this->CodeCache_low = this->Heap2_low;
 272 
 273   /*
 274    * Find start in profiled heap.
 275    */
 276   this->segment = (this->pc - this->Heap2_low) >>
 277     this->CodeHeap_log2_segment_size;
 278   this->block = this->Heap2_segmap_low;
 279   this->tag = copyin_uchar(this->block + this->segment);
 280   "second";
 281 }
 282 
 283 dtrace:helper:ustack:
 284 /!this->done && this->codecache && this->tag > 0/
 285 {
 286   MARK_LINE;
 287   this->tag = copyin_uchar(this->block + this->segment);
 288   this->segment = this->segment - this->tag;
 289 }
 290 
 291 dtrace:helper:ustack:
 292 /!this->done && this->codecache && this->tag > 0/
 293 {
 294   MARK_LINE;
 295   this->tag = copyin_uchar(this->block + this->segment);
 296   this->segment = this->segment - this->tag;
 297 }
 298