< prev index next >

src/hotspot/share/memory/allocation.cpp

Print this page

 64 }
 65 
 66 // handles null pointers
 67 void FreeHeap(void* p) {
 68   os::free(p);
 69 }
 70 
 71 void* MetaspaceObj::_shared_metaspace_base = nullptr;
 72 void* MetaspaceObj::_shared_metaspace_top  = nullptr;
 73 
 74 void* MetaspaceObj::operator new(size_t size, ClassLoaderData* loader_data,
 75                                  size_t word_size,
 76                                  MetaspaceObj::Type type, TRAPS) throw() {
 77   // Klass has its own operator new
 78   return Metaspace::allocate(loader_data, word_size, type, THREAD);
 79 }
 80 
 81 void* MetaspaceObj::operator new(size_t size, ClassLoaderData* loader_data,
 82                                  size_t word_size,
 83                                  MetaspaceObj::Type type) throw() {
 84   assert(!Thread::current()->is_Java_thread(), "only allowed by non-Java thread");
 85   return Metaspace::allocate(loader_data, word_size, type);
 86 }
 87 
 88 bool MetaspaceObj::is_valid(const MetaspaceObj* p) {
 89   // Weed out obvious bogus values first without traversing metaspace
 90   if ((size_t)p < os::min_page_size()) {
 91     return false;
 92   } else if (!is_aligned((address)p, sizeof(MetaWord))) {
 93     return false;
 94   }
 95   return Metaspace::contains((void*)p);
 96 }
 97 
 98 void MetaspaceObj::print_address_on(outputStream* st) const {
 99   st->print(" {" PTR_FORMAT "}", p2i(this));
100 }
101 
102 //
103 // ArenaObj
104 //

 64 }
 65 
 66 // handles null pointers
 67 void FreeHeap(void* p) {
 68   os::free(p);
 69 }
 70 
 71 void* MetaspaceObj::_shared_metaspace_base = nullptr;
 72 void* MetaspaceObj::_shared_metaspace_top  = nullptr;
 73 
 74 void* MetaspaceObj::operator new(size_t size, ClassLoaderData* loader_data,
 75                                  size_t word_size,
 76                                  MetaspaceObj::Type type, TRAPS) throw() {
 77   // Klass has its own operator new
 78   return Metaspace::allocate(loader_data, word_size, type, THREAD);
 79 }
 80 
 81 void* MetaspaceObj::operator new(size_t size, ClassLoaderData* loader_data,
 82                                  size_t word_size,
 83                                  MetaspaceObj::Type type) throw() {
 84   assert(!Thread::current()->is_Java_thread() || is_training_data(type), "only allowed by non-Java thread");
 85   return Metaspace::allocate(loader_data, word_size, type);
 86 }
 87 
 88 bool MetaspaceObj::is_valid(const MetaspaceObj* p) {
 89   // Weed out obvious bogus values first without traversing metaspace
 90   if ((size_t)p < os::min_page_size()) {
 91     return false;
 92   } else if (!is_aligned((address)p, sizeof(MetaWord))) {
 93     return false;
 94   }
 95   return Metaspace::contains((void*)p);
 96 }
 97 
 98 void MetaspaceObj::print_address_on(outputStream* st) const {
 99   st->print(" {" PTR_FORMAT "}", p2i(this));
100 }
101 
102 //
103 // ArenaObj
104 //
< prev index next >