< prev index next >

src/hotspot/share/memory/allocation.cpp

Print this page

        

@@ -26,10 +26,11 @@
 #include "memory/allocation.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/arena.hpp"
 #include "memory/metaspaceShared.hpp"
 #include "memory/resourceArea.hpp"
+#include "memory/universe.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/os.hpp"
 #include "runtime/task.hpp"
 #include "runtime/threadCritical.hpp"
 #include "services/memTracker.hpp"

@@ -81,18 +82,12 @@
                                  MetaspaceObj::Type type, TRAPS) throw() {
   // Klass has it's own operator new
   return Metaspace::allocate(loader_data, word_size, type, THREAD);
 }
 
-bool MetaspaceObj::is_valid(const MetaspaceObj* p) {
-  // Weed out obvious bogus values first without traversing metaspace
-  if ((size_t)p < os::min_page_size()) {
-    return false;
-  } else if (!is_aligned((address)p, sizeof(MetaWord))) {
-    return false;
-  }
-  return Metaspace::contains((void*)p);
+bool MetaspaceObj::is_metaspace_object() const {
+  return Metaspace::contains((void*)this);
 }
 
 void MetaspaceObj::print_address_on(outputStream* st) const {
   st->print(" {" INTPTR_FORMAT "}", p2i(this));
 }
< prev index next >