src/share/vm/runtime/thread.hpp

Print this page
rev 1178 : merge with cd37471eaecc from http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot


1176     return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_pc_offset();
1177   }
1178   static ByteSize frame_anchor_offset()          {
1179     return byte_offset_of(JavaThread, _anchor);
1180   }
1181   static ByteSize callee_target_offset()         { return byte_offset_of(JavaThread, _callee_target       ); }
1182   static ByteSize vm_result_offset()             { return byte_offset_of(JavaThread, _vm_result           ); }
1183   static ByteSize vm_result_2_offset()           { return byte_offset_of(JavaThread, _vm_result_2         ); }
1184   static ByteSize thread_state_offset()          { return byte_offset_of(JavaThread, _thread_state        ); }
1185   static ByteSize saved_exception_pc_offset()    { return byte_offset_of(JavaThread, _saved_exception_pc  ); }
1186   static ByteSize osthread_offset()              { return byte_offset_of(JavaThread, _osthread            ); }
1187   static ByteSize exception_oop_offset()         { return byte_offset_of(JavaThread, _exception_oop       ); }
1188   static ByteSize exception_pc_offset()          { return byte_offset_of(JavaThread, _exception_pc        ); }
1189   static ByteSize exception_handler_pc_offset()  { return byte_offset_of(JavaThread, _exception_handler_pc); }
1190   static ByteSize exception_stack_size_offset()  { return byte_offset_of(JavaThread, _exception_stack_size); }
1191   static ByteSize is_method_handle_exception_offset() { return byte_offset_of(JavaThread, _is_method_handle_exception); }
1192   static ByteSize stack_guard_state_offset()     { return byte_offset_of(JavaThread, _stack_guard_state   ); }
1193   static ByteSize suspend_flags_offset()         { return byte_offset_of(JavaThread, _suspend_flags       ); }
1194 
1195   static ByteSize do_not_unlock_if_synchronized_offset() { return byte_offset_of(JavaThread, _do_not_unlock_if_synchronized); }



1196 
1197 #ifndef SERIALGC
1198   static ByteSize satb_mark_queue_offset()       { return byte_offset_of(JavaThread, _satb_mark_queue); }
1199   static ByteSize dirty_card_queue_offset()      { return byte_offset_of(JavaThread, _dirty_card_queue); }
1200 #endif // !SERIALGC
1201 
1202   // Returns the jni environment for this thread
1203   JNIEnv* jni_environment()                      { return &_jni_environment; }
1204 
1205   static JavaThread* thread_from_jni_environment(JNIEnv* env) {
1206     JavaThread *thread_from_jni_env = (JavaThread*)((intptr_t)env - in_bytes(jni_environment_offset()));
1207     // Only return NULL if thread is off the thread list; starting to
1208     // exit should not return NULL.
1209     if (thread_from_jni_env->is_terminated()) {
1210        thread_from_jni_env->block_if_vm_exited();
1211        return NULL;
1212     } else {
1213        return thread_from_jni_env;
1214     }
1215   }


1415 
1416  private:
1417   JvmtiThreadState *_jvmti_thread_state;
1418   JvmtiGetLoadedClassesClosure* _jvmti_get_loaded_classes_closure;
1419 
1420   // Used by the interpreter in fullspeed mode for frame pop, method
1421   // entry, method exit and single stepping support. This field is
1422   // only set to non-zero by the VM_EnterInterpOnlyMode VM operation.
1423   // It can be set to zero asynchronously (i.e., without a VM operation
1424   // or a lock) so we have to be very careful.
1425   int               _interp_only_mode;
1426 
1427  public:
1428   // used by the interpreter for fullspeed debugging support (see above)
1429   static ByteSize interp_only_mode_offset() { return byte_offset_of(JavaThread, _interp_only_mode); }
1430   bool is_interp_only_mode()                { return (_interp_only_mode != 0); }
1431   int get_interp_only_mode()                { return _interp_only_mode; }
1432   void increment_interp_only_mode()         { ++_interp_only_mode; }
1433   void decrement_interp_only_mode()         { --_interp_only_mode; }
1434 










1435  private:
1436   ThreadStatistics *_thread_stat;
1437 
1438  public:
1439   ThreadStatistics* get_thread_stat() const    { return _thread_stat; }
1440 
1441   // Return a blocker object for which this thread is blocked parking.
1442   oop current_park_blocker();
1443 
1444  private:
1445   static size_t _stack_size_at_create;
1446 
1447  public:
1448   static inline size_t stack_size_at_create(void) {
1449     return _stack_size_at_create;
1450   }
1451   static inline void set_stack_size_at_create(size_t value) {
1452     _stack_size_at_create = value;
1453   }
1454 




1176     return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_pc_offset();
1177   }
1178   static ByteSize frame_anchor_offset()          {
1179     return byte_offset_of(JavaThread, _anchor);
1180   }
1181   static ByteSize callee_target_offset()         { return byte_offset_of(JavaThread, _callee_target       ); }
1182   static ByteSize vm_result_offset()             { return byte_offset_of(JavaThread, _vm_result           ); }
1183   static ByteSize vm_result_2_offset()           { return byte_offset_of(JavaThread, _vm_result_2         ); }
1184   static ByteSize thread_state_offset()          { return byte_offset_of(JavaThread, _thread_state        ); }
1185   static ByteSize saved_exception_pc_offset()    { return byte_offset_of(JavaThread, _saved_exception_pc  ); }
1186   static ByteSize osthread_offset()              { return byte_offset_of(JavaThread, _osthread            ); }
1187   static ByteSize exception_oop_offset()         { return byte_offset_of(JavaThread, _exception_oop       ); }
1188   static ByteSize exception_pc_offset()          { return byte_offset_of(JavaThread, _exception_pc        ); }
1189   static ByteSize exception_handler_pc_offset()  { return byte_offset_of(JavaThread, _exception_handler_pc); }
1190   static ByteSize exception_stack_size_offset()  { return byte_offset_of(JavaThread, _exception_stack_size); }
1191   static ByteSize is_method_handle_exception_offset() { return byte_offset_of(JavaThread, _is_method_handle_exception); }
1192   static ByteSize stack_guard_state_offset()     { return byte_offset_of(JavaThread, _stack_guard_state   ); }
1193   static ByteSize suspend_flags_offset()         { return byte_offset_of(JavaThread, _suspend_flags       ); }
1194 
1195   static ByteSize do_not_unlock_if_synchronized_offset() { return byte_offset_of(JavaThread, _do_not_unlock_if_synchronized); }
1196   static ByteSize should_post_on_exceptions_flag_offset() { 
1197     return byte_offset_of(JavaThread, _should_post_on_exceptions_flag);
1198   }
1199 
1200 #ifndef SERIALGC
1201   static ByteSize satb_mark_queue_offset()       { return byte_offset_of(JavaThread, _satb_mark_queue); }
1202   static ByteSize dirty_card_queue_offset()      { return byte_offset_of(JavaThread, _dirty_card_queue); }
1203 #endif // !SERIALGC
1204 
1205   // Returns the jni environment for this thread
1206   JNIEnv* jni_environment()                      { return &_jni_environment; }
1207 
1208   static JavaThread* thread_from_jni_environment(JNIEnv* env) {
1209     JavaThread *thread_from_jni_env = (JavaThread*)((intptr_t)env - in_bytes(jni_environment_offset()));
1210     // Only return NULL if thread is off the thread list; starting to
1211     // exit should not return NULL.
1212     if (thread_from_jni_env->is_terminated()) {
1213        thread_from_jni_env->block_if_vm_exited();
1214        return NULL;
1215     } else {
1216        return thread_from_jni_env;
1217     }
1218   }


1418 
1419  private:
1420   JvmtiThreadState *_jvmti_thread_state;
1421   JvmtiGetLoadedClassesClosure* _jvmti_get_loaded_classes_closure;
1422 
1423   // Used by the interpreter in fullspeed mode for frame pop, method
1424   // entry, method exit and single stepping support. This field is
1425   // only set to non-zero by the VM_EnterInterpOnlyMode VM operation.
1426   // It can be set to zero asynchronously (i.e., without a VM operation
1427   // or a lock) so we have to be very careful.
1428   int               _interp_only_mode;
1429 
1430  public:
1431   // used by the interpreter for fullspeed debugging support (see above)
1432   static ByteSize interp_only_mode_offset() { return byte_offset_of(JavaThread, _interp_only_mode); }
1433   bool is_interp_only_mode()                { return (_interp_only_mode != 0); }
1434   int get_interp_only_mode()                { return _interp_only_mode; }
1435   void increment_interp_only_mode()         { ++_interp_only_mode; }
1436   void decrement_interp_only_mode()         { --_interp_only_mode; }
1437 
1438   // support for cached flag that indicates whether exceptions need to be posted for this thread
1439   // if this is false, we can avoid deoptimizing when events are thrown
1440   // this gets set to reflect whether jvmtiExport::post_exception_throw would actually do anything
1441  private:
1442   int    _should_post_on_exceptions_flag;
1443 
1444  public:  
1445   int   should_post_on_exceptions_flag()  { return _should_post_on_exceptions_flag; }
1446   void  set_should_post_on_exceptions_flag(int val)  { _should_post_on_exceptions_flag = val; }
1447 
1448  private:
1449   ThreadStatistics *_thread_stat;
1450 
1451  public:
1452   ThreadStatistics* get_thread_stat() const    { return _thread_stat; }
1453 
1454   // Return a blocker object for which this thread is blocked parking.
1455   oop current_park_blocker();
1456 
1457  private:
1458   static size_t _stack_size_at_create;
1459 
1460  public:
1461   static inline size_t stack_size_at_create(void) {
1462     return _stack_size_at_create;
1463   }
1464   static inline void set_stack_size_at_create(size_t value) {
1465     _stack_size_at_create = value;
1466   }
1467