changeset 55785:a297f7ab46c3

8228484: Remove NoAllocVerifier because nothing uses it Reviewed-by: hseigel, kbarrett
author coleenp
date Tue, 23 Jul 2019 13:56:41 -0400
parents ab6867688e7a
children 650335128b9d
files src/hotspot/share/gc/shared/memAllocator.cpp src/hotspot/share/runtime/safepointVerifiers.hpp src/hotspot/share/runtime/thread.cpp src/hotspot/share/runtime/thread.hpp
diffstat 4 files changed, 2 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/shared/memAllocator.cpp	Thu Jul 18 13:58:34 2019 -0700
+++ b/src/hotspot/share/gc/shared/memAllocator.cpp	Tue Jul 23 13:56:41 2019 -0400
@@ -173,11 +173,8 @@
   assert(!_thread->has_pending_exception(),
          "shouldn't be allocating with pending exception");
   if (StrictSafepointChecks) {
-    assert(_thread->allow_allocation(),
-           "Allocation done by thread for which allocation is blocked "
-           "by No_Allocation_Verifier!");
     // Allocation of an oop can always invoke a safepoint,
-    // hence, the true argument
+    // hence, the true argument.
     _thread->check_for_valid_safepoint_state(true);
   }
 }
--- a/src/hotspot/share/runtime/safepointVerifiers.hpp	Thu Jul 18 13:58:34 2019 -0700
+++ b/src/hotspot/share/runtime/safepointVerifiers.hpp	Tue Jul 23 13:56:41 2019 -0400
@@ -91,14 +91,12 @@
     _activated(activated) {
     _thread = Thread::current();
     if (_activated) {
-      _thread->_allow_allocation_count++;
       _thread->_allow_safepoint_count++;
     }
   }
 
   ~NoSafepointVerifier() {
     if (_activated) {
-      _thread->_allow_allocation_count--;
       _thread->_allow_safepoint_count--;
     }
   }
@@ -126,14 +124,12 @@
 
     _nsv = nsv;
     if (_nsv->_activated) {
-      _nsv->_thread->_allow_allocation_count--;
       _nsv->_thread->_allow_safepoint_count--;
     }
   }
 
   ~PauseNoSafepointVerifier() {
     if (_nsv->_activated) {
-      _nsv->_thread->_allow_allocation_count++;
       _nsv->_thread->_allow_safepoint_count++;
     }
   }
@@ -144,32 +140,4 @@
 #endif
 };
 
-// A NoAllocVerifier object can be placed in methods where one assumes that
-// no allocation will occur. The destructor will verify this property
-// unless the constructor is called with argument false (not activated).
-//
-// The check will only be done in debug mode and if activated.
-// Note: this only makes sense at safepoints (otherwise, other threads may
-// allocate concurrently.)
-
-class NoAllocVerifier : public StackObj {
- private:
-  bool  _activated;
-
- public:
-#ifdef ASSERT
-  NoAllocVerifier(bool activated = true) {
-    _activated = activated;
-    if (_activated) Thread::current()->_allow_allocation_count++;
-  }
-
-  ~NoAllocVerifier() {
-    if (_activated) Thread::current()->_allow_allocation_count--;
-  }
-#else
-  NoAllocVerifier(bool activated = true) {}
-  ~NoAllocVerifier() {}
-#endif
-};
-
 #endif // SHARE_RUNTIME_SAFEPOINTVERIFIERS_HPP
--- a/src/hotspot/share/runtime/thread.cpp	Thu Jul 18 13:58:34 2019 -0700
+++ b/src/hotspot/share/runtime/thread.cpp	Tue Jul 23 13:56:41 2019 -0400
@@ -250,7 +250,6 @@
 
   // plain initialization
   debug_only(_owned_locks = NULL;)
-  debug_only(_allow_allocation_count = 0;)
   NOT_PRODUCT(_allow_safepoint_count = 0;)
   NOT_PRODUCT(_skip_gcalot = false;)
   _jvmti_env_iteration_count = 0;
--- a/src/hotspot/share/runtime/thread.hpp	Thu Jul 18 13:58:34 2019 -0700
+++ b/src/hotspot/share/runtime/thread.hpp	Tue Jul 23 13:56:41 2019 -0400
@@ -375,18 +375,14 @@
   // GC points in the VM can happen because of allocation, invoking a VM operation, or blocking on
   // mutex, or blocking on an object synchronizer (Java locking).
   // If !allow_safepoint(), then an assertion failure will happen in any of the above cases
-  // If !allow_allocation(), then an assertion failure will happen during allocation
-  // (Hence, !allow_safepoint() => !allow_allocation()).
   //
-  // The two classes NoSafepointVerifier and No_Allocation_Verifier are used to set these counters.
+  // The class NoSafepointVerifier is used to set this counter.
   //
   NOT_PRODUCT(int _allow_safepoint_count;)      // If 0, thread allow a safepoint to happen
-  debug_only(int _allow_allocation_count;)     // If 0, the thread is allowed to allocate oops.
 
   // Used by SkipGCALot class.
   NOT_PRODUCT(bool _skip_gcalot;)               // Should we elide gc-a-lot?
 
-  friend class NoAllocVerifier;
   friend class NoSafepointVerifier;
   friend class PauseNoSafepointVerifier;
   friend class GCLocker;
@@ -754,7 +750,6 @@
   bool owns_locks_but_compiled_lock() const;
 
   // Deadlock detection
-  bool allow_allocation()                        { return _allow_allocation_count == 0; }
   ResourceMark* current_resource_mark()          { return _current_resource_mark; }
   void set_current_resource_mark(ResourceMark* rm) { _current_resource_mark = rm; }
 #endif