< prev index next >

src/hotspot/share/runtime/javaThread.hpp

Print this page

 467   // JVMTI PopFrame support
 468   // This is set to popframe_pending to signal that top Java frame should be popped immediately
 469   int _popframe_condition;
 470 
 471   // If reallocation of scalar replaced objects fails, we throw OOM
 472   // and during exception propagation, pop the top
 473   // _frames_to_pop_failed_realloc frames, the ones that reference
 474   // failed reallocations.
 475   int _frames_to_pop_failed_realloc;
 476 
 477   ContinuationEntry* _cont_entry;
 478   intptr_t* _cont_fastpath; // the sp of the oldest known interpreted/call_stub/upcall_stub/native_wrapper
 479                             // frame inside the continuation that we know about
 480   int _cont_fastpath_thread_state; // whether global thread state allows continuation fastpath (JVMTI)
 481 
 482   // It's signed for error detection.
 483   intx _held_monitor_count;  // used by continuations for fast lock detection
 484   intx _jni_monitor_count;
 485   ObjectMonitor* _unlocked_inflated_monitor;
 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   // Testers
 562   virtual bool is_Java_thread() const            { return true;  }
 563   virtual bool can_call_java() const             { return true; }
 564 
 565   virtual bool is_active_Java_thread() const;
 566 
 567   // Thread oop. threadObj() can be null for initial JavaThread
 568   // (or for threads attached via JNI)
 569   oop threadObj() const;
 570   void set_threadOopHandles(oop p);
 571   oop vthread() const;
 572   void set_vthread(oop p);
 573   oop scopedValueCache() const;
 574   void set_scopedValueCache(oop p);
 575   void clear_scopedValueBindings();
 576   oop jvmti_vthread() const;
 577   void set_jvmti_vthread(oop p);
 578   oop vthread_or_thread() const;
 579 
 580   // Prepare thread and add to priority queue.  If a priority is
 581   // not specified, use the priority of the thread object. Threads_lock
 582   // must be held while this function is called.
 583   void prepare(jobject jni_thread, ThreadPriority prio=NoPriority);

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

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

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

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

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