< prev index next >

src/hotspot/share/runtime/javaThread.hpp

Print this page

 461   // For deadlock detection.
 462   int _depth_first_number;
 463 
 464   // JVMTI PopFrame support
 465   // This is set to popframe_pending to signal that top Java frame should be popped immediately
 466   int _popframe_condition;
 467 
 468   // If reallocation of scalar replaced objects fails, we throw OOM
 469   // and during exception propagation, pop the top
 470   // _frames_to_pop_failed_realloc frames, the ones that reference
 471   // failed reallocations.
 472   int _frames_to_pop_failed_realloc;
 473 
 474   ContinuationEntry* _cont_entry;
 475   intptr_t* _cont_fastpath; // the sp of the oldest known interpreted/call_stub/upcall_stub/native_wrapper
 476                             // frame inside the continuation that we know about
 477   int _cont_fastpath_thread_state; // whether global thread state allows continuation fastpath (JVMTI)
 478 
 479   ObjectMonitor* _unlocked_inflated_monitor;
 480 


 481   // This is the field we poke in the interpreter and native
 482   // wrapper (Object.wait) to check for preemption.
 483   address _preempt_alternate_return;
 484   // When preempting on monitorenter we could have acquired the
 485   // monitor after freezing all vthread frames. In that case we
 486   // set this field so that in the preempt stub we call thaw again
 487   // instead of unmounting.
 488   bool _preemption_cancelled;
 489   // For Object.wait() we set this field to know if we need to
 490   // throw IE at the end of thawing before returning to Java.
 491   bool _pending_interrupted_exception;
 492 
 493  public:
 494   bool preemption_cancelled()           { return _preemption_cancelled; }
 495   void set_preemption_cancelled(bool b) { _preemption_cancelled = b; }
 496 
 497   bool pending_interrupted_exception()           { return _pending_interrupted_exception; }
 498   void set_pending_interrupted_exception(bool b) { _pending_interrupted_exception = b; }
 499 
 500   bool preempting()           { return _preempt_alternate_return != nullptr; }

 535   struct JNINativeInterface_* get_jni_functions() {
 536     return (struct JNINativeInterface_ *)_jni_environment.functions;
 537   }
 538 
 539   // This function is called at thread creation to allow
 540   // platform specific thread variables to be initialized.
 541   void cache_global_variables();
 542 
 543   // Executes Shutdown.shutdown()
 544   void invoke_shutdown_hooks();
 545 
 546   // Cleanup on thread exit
 547   enum ExitType {
 548     normal_exit,
 549     jni_detach
 550   };
 551   void exit(bool destroy_vm, ExitType exit_type = normal_exit);
 552 
 553   void cleanup_failed_attach_current_thread(bool is_daemon);
 554 













 555   // Testers
 556   virtual bool is_Java_thread() const            { return true;  }
 557   virtual bool can_call_java() const             { return true; }
 558 
 559   virtual bool is_active_Java_thread() const;
 560 
 561   // Thread oop. threadObj() can be null for initial JavaThread
 562   // (or for threads attached via JNI)
 563   oop threadObj() const;
 564   void set_threadOopHandles(oop p);
 565   oop vthread() const;
 566   void set_vthread(oop p);
 567   oop scopedValueCache() const;
 568   void set_scopedValueCache(oop p);
 569   void clear_scopedValueBindings();
 570   oop jvmti_vthread() const;
 571   void set_jvmti_vthread(oop p);
 572   oop vthread_or_thread() const;
 573 
 574   // Prepare thread and add to priority queue.  If a priority is
 575   // not specified, use the priority of the thread object. Threads_lock
 576   // must be held while this function is called.
 577   void prepare(jobject jni_thread, ThreadPriority prio=NoPriority);

1192 #include OS_CPU_HEADER(javaThread)
1193 
1194   // JSR166 per-thread parker
1195  private:
1196   Parker _parker;
1197  public:
1198   Parker* parker() { return &_parker; }
1199 
1200  public:
1201   // clearing/querying jni attach status
1202   bool is_attaching_via_jni() const { return _jni_attach_state == _attaching_via_jni; }
1203   bool has_attached_via_jni() const { return is_attaching_via_jni() || _jni_attach_state == _attached_via_jni; }
1204   inline void set_done_attaching_via_jni();
1205 
1206   // Stack dump assistance:
1207   // Track the class we want to initialize but for which we have to wait
1208   // on its init_lock() because it is already being initialized.
1209   void set_class_to_be_initialized(InstanceKlass* k);
1210   InstanceKlass* class_to_be_initialized() const;
1211 
1212   // Track executing class initializer, see ThreadInClassInitializer
1213   void set_class_being_initialized(InstanceKlass* k);

1214   InstanceKlass* class_being_initialized() const;
1215 
1216 private:
1217   InstanceKlass* _class_to_be_initialized;
1218   InstanceKlass* _class_being_initialized;
1219 
1220   // java.lang.Thread.sleep support
1221   ParkEvent * _SleepEvent;
1222 
1223 #if INCLUDE_JFR
1224   // Support for jdk.VirtualThreadPinned event
1225   freeze_result _last_freeze_fail_result;
1226   Ticks _last_freeze_fail_time;
1227 #endif
1228 
1229 public:
1230   bool sleep(jlong millis);
1231   bool sleep_nanos(jlong nanos);
1232 
1233   // java.lang.Thread interruption support

 461   // For deadlock detection.
 462   int _depth_first_number;
 463 
 464   // JVMTI PopFrame support
 465   // This is set to popframe_pending to signal that top Java frame should be popped immediately
 466   int _popframe_condition;
 467 
 468   // If reallocation of scalar replaced objects fails, we throw OOM
 469   // and during exception propagation, pop the top
 470   // _frames_to_pop_failed_realloc frames, the ones that reference
 471   // failed reallocations.
 472   int _frames_to_pop_failed_realloc;
 473 
 474   ContinuationEntry* _cont_entry;
 475   intptr_t* _cont_fastpath; // the sp of the oldest known interpreted/call_stub/upcall_stub/native_wrapper
 476                             // frame inside the continuation that we know about
 477   int _cont_fastpath_thread_state; // whether global thread state allows continuation fastpath (JVMTI)
 478 
 479   ObjectMonitor* _unlocked_inflated_monitor;
 480 
 481   bool _can_call_java;
 482 
 483   // This is the field we poke in the interpreter and native
 484   // wrapper (Object.wait) to check for preemption.
 485   address _preempt_alternate_return;
 486   // When preempting on monitorenter we could have acquired the
 487   // monitor after freezing all vthread frames. In that case we
 488   // set this field so that in the preempt stub we call thaw again
 489   // instead of unmounting.
 490   bool _preemption_cancelled;
 491   // For Object.wait() we set this field to know if we need to
 492   // throw IE at the end of thawing before returning to Java.
 493   bool _pending_interrupted_exception;
 494 
 495  public:
 496   bool preemption_cancelled()           { return _preemption_cancelled; }
 497   void set_preemption_cancelled(bool b) { _preemption_cancelled = b; }
 498 
 499   bool pending_interrupted_exception()           { return _pending_interrupted_exception; }
 500   void set_pending_interrupted_exception(bool b) { _pending_interrupted_exception = b; }
 501 
 502   bool preempting()           { return _preempt_alternate_return != nullptr; }

 537   struct JNINativeInterface_* get_jni_functions() {
 538     return (struct JNINativeInterface_ *)_jni_environment.functions;
 539   }
 540 
 541   // This function is called at thread creation to allow
 542   // platform specific thread variables to be initialized.
 543   void cache_global_variables();
 544 
 545   // Executes Shutdown.shutdown()
 546   void invoke_shutdown_hooks();
 547 
 548   // Cleanup on thread exit
 549   enum ExitType {
 550     normal_exit,
 551     jni_detach
 552   };
 553   void exit(bool destroy_vm, ExitType exit_type = normal_exit);
 554 
 555   void cleanup_failed_attach_current_thread(bool is_daemon);
 556 
 557   class NoJavaCodeMark : public StackObj {
 558     friend JavaThread;
 559     JavaThread* _target;
 560     bool _orig;
 561    public:
 562     NoJavaCodeMark(JavaThread* t) : _target(t), _orig(t->_can_call_java) {
 563       _target->_can_call_java = false;
 564     }
 565     ~NoJavaCodeMark() {
 566       _target->_can_call_java = _orig;
 567     }
 568   };
 569 
 570   // Testers
 571   virtual bool is_Java_thread() const            { return true;  }
 572   virtual bool can_call_java() const             { return _can_call_java; }
 573 
 574   virtual bool is_active_Java_thread() const;
 575 
 576   // Thread oop. threadObj() can be null for initial JavaThread
 577   // (or for threads attached via JNI)
 578   oop threadObj() const;
 579   void set_threadOopHandles(oop p);
 580   oop vthread() const;
 581   void set_vthread(oop p);
 582   oop scopedValueCache() const;
 583   void set_scopedValueCache(oop p);
 584   void clear_scopedValueBindings();
 585   oop jvmti_vthread() const;
 586   void set_jvmti_vthread(oop p);
 587   oop vthread_or_thread() const;
 588 
 589   // Prepare thread and add to priority queue.  If a priority is
 590   // not specified, use the priority of the thread object. Threads_lock
 591   // must be held while this function is called.
 592   void prepare(jobject jni_thread, ThreadPriority prio=NoPriority);

1207 #include OS_CPU_HEADER(javaThread)
1208 
1209   // JSR166 per-thread parker
1210  private:
1211   Parker _parker;
1212  public:
1213   Parker* parker() { return &_parker; }
1214 
1215  public:
1216   // clearing/querying jni attach status
1217   bool is_attaching_via_jni() const { return _jni_attach_state == _attaching_via_jni; }
1218   bool has_attached_via_jni() const { return is_attaching_via_jni() || _jni_attach_state == _attached_via_jni; }
1219   inline void set_done_attaching_via_jni();
1220 
1221   // Stack dump assistance:
1222   // Track the class we want to initialize but for which we have to wait
1223   // on its init_lock() because it is already being initialized.
1224   void set_class_to_be_initialized(InstanceKlass* k);
1225   InstanceKlass* class_to_be_initialized() const;
1226 
1227   // The most recent active <clinit> invocation is tracked by this variable.
1228   // The setter returns the previous value, so it can be restored later if needed.
1229   InstanceKlass* set_class_being_initialized(InstanceKlass* k);
1230   InstanceKlass* class_being_initialized() const;
1231 
1232 private:
1233   InstanceKlass* _class_to_be_initialized;
1234   InstanceKlass* _class_being_initialized;
1235 
1236   // java.lang.Thread.sleep support
1237   ParkEvent * _SleepEvent;
1238 
1239 #if INCLUDE_JFR
1240   // Support for jdk.VirtualThreadPinned event
1241   freeze_result _last_freeze_fail_result;
1242   Ticks _last_freeze_fail_time;
1243 #endif
1244 
1245 public:
1246   bool sleep(jlong millis);
1247   bool sleep_nanos(jlong nanos);
1248 
1249   // java.lang.Thread interruption support
< prev index next >