hotspot/src/share/vm/memory/filemap.cpp
changeset 37439 e8970711113b
parent 37179 4dbcb3a642d2
child 38108 95c7e9d6747c
child 37773 e5b3e9732c3c
--- a/hotspot/src/share/vm/memory/filemap.cpp	Fri Apr 08 12:26:29 2016 -0700
+++ b/hotspot/src/share/vm/memory/filemap.cpp	Thu Apr 07 22:03:04 2016 -0700
@@ -959,6 +959,16 @@
   return false;
 }
 
+// Check if a given address is within one of the shared regions (ro, rw, md, mc)
+bool FileMapInfo::is_in_shared_region(const void* p, int idx) {
+  assert((idx >= MetaspaceShared::ro) && (idx <= MetaspaceShared::mc), "invalid region index");
+  char* base = _header->region_addr(idx);
+  if (p >= base && p < base + _header->_space[idx]._used) {
+    return true;
+  }
+  return false;
+}
+
 void FileMapInfo::print_shared_spaces() {
   tty->print_cr("Shared Spaces:");
   for (int i = 0; i < MetaspaceShared::n_regions; i++) {