< prev index next >

src/hotspot/share/runtime/javaThread.hpp

Print this page

 465   // JVMTI PopFrame support
 466   // This is set to popframe_pending to signal that top Java frame should be popped immediately
 467   int _popframe_condition;
 468 
 469   // If reallocation of scalar replaced objects fails, we throw OOM
 470   // and during exception propagation, pop the top
 471   // _frames_to_pop_failed_realloc frames, the ones that reference
 472   // failed reallocations.
 473   int _frames_to_pop_failed_realloc;
 474 
 475   ContinuationEntry* _cont_entry;
 476   intptr_t* _cont_fastpath; // the sp of the oldest known interpreted/call_stub/upcall_stub/native_wrapper
 477                             // frame inside the continuation that we know about
 478   int _cont_fastpath_thread_state; // whether global thread state allows continuation fastpath (JVMTI)
 479 
 480   // It's signed for error detection.
 481   intx _held_monitor_count;  // used by continuations for fast lock detection
 482   intx _jni_monitor_count;
 483   ObjectMonitor* _unlocked_inflated_monitor;
 484 


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

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













 559   // Testers
 560   virtual bool is_Java_thread() const            { return true;  }
 561   virtual bool can_call_java() const             { return true; }
 562 
 563   virtual bool is_active_Java_thread() const;
 564 
 565   // Thread oop. threadObj() can be null for initial JavaThread
 566   // (or for threads attached via JNI)
 567   oop threadObj() const;
 568   void set_threadOopHandles(oop p);
 569   oop vthread() const;
 570   void set_vthread(oop p);
 571   oop scopedValueCache() const;
 572   void set_scopedValueCache(oop p);
 573   void clear_scopedValueBindings();
 574   oop jvmti_vthread() const;
 575   void set_jvmti_vthread(oop p);
 576   oop vthread_or_thread() const;
 577 
 578   // Prepare thread and add to priority queue.  If a priority is
 579   // not specified, use the priority of the thread object. Threads_lock
 580   // must be held while this function is called.
 581   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   // Track executing class initializer, see ThreadInClassInitializer
1228   void set_class_being_initialized(InstanceKlass* k);

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

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

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

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