hotspot Sdiff src/share/vm/runtime (original) (raw)


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);


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

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

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


976 } 977 978 // This function is called at thread creation to allow 979 // platform specific thread variables to be initialized. 980 void cache_global_variables(); 981 982 // Executes Shutdown.shutdown() 983 void invoke_shutdown_hooks(); 984 985 // Cleanup on thread exit 986 enum ExitType { 987 normal_exit, 988 jni_detach 989 }; 990 void exit(bool destroy_vm, ExitType exit_type = normal_exit); 991 992 void cleanup_failed_attach_current_thread(); 993 994 // Testers 995 virtual bool is_Java_thread() const { return true; }

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


1234 intptr_t* must_deopt_id() { return _must_deopt_id; } 1235 void set_must_deopt_id(intptr_t* id) { _must_deopt_id = id; } 1236 void clear_must_deopt_id() { _must_deopt_id = NULL; } 1237 1238 void set_deopt_nmethod(nmethod* nm) { _deopt_nmethod = nm; } 1239 nmethod* deopt_nmethod() { return _deopt_nmethod; } 1240 1241 Method* callee_target() const { return _callee_target; } 1242 void set_callee_target (Method* x) { _callee_target = x; } 1243 1244 // Oop results of vm runtime calls 1245 oop vm_result() const { return _vm_result; } 1246 void set_vm_result (oop x) { _vm_result = x; } 1247 1248 Metadata* vm_result_2() const { return _vm_result_2; } 1249 void set_vm_result_2 (Metadata* x) { _vm_result_2 = x; } 1250 1251 MemRegion deferred_card_mark() const { return _deferred_card_mark; } 1252 void set_deferred_card_mark(MemRegion mr) { _deferred_card_mark = mr; } 1253

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


1334 #ifndef PRODUCT 1335 static ByteSize jmp_ring_index_offset() { return byte_offset_of(JavaThread, _jmp_ring_index); } 1336 static ByteSize jmp_ring_offset() { return byte_offset_of(JavaThread, _jmp_ring); } 1337 #endif // PRODUCT 1338 static ByteSize jni_environment_offset() { return byte_offset_of(JavaThread, _jni_environment); } 1339 static ByteSize last_Java_sp_offset() { 1340 return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_sp_offset(); 1341 } 1342 static ByteSize last_Java_pc_offset() { 1343 return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_pc_offset(); 1344 } 1345 static ByteSize frame_anchor_offset() { 1346 return byte_offset_of(JavaThread, _anchor); 1347 } 1348 static ByteSize callee_target_offset() { return byte_offset_of(JavaThread, _callee_target); } 1349 static ByteSize vm_result_offset() { return byte_offset_of(JavaThread, _vm_result); } 1350 static ByteSize vm_result_2_offset() { return byte_offset_of(JavaThread, _vm_result_2); } 1351 static ByteSize thread_state_offset() { return byte_offset_of(JavaThread, _thread_state); } 1352 static ByteSize saved_exception_pc_offset() { return byte_offset_of(JavaThread, _saved_exception_pc); } 1353 static ByteSize osthread_offset() { return byte_offset_of(JavaThread, _osthread); }

1354 static ByteSize exception_oop_offset() { return byte_offset_of(JavaThread, _exception_oop); } 1355 static ByteSize exception_pc_offset() { return byte_offset_of(JavaThread, _exception_pc); } 1356 static ByteSize exception_handler_pc_offset() { return byte_offset_of(JavaThread, _exception_handler_pc); } 1357 static ByteSize stack_overflow_limit_offset() { return byte_offset_of(JavaThread, _stack_overflow_limit); } 1358 static ByteSize is_method_handle_return_offset() { return byte_offset_of(JavaThread, _is_method_handle_return); } 1359 static ByteSize stack_guard_state_offset() { return byte_offset_of(JavaThread, _stack_guard_state); } 1360 static ByteSize suspend_flags_offset() { return byte_offset_of(JavaThread, _suspend_flags); } 1361 1362 static ByteSize do_not_unlock_if_synchronized_offset() { return byte_offset_of(JavaThread, _do_not_unlock_if_synchronized); } 1363 static ByteSize should_post_on_exceptions_flag_offset() { 1364 return byte_offset_of(JavaThread, _should_post_on_exceptions_flag); 1365 } 1366 1367 #if INCLUDE_ALL_GCS 1368 static ByteSize satb_mark_queue_offset() { return byte_offset_of(JavaThread, _satb_mark_queue); } 1369 static ByteSize dirty_card_queue_offset() { return byte_offset_of(JavaThread, _dirty_card_queue); } 1370 #endif // INCLUDE_ALL_GCS 1371 1372 // Returns the jni environment for this thread 1373 JNIEnv* jni_environment() { return &_jni_environment; }


1803 class CompilerThread : public JavaThread { 1804 friend class VMStructs; 1805 private: 1806 CompilerCounters* _counters; 1807 1808 ciEnv* _env; 1809 CompileLog* _log; 1810 CompileTask* _task; 1811 CompileQueue* _queue; 1812 BufferBlob* _buffer_blob; 1813 1814 AbstractCompiler* _compiler; 1815 1816 public: 1817 1818 static CompilerThread* current(); 1819 1820 CompilerThread(CompileQueue* queue, CompilerCounters* counters); 1821 1822 bool is_Compiler_thread() const { return true; } 1823 // Hide this compiler thread from external view. 1824 bool is_hidden_from_external_view() const { return true; }

1825 1826 void set_compiler(AbstractCompiler* c) { _compiler = c; } 1827 AbstractCompiler* compiler() const { return _compiler; } 1828 1829 CompileQueue* queue() const { return _queue; } 1830 CompilerCounters* counters() const { return _counters; } 1831 1832 // Get/set the thread's compilation environment. 1833 ciEnv* env() { return _env; } 1834 void set_env(ciEnv* env) { _env = env; } 1835 1836 BufferBlob* get_buffer_blob() const { return _buffer_blob; } 1837 void set_buffer_blob(BufferBlob* b) { _buffer_blob = b; } 1838 1839 // Get/set the thread's logging information 1840 CompileLog* log() { return _log; } 1841 void init_log(CompileLog* log) { 1842 // Set once, for good. 1843 assert(_log == NULL, "set only once"); 1844 _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);


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


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


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


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


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