8077403: Remove guarantee from GenCollectedHeap::is_in()
authorbrutisso
Tue, 14 Apr 2015 11:24:03 +0200
changeset 30177 925cd0b4f0e7
parent 30176 90aa2ac76bae
child 30178 33317ec95df7
child 30180 8da3724f19a6
8077403: Remove guarantee from GenCollectedHeap::is_in() Reviewed-by: mgerdin, jmasa
hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp
hotspot/src/share/vm/gc_interface/collectedHeap.hpp
hotspot/src/share/vm/memory/genCollectedHeap.cpp
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp	Tue Apr 14 11:40:13 2015 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp	Tue Apr 14 11:24:03 2015 +0200
@@ -170,27 +170,11 @@
 }
 
 bool ParallelScavengeHeap::is_in(const void* p) const {
-  if (young_gen()->is_in(p)) {
-    return true;
-  }
-
-  if (old_gen()->is_in(p)) {
-    return true;
-  }
-
-  return false;
+  return young_gen()->is_in(p) || old_gen()->is_in(p);
 }
 
 bool ParallelScavengeHeap::is_in_reserved(const void* p) const {
-  if (young_gen()->is_in_reserved(p)) {
-    return true;
-  }
-
-  if (old_gen()->is_in_reserved(p)) {
-    return true;
-  }
-
-  return false;
+  return young_gen()->is_in_reserved(p) || old_gen()->is_in_reserved(p);
 }
 
 bool ParallelScavengeHeap::is_scavengable(const void* addr) {
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp	Tue Apr 14 11:40:13 2015 +0200
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp	Tue Apr 14 11:24:03 2015 +0200
@@ -239,22 +239,11 @@
   }
 
   // Returns "TRUE" iff "p" points into the committed areas of the heap.
-  // Since this method can be expensive in general, we restrict its
-  // use to assertion checking only.
+  // This method can be expensive so avoid using it in performance critical
+  // code.
   virtual bool is_in(const void* p) const = 0;
 
-  bool is_in_or_null(const void* p) const {
-    return p == NULL || is_in(p);
-  }
-
-  bool is_in_place(Metadata** p) {
-    return !Universe::heap()->is_in(p);
-  }
-  bool is_in_place(oop* p) { return Universe::heap()->is_in(p); }
-  bool is_in_place(narrowOop* p) {
-    oop o = oopDesc::load_decode_heap_oop_not_null(p);
-    return Universe::heap()->is_in((const void*)o);
-  }
+  DEBUG_ONLY(bool is_in_or_null(const void* p) const { return p == NULL || is_in(p); })
 
   // Let's define some terms: a "closed" subset of a heap is one that
   //
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Tue Apr 14 11:40:13 2015 +0200
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Tue Apr 14 11:24:03 2015 +0200
@@ -906,17 +906,6 @@
 
 // Returns "TRUE" iff "p" points into the committed areas of the heap.
 bool GenCollectedHeap::is_in(const void* p) const {
-  #ifndef ASSERT
-  guarantee(VerifyBeforeGC      ||
-            VerifyDuringGC      ||
-            VerifyBeforeExit    ||
-            VerifyDuringStartup ||
-            PrintAssembly       ||
-            tty->count() != 0   ||   // already printing
-            VerifyAfterGC       ||
-    VMError::fatal_error_in_progress(), "too expensive");
-
-  #endif
   return _young_gen->is_in(p) || _old_gen->is_in(p);
 }