src/share/vm/runtime/synchronizer.cpp

Print this page




 407       NEWPERFCOUNTER(_sync_SlowExit) ;
 408       NEWPERFCOUNTER(_sync_SlowNotify) ;
 409       NEWPERFCOUNTER(_sync_SlowNotifyAll) ;
 410       NEWPERFCOUNTER(_sync_FailedSpins) ;
 411       NEWPERFCOUNTER(_sync_SuccessfulSpins) ;
 412       NEWPERFCOUNTER(_sync_PrivateA) ;
 413       NEWPERFCOUNTER(_sync_PrivateB) ;
 414       NEWPERFCOUNTER(_sync_MonInCirculation) ;
 415       NEWPERFCOUNTER(_sync_MonScavenged) ;
 416       NEWPERFVARIABLE(_sync_MonExtant) ;
 417       #undef NEWPERFCOUNTER
 418   }
 419 }
 420 
 421 // Compile-time asserts
 422 // When possible, it's better to catch errors deterministically at
 423 // compile-time than at runtime.  The down-side to using compile-time
 424 // asserts is that error message -- often something about negative array
 425 // indices -- is opaque.
 426 
 427 #define CTASSERT(x) { int tag[1-(2*!(x))]; printf ("Tag @%X\n", tag); }
 428 
 429 void ObjectMonitor::ctAsserts() {
 430   CTASSERT(offset_of (ObjectMonitor, _header) == 0);
 431 }
 432 
 433 static int Adjust (volatile int * adr, int dx) {
 434   int v ;
 435   for (v = *adr ; Atomic::cmpxchg (v + dx, adr, v) != v; v = *adr) ;
 436   return v ;
 437 }
 438 
 439 // Ad-hoc mutual exclusion primitives: SpinLock and Mux
 440 //
 441 // We employ SpinLocks _only for low-contention, fixed-length
 442 // short-duration critical sections where we're concerned
 443 // about native mutex_t or HotSpot Mutex:: latency.
 444 // The mux construct provides a spin-then-block mutual exclusion
 445 // mechanism.
 446 //
 447 // Testing has shown that contention on the ListLock guarding gFreeList




 407       NEWPERFCOUNTER(_sync_SlowExit) ;
 408       NEWPERFCOUNTER(_sync_SlowNotify) ;
 409       NEWPERFCOUNTER(_sync_SlowNotifyAll) ;
 410       NEWPERFCOUNTER(_sync_FailedSpins) ;
 411       NEWPERFCOUNTER(_sync_SuccessfulSpins) ;
 412       NEWPERFCOUNTER(_sync_PrivateA) ;
 413       NEWPERFCOUNTER(_sync_PrivateB) ;
 414       NEWPERFCOUNTER(_sync_MonInCirculation) ;
 415       NEWPERFCOUNTER(_sync_MonScavenged) ;
 416       NEWPERFVARIABLE(_sync_MonExtant) ;
 417       #undef NEWPERFCOUNTER
 418   }
 419 }
 420 
 421 // Compile-time asserts
 422 // When possible, it's better to catch errors deterministically at
 423 // compile-time than at runtime.  The down-side to using compile-time
 424 // asserts is that error message -- often something about negative array
 425 // indices -- is opaque.
 426 
 427 #define CTASSERT(x) { int tag[1-(2*!(x))]; printf ("Tag @" INTPTR_FORMAT "\n", (intptr_t)tag); }
 428 
 429 void ObjectMonitor::ctAsserts() {
 430   CTASSERT(offset_of (ObjectMonitor, _header) == 0);
 431 }
 432 
 433 static int Adjust (volatile int * adr, int dx) {
 434   int v ;
 435   for (v = *adr ; Atomic::cmpxchg (v + dx, adr, v) != v; v = *adr) ;
 436   return v ;
 437 }
 438 
 439 // Ad-hoc mutual exclusion primitives: SpinLock and Mux
 440 //
 441 // We employ SpinLocks _only for low-contention, fixed-length
 442 // short-duration critical sections where we're concerned
 443 // about native mutex_t or HotSpot Mutex:: latency.
 444 // The mux construct provides a spin-then-block mutual exclusion
 445 // mechanism.
 446 //
 447 // Testing has shown that contention on the ListLock guarding gFreeList