< prev index next >

src/hotspot/share/classfile/javaClasses.hpp

Print this page




 354 };
 355 
 356 // Interface to java.lang.Thread objects
 357 
 358 class java_lang_Thread : AllStatic {
 359  private:
 360   // Note that for this class the layout changed between JDK1.2 and JDK1.3,
 361   // so we compute the offsets at startup rather than hard-wiring them.
 362   static int _name_offset;
 363   static int _group_offset;
 364   static int _contextClassLoader_offset;
 365   static int _inheritedAccessControlContext_offset;
 366   static int _priority_offset;
 367   static int _eetop_offset;
 368   static int _daemon_offset;
 369   static int _stillborn_offset;
 370   static int _stackSize_offset;
 371   static int _tid_offset;
 372   static int _thread_status_offset;
 373   static int _park_blocker_offset;
 374   static int _park_event_offset ;
 375 
 376   static void compute_offsets();
 377 
 378  public:
 379   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 380 
 381   // Instance creation
 382   static oop create();
 383   // Returns the JavaThread associated with the thread obj
 384   static JavaThread* thread(oop java_thread);
 385   // Set JavaThread for instance
 386   static void set_thread(oop java_thread, JavaThread* thread);
 387   // Name
 388   static oop name(oop java_thread);
 389   static void set_name(oop java_thread, oop name);
 390   // Priority
 391   static ThreadPriority priority(oop java_thread);
 392   static void set_priority(oop java_thread, ThreadPriority priority);
 393   // Thread group
 394   static oop  threadGroup(oop java_thread);
 395   // Stillborn
 396   static bool is_stillborn(oop java_thread);
 397   static void set_stillborn(oop java_thread);
 398   // Alive (NOTE: this is not really a field, but provides the correct
 399   // definition without doing a Java call)
 400   static bool is_alive(oop java_thread);
 401   // Daemon
 402   static bool is_daemon(oop java_thread);
 403   static void set_daemon(oop java_thread);
 404   // Context ClassLoader
 405   static oop context_class_loader(oop java_thread);
 406   // Control context
 407   static oop inherited_access_control_context(oop java_thread);
 408   // Stack size hint
 409   static jlong stackSize(oop java_thread);
 410   // Thread ID
 411   static jlong thread_id(oop java_thread);
 412 
 413   // Blocker object responsible for thread parking
 414   static oop park_blocker(oop java_thread);
 415 
 416   // Pointer to type-stable park handler, encoded as jlong.
 417   // Should be set when apparently null
 418   // For details, see unsafe.cpp Unsafe_Unpark
 419   static jlong park_event(oop java_thread);
 420   static bool set_park_event(oop java_thread, jlong ptr);
 421 
 422   // Java Thread Status for JVMTI and M&M use.
 423   // This thread status info is saved in threadStatus field of
 424   // java.lang.Thread java class.
 425   enum ThreadStatus {
 426     NEW                      = 0,
 427     RUNNABLE                 = JVMTI_THREAD_STATE_ALIVE +          // runnable / running
 428                                JVMTI_THREAD_STATE_RUNNABLE,
 429     SLEEPING                 = JVMTI_THREAD_STATE_ALIVE +          // Thread.sleep()
 430                                JVMTI_THREAD_STATE_WAITING +
 431                                JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
 432                                JVMTI_THREAD_STATE_SLEEPING,
 433     IN_OBJECT_WAIT           = JVMTI_THREAD_STATE_ALIVE +          // Object.wait()
 434                                JVMTI_THREAD_STATE_WAITING +
 435                                JVMTI_THREAD_STATE_WAITING_INDEFINITELY +
 436                                JVMTI_THREAD_STATE_IN_OBJECT_WAIT,
 437     IN_OBJECT_WAIT_TIMED     = JVMTI_THREAD_STATE_ALIVE +          // Object.wait(long)
 438                                JVMTI_THREAD_STATE_WAITING +
 439                                JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
 440                                JVMTI_THREAD_STATE_IN_OBJECT_WAIT,




 354 };
 355 
 356 // Interface to java.lang.Thread objects
 357 
 358 class java_lang_Thread : AllStatic {
 359  private:
 360   // Note that for this class the layout changed between JDK1.2 and JDK1.3,
 361   // so we compute the offsets at startup rather than hard-wiring them.
 362   static int _name_offset;
 363   static int _group_offset;
 364   static int _contextClassLoader_offset;
 365   static int _inheritedAccessControlContext_offset;
 366   static int _priority_offset;
 367   static int _eetop_offset;
 368   static int _daemon_offset;
 369   static int _stillborn_offset;
 370   static int _stackSize_offset;
 371   static int _tid_offset;
 372   static int _thread_status_offset;
 373   static int _park_blocker_offset;

 374 
 375   static void compute_offsets();
 376 
 377  public:
 378   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 379 
 380   // Instance creation
 381   static oop create();
 382   // Returns the JavaThread associated with the thread obj
 383   static JavaThread* thread(oop java_thread);
 384   // Set JavaThread for instance
 385   static void set_thread(oop java_thread, JavaThread* thread);
 386   // Name
 387   static oop name(oop java_thread);
 388   static void set_name(oop java_thread, oop name);
 389   // Priority
 390   static ThreadPriority priority(oop java_thread);
 391   static void set_priority(oop java_thread, ThreadPriority priority);
 392   // Thread group
 393   static oop  threadGroup(oop java_thread);
 394   // Stillborn
 395   static bool is_stillborn(oop java_thread);
 396   static void set_stillborn(oop java_thread);
 397   // Alive (NOTE: this is not really a field, but provides the correct
 398   // definition without doing a Java call)
 399   static bool is_alive(oop java_thread);
 400   // Daemon
 401   static bool is_daemon(oop java_thread);
 402   static void set_daemon(oop java_thread);
 403   // Context ClassLoader
 404   static oop context_class_loader(oop java_thread);
 405   // Control context
 406   static oop inherited_access_control_context(oop java_thread);
 407   // Stack size hint
 408   static jlong stackSize(oop java_thread);
 409   // Thread ID
 410   static jlong thread_id(oop java_thread);
 411 
 412   // Blocker object responsible for thread parking
 413   static oop park_blocker(oop java_thread);






 414 
 415   // Java Thread Status for JVMTI and M&M use.
 416   // This thread status info is saved in threadStatus field of
 417   // java.lang.Thread java class.
 418   enum ThreadStatus {
 419     NEW                      = 0,
 420     RUNNABLE                 = JVMTI_THREAD_STATE_ALIVE +          // runnable / running
 421                                JVMTI_THREAD_STATE_RUNNABLE,
 422     SLEEPING                 = JVMTI_THREAD_STATE_ALIVE +          // Thread.sleep()
 423                                JVMTI_THREAD_STATE_WAITING +
 424                                JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
 425                                JVMTI_THREAD_STATE_SLEEPING,
 426     IN_OBJECT_WAIT           = JVMTI_THREAD_STATE_ALIVE +          // Object.wait()
 427                                JVMTI_THREAD_STATE_WAITING +
 428                                JVMTI_THREAD_STATE_WAITING_INDEFINITELY +
 429                                JVMTI_THREAD_STATE_IN_OBJECT_WAIT,
 430     IN_OBJECT_WAIT_TIMED     = JVMTI_THREAD_STATE_ALIVE +          // Object.wait(long)
 431                                JVMTI_THREAD_STATE_WAITING +
 432                                JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
 433                                JVMTI_THREAD_STATE_IN_OBJECT_WAIT,


< prev index next >