< prev index next >

src/hotspot/share/runtime/javaThread.hpp

Print this page

 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   // It's signed for error detection.
 480   intx _held_monitor_count;  // used by continuations for fast lock detection
 481   intx _jni_monitor_count;
 482   ObjectMonitor* _unlocked_inflated_monitor;
 483 


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

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













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

1205 #include OS_CPU_HEADER(javaThread)
1206 
1207   // JSR166 per-thread parker
1208  private:
1209   Parker _parker;
1210  public:
1211   Parker* parker() { return &_parker; }
1212 
1213  public:
1214   // clearing/querying jni attach status
1215   bool is_attaching_via_jni() const { return _jni_attach_state == _attaching_via_jni; }
1216   bool has_attached_via_jni() const { return is_attaching_via_jni() || _jni_attach_state == _attached_via_jni; }
1217   inline void set_done_attaching_via_jni();
1218 
1219   // Stack dump assistance:
1220   // Track the class we want to initialize but for which we have to wait
1221   // on its init_lock() because it is already being initialized.
1222   void set_class_to_be_initialized(InstanceKlass* k);
1223   InstanceKlass* class_to_be_initialized() const;
1224 
1225   // Track executing class initializer, see ThreadInClassInitializer
1226   void set_class_being_initialized(InstanceKlass* k);

1227   InstanceKlass* class_being_initialized() const;
1228 
1229 private:
1230   InstanceKlass* _class_to_be_initialized;
1231   InstanceKlass* _class_being_initialized;
1232 
1233   // java.lang.Thread.sleep support
1234   ParkEvent * _SleepEvent;
1235 
1236 #if INCLUDE_JFR
1237   // Support for jdk.VirtualThreadPinned event
1238   freeze_result _last_freeze_fail_result;
1239   Ticks _last_freeze_fail_time;
1240 #endif
1241 
1242 public:
1243   bool sleep(jlong millis);
1244   bool sleep_nanos(jlong nanos);
1245 
1246   // java.lang.Thread interruption support

 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   // It's signed for error detection.
 480   intx _held_monitor_count;  // used by continuations for fast lock detection
 481   intx _jni_monitor_count;
 482   ObjectMonitor* _unlocked_inflated_monitor;
 483 
 484   bool _can_call_java;
 485 
 486   // This is the field we poke in the interpreter and native
 487   // wrapper (Object.wait) to check for preemption.
 488   address _preempt_alternate_return;
 489   // When preempting on monitorenter we could have acquired the
 490   // monitor after freezing all vthread frames. In that case we
 491   // set this field so that in the preempt stub we call thaw again
 492   // instead of unmounting.
 493   bool _preemption_cancelled;
 494   // For Object.wait() we set this field to know if we need to
 495   // throw IE at the end of thawing before returning to Java.
 496   bool _pending_interrupted_exception;
 497 
 498  public:
 499   bool preemption_cancelled()           { return _preemption_cancelled; }
 500   void set_preemption_cancelled(bool b) { _preemption_cancelled = b; }
 501 
 502   bool pending_interrupted_exception()           { return _pending_interrupted_exception; }
 503   void set_pending_interrupted_exception(bool b) { _pending_interrupted_exception = b; }
 504 
 505   bool preempting()           { return _preempt_alternate_return != nullptr; }

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

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