src/share/vm/code/vtableStubs.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/code

src/share/vm/code/vtableStubs.cpp

Print this page




  46 // Implementation of VtableStub
  47 
  48 address VtableStub::_chunk             = NULL;
  49 address VtableStub::_chunk_end         = NULL;
  50 VMReg   VtableStub::_receiver_location = VMRegImpl::Bad();
  51 
  52 
  53 void* VtableStub::operator new(size_t size, int code_size) throw() {
  54   assert(size == sizeof(VtableStub), "mismatched size");
  55   // compute real VtableStub size (rounded to nearest word)
  56   const int real_size = round_to(code_size + sizeof(VtableStub), wordSize);
  57   // malloc them in chunks to minimize header overhead
  58   const int chunk_factor = 32;
  59   if (_chunk == NULL || _chunk + real_size > _chunk_end) {
  60     const int bytes = chunk_factor * real_size + pd_code_alignment();
  61 
  62    // There is a dependency on the name of the blob in src/share/vm/prims/jvmtiCodeBlobEvents.cpp
  63    // If changing the name, update the other file accordingly.
  64     BufferBlob* blob = BufferBlob::create("vtable chunks", bytes);
  65     if (blob == NULL) {
  66       CompileBroker::handle_full_code_cache(CodeBlobType::NonMethod);
  67       return NULL;
  68     }
  69     _chunk = blob->content_begin();
  70     _chunk_end = _chunk + bytes;
  71     Forte::register_stub("vtable stub", _chunk, _chunk_end);
  72     align_chunk();
  73   }
  74   assert(_chunk + real_size <= _chunk_end, "bad allocation");
  75   void* res = _chunk;
  76   _chunk += real_size;
  77   align_chunk();
  78  return res;
  79 }
  80 
  81 
  82 void VtableStub::print_on(outputStream* st) const {
  83   st->print("vtable stub (index = %d, receiver_location = %d, code = [" INTPTR_FORMAT ", " INTPTR_FORMAT "[)",
  84              index(), receiver_location(), code_begin(), code_end());
  85 }
  86 




  46 // Implementation of VtableStub
  47 
  48 address VtableStub::_chunk             = NULL;
  49 address VtableStub::_chunk_end         = NULL;
  50 VMReg   VtableStub::_receiver_location = VMRegImpl::Bad();
  51 
  52 
  53 void* VtableStub::operator new(size_t size, int code_size) throw() {
  54   assert(size == sizeof(VtableStub), "mismatched size");
  55   // compute real VtableStub size (rounded to nearest word)
  56   const int real_size = round_to(code_size + sizeof(VtableStub), wordSize);
  57   // malloc them in chunks to minimize header overhead
  58   const int chunk_factor = 32;
  59   if (_chunk == NULL || _chunk + real_size > _chunk_end) {
  60     const int bytes = chunk_factor * real_size + pd_code_alignment();
  61 
  62    // There is a dependency on the name of the blob in src/share/vm/prims/jvmtiCodeBlobEvents.cpp
  63    // If changing the name, update the other file accordingly.
  64     BufferBlob* blob = BufferBlob::create("vtable chunks", bytes);
  65     if (blob == NULL) {
  66       CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
  67       return NULL;
  68     }
  69     _chunk = blob->content_begin();
  70     _chunk_end = _chunk + bytes;
  71     Forte::register_stub("vtable stub", _chunk, _chunk_end);
  72     align_chunk();
  73   }
  74   assert(_chunk + real_size <= _chunk_end, "bad allocation");
  75   void* res = _chunk;
  76   _chunk += real_size;
  77   align_chunk();
  78  return res;
  79 }
  80 
  81 
  82 void VtableStub::print_on(outputStream* st) const {
  83   st->print("vtable stub (index = %d, receiver_location = %d, code = [" INTPTR_FORMAT ", " INTPTR_FORMAT "[)",
  84              index(), receiver_location(), code_begin(), code_end());
  85 }
  86 


src/share/vm/code/vtableStubs.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File