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

changeset 6911
ce8f6bb717c9
parent 6461
bdd155477289
child 7535
7ae4e26cb1e0
     1.1 --- a/src/share/vm/runtime/thread.inline.hpp	Wed Jul 02 22:54:18 2014 +0200
     1.2 +++ b/src/share/vm/runtime/thread.inline.hpp	Tue Apr 29 15:17:27 2014 +0200
     1.3 @@ -46,4 +46,32 @@
     1.4  
     1.5  #undef SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE
     1.6  
     1.7 +inline jlong Thread::cooked_allocated_bytes() {
     1.8 +  jlong allocated_bytes = OrderAccess::load_acquire(&_allocated_bytes);
     1.9 +  if (UseTLAB) {
    1.10 +    size_t used_bytes = tlab().used_bytes();
    1.11 +    if ((ssize_t)used_bytes > 0) {
    1.12 +      // More-or-less valid tlab. The load_acquire above should ensure
    1.13 +      // that the result of the add is <= the instantaneous value.
    1.14 +      return allocated_bytes + used_bytes;
    1.15 +    }
    1.16 +  }
    1.17 +  return allocated_bytes;
    1.18 +}
    1.19 +
    1.20 +#ifdef PPC64
    1.21 +inline JavaThreadState JavaThread::thread_state() const    {
    1.22 +  return (JavaThreadState) OrderAccess::load_acquire((volatile jint*)&_thread_state);
    1.23 +}
    1.24 +
    1.25 +inline void JavaThread::set_thread_state(JavaThreadState s) {
    1.26 +  OrderAccess::release_store((volatile jint*)&_thread_state, (jint)s);
    1.27 +}
    1.28 +#endif
    1.29 +
    1.30 +inline void JavaThread::set_done_attaching_via_jni() {
    1.31 +  _jni_attach_state = _attached_via_jni;
    1.32 +  OrderAccess::fence();
    1.33 +}
    1.34 +
    1.35  #endif // SHARE_VM_RUNTIME_THREAD_INLINE_HPP

mercurial