< prev index next >

src/share/vm/runtime/thread.inline.hpp

Print this page
rev 11275 : 8149085: IntegrationTest1.java fails intermittently due to use of semi-initialized TLAB
Reviewed-by:


  54                          (jint)flags) != (jint)flags);
  55 }
  56 
  57 inline void Thread::set_has_async_exception() {
  58   set_suspend_flag(_has_async_exception);
  59 }
  60 inline void Thread::clear_has_async_exception() {
  61   clear_suspend_flag(_has_async_exception);
  62 }
  63 inline void Thread::set_critical_native_unlock() {
  64   set_suspend_flag(_critical_native_unlock);
  65 }
  66 inline void Thread::clear_critical_native_unlock() {
  67   clear_suspend_flag(_critical_native_unlock);
  68 }
  69 
  70 inline jlong Thread::cooked_allocated_bytes() {
  71   jlong allocated_bytes = OrderAccess::load_acquire(&_allocated_bytes);
  72   if (UseTLAB) {
  73     size_t used_bytes = tlab().used_bytes();
  74     if ((ssize_t)used_bytes > 0) {
  75       // More-or-less valid tlab. The load_acquire above should ensure
  76       // that the result of the add is <= the instantaneous value.



  77       return allocated_bytes + used_bytes;
  78     }
  79   }
  80   return allocated_bytes;
  81 }
  82 
  83 inline void JavaThread::set_ext_suspended() {
  84   set_suspend_flag (_ext_suspended);
  85 }
  86 inline void JavaThread::clear_ext_suspended() {
  87   clear_suspend_flag(_ext_suspended);
  88 }
  89 
  90 inline void JavaThread::set_external_suspend() {
  91   set_suspend_flag(_external_suspend);
  92 }
  93 inline void JavaThread::clear_external_suspend() {
  94   clear_suspend_flag(_external_suspend);
  95 }
  96 




  54                          (jint)flags) != (jint)flags);
  55 }
  56 
  57 inline void Thread::set_has_async_exception() {
  58   set_suspend_flag(_has_async_exception);
  59 }
  60 inline void Thread::clear_has_async_exception() {
  61   clear_suspend_flag(_has_async_exception);
  62 }
  63 inline void Thread::set_critical_native_unlock() {
  64   set_suspend_flag(_critical_native_unlock);
  65 }
  66 inline void Thread::clear_critical_native_unlock() {
  67   clear_suspend_flag(_critical_native_unlock);
  68 }
  69 
  70 inline jlong Thread::cooked_allocated_bytes() {
  71   jlong allocated_bytes = OrderAccess::load_acquire(&_allocated_bytes);
  72   if (UseTLAB) {
  73     size_t used_bytes = tlab().used_bytes();
  74     if (used_bytes <= ThreadLocalAllocBuffer::max_size_in_bytes()) {
  75       // Comparing used_bytes with the maximum allowed size will ensure
  76       // that we don't add the used bytes from a semi-initialized TLAB
  77       // ending up with incorrect values. There is still a race between
  78       // incrementing _allocated_bytes and clearing the TLAB, that might
  79       // cause double counting in rare cases.
  80       return allocated_bytes + used_bytes;
  81     }
  82   }
  83   return allocated_bytes;
  84 }
  85 
  86 inline void JavaThread::set_ext_suspended() {
  87   set_suspend_flag (_ext_suspended);
  88 }
  89 inline void JavaThread::clear_ext_suspended() {
  90   clear_suspend_flag(_ext_suspended);
  91 }
  92 
  93 inline void JavaThread::set_external_suspend() {
  94   set_suspend_flag(_external_suspend);
  95 }
  96 inline void JavaThread::clear_external_suspend() {
  97   clear_suspend_flag(_external_suspend);
  98 }
  99 


< prev index next >