< prev index next >

src/hotspot/share/runtime/interfaceSupport.cpp

Print this page




  71   if (GCALotAtAllSafepoints) InterfaceSupport::check_gc_alot();
  72 }
  73 
  74 VMNativeEntryWrapper::~VMNativeEntryWrapper() {
  75   if (GCALotAtAllSafepoints) InterfaceSupport::check_gc_alot();
  76 }
  77 
  78 long InterfaceSupport::_number_of_calls       = 0;
  79 long InterfaceSupport::_scavenge_alot_counter = 1;
  80 long InterfaceSupport::_fullgc_alot_counter   = 1;
  81 long InterfaceSupport::_fullgc_alot_invocation = 0;
  82 
  83 Histogram* RuntimeHistogram;
  84 
  85 RuntimeHistogramElement::RuntimeHistogramElement(const char* elementName) {
  86   static volatile int RuntimeHistogram_lock = 0;
  87   _name = elementName;
  88   uintx count = 0;
  89 
  90   while (Atomic::cmpxchg(1, &RuntimeHistogram_lock, 0) != 0) {
  91     while (OrderAccess::load_acquire(&RuntimeHistogram_lock) != 0) {
  92       count +=1;
  93       if ( (WarnOnStalledSpinLock > 0)
  94         && (count % WarnOnStalledSpinLock == 0)) {
  95         warning("RuntimeHistogram_lock seems to be stalled");
  96       }
  97     }
  98   }
  99 
 100   if (RuntimeHistogram == NULL) {
 101     RuntimeHistogram = new Histogram("VM Runtime Call Counts",200);
 102   }
 103 
 104   RuntimeHistogram->add_element(this);
 105   Atomic::dec(&RuntimeHistogram_lock);
 106 }
 107 
 108 void InterfaceSupport::gc_alot() {
 109   Thread *thread = Thread::current();
 110   if (!thread->is_Java_thread()) return; // Avoid concurrent calls
 111   // Check for new, not quite initialized thread. A thread in new mode cannot initiate a GC.




  71   if (GCALotAtAllSafepoints) InterfaceSupport::check_gc_alot();
  72 }
  73 
  74 VMNativeEntryWrapper::~VMNativeEntryWrapper() {
  75   if (GCALotAtAllSafepoints) InterfaceSupport::check_gc_alot();
  76 }
  77 
  78 long InterfaceSupport::_number_of_calls       = 0;
  79 long InterfaceSupport::_scavenge_alot_counter = 1;
  80 long InterfaceSupport::_fullgc_alot_counter   = 1;
  81 long InterfaceSupport::_fullgc_alot_invocation = 0;
  82 
  83 Histogram* RuntimeHistogram;
  84 
  85 RuntimeHistogramElement::RuntimeHistogramElement(const char* elementName) {
  86   static volatile int RuntimeHistogram_lock = 0;
  87   _name = elementName;
  88   uintx count = 0;
  89 
  90   while (Atomic::cmpxchg(1, &RuntimeHistogram_lock, 0) != 0) {
  91     while (Atomic::load_acquire(&RuntimeHistogram_lock) != 0) {
  92       count +=1;
  93       if ( (WarnOnStalledSpinLock > 0)
  94         && (count % WarnOnStalledSpinLock == 0)) {
  95         warning("RuntimeHistogram_lock seems to be stalled");
  96       }
  97     }
  98   }
  99 
 100   if (RuntimeHistogram == NULL) {
 101     RuntimeHistogram = new Histogram("VM Runtime Call Counts",200);
 102   }
 103 
 104   RuntimeHistogram->add_element(this);
 105   Atomic::dec(&RuntimeHistogram_lock);
 106 }
 107 
 108 void InterfaceSupport::gc_alot() {
 109   Thread *thread = Thread::current();
 110   if (!thread->is_Java_thread()) return; // Avoid concurrent calls
 111   // Check for new, not quite initialized thread. A thread in new mode cannot initiate a GC.


< prev index next >