hotspot/src/share/vm/runtime/thread.hpp
changeset 15482 470d0b0c09f1
parent 14582 490bb6c0df7c
child 15926 8e87d545195f
equal deleted inserted replaced
15224:0f9e3436040d 15482:470d0b0c09f1
    39 #include "runtime/park.hpp"
    39 #include "runtime/park.hpp"
    40 #include "runtime/safepoint.hpp"
    40 #include "runtime/safepoint.hpp"
    41 #include "runtime/stubRoutines.hpp"
    41 #include "runtime/stubRoutines.hpp"
    42 #include "runtime/threadLocalStorage.hpp"
    42 #include "runtime/threadLocalStorage.hpp"
    43 #include "runtime/unhandledOops.hpp"
    43 #include "runtime/unhandledOops.hpp"
       
    44 #include "utilities/macros.hpp"
    44 
    45 
    45 #if INCLUDE_NMT
    46 #if INCLUDE_NMT
    46 #include "services/memRecorder.hpp"
    47 #include "services/memRecorder.hpp"
    47 #endif // INCLUDE_NMT
    48 #endif // INCLUDE_NMT
    48 
    49 
    49 #include "trace/tracing.hpp"
    50 #include "trace/tracing.hpp"
    50 #include "utilities/exceptions.hpp"
    51 #include "utilities/exceptions.hpp"
    51 #include "utilities/top.hpp"
    52 #include "utilities/top.hpp"
    52 #ifndef SERIALGC
    53 #if INCLUDE_ALL_GCS
    53 #include "gc_implementation/g1/dirtyCardQueue.hpp"
    54 #include "gc_implementation/g1/dirtyCardQueue.hpp"
    54 #include "gc_implementation/g1/satbQueue.hpp"
    55 #include "gc_implementation/g1/satbQueue.hpp"
    55 #endif
    56 #endif // INCLUDE_ALL_GCS
    56 #ifdef ZERO
    57 #ifdef ZERO
    57 #ifdef TARGET_ARCH_zero
    58 #ifdef TARGET_ARCH_zero
    58 # include "stack_zero.hpp"
    59 # include "stack_zero.hpp"
    59 #endif
    60 #endif
    60 #endif
    61 #endif
   927       const char*  _file;
   928       const char*  _file;
   928       int _line;
   929       int _line;
   929   }   _jmp_ring[ jump_ring_buffer_size ];
   930   }   _jmp_ring[ jump_ring_buffer_size ];
   930 #endif /* PRODUCT */
   931 #endif /* PRODUCT */
   931 
   932 
   932 #ifndef SERIALGC
   933 #if INCLUDE_ALL_GCS
   933   // Support for G1 barriers
   934   // Support for G1 barriers
   934 
   935 
   935   ObjPtrQueue _satb_mark_queue;          // Thread-local log for SATB barrier.
   936   ObjPtrQueue _satb_mark_queue;          // Thread-local log for SATB barrier.
   936   // Set of all such queues.
   937   // Set of all such queues.
   937   static SATBMarkQueueSet _satb_mark_queue_set;
   938   static SATBMarkQueueSet _satb_mark_queue_set;
   939   DirtyCardQueue _dirty_card_queue;      // Thread-local log for dirty cards.
   940   DirtyCardQueue _dirty_card_queue;      // Thread-local log for dirty cards.
   940   // Set of all such queues.
   941   // Set of all such queues.
   941   static DirtyCardQueueSet _dirty_card_queue_set;
   942   static DirtyCardQueueSet _dirty_card_queue_set;
   942 
   943 
   943   void flush_barrier_queues();
   944   void flush_barrier_queues();
   944 #endif // !SERIALGC
   945 #endif // INCLUDE_ALL_GCS
   945 
   946 
   946   friend class VMThread;
   947   friend class VMThread;
   947   friend class ThreadWaitTransition;
   948   friend class ThreadWaitTransition;
   948   friend class VM_Exit;
   949   friend class VM_Exit;
   949 
   950 
  1343   static ByteSize do_not_unlock_if_synchronized_offset() { return byte_offset_of(JavaThread, _do_not_unlock_if_synchronized); }
  1344   static ByteSize do_not_unlock_if_synchronized_offset() { return byte_offset_of(JavaThread, _do_not_unlock_if_synchronized); }
  1344   static ByteSize should_post_on_exceptions_flag_offset() {
  1345   static ByteSize should_post_on_exceptions_flag_offset() {
  1345     return byte_offset_of(JavaThread, _should_post_on_exceptions_flag);
  1346     return byte_offset_of(JavaThread, _should_post_on_exceptions_flag);
  1346   }
  1347   }
  1347 
  1348 
  1348 #ifndef SERIALGC
  1349 #if INCLUDE_ALL_GCS
  1349   static ByteSize satb_mark_queue_offset()       { return byte_offset_of(JavaThread, _satb_mark_queue); }
  1350   static ByteSize satb_mark_queue_offset()       { return byte_offset_of(JavaThread, _satb_mark_queue); }
  1350   static ByteSize dirty_card_queue_offset()      { return byte_offset_of(JavaThread, _dirty_card_queue); }
  1351   static ByteSize dirty_card_queue_offset()      { return byte_offset_of(JavaThread, _dirty_card_queue); }
  1351 #endif // !SERIALGC
  1352 #endif // INCLUDE_ALL_GCS
  1352 
  1353 
  1353   // Returns the jni environment for this thread
  1354   // Returns the jni environment for this thread
  1354   JNIEnv* jni_environment()                      { return &_jni_environment; }
  1355   JNIEnv* jni_environment()                      { return &_jni_environment; }
  1355 
  1356 
  1356   static JavaThread* thread_from_jni_environment(JNIEnv* env) {
  1357   static JavaThread* thread_from_jni_environment(JNIEnv* env) {
  1635   }
  1636   }
  1636   static inline void set_stack_size_at_create(size_t value) {
  1637   static inline void set_stack_size_at_create(size_t value) {
  1637     _stack_size_at_create = value;
  1638     _stack_size_at_create = value;
  1638   }
  1639   }
  1639 
  1640 
  1640 #ifndef SERIALGC
  1641 #if INCLUDE_ALL_GCS
  1641   // SATB marking queue support
  1642   // SATB marking queue support
  1642   ObjPtrQueue& satb_mark_queue() { return _satb_mark_queue; }
  1643   ObjPtrQueue& satb_mark_queue() { return _satb_mark_queue; }
  1643   static SATBMarkQueueSet& satb_mark_queue_set() {
  1644   static SATBMarkQueueSet& satb_mark_queue_set() {
  1644     return _satb_mark_queue_set;
  1645     return _satb_mark_queue_set;
  1645   }
  1646   }
  1647   // Dirty card queue support
  1648   // Dirty card queue support
  1648   DirtyCardQueue& dirty_card_queue() { return _dirty_card_queue; }
  1649   DirtyCardQueue& dirty_card_queue() { return _dirty_card_queue; }
  1649   static DirtyCardQueueSet& dirty_card_queue_set() {
  1650   static DirtyCardQueueSet& dirty_card_queue_set() {
  1650     return _dirty_card_queue_set;
  1651     return _dirty_card_queue_set;
  1651   }
  1652   }
  1652 #endif // !SERIALGC
  1653 #endif // INCLUDE_ALL_GCS
  1653 
  1654 
  1654   // This method initializes the SATB and dirty card queues before a
  1655   // This method initializes the SATB and dirty card queues before a
  1655   // JavaThread is added to the Java thread list. Right now, we don't
  1656   // JavaThread is added to the Java thread list. Right now, we don't
  1656   // have to do anything to the dirty card queue (it should have been
  1657   // have to do anything to the dirty card queue (it should have been
  1657   // activated when the thread was created), but we have to activate
  1658   // activated when the thread was created), but we have to activate
  1666   // cannot do the obvious and set the active field of the SATB queue
  1667   // cannot do the obvious and set the active field of the SATB queue
  1667   // when the thread is created given that, in some cases, safepoints
  1668   // when the thread is created given that, in some cases, safepoints
  1668   // might happen between the JavaThread constructor being called and the
  1669   // might happen between the JavaThread constructor being called and the
  1669   // thread being added to the Java thread list (an example of this is
  1670   // thread being added to the Java thread list (an example of this is
  1670   // when the structure for the DestroyJavaVM thread is created).
  1671   // when the structure for the DestroyJavaVM thread is created).
  1671 #ifndef SERIALGC
  1672 #if INCLUDE_ALL_GCS
  1672   void initialize_queues();
  1673   void initialize_queues();
  1673 #else // !SERIALGC
  1674 #else  // INCLUDE_ALL_GCS
  1674   void initialize_queues() { }
  1675   void initialize_queues() { }
  1675 #endif // !SERIALGC
  1676 #endif // INCLUDE_ALL_GCS
  1676 
  1677 
  1677   // Machine dependent stuff
  1678   // Machine dependent stuff
  1678 #ifdef TARGET_OS_ARCH_linux_x86
  1679 #ifdef TARGET_OS_ARCH_linux_x86
  1679 # include "thread_linux_x86.hpp"
  1680 # include "thread_linux_x86.hpp"
  1680 #endif
  1681 #endif