src/hotspot/share/prims/jni.cpp
changeset 59247 56bf71d64d51
parent 58920 d67ebc838ab8
child 59248 e92153ed8bdc
equal deleted inserted replaced
59246:fcad92f425c5 59247:56bf71d64d51
   272   JNIHistogramElement::JNIHistogramElement(const char* elementName) {
   272   JNIHistogramElement::JNIHistogramElement(const char* elementName) {
   273     _name = elementName;
   273     _name = elementName;
   274     uintx count = 0;
   274     uintx count = 0;
   275 
   275 
   276     while (Atomic::cmpxchg(1, &JNIHistogram_lock, 0) != 0) {
   276     while (Atomic::cmpxchg(1, &JNIHistogram_lock, 0) != 0) {
   277       while (OrderAccess::load_acquire(&JNIHistogram_lock) != 0) {
   277       while (Atomic::load_acquire(&JNIHistogram_lock) != 0) {
   278         count +=1;
   278         count +=1;
   279         if ( (WarnOnStalledSpinLock > 0)
   279         if ( (WarnOnStalledSpinLock > 0)
   280           && (count % WarnOnStalledSpinLock == 0)) {
   280           && (count % WarnOnStalledSpinLock == 0)) {
   281           warning("JNIHistogram_lock seems to be stalled");
   281           warning("JNIHistogram_lock seems to be stalled");
   282         }
   282         }
  3914     // Creation failed. We must reset vm_created
  3914     // Creation failed. We must reset vm_created
  3915     *vm = 0;
  3915     *vm = 0;
  3916     *(JNIEnv**)penv = 0;
  3916     *(JNIEnv**)penv = 0;
  3917     // reset vm_created last to avoid race condition. Use OrderAccess to
  3917     // reset vm_created last to avoid race condition. Use OrderAccess to
  3918     // control both compiler and architectural-based reordering.
  3918     // control both compiler and architectural-based reordering.
  3919     OrderAccess::release_store(&vm_created, 0);
  3919     Atomic::release_store(&vm_created, 0);
  3920   }
  3920   }
  3921 
  3921 
  3922   // Flush stdout and stderr before exit.
  3922   // Flush stdout and stderr before exit.
  3923   fflush(stdout);
  3923   fflush(stdout);
  3924   fflush(stderr);
  3924   fflush(stderr);