src/hotspot/share/runtime/thread.hpp
changeset 57501 a297f7ab46c3
parent 55490 3f3dc00a69a5
child 57603 f9d9bed12d1a
equal deleted inserted replaced
57500:ab6867688e7a 57501:a297f7ab46c3
   373 
   373 
   374   // debug support for checking if code does allow safepoints or not
   374   // debug support for checking if code does allow safepoints or not
   375   // GC points in the VM can happen because of allocation, invoking a VM operation, or blocking on
   375   // GC points in the VM can happen because of allocation, invoking a VM operation, or blocking on
   376   // mutex, or blocking on an object synchronizer (Java locking).
   376   // mutex, or blocking on an object synchronizer (Java locking).
   377   // If !allow_safepoint(), then an assertion failure will happen in any of the above cases
   377   // If !allow_safepoint(), then an assertion failure will happen in any of the above cases
   378   // If !allow_allocation(), then an assertion failure will happen during allocation
       
   379   // (Hence, !allow_safepoint() => !allow_allocation()).
       
   380   //
   378   //
   381   // The two classes NoSafepointVerifier and No_Allocation_Verifier are used to set these counters.
   379   // The class NoSafepointVerifier is used to set this counter.
   382   //
   380   //
   383   NOT_PRODUCT(int _allow_safepoint_count;)      // If 0, thread allow a safepoint to happen
   381   NOT_PRODUCT(int _allow_safepoint_count;)      // If 0, thread allow a safepoint to happen
   384   debug_only(int _allow_allocation_count;)     // If 0, the thread is allowed to allocate oops.
       
   385 
   382 
   386   // Used by SkipGCALot class.
   383   // Used by SkipGCALot class.
   387   NOT_PRODUCT(bool _skip_gcalot;)               // Should we elide gc-a-lot?
   384   NOT_PRODUCT(bool _skip_gcalot;)               // Should we elide gc-a-lot?
   388 
   385 
   389   friend class NoAllocVerifier;
       
   390   friend class NoSafepointVerifier;
   386   friend class NoSafepointVerifier;
   391   friend class PauseNoSafepointVerifier;
   387   friend class PauseNoSafepointVerifier;
   392   friend class GCLocker;
   388   friend class GCLocker;
   393 
   389 
   394   volatile void* _polling_page;                 // Thread local polling page
   390   volatile void* _polling_page;                 // Thread local polling page
   752   Monitor* owned_locks() const                   { return _owned_locks;          }
   748   Monitor* owned_locks() const                   { return _owned_locks;          }
   753   bool owns_locks() const                        { return owned_locks() != NULL; }
   749   bool owns_locks() const                        { return owned_locks() != NULL; }
   754   bool owns_locks_but_compiled_lock() const;
   750   bool owns_locks_but_compiled_lock() const;
   755 
   751 
   756   // Deadlock detection
   752   // Deadlock detection
   757   bool allow_allocation()                        { return _allow_allocation_count == 0; }
       
   758   ResourceMark* current_resource_mark()          { return _current_resource_mark; }
   753   ResourceMark* current_resource_mark()          { return _current_resource_mark; }
   759   void set_current_resource_mark(ResourceMark* rm) { _current_resource_mark = rm; }
   754   void set_current_resource_mark(ResourceMark* rm) { _current_resource_mark = rm; }
   760 #endif
   755 #endif
   761 
   756 
   762   void check_for_valid_safepoint_state(bool potential_vm_operation) PRODUCT_RETURN;
   757   void check_for_valid_safepoint_state(bool potential_vm_operation) PRODUCT_RETURN;