src/share/vm/runtime/thread.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6893081 Sdiff src/share/vm/runtime

src/share/vm/runtime/thread.hpp

Print this page
rev 1081 : imported patch indy-cleanup-6893081.patch


 743 
 744  public:
 745   // State of the stack guard pages for this thread.
 746   enum StackGuardState {
 747     stack_guard_unused,         // not needed
 748     stack_guard_yellow_disabled,// disabled (temporarily) after stack overflow
 749     stack_guard_enabled         // enabled
 750   };
 751 
 752  private:
 753 
 754   StackGuardState        _stack_guard_state;
 755 
 756   // Compiler exception handling (NOTE: The _exception_oop is *NOT* the same as _pending_exception. It is
 757   // used to temp. parsing values into and out of the runtime system during exception handling for compiled
 758   // code)
 759   volatile oop     _exception_oop;               // Exception thrown in compiled code
 760   volatile address _exception_pc;                // PC where exception happened
 761   volatile address _exception_handler_pc;        // PC for handler of exception
 762   volatile int     _exception_stack_size;        // Size of frame where exception happened

 763 
 764   // support for compilation
 765   bool    _is_compiling;                         // is true if a compilation is active inthis thread (one compilation per thread possible)
 766 
 767   // support for JNI critical regions
 768   jint    _jni_active_critical;                  // count of entries into JNI critical region
 769 
 770   // For deadlock detection.
 771   int _depth_first_number;
 772 
 773   // JVMTI PopFrame support
 774   // This is set to popframe_pending to signal that top Java frame should be popped immediately
 775   int _popframe_condition;
 776 
 777 #ifndef PRODUCT
 778   int _jmp_ring_index;
 779   struct {
 780       // We use intptr_t instead of address so debugger doesn't try and display strings
 781       intptr_t _target;
 782       intptr_t _instruction;


1078   void     clear_must_deopt_id()                 { _must_deopt_id = NULL; }
1079 
1080   methodOop  callee_target() const               { return _callee_target; }
1081   void set_callee_target  (methodOop x)          { _callee_target   = x; }
1082 
1083   // Oop results of vm runtime calls
1084   oop  vm_result() const                         { return _vm_result; }
1085   void set_vm_result  (oop x)                    { _vm_result   = x; }
1086 
1087   oop  vm_result_2() const                       { return _vm_result_2; }
1088   void set_vm_result_2  (oop x)                  { _vm_result_2   = x; }
1089 
1090   MemRegion deferred_card_mark() const           { return _deferred_card_mark; }
1091   void set_deferred_card_mark(MemRegion mr)      { _deferred_card_mark = mr;   }
1092 
1093   // Exception handling for compiled methods
1094   oop      exception_oop() const                 { return _exception_oop; }
1095   int      exception_stack_size() const          { return _exception_stack_size; }
1096   address  exception_pc() const                  { return _exception_pc; }
1097   address  exception_handler_pc() const          { return _exception_handler_pc; }

1098 
1099   void set_exception_oop(oop o)                  { _exception_oop = o; }
1100   void set_exception_pc(address a)               { _exception_pc = a; }
1101   void set_exception_handler_pc(address a)       { _exception_handler_pc = a; }
1102   void set_exception_stack_size(int size)        { _exception_stack_size = size; }

1103 
1104   // Stack overflow support
1105   inline size_t stack_available(address cur_sp);
1106   address stack_yellow_zone_base()
1107     { return (address)(stack_base() - (stack_size() - (stack_red_zone_size() + stack_yellow_zone_size()))); }
1108   size_t  stack_yellow_zone_size()
1109     { return StackYellowPages * os::vm_page_size(); }
1110   address stack_red_zone_base()
1111     { return (address)(stack_base() - (stack_size() - stack_red_zone_size())); }
1112   size_t stack_red_zone_size()
1113     { return StackRedPages * os::vm_page_size(); }
1114   bool in_stack_yellow_zone(address a)
1115     { return (a <= stack_yellow_zone_base()) && (a >= stack_red_zone_base()); }
1116   bool in_stack_red_zone(address a)
1117     { return (a <= stack_red_zone_base()) && (a >= (address)((intptr_t)stack_base() - stack_size())); }
1118 
1119   void create_stack_guard_pages();
1120   void remove_stack_guard_pages();
1121 
1122   void enable_stack_yellow_zone();


1156   static ByteSize jni_environment_offset()       { return byte_offset_of(JavaThread, _jni_environment     ); }
1157   static ByteSize last_Java_sp_offset()          {
1158     return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_sp_offset();
1159   }
1160   static ByteSize last_Java_pc_offset()          {
1161     return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_pc_offset();
1162   }
1163   static ByteSize frame_anchor_offset()          {
1164     return byte_offset_of(JavaThread, _anchor);
1165   }
1166   static ByteSize callee_target_offset()         { return byte_offset_of(JavaThread, _callee_target       ); }
1167   static ByteSize vm_result_offset()             { return byte_offset_of(JavaThread, _vm_result           ); }
1168   static ByteSize vm_result_2_offset()           { return byte_offset_of(JavaThread, _vm_result_2         ); }
1169   static ByteSize thread_state_offset()          { return byte_offset_of(JavaThread, _thread_state        ); }
1170   static ByteSize saved_exception_pc_offset()    { return byte_offset_of(JavaThread, _saved_exception_pc  ); }
1171   static ByteSize osthread_offset()              { return byte_offset_of(JavaThread, _osthread            ); }
1172   static ByteSize exception_oop_offset()         { return byte_offset_of(JavaThread, _exception_oop       ); }
1173   static ByteSize exception_pc_offset()          { return byte_offset_of(JavaThread, _exception_pc        ); }
1174   static ByteSize exception_handler_pc_offset()  { return byte_offset_of(JavaThread, _exception_handler_pc); }
1175   static ByteSize exception_stack_size_offset()  { return byte_offset_of(JavaThread, _exception_stack_size); }

1176   static ByteSize stack_guard_state_offset()     { return byte_offset_of(JavaThread, _stack_guard_state   ); }
1177   static ByteSize suspend_flags_offset()         { return byte_offset_of(JavaThread, _suspend_flags       ); }
1178 
1179   static ByteSize do_not_unlock_if_synchronized_offset() { return byte_offset_of(JavaThread, _do_not_unlock_if_synchronized); }
1180 
1181 #ifndef SERIALGC
1182   static ByteSize satb_mark_queue_offset()       { return byte_offset_of(JavaThread, _satb_mark_queue); }
1183   static ByteSize dirty_card_queue_offset()      { return byte_offset_of(JavaThread, _dirty_card_queue); }
1184 #endif // !SERIALGC
1185 
1186   // Returns the jni environment for this thread
1187   JNIEnv* jni_environment()                      { return &_jni_environment; }
1188 
1189   static JavaThread* thread_from_jni_environment(JNIEnv* env) {
1190     JavaThread *thread_from_jni_env = (JavaThread*)((intptr_t)env - in_bytes(jni_environment_offset()));
1191     // Only return NULL if thread is off the thread list; starting to
1192     // exit should not return NULL.
1193     if (thread_from_jni_env->is_terminated()) {
1194        thread_from_jni_env->block_if_vm_exited();
1195        return NULL;




 743 
 744  public:
 745   // State of the stack guard pages for this thread.
 746   enum StackGuardState {
 747     stack_guard_unused,         // not needed
 748     stack_guard_yellow_disabled,// disabled (temporarily) after stack overflow
 749     stack_guard_enabled         // enabled
 750   };
 751 
 752  private:
 753 
 754   StackGuardState        _stack_guard_state;
 755 
 756   // Compiler exception handling (NOTE: The _exception_oop is *NOT* the same as _pending_exception. It is
 757   // used to temp. parsing values into and out of the runtime system during exception handling for compiled
 758   // code)
 759   volatile oop     _exception_oop;               // Exception thrown in compiled code
 760   volatile address _exception_pc;                // PC where exception happened
 761   volatile address _exception_handler_pc;        // PC for handler of exception
 762   volatile int     _exception_stack_size;        // Size of frame where exception happened
 763   volatile int     _is_method_handle_exception;  // True if the current exception PC is at a MethodHandle call.
 764 
 765   // support for compilation
 766   bool    _is_compiling;                         // is true if a compilation is active inthis thread (one compilation per thread possible)
 767 
 768   // support for JNI critical regions
 769   jint    _jni_active_critical;                  // count of entries into JNI critical region
 770 
 771   // For deadlock detection.
 772   int _depth_first_number;
 773 
 774   // JVMTI PopFrame support
 775   // This is set to popframe_pending to signal that top Java frame should be popped immediately
 776   int _popframe_condition;
 777 
 778 #ifndef PRODUCT
 779   int _jmp_ring_index;
 780   struct {
 781       // We use intptr_t instead of address so debugger doesn't try and display strings
 782       intptr_t _target;
 783       intptr_t _instruction;


1079   void     clear_must_deopt_id()                 { _must_deopt_id = NULL; }
1080 
1081   methodOop  callee_target() const               { return _callee_target; }
1082   void set_callee_target  (methodOop x)          { _callee_target   = x; }
1083 
1084   // Oop results of vm runtime calls
1085   oop  vm_result() const                         { return _vm_result; }
1086   void set_vm_result  (oop x)                    { _vm_result   = x; }
1087 
1088   oop  vm_result_2() const                       { return _vm_result_2; }
1089   void set_vm_result_2  (oop x)                  { _vm_result_2   = x; }
1090 
1091   MemRegion deferred_card_mark() const           { return _deferred_card_mark; }
1092   void set_deferred_card_mark(MemRegion mr)      { _deferred_card_mark = mr;   }
1093 
1094   // Exception handling for compiled methods
1095   oop      exception_oop() const                 { return _exception_oop; }
1096   int      exception_stack_size() const          { return _exception_stack_size; }
1097   address  exception_pc() const                  { return _exception_pc; }
1098   address  exception_handler_pc() const          { return _exception_handler_pc; }
1099   int      is_method_handle_exception() const    { return _is_method_handle_exception; }
1100 
1101   void set_exception_oop(oop o)                  { _exception_oop = o; }
1102   void set_exception_pc(address a)               { _exception_pc = a; }
1103   void set_exception_handler_pc(address a)       { _exception_handler_pc = a; }
1104   void set_exception_stack_size(int size)        { _exception_stack_size = size; }
1105   void set_is_method_handle_exception(int value) { _is_method_handle_exception = value; }
1106 
1107   // Stack overflow support
1108   inline size_t stack_available(address cur_sp);
1109   address stack_yellow_zone_base()
1110     { return (address)(stack_base() - (stack_size() - (stack_red_zone_size() + stack_yellow_zone_size()))); }
1111   size_t  stack_yellow_zone_size()
1112     { return StackYellowPages * os::vm_page_size(); }
1113   address stack_red_zone_base()
1114     { return (address)(stack_base() - (stack_size() - stack_red_zone_size())); }
1115   size_t stack_red_zone_size()
1116     { return StackRedPages * os::vm_page_size(); }
1117   bool in_stack_yellow_zone(address a)
1118     { return (a <= stack_yellow_zone_base()) && (a >= stack_red_zone_base()); }
1119   bool in_stack_red_zone(address a)
1120     { return (a <= stack_red_zone_base()) && (a >= (address)((intptr_t)stack_base() - stack_size())); }
1121 
1122   void create_stack_guard_pages();
1123   void remove_stack_guard_pages();
1124 
1125   void enable_stack_yellow_zone();


1159   static ByteSize jni_environment_offset()       { return byte_offset_of(JavaThread, _jni_environment     ); }
1160   static ByteSize last_Java_sp_offset()          {
1161     return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_sp_offset();
1162   }
1163   static ByteSize last_Java_pc_offset()          {
1164     return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_pc_offset();
1165   }
1166   static ByteSize frame_anchor_offset()          {
1167     return byte_offset_of(JavaThread, _anchor);
1168   }
1169   static ByteSize callee_target_offset()         { return byte_offset_of(JavaThread, _callee_target       ); }
1170   static ByteSize vm_result_offset()             { return byte_offset_of(JavaThread, _vm_result           ); }
1171   static ByteSize vm_result_2_offset()           { return byte_offset_of(JavaThread, _vm_result_2         ); }
1172   static ByteSize thread_state_offset()          { return byte_offset_of(JavaThread, _thread_state        ); }
1173   static ByteSize saved_exception_pc_offset()    { return byte_offset_of(JavaThread, _saved_exception_pc  ); }
1174   static ByteSize osthread_offset()              { return byte_offset_of(JavaThread, _osthread            ); }
1175   static ByteSize exception_oop_offset()         { return byte_offset_of(JavaThread, _exception_oop       ); }
1176   static ByteSize exception_pc_offset()          { return byte_offset_of(JavaThread, _exception_pc        ); }
1177   static ByteSize exception_handler_pc_offset()  { return byte_offset_of(JavaThread, _exception_handler_pc); }
1178   static ByteSize exception_stack_size_offset()  { return byte_offset_of(JavaThread, _exception_stack_size); }
1179   static ByteSize is_method_handle_exception_offset() { return byte_offset_of(JavaThread, _is_method_handle_exception); }
1180   static ByteSize stack_guard_state_offset()     { return byte_offset_of(JavaThread, _stack_guard_state   ); }
1181   static ByteSize suspend_flags_offset()         { return byte_offset_of(JavaThread, _suspend_flags       ); }
1182 
1183   static ByteSize do_not_unlock_if_synchronized_offset() { return byte_offset_of(JavaThread, _do_not_unlock_if_synchronized); }
1184 
1185 #ifndef SERIALGC
1186   static ByteSize satb_mark_queue_offset()       { return byte_offset_of(JavaThread, _satb_mark_queue); }
1187   static ByteSize dirty_card_queue_offset()      { return byte_offset_of(JavaThread, _dirty_card_queue); }
1188 #endif // !SERIALGC
1189 
1190   // Returns the jni environment for this thread
1191   JNIEnv* jni_environment()                      { return &_jni_environment; }
1192 
1193   static JavaThread* thread_from_jni_environment(JNIEnv* env) {
1194     JavaThread *thread_from_jni_env = (JavaThread*)((intptr_t)env - in_bytes(jni_environment_offset()));
1195     // Only return NULL if thread is off the thread list; starting to
1196     // exit should not return NULL.
1197     if (thread_from_jni_env->is_terminated()) {
1198        thread_from_jni_env->block_if_vm_exited();
1199        return NULL;


src/share/vm/runtime/thread.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File