< prev index next >

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

Print this page


   1 /*
   2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
   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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *  


  42 #endif
  43 
  44 extern pointer __JvmOffsets;
  45 
  46 /* GrowableArray<CodeHeaps*>* */
  47 extern pointer __1cJCodeCacheG_heaps_;
  48 
  49 extern pointer __1cIUniverseO_collectedHeap_;
  50 
  51 extern pointer __1cHnmethodG__vtbl_;
  52 extern pointer __1cGMethodG__vtbl_;
  53 extern pointer __1cKBufferBlobG__vtbl_;
  54 
  55 #define copyin_ptr(ADDR)    *(pointer*)  copyin((pointer) (ADDR), sizeof(pointer))
  56 #define copyin_uchar(ADDR)  *(uchar_t*)  copyin((pointer) (ADDR), sizeof(uchar_t))
  57 #define copyin_uint16(ADDR) *(uint16_t*) copyin((pointer) (ADDR), sizeof(uint16_t))
  58 #define copyin_uint32(ADDR) *(uint32_t*) copyin((pointer) (ADDR), sizeof(uint32_t))
  59 #define copyin_int32(ADDR)  *(int32_t*)  copyin((pointer) (ADDR), sizeof(int32_t))
  60 #define copyin_uint8(ADDR)  *(uint8_t*)  copyin((pointer) (ADDR), sizeof(uint8_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;
  72   /*
  73    * TBD:
  74    * Here we initialize init_done, otherwise jhelper does not work.
  75    * Therefore, copyin_offset() statements work multiple times now.
  76    * There is a hope we could avoid it in the future, and so,
  77    * this initialization can be removed.
  78    */
  79   init_done  = 0;
  80   this->error = (char *) NULL;
  81   this->result = (char *) NULL;
  82   this->isMethod = 0;
  83   this->codecache = 0;
  84   this->klass = (pointer) NULL;


 141   copyin_offset(OFFSET_NarrowPtrStruct_shift);
 142 
 143   /*
 144    * The PC to translate is in arg0.
 145    */
 146   this->pc = arg0;
 147 
 148   /*
 149    * The methodPtr is in %l2 on SPARC.  This can be found at
 150    * offset 8 from the frame pointer on 32-bit processes.
 151    */
 152 #if   defined(__sparc)
 153   this->methodPtr = copyin_ptr(arg1 + 2 * sizeof(pointer) + STACK_BIAS);
 154 #elif defined(__i386) || defined(__amd64)
 155   this->methodPtr = copyin_ptr(arg1 + OFFSET_interpreter_frame_method);
 156 #else
 157 #error "Don't know architecture"
 158 #endif
 159 
 160   /* Read address of GrowableArray<CodeHeaps*> */
 161   this->code_heaps_address = copyin_ptr(&``__1cJCodeCacheG_heaps_);


 162   /* Read address of _data array field in GrowableArray */
 163   this->code_heaps_array_address = copyin_ptr(this->code_heaps_address + OFFSET_GrowableArray_CodeHeap_data);
 164   this->number_of_heaps = copyin_uint32(this->code_heaps_address + OFFSET_GrowableArray_CodeHeap_len);
 165 
 166   this->Method_vtbl = (pointer) &``__1cGMethodG__vtbl_;
 167 
 168   /*
 169    * Get Java heap bounds
 170    */
 171   this->Universe_collectedHeap = copyin_ptr(&``__1cIUniverseO_collectedHeap_);


 172   this->heap_start = copyin_ptr(this->Universe_collectedHeap +
 173       OFFSET_CollectedHeap_reserved +
 174       OFFSET_MemRegion_start);
 175   this->heap_size = SIZE_HeapWord *
 176     copyin_ptr(this->Universe_collectedHeap +
 177         OFFSET_CollectedHeap_reserved +
 178         OFFSET_MemRegion_word_size
 179         );
 180   this->heap_end = this->heap_start + this->heap_size;
 181 }
 182 
 183 /*
 184  * IMPORTANT: At the moment the ustack helper supports up to 5 code heaps in 
 185  * the code cache. If more code heaps are added the following probes have to 
 186  * be extended. This is done by simply adding a probe to get the heap bounds
 187  * and another probe to set the code heap address of the newly created heap.
 188  */
 189 
 190 /*
 191  * ----- BEGIN: Get bounds of code heaps -----


   1 /*
   2  * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
   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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  42 #endif
  43 
  44 extern pointer __JvmOffsets;
  45 
  46 /* GrowableArray<CodeHeaps*>* */
  47 extern pointer __1cJCodeCacheG_heaps_;
  48 
  49 extern pointer __1cIUniverseO_collectedHeap_;
  50 
  51 extern pointer __1cHnmethodG__vtbl_;
  52 extern pointer __1cGMethodG__vtbl_;
  53 extern pointer __1cKBufferBlobG__vtbl_;
  54 
  55 #define copyin_ptr(ADDR)    *(pointer*)  copyin((pointer) (ADDR), sizeof(pointer))
  56 #define copyin_uchar(ADDR)  *(uchar_t*)  copyin((pointer) (ADDR), sizeof(uchar_t))
  57 #define copyin_uint16(ADDR) *(uint16_t*) copyin((pointer) (ADDR), sizeof(uint16_t))
  58 #define copyin_uint32(ADDR) *(uint32_t*) copyin((pointer) (ADDR), sizeof(uint32_t))
  59 #define copyin_int32(ADDR)  *(int32_t*)  copyin((pointer) (ADDR), sizeof(int32_t))
  60 #define copyin_uint8(ADDR)  *(uint8_t*)  copyin((pointer) (ADDR), sizeof(uint8_t))
  61 

  62 #define copyin_offset(JVM_CONST)  JVM_CONST = \
  63         copyin_int32(JvmOffsetsPtr + IDX_##JVM_CONST * sizeof(int32_t))
  64 
  65 int init_done;
  66 
  67 dtrace:helper:ustack:
  68 {
  69   MARK_LINE;
  70   this->done = 0;
  71   /*
  72    * TBD:
  73    * Here we initialize init_done, otherwise jhelper does not work.
  74    * Therefore, copyin_offset() statements work multiple times now.
  75    * There is a hope we could avoid it in the future, and so,
  76    * this initialization can be removed.
  77    */
  78   init_done  = 0;
  79   this->error = (char *) NULL;
  80   this->result = (char *) NULL;
  81   this->isMethod = 0;
  82   this->codecache = 0;
  83   this->klass = (pointer) NULL;


 140   copyin_offset(OFFSET_NarrowPtrStruct_shift);
 141 
 142   /*
 143    * The PC to translate is in arg0.
 144    */
 145   this->pc = arg0;
 146 
 147   /*
 148    * The methodPtr is in %l2 on SPARC.  This can be found at
 149    * offset 8 from the frame pointer on 32-bit processes.
 150    */
 151 #if   defined(__sparc)
 152   this->methodPtr = copyin_ptr(arg1 + 2 * sizeof(pointer) + STACK_BIAS);
 153 #elif defined(__i386) || defined(__amd64)
 154   this->methodPtr = copyin_ptr(arg1 + OFFSET_interpreter_frame_method);
 155 #else
 156 #error "Don't know architecture"
 157 #endif
 158 
 159   /* Read address of GrowableArray<CodeHeaps*> */
 160   // this->code_heaps_address = copyin_ptr(&``__1cJCodeCacheG_heaps_);
 161   this->code_heaps_address =  * ( uint64_t * ) copyin ( ( uint64_t ) ( &``__1cJCodeCacheG_heaps_ ) , sizeof ( uint64_t ) );
 162 
 163   /* Read address of _data array field in GrowableArray */
 164   this->code_heaps_array_address = copyin_ptr(this->code_heaps_address + OFFSET_GrowableArray_CodeHeap_data);
 165   this->number_of_heaps = copyin_uint32(this->code_heaps_address + OFFSET_GrowableArray_CodeHeap_len);
 166 
 167   this->Method_vtbl = (pointer) &``__1cGMethodG__vtbl_;
 168 
 169   /*
 170    * Get Java heap bounds
 171    */
 172   // this->Universe_collectedHeap = copyin_ptr(&``__1cIUniverseO_collectedHeap_);
 173   this->Universe_collectedHeap =  * ( uint64_t * ) copyin ( ( uint64_t ) ( &``__1cIUniverseO_collectedHeap_ ) , sizeof ( uint64_t ) );
 174 
 175   this->heap_start = copyin_ptr(this->Universe_collectedHeap +
 176       OFFSET_CollectedHeap_reserved +
 177       OFFSET_MemRegion_start);
 178   this->heap_size = SIZE_HeapWord *
 179     copyin_ptr(this->Universe_collectedHeap +
 180         OFFSET_CollectedHeap_reserved +
 181         OFFSET_MemRegion_word_size
 182         );
 183   this->heap_end = this->heap_start + this->heap_size;
 184 }
 185 
 186 /*
 187  * IMPORTANT: At the moment the ustack helper supports up to 5 code heaps in
 188  * the code cache. If more code heaps are added the following probes have to
 189  * be extended. This is done by simply adding a probe to get the heap bounds
 190  * and another probe to set the code heap address of the newly created heap.
 191  */
 192 
 193 /*
 194  * ----- BEGIN: Get bounds of code heaps -----


< prev index next >