hotspot/src/share/vm/code/codeBlob.cpp
changeset 38133 78b95467b9f1
parent 37248 11a660dbbb8e
child 42040 70ec5a09a0d5
equal deleted inserted replaced
38132:ba888a4f352a 38133:78b95467b9f1
    63   size += round_to(cb->total_oop_size(), oopSize);
    63   size += round_to(cb->total_oop_size(), oopSize);
    64   size += round_to(cb->total_metadata_size(), oopSize);
    64   size += round_to(cb->total_metadata_size(), oopSize);
    65   return size;
    65   return size;
    66 }
    66 }
    67 
    67 
       
    68 CodeBlob::CodeBlob(const char* name, const CodeBlobLayout& layout, int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps, bool caller_must_gc_arguments) :
       
    69   _name(name),
       
    70   _size(layout.size()),
       
    71   _header_size(layout.header_size()),
       
    72   _frame_complete_offset(frame_complete_offset),
       
    73   _data_offset(layout.data_offset()),
       
    74   _frame_size(frame_size),
       
    75   _strings(CodeStrings()),
       
    76   _oop_maps(oop_maps),
       
    77   _caller_must_gc_arguments(caller_must_gc_arguments),
       
    78   _code_begin(layout.code_begin()),
       
    79   _code_end(layout.code_end()),
       
    80   _data_end(layout.data_end()),
       
    81   _relocation_begin(layout.relocation_begin()),
       
    82   _relocation_end(layout.relocation_end()),
       
    83   _content_begin(layout.content_begin())
       
    84 {
       
    85   assert(layout.size()        == round_to(layout.size(),        oopSize), "unaligned size");
       
    86   assert(layout.header_size() == round_to(layout.header_size(), oopSize), "unaligned size");
       
    87   assert(layout.relocation_size() == round_to(layout.relocation_size(), oopSize), "unaligned size");
       
    88   assert(layout.code_end() == layout.content_end(), "must be the same - see code_end()");
       
    89 #ifdef COMPILER1
       
    90   // probably wrong for tiered
       
    91   assert(_frame_size >= -1, "must use frame size or -1 for runtime stubs");
       
    92 #endif // COMPILER1
       
    93 }
       
    94 
       
    95 CodeBlob::CodeBlob(const char* name, const CodeBlobLayout& layout, CodeBuffer* cb, int frame_complete_offset, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments) :
       
    96   _name(name),
       
    97   _size(layout.size()),
       
    98   _header_size(layout.header_size()),
       
    99   _frame_complete_offset(frame_complete_offset),
       
   100   _data_offset(layout.data_offset()),
       
   101   _frame_size(frame_size),
       
   102   _strings(CodeStrings()),
       
   103   _caller_must_gc_arguments(caller_must_gc_arguments),
       
   104   _code_begin(layout.code_begin()),
       
   105   _code_end(layout.code_end()),
       
   106   _data_end(layout.data_end()),
       
   107   _relocation_begin(layout.relocation_begin()),
       
   108   _relocation_end(layout.relocation_end()),
       
   109   _content_begin(layout.content_begin())
       
   110 {
       
   111   assert(_size        == round_to(_size,        oopSize), "unaligned size");
       
   112   assert(_header_size == round_to(_header_size, oopSize), "unaligned size");
       
   113   assert(_data_offset <= _size, "codeBlob is too small");
       
   114   assert(layout.code_end() == layout.content_end(), "must be the same - see code_end()");
       
   115 
       
   116   set_oop_maps(oop_maps);
       
   117 #ifdef COMPILER1
       
   118   // probably wrong for tiered
       
   119   assert(_frame_size >= -1, "must use frame size or -1 for runtime stubs");
       
   120 #endif // COMPILER1
       
   121 }
       
   122 
    68 
   123 
    69 // Creates a simple CodeBlob. Sets up the size of the different regions.
   124 // Creates a simple CodeBlob. Sets up the size of the different regions.
    70 CodeBlob::CodeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size) {
   125 RuntimeBlob::RuntimeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size)
    71   assert(size        == round_to(size,        oopSize), "unaligned size");
   126   : CodeBlob(name, CodeBlobLayout((address) this, size, header_size, locs_size, size), frame_complete, 0, NULL, false /* caller_must_gc_arguments */)
       
   127 {
    72   assert(locs_size   == round_to(locs_size,   oopSize), "unaligned size");
   128   assert(locs_size   == round_to(locs_size,   oopSize), "unaligned size");
    73   assert(header_size == round_to(header_size, oopSize), "unaligned size");
       
    74   assert(!UseRelocIndex, "no space allocated for reloc index yet");
   129   assert(!UseRelocIndex, "no space allocated for reloc index yet");
    75 
   130 
    76   // Note: If UseRelocIndex is enabled, there needs to be (at least) one
   131   // Note: If UseRelocIndex is enabled, there needs to be (at least) one
    77   //       extra word for the relocation information, containing the reloc
   132   //       extra word for the relocation information, containing the reloc
    78   //       index table length. Unfortunately, the reloc index table imple-
   133   //       index table length. Unfortunately, the reloc index table imple-
    79   //       mentation is not easily understandable and thus it is not clear
   134   //       mentation is not easily understandable and thus it is not clear
    80   //       what exactly the format is supposed to be. For now, we just turn
   135   //       what exactly the format is supposed to be. For now, we just turn
    81   //       off the use of this table (gri 7/6/2000).
   136   //       off the use of this table (gri 7/6/2000).
    82 
   137 }
    83   _name                  = name;
   138 
    84   _size                  = size;
   139 
    85   _frame_complete_offset = frame_complete;
   140 // Creates a RuntimeBlob from a CodeBuffer
    86   _header_size           = header_size;
       
    87   _relocation_size       = locs_size;
       
    88   _content_offset        = align_code_offset(header_size + _relocation_size);
       
    89   _code_offset           = _content_offset;
       
    90   _data_offset           = size;
       
    91   _frame_size            =  0;
       
    92   set_oop_maps(NULL);
       
    93   _strings               = CodeStrings();
       
    94 }
       
    95 
       
    96 
       
    97 // Creates a CodeBlob from a CodeBuffer. Sets up the size of the different regions,
       
    98 // and copy code and relocation info.
   141 // and copy code and relocation info.
    99 CodeBlob::CodeBlob(
   142 RuntimeBlob::RuntimeBlob(
   100   const char* name,
   143   const char* name,
   101   CodeBuffer* cb,
   144   CodeBuffer* cb,
   102   int         header_size,
   145   int         header_size,
   103   int         size,
   146   int         size,
   104   int         frame_complete,
   147   int         frame_complete,
   105   int         frame_size,
   148   int         frame_size,
   106   OopMapSet*  oop_maps
   149   OopMapSet*  oop_maps,
   107 ) {
   150   bool        caller_must_gc_arguments
   108   assert(size        == round_to(size,        oopSize), "unaligned size");
   151 ) : CodeBlob(name, CodeBlobLayout((address) this, size, header_size, cb), cb, frame_complete, frame_size, oop_maps, caller_must_gc_arguments) {
   109   assert(header_size == round_to(header_size, oopSize), "unaligned size");
       
   110 
       
   111   _name                  = name;
       
   112   _size                  = size;
       
   113   _frame_complete_offset = frame_complete;
       
   114   _header_size           = header_size;
       
   115   _relocation_size       = round_to(cb->total_relocation_size(), oopSize);
       
   116   _content_offset        = align_code_offset(header_size + _relocation_size);
       
   117   _code_offset           = _content_offset + cb->total_offset_of(cb->insts());
       
   118   _data_offset           = _content_offset + round_to(cb->total_content_size(), oopSize);
       
   119   assert(_data_offset <= size, "codeBlob is too small");
       
   120   _strings               = CodeStrings();
       
   121 
       
   122   cb->copy_code_and_locs_to(this);
   152   cb->copy_code_and_locs_to(this);
   123   set_oop_maps(oop_maps);
   153 }
   124   _frame_size = frame_size;
   154 
   125 #ifdef COMPILER1
   155 void CodeBlob::flush() {
   126   // probably wrong for tiered
   156   if (_oop_maps) {
   127   assert(_frame_size >= -1, "must use frame size or -1 for runtime stubs");
   157     FREE_C_HEAP_ARRAY(unsigned char, _oop_maps);
   128 #endif // COMPILER1
   158     _oop_maps = NULL;
   129 }
   159   }
   130 
   160   _strings.free();
       
   161 }
   131 
   162 
   132 void CodeBlob::set_oop_maps(OopMapSet* p) {
   163 void CodeBlob::set_oop_maps(OopMapSet* p) {
   133   // Danger Will Robinson! This method allocates a big
   164   // Danger Will Robinson! This method allocates a big
   134   // chunk of memory, its your job to free it.
   165   // chunk of memory, its your job to free it.
   135   if (p != NULL) {
   166   if (p != NULL) {
   138     _oop_maps = NULL;
   169     _oop_maps = NULL;
   139   }
   170   }
   140 }
   171 }
   141 
   172 
   142 
   173 
   143 void CodeBlob::trace_new_stub(CodeBlob* stub, const char* name1, const char* name2) {
   174 void RuntimeBlob::trace_new_stub(RuntimeBlob* stub, const char* name1, const char* name2) {
   144   // Do not hold the CodeCache lock during name formatting.
   175   // Do not hold the CodeCache lock during name formatting.
   145   assert(!CodeCache_lock->owned_by_self(), "release CodeCache before registering the stub");
   176   assert(!CodeCache_lock->owned_by_self(), "release CodeCache before registering the stub");
   146 
   177 
   147   if (stub != NULL) {
   178   if (stub != NULL) {
   148     char stub_id[256];
   179     char stub_id[256];
   165 
   196 
   166   // Track memory usage statistic after releasing CodeCache_lock
   197   // Track memory usage statistic after releasing CodeCache_lock
   167   MemoryService::track_code_cache_memory_usage();
   198   MemoryService::track_code_cache_memory_usage();
   168 }
   199 }
   169 
   200 
   170 
       
   171 void CodeBlob::flush() {
       
   172   if (_oop_maps) {
       
   173     FREE_C_HEAP_ARRAY(unsigned char, _oop_maps);
       
   174     _oop_maps = NULL;
       
   175   }
       
   176   _strings.free();
       
   177 }
       
   178 
       
   179 
       
   180 const ImmutableOopMap* CodeBlob::oop_map_for_return_address(address return_address) {
   201 const ImmutableOopMap* CodeBlob::oop_map_for_return_address(address return_address) {
   181   assert(oop_maps() != NULL, "nope");
   202   assert(_oop_maps != NULL, "nope");
   182   return oop_maps()->find_map_at_offset((intptr_t) return_address - (intptr_t) code_begin());
   203   return _oop_maps->find_map_at_offset((intptr_t) return_address - (intptr_t) code_begin());
   183 }
   204 }
   184 
   205 
   185 void CodeBlob::print_code() {
   206 void CodeBlob::print_code() {
   186   HandleMark hm;
   207   HandleMark hm;
   187   ResourceMark m;
   208   ResourceMark m;
   191 //----------------------------------------------------------------------------------------------------
   212 //----------------------------------------------------------------------------------------------------
   192 // Implementation of BufferBlob
   213 // Implementation of BufferBlob
   193 
   214 
   194 
   215 
   195 BufferBlob::BufferBlob(const char* name, int size)
   216 BufferBlob::BufferBlob(const char* name, int size)
   196 : CodeBlob(name, sizeof(BufferBlob), size, CodeOffsets::frame_never_safe, /*locs_size:*/ 0)
   217 : RuntimeBlob(name, sizeof(BufferBlob), size, CodeOffsets::frame_never_safe, /*locs_size:*/ 0)
   197 {}
   218 {}
   198 
   219 
   199 BufferBlob* BufferBlob::create(const char* name, int buffer_size) {
   220 BufferBlob* BufferBlob::create(const char* name, int buffer_size) {
   200   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   221   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   201 
   222 
   202   BufferBlob* blob = NULL;
   223   BufferBlob* blob = NULL;
   203   unsigned int size = sizeof(BufferBlob);
   224   unsigned int size = sizeof(BufferBlob);
   204   CodeCacheExtensions::size_blob(name, &buffer_size);
   225   CodeCacheExtensions::size_blob(name, &buffer_size);
   205   // align the size to CodeEntryAlignment
   226   // align the size to CodeEntryAlignment
   206   size = align_code_offset(size);
   227   size = CodeBlob::align_code_offset(size);
   207   size += round_to(buffer_size, oopSize);
   228   size += round_to(buffer_size, oopSize);
   208   assert(name != NULL, "must provide a name");
   229   assert(name != NULL, "must provide a name");
   209   {
   230   {
   210     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   231     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   211     blob = new (size) BufferBlob(name, size);
   232     blob = new (size) BufferBlob(name, size);
   216   return blob;
   237   return blob;
   217 }
   238 }
   218 
   239 
   219 
   240 
   220 BufferBlob::BufferBlob(const char* name, int size, CodeBuffer* cb)
   241 BufferBlob::BufferBlob(const char* name, int size, CodeBuffer* cb)
   221   : CodeBlob(name, cb, sizeof(BufferBlob), size, CodeOffsets::frame_never_safe, 0, NULL)
   242   : RuntimeBlob(name, cb, sizeof(BufferBlob), size, CodeOffsets::frame_never_safe, 0, NULL)
   222 {}
   243 {}
   223 
   244 
   224 BufferBlob* BufferBlob::create(const char* name, CodeBuffer* cb) {
   245 BufferBlob* BufferBlob::create(const char* name, CodeBuffer* cb) {
   225   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   246   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   226 
   247 
   227   BufferBlob* blob = NULL;
   248   BufferBlob* blob = NULL;
   228   unsigned int size = allocation_size(cb, sizeof(BufferBlob));
   249   unsigned int size = CodeBlob::allocation_size(cb, sizeof(BufferBlob));
   229   assert(name != NULL, "must provide a name");
   250   assert(name != NULL, "must provide a name");
   230   {
   251   {
   231     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   252     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   232     blob = new (size) BufferBlob(name, size, cb);
   253     blob = new (size) BufferBlob(name, size, cb);
   233   }
   254   }
   244 void BufferBlob::free(BufferBlob *blob) {
   265 void BufferBlob::free(BufferBlob *blob) {
   245   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   266   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   246   blob->flush();
   267   blob->flush();
   247   {
   268   {
   248     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   269     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   249     CodeCache::free((CodeBlob*)blob);
   270     CodeCache::free((RuntimeBlob*)blob);
   250   }
   271   }
   251   // Track memory usage statistic after releasing CodeCache_lock
   272   // Track memory usage statistic after releasing CodeCache_lock
   252   MemoryService::track_code_cache_memory_usage();
   273   MemoryService::track_code_cache_memory_usage();
   253 }
   274 }
   254 
   275 
   263 
   284 
   264 AdapterBlob* AdapterBlob::create(CodeBuffer* cb) {
   285 AdapterBlob* AdapterBlob::create(CodeBuffer* cb) {
   265   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   286   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   266 
   287 
   267   AdapterBlob* blob = NULL;
   288   AdapterBlob* blob = NULL;
   268   unsigned int size = allocation_size(cb, sizeof(AdapterBlob));
   289   unsigned int size = CodeBlob::allocation_size(cb, sizeof(AdapterBlob));
   269   {
   290   {
   270     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   291     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   271     blob = new (size) AdapterBlob(size, cb);
   292     blob = new (size) AdapterBlob(size, cb);
   272   }
   293   }
   273   // Track memory usage statistic after releasing CodeCache_lock
   294   // Track memory usage statistic after releasing CodeCache_lock
   285 
   306 
   286   MethodHandlesAdapterBlob* blob = NULL;
   307   MethodHandlesAdapterBlob* blob = NULL;
   287   unsigned int size = sizeof(MethodHandlesAdapterBlob);
   308   unsigned int size = sizeof(MethodHandlesAdapterBlob);
   288   CodeCacheExtensions::size_blob("MethodHandles adapters", &buffer_size);
   309   CodeCacheExtensions::size_blob("MethodHandles adapters", &buffer_size);
   289   // align the size to CodeEntryAlignment
   310   // align the size to CodeEntryAlignment
   290   size = align_code_offset(size);
   311   size = CodeBlob::align_code_offset(size);
   291   size += round_to(buffer_size, oopSize);
   312   size += round_to(buffer_size, oopSize);
   292   {
   313   {
   293     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   314     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   294     blob = new (size) MethodHandlesAdapterBlob(size);
   315     blob = new (size) MethodHandlesAdapterBlob(size);
   295     if (blob == NULL) {
   316     if (blob == NULL) {
   312   int         frame_complete,
   333   int         frame_complete,
   313   int         frame_size,
   334   int         frame_size,
   314   OopMapSet*  oop_maps,
   335   OopMapSet*  oop_maps,
   315   bool        caller_must_gc_arguments
   336   bool        caller_must_gc_arguments
   316 )
   337 )
   317 : CodeBlob(name, cb, sizeof(RuntimeStub), size, frame_complete, frame_size, oop_maps)
   338 : RuntimeBlob(name, cb, sizeof(RuntimeStub), size, frame_complete, frame_size, oop_maps, caller_must_gc_arguments)
   318 {
   339 {
   319   _caller_must_gc_arguments = caller_must_gc_arguments;
   340 }
   320 }
       
   321 
       
   322 
   341 
   323 RuntimeStub* RuntimeStub::new_runtime_stub(const char* stub_name,
   342 RuntimeStub* RuntimeStub::new_runtime_stub(const char* stub_name,
   324                                            CodeBuffer* cb,
   343                                            CodeBuffer* cb,
   325                                            int frame_complete,
   344                                            int frame_complete,
   326                                            int frame_size,
   345                                            int frame_size,
   330   RuntimeStub* stub = NULL;
   349   RuntimeStub* stub = NULL;
   331   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   350   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   332   if (!CodeCacheExtensions::skip_code_generation()) {
   351   if (!CodeCacheExtensions::skip_code_generation()) {
   333     // bypass useless code generation
   352     // bypass useless code generation
   334     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   353     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   335     unsigned int size = allocation_size(cb, sizeof(RuntimeStub));
   354     unsigned int size = CodeBlob::allocation_size(cb, sizeof(RuntimeStub));
   336     stub = new (size) RuntimeStub(stub_name, cb, size, frame_complete, frame_size, oop_maps, caller_must_gc_arguments);
   355     stub = new (size) RuntimeStub(stub_name, cb, size, frame_complete, frame_size, oop_maps, caller_must_gc_arguments);
   337   }
   356   }
   338   stub = (RuntimeStub*) CodeCacheExtensions::handle_generated_blob(stub, stub_name);
   357   stub = (RuntimeStub*) CodeCacheExtensions::handle_generated_blob(stub, stub_name);
   339 
   358 
   340   trace_new_stub(stub, "RuntimeStub - ", stub_name);
   359   trace_new_stub(stub, "RuntimeStub - ", stub_name);
   390 {
   409 {
   391   DeoptimizationBlob* blob = NULL;
   410   DeoptimizationBlob* blob = NULL;
   392   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   411   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   393   {
   412   {
   394     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   413     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   395     unsigned int size = allocation_size(cb, sizeof(DeoptimizationBlob));
   414     unsigned int size = CodeBlob::allocation_size(cb, sizeof(DeoptimizationBlob));
   396     blob = new (size) DeoptimizationBlob(cb,
   415     blob = new (size) DeoptimizationBlob(cb,
   397                                          size,
   416                                          size,
   398                                          oop_maps,
   417                                          oop_maps,
   399                                          unpack_offset,
   418                                          unpack_offset,
   400                                          unpack_with_exception_offset,
   419                                          unpack_with_exception_offset,
   429 {
   448 {
   430   UncommonTrapBlob* blob = NULL;
   449   UncommonTrapBlob* blob = NULL;
   431   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   450   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   432   {
   451   {
   433     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   452     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   434     unsigned int size = allocation_size(cb, sizeof(UncommonTrapBlob));
   453     unsigned int size = CodeBlob::allocation_size(cb, sizeof(UncommonTrapBlob));
   435     blob = new (size) UncommonTrapBlob(cb, size, oop_maps, frame_size);
   454     blob = new (size) UncommonTrapBlob(cb, size, oop_maps, frame_size);
   436   }
   455   }
   437 
   456 
   438   trace_new_stub(blob, "UncommonTrapBlob");
   457   trace_new_stub(blob, "UncommonTrapBlob");
   439 
   458 
   465 {
   484 {
   466   ExceptionBlob* blob = NULL;
   485   ExceptionBlob* blob = NULL;
   467   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   486   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   468   {
   487   {
   469     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   488     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   470     unsigned int size = allocation_size(cb, sizeof(ExceptionBlob));
   489     unsigned int size = CodeBlob::allocation_size(cb, sizeof(ExceptionBlob));
   471     blob = new (size) ExceptionBlob(cb, size, oop_maps, frame_size);
   490     blob = new (size) ExceptionBlob(cb, size, oop_maps, frame_size);
   472   }
   491   }
   473 
   492 
   474   trace_new_stub(blob, "ExceptionBlob");
   493   trace_new_stub(blob, "ExceptionBlob");
   475 
   494 
   500 {
   519 {
   501   SafepointBlob* blob = NULL;
   520   SafepointBlob* blob = NULL;
   502   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   521   ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
   503   {
   522   {
   504     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   523     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   505     unsigned int size = allocation_size(cb, sizeof(SafepointBlob));
   524     unsigned int size = CodeBlob::allocation_size(cb, sizeof(SafepointBlob));
   506     blob = new (size) SafepointBlob(cb, size, oop_maps, frame_size);
   525     blob = new (size) SafepointBlob(cb, size, oop_maps, frame_size);
   507   }
   526   }
   508 
   527 
   509   trace_new_stub(blob, "SafepointBlob");
   528   trace_new_stub(blob, "SafepointBlob");
   510 
   529 
   512 }
   531 }
   513 
   532 
   514 
   533 
   515 //----------------------------------------------------------------------------------------------------
   534 //----------------------------------------------------------------------------------------------------
   516 // Verification and printing
   535 // Verification and printing
   517 
       
   518 void CodeBlob::verify() {
       
   519   ShouldNotReachHere();
       
   520 }
       
   521 
   536 
   522 void CodeBlob::print_on(outputStream* st) const {
   537 void CodeBlob::print_on(outputStream* st) const {
   523   st->print_cr("[CodeBlob (" INTPTR_FORMAT ")]", p2i(this));
   538   st->print_cr("[CodeBlob (" INTPTR_FORMAT ")]", p2i(this));
   524   st->print_cr("Framesize: %d", _frame_size);
   539   st->print_cr("Framesize: %d", _frame_size);
   525 }
   540 }
   526 
   541 
   527 void CodeBlob::print_value_on(outputStream* st) const {
   542 void CodeBlob::print_value_on(outputStream* st) const {
   528   st->print_cr("[CodeBlob]");
   543   st->print_cr("[CodeBlob]");
   529 }
   544 }
   530 
   545 
       
   546 void RuntimeBlob::verify() {
       
   547   ShouldNotReachHere();
       
   548 }
       
   549 
   531 void BufferBlob::verify() {
   550 void BufferBlob::verify() {
   532   // unimplemented
   551   // unimplemented
   533 }
   552 }
   534 
   553 
   535 void BufferBlob::print_on(outputStream* st) const {
   554 void BufferBlob::print_on(outputStream* st) const {
   536   CodeBlob::print_on(st);
   555   RuntimeBlob::print_on(st);
   537   print_value_on(st);
   556   print_value_on(st);
   538 }
   557 }
   539 
   558 
   540 void BufferBlob::print_value_on(outputStream* st) const {
   559 void BufferBlob::print_value_on(outputStream* st) const {
   541   st->print_cr("BufferBlob (" INTPTR_FORMAT  ") used for %s", p2i(this), name());
   560   st->print_cr("BufferBlob (" INTPTR_FORMAT  ") used for %s", p2i(this), name());
   545   // unimplemented
   564   // unimplemented
   546 }
   565 }
   547 
   566 
   548 void RuntimeStub::print_on(outputStream* st) const {
   567 void RuntimeStub::print_on(outputStream* st) const {
   549   ttyLocker ttyl;
   568   ttyLocker ttyl;
   550   CodeBlob::print_on(st);
   569   RuntimeBlob::print_on(st);
   551   st->print("Runtime Stub (" INTPTR_FORMAT "): ", p2i(this));
   570   st->print("Runtime Stub (" INTPTR_FORMAT "): ", p2i(this));
   552   st->print_cr("%s", name());
   571   st->print_cr("%s", name());
   553   Disassembler::decode((CodeBlob*)this, st);
   572   Disassembler::decode((RuntimeBlob*)this, st);
   554 }
   573 }
   555 
   574 
   556 void RuntimeStub::print_value_on(outputStream* st) const {
   575 void RuntimeStub::print_value_on(outputStream* st) const {
   557   st->print("RuntimeStub (" INTPTR_FORMAT "): ", p2i(this)); st->print("%s", name());
   576   st->print("RuntimeStub (" INTPTR_FORMAT "): ", p2i(this)); st->print("%s", name());
   558 }
   577 }
   561   // unimplemented
   580   // unimplemented
   562 }
   581 }
   563 
   582 
   564 void SingletonBlob::print_on(outputStream* st) const {
   583 void SingletonBlob::print_on(outputStream* st) const {
   565   ttyLocker ttyl;
   584   ttyLocker ttyl;
   566   CodeBlob::print_on(st);
   585   RuntimeBlob::print_on(st);
   567   st->print_cr("%s", name());
   586   st->print_cr("%s", name());
   568   Disassembler::decode((CodeBlob*)this, st);
   587   Disassembler::decode((RuntimeBlob*)this, st);
   569 }
   588 }
   570 
   589 
   571 void SingletonBlob::print_value_on(outputStream* st) const {
   590 void SingletonBlob::print_value_on(outputStream* st) const {
   572   st->print_cr("%s", name());
   591   st->print_cr("%s", name());
   573 }
   592 }