src/share/vm/runtime/thread.hpp

changeset 6911
ce8f6bb717c9
parent 6680
78bbf4d43a14
child 6973
4af19b914f53
equal deleted inserted replaced
6910:c8dd4f65cc76 6911:ce8f6bb717c9
434 } 434 }
435 435
436 jlong allocated_bytes() { return _allocated_bytes; } 436 jlong allocated_bytes() { return _allocated_bytes; }
437 void set_allocated_bytes(jlong value) { _allocated_bytes = value; } 437 void set_allocated_bytes(jlong value) { _allocated_bytes = value; }
438 void incr_allocated_bytes(jlong size) { _allocated_bytes += size; } 438 void incr_allocated_bytes(jlong size) { _allocated_bytes += size; }
439 jlong cooked_allocated_bytes() { 439 inline jlong cooked_allocated_bytes();
440 jlong allocated_bytes = OrderAccess::load_acquire(&_allocated_bytes);
441 if (UseTLAB) {
442 size_t used_bytes = tlab().used_bytes();
443 if ((ssize_t)used_bytes > 0) {
444 // More-or-less valid tlab. The load_acquire above should ensure
445 // that the result of the add is <= the instantaneous value
446 return allocated_bytes + used_bytes;
447 }
448 }
449 return allocated_bytes;
450 }
451 440
452 TRACE_DATA* trace_data() { return &_trace_data; } 441 TRACE_DATA* trace_data() { return &_trace_data; }
453 442
454 // VM operation support 443 // VM operation support
455 int vm_operation_ticket() { return ++_vm_operation_started_count; } 444 int vm_operation_ticket() { return ++_vm_operation_started_count; }
1044 JavaThreadState thread_state() const { return _thread_state; } 1033 JavaThreadState thread_state() const { return _thread_state; }
1045 void set_thread_state(JavaThreadState s) { _thread_state = s; } 1034 void set_thread_state(JavaThreadState s) { _thread_state = s; }
1046 #else 1035 #else
1047 // Use membars when accessing volatile _thread_state. See 1036 // Use membars when accessing volatile _thread_state. See
1048 // Threads::create_vm() for size checks. 1037 // Threads::create_vm() for size checks.
1049 JavaThreadState thread_state() const { 1038 inline JavaThreadState thread_state() const;
1050 return (JavaThreadState) OrderAccess::load_acquire((volatile jint*)&_thread_state); 1039 inline void set_thread_state(JavaThreadState s);
1051 }
1052 void set_thread_state(JavaThreadState s) {
1053 OrderAccess::release_store((volatile jint*)&_thread_state, (jint)s);
1054 }
1055 #endif 1040 #endif
1056 ThreadSafepointState *safepoint_state() const { return _safepoint_state; } 1041 ThreadSafepointState *safepoint_state() const { return _safepoint_state; }
1057 void set_safepoint_state(ThreadSafepointState *state) { _safepoint_state = state; } 1042 void set_safepoint_state(ThreadSafepointState *state) { _safepoint_state = state; }
1058 bool is_at_poll_safepoint() { return _safepoint_state->is_at_poll_safepoint(); } 1043 bool is_at_poll_safepoint() { return _safepoint_state->is_at_poll_safepoint(); }
1059 1044
1773 void set_cached_monitor_info(GrowableArray<MonitorInfo*>* info) { _cached_monitor_info = info; } 1758 void set_cached_monitor_info(GrowableArray<MonitorInfo*>* info) { _cached_monitor_info = info; }
1774 1759
1775 // clearing/querying jni attach status 1760 // clearing/querying jni attach status
1776 bool is_attaching_via_jni() const { return _jni_attach_state == _attaching_via_jni; } 1761 bool is_attaching_via_jni() const { return _jni_attach_state == _attaching_via_jni; }
1777 bool has_attached_via_jni() const { return is_attaching_via_jni() || _jni_attach_state == _attached_via_jni; } 1762 bool has_attached_via_jni() const { return is_attaching_via_jni() || _jni_attach_state == _attached_via_jni; }
1778 void set_done_attaching_via_jni() { _jni_attach_state = _attached_via_jni; OrderAccess::fence(); } 1763 inline void set_done_attaching_via_jni();
1779 private: 1764 private:
1780 // This field is used to determine if a thread has claimed 1765 // This field is used to determine if a thread has claimed
1781 // a par_id: it is UINT_MAX if the thread has not claimed a par_id; 1766 // a par_id: it is UINT_MAX if the thread has not claimed a par_id;
1782 // otherwise its value is the par_id that has been claimed. 1767 // otherwise its value is the par_id that has been claimed.
1783 uint _claimed_par_id; 1768 uint _claimed_par_id;

mercurial