< prev index next >

src/share/vm/runtime/thread.hpp

Print this page




 312 
 313   // thread entry point
 314   virtual void run();
 315 
 316   // Testers
 317   virtual bool is_VM_thread()       const            { return false; }
 318   virtual bool is_Java_thread()     const            { return false; }
 319   virtual bool is_Compiler_thread() const            { return false; }
 320   virtual bool is_Code_cache_sweeper_thread() const  { return false; }
 321   virtual bool is_hidden_from_external_view() const  { return false; }
 322   virtual bool is_jvmti_agent_thread() const         { return false; }
 323   // True iff the thread can perform GC operations at a safepoint.
 324   // Generally will be true only of VM thread and parallel GC WorkGang
 325   // threads.
 326   virtual bool is_GC_task_thread() const             { return false; }
 327   virtual bool is_Watcher_thread() const             { return false; }
 328   virtual bool is_ConcurrentGC_thread() const        { return false; }
 329   virtual bool is_Named_thread() const               { return false; }
 330   virtual bool is_Worker_thread() const              { return false; }
 331 



 332   // Casts
 333   virtual WorkerThread* as_Worker_thread() const     { return NULL; }
 334 
 335   virtual char* name() const { return (char*)"Unknown thread"; }
 336 
 337   // Returns the current thread
 338   static inline Thread* current();
 339   // ... without having to include thread.inline.hpp.
 340   static Thread* current_noinline();
 341 
 342   // Common thread operations
 343   static void set_priority(Thread* thread, ThreadPriority priority);
 344   static ThreadPriority get_priority(const Thread* const thread);
 345   static void start(Thread* thread);
 346   static void interrupt(Thread* thr);
 347   static bool is_interrupted(Thread* thr, bool clear_interrupted);
 348 
 349   void set_native_thread_name(const char *name) {
 350     assert(Thread::current() == this, "set_native_thread_name can only be called on the current thread");
 351     os::set_native_thread_name(name);


 883     _not_attaching_via_jni = 1,  // thread is not attaching via JNI
 884     _attaching_via_jni,          // thread is attaching via JNI
 885     _attached_via_jni            // thread has attached via JNI
 886   };
 887 
 888   // A regular JavaThread's _jni_attach_state is _not_attaching_via_jni.
 889   // A native thread that is attaching via JNI starts with a value
 890   // of _attaching_via_jni and transitions to _attached_via_jni.
 891   volatile JNIAttachStates _jni_attach_state;
 892 
 893  public:
 894   // State of the stack guard pages for this thread.
 895   enum StackGuardState {
 896     stack_guard_unused,         // not needed
 897     stack_guard_yellow_disabled,// disabled (temporarily) after stack overflow
 898     stack_guard_enabled         // enabled
 899   };
 900 
 901  private:
 902 





































 903   StackGuardState  _stack_guard_state;
 904 
 905   // Precompute the limit of the stack as used in stack overflow checks.
 906   // We load it from here to simplify the stack overflow check in assembly.
 907   address          _stack_overflow_limit;
 908 
 909   // Compiler exception handling (NOTE: The _exception_oop is *NOT* the same as _pending_exception. It is
 910   // used to temp. parsing values into and out of the runtime system during exception handling for compiled
 911   // code)
 912   volatile oop     _exception_oop;               // Exception thrown in compiled code
 913   volatile address _exception_pc;                // PC where exception happened
 914   volatile address _exception_handler_pc;        // PC for handler of exception
 915   volatile int     _is_method_handle_return;     // true (== 1) if the current exception PC is a MethodHandle call site.
 916 

 917   // support for JNI critical regions
 918   jint    _jni_active_critical;                  // count of entries into JNI critical region
 919 
 920   // Checked JNI: function name requires exception check
 921   char* _pending_jni_exception_check_fn;
 922 
 923   // For deadlock detection.
 924   int _depth_first_number;
 925 
 926   // JVMTI PopFrame support
 927   // This is set to popframe_pending to signal that top Java frame should be popped immediately
 928   int _popframe_condition;
 929 
 930   // If reallocation of scalar replaced objects fails, we throw OOM
 931   // and during exception propagation, pop the top
 932   // _frames_to_pop_failed_realloc frames, the ones that reference
 933   // failed reallocations.
 934   int _frames_to_pop_failed_realloc;
 935 
 936 #ifndef PRODUCT


 984   }
 985 
 986   // This function is called at thread creation to allow
 987   // platform specific thread variables to be initialized.
 988   void cache_global_variables();
 989 
 990   // Executes Shutdown.shutdown()
 991   void invoke_shutdown_hooks();
 992 
 993   // Cleanup on thread exit
 994   enum ExitType {
 995     normal_exit,
 996     jni_detach
 997   };
 998   void exit(bool destroy_vm, ExitType exit_type = normal_exit);
 999 
1000   void cleanup_failed_attach_current_thread();
1001 
1002   // Testers
1003   virtual bool is_Java_thread() const            { return true;  }

1004 
1005   // Thread chain operations
1006   JavaThread* next() const                       { return _next; }
1007   void set_next(JavaThread* p)                   { _next = p; }
1008 
1009   // Thread oop. threadObj() can be NULL for initial JavaThread
1010   // (or for threads attached via JNI)
1011   oop threadObj() const                          { return _threadObj; }
1012   void set_threadObj(oop p)                      { _threadObj = p; }
1013 
1014   ThreadPriority java_priority() const;          // Read from threadObj()
1015 
1016   // Prepare thread and add to priority queue.  If a priority is
1017   // not specified, use the priority of the thread object. Threads_lock
1018   // must be held while this function is called.
1019   void prepare(jobject jni_thread, ThreadPriority prio=NoPriority);
1020   void prepare_ext();
1021 
1022   void set_saved_exception_pc(address pc)        { _saved_exception_pc = pc; }
1023   address saved_exception_pc()                   { return _saved_exception_pc; }


1242   intptr_t* must_deopt_id()                      { return _must_deopt_id; }
1243   void     set_must_deopt_id(intptr_t* id)       { _must_deopt_id = id; }
1244   void     clear_must_deopt_id()                 { _must_deopt_id = NULL; }
1245 
1246   void set_deopt_nmethod(nmethod* nm)            { _deopt_nmethod = nm;   }
1247   nmethod* deopt_nmethod()                       { return _deopt_nmethod; }
1248 
1249   Method*    callee_target() const               { return _callee_target; }
1250   void set_callee_target  (Method* x)          { _callee_target   = x; }
1251 
1252   // Oop results of vm runtime calls
1253   oop  vm_result() const                         { return _vm_result; }
1254   void set_vm_result  (oop x)                    { _vm_result   = x; }
1255 
1256   Metadata*    vm_result_2() const               { return _vm_result_2; }
1257   void set_vm_result_2  (Metadata* x)          { _vm_result_2   = x; }
1258 
1259   MemRegion deferred_card_mark() const           { return _deferred_card_mark; }
1260   void set_deferred_card_mark(MemRegion mr)      { _deferred_card_mark = mr;   }
1261 












1262   // Exception handling for compiled methods
1263   oop      exception_oop() const                 { return _exception_oop; }
1264   address  exception_pc() const                  { return _exception_pc; }
1265   address  exception_handler_pc() const          { return _exception_handler_pc; }
1266   bool     is_method_handle_return() const       { return _is_method_handle_return == 1; }
1267 
1268   void set_exception_oop(oop o)                  { (void)const_cast<oop&>(_exception_oop = o); }
1269   void set_exception_pc(address a)               { _exception_pc = a; }
1270   void set_exception_handler_pc(address a)       { _exception_handler_pc = a; }
1271   void set_is_method_handle_return(bool value)   { _is_method_handle_return = value ? 1 : 0; }
1272 
1273   void clear_exception_oop_and_pc() {
1274     set_exception_oop(NULL);
1275     set_exception_pc(NULL);
1276   }
1277 
1278   // Stack overflow support
1279   inline size_t stack_available(address cur_sp);
1280   address stack_yellow_zone_base() {
1281     return (address)(stack_base() -


1342 #ifndef PRODUCT
1343   static ByteSize jmp_ring_index_offset()        { return byte_offset_of(JavaThread, _jmp_ring_index); }
1344   static ByteSize jmp_ring_offset()              { return byte_offset_of(JavaThread, _jmp_ring); }
1345 #endif // PRODUCT
1346   static ByteSize jni_environment_offset()       { return byte_offset_of(JavaThread, _jni_environment); }
1347   static ByteSize last_Java_sp_offset() {
1348     return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_sp_offset();
1349   }
1350   static ByteSize last_Java_pc_offset() {
1351     return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_pc_offset();
1352   }
1353   static ByteSize frame_anchor_offset() {
1354     return byte_offset_of(JavaThread, _anchor);
1355   }
1356   static ByteSize callee_target_offset()         { return byte_offset_of(JavaThread, _callee_target); }
1357   static ByteSize vm_result_offset()             { return byte_offset_of(JavaThread, _vm_result); }
1358   static ByteSize vm_result_2_offset()           { return byte_offset_of(JavaThread, _vm_result_2); }
1359   static ByteSize thread_state_offset()          { return byte_offset_of(JavaThread, _thread_state); }
1360   static ByteSize saved_exception_pc_offset()    { return byte_offset_of(JavaThread, _saved_exception_pc); }
1361   static ByteSize osthread_offset()              { return byte_offset_of(JavaThread, _osthread); }








1362   static ByteSize exception_oop_offset()         { return byte_offset_of(JavaThread, _exception_oop); }
1363   static ByteSize exception_pc_offset()          { return byte_offset_of(JavaThread, _exception_pc); }
1364   static ByteSize exception_handler_pc_offset()  { return byte_offset_of(JavaThread, _exception_handler_pc); }
1365   static ByteSize stack_overflow_limit_offset()  { return byte_offset_of(JavaThread, _stack_overflow_limit); }
1366   static ByteSize is_method_handle_return_offset() { return byte_offset_of(JavaThread, _is_method_handle_return); }
1367   static ByteSize stack_guard_state_offset()     { return byte_offset_of(JavaThread, _stack_guard_state); }
1368   static ByteSize suspend_flags_offset()         { return byte_offset_of(JavaThread, _suspend_flags); }
1369 
1370   static ByteSize do_not_unlock_if_synchronized_offset() { return byte_offset_of(JavaThread, _do_not_unlock_if_synchronized); }
1371   static ByteSize should_post_on_exceptions_flag_offset() {
1372     return byte_offset_of(JavaThread, _should_post_on_exceptions_flag);
1373   }
1374 
1375 #if INCLUDE_ALL_GCS
1376   static ByteSize satb_mark_queue_offset()       { return byte_offset_of(JavaThread, _satb_mark_queue); }
1377   static ByteSize dirty_card_queue_offset()      { return byte_offset_of(JavaThread, _dirty_card_queue); }
1378 #endif // INCLUDE_ALL_GCS
1379 
1380   // Returns the jni environment for this thread
1381   JNIEnv* jni_environment()                      { return &_jni_environment; }


1811 class CompilerThread : public JavaThread {
1812   friend class VMStructs;
1813  private:
1814   CompilerCounters* _counters;
1815 
1816   ciEnv*            _env;
1817   CompileLog*       _log;
1818   CompileTask*      _task;
1819   CompileQueue*     _queue;
1820   BufferBlob*       _buffer_blob;
1821 
1822   AbstractCompiler* _compiler;
1823 
1824  public:
1825 
1826   static CompilerThread* current();
1827 
1828   CompilerThread(CompileQueue* queue, CompilerCounters* counters);
1829 
1830   bool is_Compiler_thread() const                { return true; }
1831   // Hide this compiler thread from external view.
1832   bool is_hidden_from_external_view() const      { return true; }



1833 
1834   void set_compiler(AbstractCompiler* c)         { _compiler = c; }
1835   AbstractCompiler* compiler() const             { return _compiler; }
1836 
1837   CompileQueue* queue()        const             { return _queue; }
1838   CompilerCounters* counters() const             { return _counters; }
1839 
1840   // Get/set the thread's compilation environment.
1841   ciEnv*        env()                            { return _env; }
1842   void          set_env(ciEnv* env)              { _env = env; }
1843 
1844   BufferBlob*   get_buffer_blob() const          { return _buffer_blob; }
1845   void          set_buffer_blob(BufferBlob* b)   { _buffer_blob = b; }
1846 
1847   // Get/set the thread's logging information
1848   CompileLog*   log()                            { return _log; }
1849   void          init_log(CompileLog* log) {
1850     // Set once, for good.
1851     assert(_log == NULL, "set only once");
1852     _log = log;




 312 
 313   // thread entry point
 314   virtual void run();
 315 
 316   // Testers
 317   virtual bool is_VM_thread()       const            { return false; }
 318   virtual bool is_Java_thread()     const            { return false; }
 319   virtual bool is_Compiler_thread() const            { return false; }
 320   virtual bool is_Code_cache_sweeper_thread() const  { return false; }
 321   virtual bool is_hidden_from_external_view() const  { return false; }
 322   virtual bool is_jvmti_agent_thread() const         { return false; }
 323   // True iff the thread can perform GC operations at a safepoint.
 324   // Generally will be true only of VM thread and parallel GC WorkGang
 325   // threads.
 326   virtual bool is_GC_task_thread() const             { return false; }
 327   virtual bool is_Watcher_thread() const             { return false; }
 328   virtual bool is_ConcurrentGC_thread() const        { return false; }
 329   virtual bool is_Named_thread() const               { return false; }
 330   virtual bool is_Worker_thread() const              { return false; }
 331 
 332   // Can this thread make Java upcalls
 333   virtual bool can_call_java() const                 { return false; }
 334 
 335   // Casts
 336   virtual WorkerThread* as_Worker_thread() const     { return NULL; }
 337 
 338   virtual char* name() const { return (char*)"Unknown thread"; }
 339 
 340   // Returns the current thread
 341   static inline Thread* current();
 342   // ... without having to include thread.inline.hpp.
 343   static Thread* current_noinline();
 344 
 345   // Common thread operations
 346   static void set_priority(Thread* thread, ThreadPriority priority);
 347   static ThreadPriority get_priority(const Thread* const thread);
 348   static void start(Thread* thread);
 349   static void interrupt(Thread* thr);
 350   static bool is_interrupted(Thread* thr, bool clear_interrupted);
 351 
 352   void set_native_thread_name(const char *name) {
 353     assert(Thread::current() == this, "set_native_thread_name can only be called on the current thread");
 354     os::set_native_thread_name(name);


 886     _not_attaching_via_jni = 1,  // thread is not attaching via JNI
 887     _attaching_via_jni,          // thread is attaching via JNI
 888     _attached_via_jni            // thread has attached via JNI
 889   };
 890 
 891   // A regular JavaThread's _jni_attach_state is _not_attaching_via_jni.
 892   // A native thread that is attaching via JNI starts with a value
 893   // of _attaching_via_jni and transitions to _attached_via_jni.
 894   volatile JNIAttachStates _jni_attach_state;
 895 
 896  public:
 897   // State of the stack guard pages for this thread.
 898   enum StackGuardState {
 899     stack_guard_unused,         // not needed
 900     stack_guard_yellow_disabled,// disabled (temporarily) after stack overflow
 901     stack_guard_enabled         // enabled
 902   };
 903 
 904  private:
 905 
 906 #if INCLUDE_JVMCI
 907   // The _pending_* fields below are used to communicate extra information
 908   // from an uncommon trap in JVMCI compiled code to the uncommon trap handler.
 909 
 910   // Communicates the DeoptReason and DeoptAction of the uncommon trap
 911   int       _pending_deoptimization;
 912 
 913   // Specifies whether the uncommon trap is to bci 0 of a synchronized method
 914   // before the monitor has been acquired.
 915   bool      _pending_monitorenter;
 916 
 917   // Specifies if the DeoptReason for the last uncommon trap was Reason_transfer_to_interpreter
 918   bool      _pending_transfer_to_interpreter;
 919 
 920   // An object that JVMCI compiled code can use to further describe and
 921   // uniquely identify the  speculative optimization guarded by the uncommon trap
 922   oop       _pending_failed_speculation;
 923 
 924   // These fields are mutually exclusive in terms of live ranges.
 925   union {
 926     // Communicates the pc at which the most recent implicit exception occurred
 927     // from the signal handler to a deoptimization stub.
 928     address   _implicit_exception_pc;
 929 
 930     // Communicates an alternative call target to an i2c stub from a JavaCall .
 931     address   _alternate_call_target;
 932   } _jvmci;
 933 
 934   // Support for high precision, thread sensitive counters in JVMCI compiled code.
 935   jlong*    _jvmci_counters;
 936 
 937  public:
 938   static jlong* _jvmci_old_thread_counters;
 939   static void collect_counters(typeArrayOop array);
 940  private:
 941 #endif // INCLUDE_JVMCI
 942 
 943   StackGuardState  _stack_guard_state;
 944 
 945   // Precompute the limit of the stack as used in stack overflow checks.
 946   // We load it from here to simplify the stack overflow check in assembly.
 947   address          _stack_overflow_limit;
 948 
 949   // Compiler exception handling (NOTE: The _exception_oop is *NOT* the same as _pending_exception. It is
 950   // used to temp. parsing values into and out of the runtime system during exception handling for compiled
 951   // code)
 952   volatile oop     _exception_oop;               // Exception thrown in compiled code
 953   volatile address _exception_pc;                // PC where exception happened
 954   volatile address _exception_handler_pc;        // PC for handler of exception
 955   volatile int     _is_method_handle_return;     // true (== 1) if the current exception PC is a MethodHandle call site.
 956 
 957  private:  
 958   // support for JNI critical regions
 959   jint    _jni_active_critical;                  // count of entries into JNI critical region
 960 
 961   // Checked JNI: function name requires exception check
 962   char* _pending_jni_exception_check_fn;
 963 
 964   // For deadlock detection.
 965   int _depth_first_number;
 966 
 967   // JVMTI PopFrame support
 968   // This is set to popframe_pending to signal that top Java frame should be popped immediately
 969   int _popframe_condition;
 970 
 971   // If reallocation of scalar replaced objects fails, we throw OOM
 972   // and during exception propagation, pop the top
 973   // _frames_to_pop_failed_realloc frames, the ones that reference
 974   // failed reallocations.
 975   int _frames_to_pop_failed_realloc;
 976 
 977 #ifndef PRODUCT


1025   }
1026 
1027   // This function is called at thread creation to allow
1028   // platform specific thread variables to be initialized.
1029   void cache_global_variables();
1030 
1031   // Executes Shutdown.shutdown()
1032   void invoke_shutdown_hooks();
1033 
1034   // Cleanup on thread exit
1035   enum ExitType {
1036     normal_exit,
1037     jni_detach
1038   };
1039   void exit(bool destroy_vm, ExitType exit_type = normal_exit);
1040 
1041   void cleanup_failed_attach_current_thread();
1042 
1043   // Testers
1044   virtual bool is_Java_thread() const            { return true;  }
1045   virtual bool can_call_java() const             { return true; }
1046 
1047   // Thread chain operations
1048   JavaThread* next() const                       { return _next; }
1049   void set_next(JavaThread* p)                   { _next = p; }
1050 
1051   // Thread oop. threadObj() can be NULL for initial JavaThread
1052   // (or for threads attached via JNI)
1053   oop threadObj() const                          { return _threadObj; }
1054   void set_threadObj(oop p)                      { _threadObj = p; }
1055 
1056   ThreadPriority java_priority() const;          // Read from threadObj()
1057 
1058   // Prepare thread and add to priority queue.  If a priority is
1059   // not specified, use the priority of the thread object. Threads_lock
1060   // must be held while this function is called.
1061   void prepare(jobject jni_thread, ThreadPriority prio=NoPriority);
1062   void prepare_ext();
1063 
1064   void set_saved_exception_pc(address pc)        { _saved_exception_pc = pc; }
1065   address saved_exception_pc()                   { return _saved_exception_pc; }


1284   intptr_t* must_deopt_id()                      { return _must_deopt_id; }
1285   void     set_must_deopt_id(intptr_t* id)       { _must_deopt_id = id; }
1286   void     clear_must_deopt_id()                 { _must_deopt_id = NULL; }
1287 
1288   void set_deopt_nmethod(nmethod* nm)            { _deopt_nmethod = nm;   }
1289   nmethod* deopt_nmethod()                       { return _deopt_nmethod; }
1290 
1291   Method*    callee_target() const               { return _callee_target; }
1292   void set_callee_target  (Method* x)          { _callee_target   = x; }
1293 
1294   // Oop results of vm runtime calls
1295   oop  vm_result() const                         { return _vm_result; }
1296   void set_vm_result  (oop x)                    { _vm_result   = x; }
1297 
1298   Metadata*    vm_result_2() const               { return _vm_result_2; }
1299   void set_vm_result_2  (Metadata* x)          { _vm_result_2   = x; }
1300 
1301   MemRegion deferred_card_mark() const           { return _deferred_card_mark; }
1302   void set_deferred_card_mark(MemRegion mr)      { _deferred_card_mark = mr;   }
1303 
1304 #if INCLUDE_JVMCI
1305   int  pending_deoptimization() const             { return _pending_deoptimization; }
1306   oop  pending_failed_speculation() const         { return _pending_failed_speculation; }
1307   bool has_pending_monitorenter() const           { return _pending_monitorenter; }
1308   void set_pending_monitorenter(bool b)           { _pending_monitorenter = b; }
1309   void set_pending_deoptimization(int reason)     { _pending_deoptimization = reason; }
1310   void set_pending_failed_speculation(oop failed_speculation) { _pending_failed_speculation = failed_speculation; }
1311   void set_pending_transfer_to_interpreter(bool b) { _pending_transfer_to_interpreter = b; }
1312   void set_jvmci_alternate_call_target(address a) { assert(_jvmci._alternate_call_target == NULL, "must be"); _jvmci._alternate_call_target = a; }
1313   void set_jvmci_implicit_exception_pc(address a) { assert(_jvmci._implicit_exception_pc == NULL, "must be"); _jvmci._implicit_exception_pc = a; }
1314 #endif // INCLUDE_JVMCI
1315 
1316   // Exception handling for compiled methods
1317   oop      exception_oop() const                 { return _exception_oop; }
1318   address  exception_pc() const                  { return _exception_pc; }
1319   address  exception_handler_pc() const          { return _exception_handler_pc; }
1320   bool     is_method_handle_return() const       { return _is_method_handle_return == 1; }
1321 
1322   void set_exception_oop(oop o)                  { (void)const_cast<oop&>(_exception_oop = o); }
1323   void set_exception_pc(address a)               { _exception_pc = a; }
1324   void set_exception_handler_pc(address a)       { _exception_handler_pc = a; }
1325   void set_is_method_handle_return(bool value)   { _is_method_handle_return = value ? 1 : 0; }
1326 
1327   void clear_exception_oop_and_pc() {
1328     set_exception_oop(NULL);
1329     set_exception_pc(NULL);
1330   }
1331 
1332   // Stack overflow support
1333   inline size_t stack_available(address cur_sp);
1334   address stack_yellow_zone_base() {
1335     return (address)(stack_base() -


1396 #ifndef PRODUCT
1397   static ByteSize jmp_ring_index_offset()        { return byte_offset_of(JavaThread, _jmp_ring_index); }
1398   static ByteSize jmp_ring_offset()              { return byte_offset_of(JavaThread, _jmp_ring); }
1399 #endif // PRODUCT
1400   static ByteSize jni_environment_offset()       { return byte_offset_of(JavaThread, _jni_environment); }
1401   static ByteSize last_Java_sp_offset() {
1402     return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_sp_offset();
1403   }
1404   static ByteSize last_Java_pc_offset() {
1405     return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_pc_offset();
1406   }
1407   static ByteSize frame_anchor_offset() {
1408     return byte_offset_of(JavaThread, _anchor);
1409   }
1410   static ByteSize callee_target_offset()         { return byte_offset_of(JavaThread, _callee_target); }
1411   static ByteSize vm_result_offset()             { return byte_offset_of(JavaThread, _vm_result); }
1412   static ByteSize vm_result_2_offset()           { return byte_offset_of(JavaThread, _vm_result_2); }
1413   static ByteSize thread_state_offset()          { return byte_offset_of(JavaThread, _thread_state); }
1414   static ByteSize saved_exception_pc_offset()    { return byte_offset_of(JavaThread, _saved_exception_pc); }
1415   static ByteSize osthread_offset()              { return byte_offset_of(JavaThread, _osthread); }
1416 #if INCLUDE_JVMCI
1417   static ByteSize pending_deoptimization_offset() { return byte_offset_of(JavaThread, _pending_deoptimization); }
1418   static ByteSize pending_monitorenter_offset()  { return byte_offset_of(JavaThread, _pending_monitorenter); }
1419   static ByteSize pending_failed_speculation_offset() { return byte_offset_of(JavaThread, _pending_failed_speculation); }
1420   static ByteSize jvmci_alternate_call_target_offset() { return byte_offset_of(JavaThread, _jvmci._alternate_call_target); }
1421   static ByteSize jvmci_implicit_exception_pc_offset() { return byte_offset_of(JavaThread, _jvmci._implicit_exception_pc); }
1422   static ByteSize jvmci_counters_offset()        { return byte_offset_of(JavaThread, _jvmci_counters); }
1423 #endif // INCLUDE_JVMCI
1424   static ByteSize exception_oop_offset()         { return byte_offset_of(JavaThread, _exception_oop); }
1425   static ByteSize exception_pc_offset()          { return byte_offset_of(JavaThread, _exception_pc); }
1426   static ByteSize exception_handler_pc_offset()  { return byte_offset_of(JavaThread, _exception_handler_pc); }
1427   static ByteSize stack_overflow_limit_offset()  { return byte_offset_of(JavaThread, _stack_overflow_limit); }
1428   static ByteSize is_method_handle_return_offset() { return byte_offset_of(JavaThread, _is_method_handle_return); }
1429   static ByteSize stack_guard_state_offset()     { return byte_offset_of(JavaThread, _stack_guard_state); }
1430   static ByteSize suspend_flags_offset()         { return byte_offset_of(JavaThread, _suspend_flags); }
1431 
1432   static ByteSize do_not_unlock_if_synchronized_offset() { return byte_offset_of(JavaThread, _do_not_unlock_if_synchronized); }
1433   static ByteSize should_post_on_exceptions_flag_offset() {
1434     return byte_offset_of(JavaThread, _should_post_on_exceptions_flag);
1435   }
1436 
1437 #if INCLUDE_ALL_GCS
1438   static ByteSize satb_mark_queue_offset()       { return byte_offset_of(JavaThread, _satb_mark_queue); }
1439   static ByteSize dirty_card_queue_offset()      { return byte_offset_of(JavaThread, _dirty_card_queue); }
1440 #endif // INCLUDE_ALL_GCS
1441 
1442   // Returns the jni environment for this thread
1443   JNIEnv* jni_environment()                      { return &_jni_environment; }


1873 class CompilerThread : public JavaThread {
1874   friend class VMStructs;
1875  private:
1876   CompilerCounters* _counters;
1877 
1878   ciEnv*            _env;
1879   CompileLog*       _log;
1880   CompileTask*      _task;
1881   CompileQueue*     _queue;
1882   BufferBlob*       _buffer_blob;
1883 
1884   AbstractCompiler* _compiler;
1885 
1886  public:
1887 
1888   static CompilerThread* current();
1889 
1890   CompilerThread(CompileQueue* queue, CompilerCounters* counters);
1891 
1892   bool is_Compiler_thread() const                { return true; }
1893 
1894   virtual bool can_call_java() const;
1895 
1896   // Hide native compiler threads from external view.
1897   bool is_hidden_from_external_view() const      { return !can_call_java(); }
1898 
1899   void set_compiler(AbstractCompiler* c)         { _compiler = c; }
1900   AbstractCompiler* compiler() const             { return _compiler; }
1901 
1902   CompileQueue* queue()        const             { return _queue; }
1903   CompilerCounters* counters() const             { return _counters; }
1904 
1905   // Get/set the thread's compilation environment.
1906   ciEnv*        env()                            { return _env; }
1907   void          set_env(ciEnv* env)              { _env = env; }
1908 
1909   BufferBlob*   get_buffer_blob() const          { return _buffer_blob; }
1910   void          set_buffer_blob(BufferBlob* b)   { _buffer_blob = b; }
1911 
1912   // Get/set the thread's logging information
1913   CompileLog*   log()                            { return _log; }
1914   void          init_log(CompileLog* log) {
1915     // Set once, for good.
1916     assert(_log == NULL, "set only once");
1917     _log = log;


< prev index next >