< prev index next >

src/hotspot/share/runtime/interfaceSupport.cpp

Print this page




  56     InterfaceSupport::walk_stack();
  57   }
  58 #ifdef COMPILER2
  59   // This option is not used by Compiler 1
  60   if (StressDerivedPointers) {
  61     InterfaceSupport::stress_derived_pointers();
  62   }
  63 #endif
  64   if (DeoptimizeALot || DeoptimizeRandom) {
  65     InterfaceSupport::deoptimizeAll();
  66   }
  67   if (ZombieALot) {
  68     InterfaceSupport::zombieAll();
  69   }
  70   // do verification AFTER potential deoptimization
  71   if (VerifyStack) {
  72     InterfaceSupport::verify_stack();
  73   }
  74 }
  75 








  76 long InterfaceSupport::_number_of_calls       = 0;
  77 long InterfaceSupport::_scavenge_alot_counter = 1;
  78 long InterfaceSupport::_fullgc_alot_counter   = 1;
  79 long InterfaceSupport::_fullgc_alot_invocation = 0;
  80 
  81 Histogram* RuntimeHistogram;
  82 
  83 RuntimeHistogramElement::RuntimeHistogramElement(const char* elementName) {
  84   static volatile int RuntimeHistogram_lock = 0;
  85   _name = elementName;
  86   uintx count = 0;
  87 
  88   while (Atomic::cmpxchg(1, &RuntimeHistogram_lock, 0) != 0) {
  89     while (OrderAccess::load_acquire(&RuntimeHistogram_lock) != 0) {
  90       count +=1;
  91       if ( (WarnOnStalledSpinLock > 0)
  92         && (count % WarnOnStalledSpinLock == 0)) {
  93         warning("RuntimeHistogram_lock seems to be stalled");
  94       }
  95     }


 275 
 276 void InterfaceSupport::verify_last_frame() {
 277   JavaThread* thread = JavaThread::current();
 278   ResourceMark rm(thread);
 279   RegisterMap reg_map(thread);
 280   frame fr = thread->last_frame();
 281   fr.verify(&reg_map);
 282 }
 283 
 284 
 285 #endif // ASSERT
 286 
 287 
 288 void InterfaceSupport_init() {
 289 #ifdef ASSERT
 290   if (ScavengeALot || FullGCALot) {
 291     srand(ScavengeALotInterval * FullGCALotInterval);
 292   }
 293 #endif
 294 }
 295 
 296 #ifdef ASSERT
 297 // JRT_LEAF rules:
 298 // A JRT_LEAF method may not interfere with safepointing by
 299 //   1) acquiring or blocking on a Mutex or JavaLock - checked
 300 //   2) allocating heap memory - checked
 301 //   3) executing a VM operation - checked
 302 //   4) executing a system call (including malloc) that could block or grab a lock
 303 //   5) invoking GC
 304 //   6) reaching a safepoint
 305 //   7) running too long
 306 // Nor may any method it calls.
 307 JRTLeafVerifier::JRTLeafVerifier()
 308   : NoSafepointVerifier(true, JRTLeafVerifier::should_verify_GC())
 309 {
 310 }
 311 
 312 JRTLeafVerifier::~JRTLeafVerifier()
 313 {
 314 }
 315 
 316 bool JRTLeafVerifier::should_verify_GC() {
 317   switch (JavaThread::current()->thread_state()) {
 318   case _thread_in_Java:
 319     // is in a leaf routine, there must be no safepoint.
 320     return true;
 321   case _thread_in_native:
 322     // A native thread is not subject to safepoints.
 323     // Even while it is in a leaf routine, GC is ok
 324     return false;
 325   default:
 326     // Leaf routines cannot be called from other contexts.
 327     ShouldNotReachHere();
 328     return false;
 329   }
 330 }
 331 #endif // ASSERT


  56     InterfaceSupport::walk_stack();
  57   }
  58 #ifdef COMPILER2
  59   // This option is not used by Compiler 1
  60   if (StressDerivedPointers) {
  61     InterfaceSupport::stress_derived_pointers();
  62   }
  63 #endif
  64   if (DeoptimizeALot || DeoptimizeRandom) {
  65     InterfaceSupport::deoptimizeAll();
  66   }
  67   if (ZombieALot) {
  68     InterfaceSupport::zombieAll();
  69   }
  70   // do verification AFTER potential deoptimization
  71   if (VerifyStack) {
  72     InterfaceSupport::verify_stack();
  73   }
  74 }
  75 
  76 VMNativeEntryWrapper::VMNativeEntryWrapper() {
  77   if (GCALotAtAllSafepoints) InterfaceSupport::check_gc_alot();
  78 }
  79 
  80 VMNativeEntryWrapper::~VMNativeEntryWrapper() {
  81   if (GCALotAtAllSafepoints) InterfaceSupport::check_gc_alot();
  82 }
  83 
  84 long InterfaceSupport::_number_of_calls       = 0;
  85 long InterfaceSupport::_scavenge_alot_counter = 1;
  86 long InterfaceSupport::_fullgc_alot_counter   = 1;
  87 long InterfaceSupport::_fullgc_alot_invocation = 0;
  88 
  89 Histogram* RuntimeHistogram;
  90 
  91 RuntimeHistogramElement::RuntimeHistogramElement(const char* elementName) {
  92   static volatile int RuntimeHistogram_lock = 0;
  93   _name = elementName;
  94   uintx count = 0;
  95 
  96   while (Atomic::cmpxchg(1, &RuntimeHistogram_lock, 0) != 0) {
  97     while (OrderAccess::load_acquire(&RuntimeHistogram_lock) != 0) {
  98       count +=1;
  99       if ( (WarnOnStalledSpinLock > 0)
 100         && (count % WarnOnStalledSpinLock == 0)) {
 101         warning("RuntimeHistogram_lock seems to be stalled");
 102       }
 103     }


 283 
 284 void InterfaceSupport::verify_last_frame() {
 285   JavaThread* thread = JavaThread::current();
 286   ResourceMark rm(thread);
 287   RegisterMap reg_map(thread);
 288   frame fr = thread->last_frame();
 289   fr.verify(&reg_map);
 290 }
 291 
 292 
 293 #endif // ASSERT
 294 
 295 
 296 void InterfaceSupport_init() {
 297 #ifdef ASSERT
 298   if (ScavengeALot || FullGCALot) {
 299     srand(ScavengeALotInterval * FullGCALotInterval);
 300   }
 301 #endif
 302 }





































< prev index next >