< prev index next >

src/hotspot/share/runtime/javaThread.hpp

Print this page

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


 473   // This is the field we poke in the interpreter and native
 474   // wrapper (Object.wait) to check for preemption.
 475   address _preempt_alternate_return;
 476   // When preempting on monitorenter we could have acquired the
 477   // monitor after freezing all vthread frames. In that case we
 478   // set this field so that in the preempt stub we call thaw again
 479   // instead of unmounting.
 480   bool _preemption_cancelled;
 481   // For Object.wait() we set this field to know if we need to
 482   // throw IE at the end of thawing before returning to Java.
 483   bool _pending_interrupted_exception;
 484   // We allow preemption on some klass initialization calls.
 485   // We use this boolean to mark such calls.
 486   bool _at_preemptable_init;
 487 
 488  public:
 489   bool preemption_cancelled()           { return _preemption_cancelled; }
 490   void set_preemption_cancelled(bool b) { _preemption_cancelled = b; }
 491 
 492   bool pending_interrupted_exception()           { return _pending_interrupted_exception; }

 565   struct JNINativeInterface_* get_jni_functions() {
 566     return (struct JNINativeInterface_ *)_jni_environment.functions;
 567   }
 568 
 569   // This function is called at thread creation to allow
 570   // platform specific thread variables to be initialized.
 571   void cache_global_variables();
 572 
 573   // Executes Shutdown.shutdown()
 574   void invoke_shutdown_hooks();
 575 
 576   // Cleanup on thread exit
 577   enum ExitType {
 578     normal_exit,
 579     jni_detach
 580   };
 581   void exit(bool destroy_vm, ExitType exit_type = normal_exit);
 582 
 583   void cleanup_failed_attach_current_thread(bool is_daemon);
 584 













 585   // Testers
 586   virtual bool is_Java_thread() const            { return true;  }
 587   virtual bool can_call_java() const             { return true; }
 588 
 589   virtual bool is_active_Java_thread() const;
 590 
 591   // Thread oop. threadObj() can be null for initial JavaThread
 592   // (or for threads attached via JNI)
 593   oop threadObj() const;
 594   void set_threadOopHandles(oop p);
 595   oop vthread() const;
 596   void set_vthread(oop p);
 597   oop scopedValueCache() const;
 598   void set_scopedValueCache(oop p);
 599   void clear_scopedValueBindings();
 600   oop jvmti_vthread() const;
 601   void set_jvmti_vthread(oop p);
 602   oop vthread_or_thread() const;
 603 
 604   // Prepare thread and add to priority queue.  If a priority is
 605   // not specified, use the priority of the thread object. Threads_lock
 606   // must be held while this function is called.
 607   void prepare(jobject jni_thread, ThreadPriority prio=NoPriority);

1232 #include OS_CPU_HEADER(javaThread)
1233 
1234   // JSR166 per-thread parker
1235  private:
1236   Parker _parker;
1237  public:
1238   Parker* parker() { return &_parker; }
1239 
1240  public:
1241   // clearing/querying jni attach status
1242   bool is_attaching_via_jni() const { return _jni_attach_state == _attaching_via_jni; }
1243   bool has_attached_via_jni() const { return is_attaching_via_jni() || _jni_attach_state == _attached_via_jni; }
1244   inline void set_done_attaching_via_jni();
1245 
1246   // Stack dump assistance:
1247   // Track the class we want to initialize but for which we have to wait
1248   // on its init_lock() because it is already being initialized.
1249   void set_class_to_be_initialized(InstanceKlass* k);
1250   InstanceKlass* class_to_be_initialized() const;
1251 
1252   // Track executing class initializer, see ThreadInClassInitializer
1253   void set_class_being_initialized(InstanceKlass* k);

1254   InstanceKlass* class_being_initialized() const;
1255 
1256 private:
1257   InstanceKlass* _class_to_be_initialized;
1258   InstanceKlass* _class_being_initialized;
1259 
1260   // java.lang.Thread.sleep support
1261   ParkEvent * _SleepEvent;
1262 
1263 #if INCLUDE_JFR
1264   // Support for jdk.VirtualThreadPinned event
1265   freeze_result _last_freeze_fail_result;
1266   Ticks _last_freeze_fail_time;
1267 #endif
1268 
1269 public:
1270   bool sleep(jlong millis);
1271   bool sleep_nanos(jlong nanos);
1272 
1273   // java.lang.Thread interruption support

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

 567   struct JNINativeInterface_* get_jni_functions() {
 568     return (struct JNINativeInterface_ *)_jni_environment.functions;
 569   }
 570 
 571   // This function is called at thread creation to allow
 572   // platform specific thread variables to be initialized.
 573   void cache_global_variables();
 574 
 575   // Executes Shutdown.shutdown()
 576   void invoke_shutdown_hooks();
 577 
 578   // Cleanup on thread exit
 579   enum ExitType {
 580     normal_exit,
 581     jni_detach
 582   };
 583   void exit(bool destroy_vm, ExitType exit_type = normal_exit);
 584 
 585   void cleanup_failed_attach_current_thread(bool is_daemon);
 586 
 587   class NoJavaCodeMark : public StackObj {
 588     friend JavaThread;
 589     JavaThread* _target;
 590     bool _orig;
 591    public:
 592     NoJavaCodeMark(JavaThread* t) : _target(t), _orig(t->_can_call_java) {
 593       _target->_can_call_java = false;
 594     }
 595     ~NoJavaCodeMark() {
 596       _target->_can_call_java = _orig;
 597     }
 598   };
 599 
 600   // Testers
 601   virtual bool is_Java_thread() const            { return true;  }
 602   virtual bool can_call_java() const             { return _can_call_java; }
 603 
 604   virtual bool is_active_Java_thread() const;
 605 
 606   // Thread oop. threadObj() can be null for initial JavaThread
 607   // (or for threads attached via JNI)
 608   oop threadObj() const;
 609   void set_threadOopHandles(oop p);
 610   oop vthread() const;
 611   void set_vthread(oop p);
 612   oop scopedValueCache() const;
 613   void set_scopedValueCache(oop p);
 614   void clear_scopedValueBindings();
 615   oop jvmti_vthread() const;
 616   void set_jvmti_vthread(oop p);
 617   oop vthread_or_thread() const;
 618 
 619   // Prepare thread and add to priority queue.  If a priority is
 620   // not specified, use the priority of the thread object. Threads_lock
 621   // must be held while this function is called.
 622   void prepare(jobject jni_thread, ThreadPriority prio=NoPriority);

1247 #include OS_CPU_HEADER(javaThread)
1248 
1249   // JSR166 per-thread parker
1250  private:
1251   Parker _parker;
1252  public:
1253   Parker* parker() { return &_parker; }
1254 
1255  public:
1256   // clearing/querying jni attach status
1257   bool is_attaching_via_jni() const { return _jni_attach_state == _attaching_via_jni; }
1258   bool has_attached_via_jni() const { return is_attaching_via_jni() || _jni_attach_state == _attached_via_jni; }
1259   inline void set_done_attaching_via_jni();
1260 
1261   // Stack dump assistance:
1262   // Track the class we want to initialize but for which we have to wait
1263   // on its init_lock() because it is already being initialized.
1264   void set_class_to_be_initialized(InstanceKlass* k);
1265   InstanceKlass* class_to_be_initialized() const;
1266 
1267   // The most recent active <clinit> invocation is tracked by this variable.
1268   // The setter returns the previous value, so it can be restored later if needed.
1269   InstanceKlass* set_class_being_initialized(InstanceKlass* k);
1270   InstanceKlass* class_being_initialized() const;
1271 
1272 private:
1273   InstanceKlass* _class_to_be_initialized;
1274   InstanceKlass* _class_being_initialized;
1275 
1276   // java.lang.Thread.sleep support
1277   ParkEvent * _SleepEvent;
1278 
1279 #if INCLUDE_JFR
1280   // Support for jdk.VirtualThreadPinned event
1281   freeze_result _last_freeze_fail_result;
1282   Ticks _last_freeze_fail_time;
1283 #endif
1284 
1285 public:
1286   bool sleep(jlong millis);
1287   bool sleep_nanos(jlong nanos);
1288 
1289   // java.lang.Thread interruption support
< prev index next >