292 friend class InstanceKlass; // verification code accesses offsets
293 friend class ClassFileParser; // access to number_of_fake_fields
294 };
295
296 // Interface to java.lang.Thread objects
297
298 class java_lang_Thread : AllStatic {
299 private:
300 // Note that for this class the layout changed between JDK1.2 and JDK1.3,
301 // so we compute the offsets at startup rather than hard-wiring them.
302 static int _name_offset;
303 static int _group_offset;
304 static int _contextClassLoader_offset;
305 static int _inheritedAccessControlContext_offset;
306 static int _priority_offset;
307 static int _eetop_offset;
308 static int _daemon_offset;
309 static int _stillborn_offset;
310 static int _stackSize_offset;
311 static int _tid_offset;
312 static int _thread_status_offset;
313 static int _park_blocker_offset;
314 static int _park_event_offset ;
315
316 static void compute_offsets();
317
318 public:
319 static void serialize(SerializeClosure* f) NOT_CDS_RETURN;
320
321 // Instance creation
322 static oop create();
323 // Returns the JavaThread associated with the thread obj
324 static JavaThread* thread(oop java_thread);
325 // Set JavaThread for instance
326 static void set_thread(oop java_thread, JavaThread* thread);
327 // Name
328 static oop name(oop java_thread);
329 static void set_name(oop java_thread, oop name);
330 // Priority
331 static ThreadPriority priority(oop java_thread);
332 static void set_priority(oop java_thread, ThreadPriority priority);
333 // Thread group
334 static oop threadGroup(oop java_thread);
335 // Stillborn
336 static bool is_stillborn(oop java_thread);
337 static void set_stillborn(oop java_thread);
338 // Alive (NOTE: this is not really a field, but provides the correct
339 // definition without doing a Java call)
340 static bool is_alive(oop java_thread);
341 // Daemon
342 static bool is_daemon(oop java_thread);
343 static void set_daemon(oop java_thread);
344 // Context ClassLoader
345 static oop context_class_loader(oop java_thread);
346 // Control context
347 static oop inherited_access_control_context(oop java_thread);
348 // Stack size hint
349 static jlong stackSize(oop java_thread);
350 // Thread ID
351 static jlong thread_id(oop java_thread);
352
353 // Blocker object responsible for thread parking
354 static oop park_blocker(oop java_thread);
355
356 // Pointer to type-stable park handler, encoded as jlong.
357 // Should be set when apparently null
358 // For details, see unsafe.cpp Unsafe_Unpark
359 static jlong park_event(oop java_thread);
360 static bool set_park_event(oop java_thread, jlong ptr);
361
362 // Java Thread Status for JVMTI and M&M use.
363 // This thread status info is saved in threadStatus field of
364 // java.lang.Thread java class.
365 enum ThreadStatus {
366 NEW = 0,
367 RUNNABLE = JVMTI_THREAD_STATE_ALIVE + // runnable / running
368 JVMTI_THREAD_STATE_RUNNABLE,
369 SLEEPING = JVMTI_THREAD_STATE_ALIVE + // Thread.sleep()
370 JVMTI_THREAD_STATE_WAITING +
371 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
929
930
931 // Interface to java.lang.ref.SoftReference objects
932
933 class java_lang_ref_SoftReference: public java_lang_ref_Reference {
934 public:
935 static int timestamp_offset;
936 static int static_clock_offset;
937
938 // Accessors
939 static jlong timestamp(oop ref);
940
941 // Accessors for statics
942 static jlong clock();
943 static void set_clock(jlong value);
944
945 static void compute_offsets();
946 static void serialize(SerializeClosure* f) NOT_CDS_RETURN;
947 };
948
949 // Interface to java.lang.invoke.MethodHandle objects
950
951 class MethodHandleEntry;
952
953 class java_lang_invoke_MethodHandle: AllStatic {
954 friend class JavaClasses;
955
956 private:
957 static int _type_offset; // the MethodType of this MH
958 static int _form_offset; // the LambdaForm of this MH
959
960 static void compute_offsets();
961
962 public:
963 static void serialize(SerializeClosure* f) NOT_CDS_RETURN;
964
965 // Accessors
966 static oop type(oop mh);
967 static void set_type(oop mh, oop mtype);
968
|
292 friend class InstanceKlass; // verification code accesses offsets
293 friend class ClassFileParser; // access to number_of_fake_fields
294 };
295
296 // Interface to java.lang.Thread objects
297
298 class java_lang_Thread : AllStatic {
299 private:
300 // Note that for this class the layout changed between JDK1.2 and JDK1.3,
301 // so we compute the offsets at startup rather than hard-wiring them.
302 static int _name_offset;
303 static int _group_offset;
304 static int _contextClassLoader_offset;
305 static int _inheritedAccessControlContext_offset;
306 static int _priority_offset;
307 static int _eetop_offset;
308 static int _daemon_offset;
309 static int _stillborn_offset;
310 static int _stackSize_offset;
311 static int _tid_offset;
312 static int _continuation_offset;
313 static int _thread_status_offset;
314 static int _park_blocker_offset;
315 static int _park_event_offset ;
316
317 static void compute_offsets();
318
319 public:
320 static void serialize(SerializeClosure* f) NOT_CDS_RETURN;
321
322 // Instance creation
323 static oop create();
324 // Returns the JavaThread associated with the thread obj
325 static JavaThread* thread(oop java_thread);
326 // Set JavaThread for instance
327 static void set_thread(oop java_thread, JavaThread* thread);
328 // Name
329 static oop name(oop java_thread);
330 static void set_name(oop java_thread, oop name);
331 // Priority
332 static ThreadPriority priority(oop java_thread);
333 static void set_priority(oop java_thread, ThreadPriority priority);
334 // Thread group
335 static oop threadGroup(oop java_thread);
336 // Stillborn
337 static bool is_stillborn(oop java_thread);
338 static void set_stillborn(oop java_thread);
339 // Alive (NOTE: this is not really a field, but provides the correct
340 // definition without doing a Java call)
341 static bool is_alive(oop java_thread);
342 // Daemon
343 static bool is_daemon(oop java_thread);
344 static void set_daemon(oop java_thread);
345 // Context ClassLoader
346 static oop context_class_loader(oop java_thread);
347 // Control context
348 static oop inherited_access_control_context(oop java_thread);
349 // Stack size hint
350 static jlong stackSize(oop java_thread);
351 // Thread ID
352 static jlong thread_id(oop java_thread);
353 // Continuation
354 static oop continuation(oop java_thread);
355 static void set_continuation(oop java_thread, oop continuation);
356
357 // Blocker object responsible for thread parking
358 static oop park_blocker(oop java_thread);
359
360 // Pointer to type-stable park handler, encoded as jlong.
361 // Should be set when apparently null
362 // For details, see unsafe.cpp Unsafe_Unpark
363 static jlong park_event(oop java_thread);
364 static bool set_park_event(oop java_thread, jlong ptr);
365
366 // Java Thread Status for JVMTI and M&M use.
367 // This thread status info is saved in threadStatus field of
368 // java.lang.Thread java class.
369 enum ThreadStatus {
370 NEW = 0,
371 RUNNABLE = JVMTI_THREAD_STATE_ALIVE + // runnable / running
372 JVMTI_THREAD_STATE_RUNNABLE,
373 SLEEPING = JVMTI_THREAD_STATE_ALIVE + // Thread.sleep()
374 JVMTI_THREAD_STATE_WAITING +
375 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
933
934
935 // Interface to java.lang.ref.SoftReference objects
936
937 class java_lang_ref_SoftReference: public java_lang_ref_Reference {
938 public:
939 static int timestamp_offset;
940 static int static_clock_offset;
941
942 // Accessors
943 static jlong timestamp(oop ref);
944
945 // Accessors for statics
946 static jlong clock();
947 static void set_clock(jlong value);
948
949 static void compute_offsets();
950 static void serialize(SerializeClosure* f) NOT_CDS_RETURN;
951 };
952
953 // Interface to java.lang.Continuation objects
954 class java_lang_Continuation: AllStatic {
955 friend class JavaClasses;
956 private:
957 static void compute_offsets();
958 public:
959 enum {
960 hc_fp_offset = 0,
961 hc_sp_offset = 11,
962 hc_entrySP_offset = 1,
963 hc_entryFP_offset = 3,
964 hc_target_offset = 13,
965 hc_parent_offset = 14,
966 hc_stack_offset = 15,
967 };
968 static int scope_offset;
969 static int target_offset;
970 static int parent_offset;
971 static int entrySP_offset;
972 static int entryFP_offset;
973 static int entryPC_offset;
974 static int stack_offset;
975 static int maxSize_offset;
976 static int numFrames_offset;
977 static int numInterpretedFrames_offset;
978 static int refStack_offset;
979 static int fp_offset;
980 static int sp_offset;
981 static int pc_offset;
982 static int refSP_offset;
983 static int flags_offset;
984 // Accessors
985 static inline oop scope(oop ref);
986 static inline oop target(oop ref);
987 static inline oop parent(oop ref);
988 static inline typeArrayOop stack(oop ref);
989 static inline objArrayOop refStack(oop ref);
990 static inline jlong fp(oop ref);
991 static inline void set_fp(oop ref, const jlong i);
992 static inline jint sp(oop ref);
993 static inline void set_sp(oop ref, const jint i);
994 static inline void* pc(oop ref);
995 static inline void set_pc(oop ref, const void* pc);
996 static inline jint refSP(oop ref);
997 static inline void set_refSP(oop ref, jint i);
998 static inline intptr_t* entrySP(oop ref);
999 static inline void set_entrySP(oop ref, intptr_t* sp);
1000 static inline intptr_t* entryFP(oop ref);
1001 static inline void set_entryFP(oop ref, intptr_t* fp);
1002 static inline address entryPC(oop ref);
1003 static inline void set_entryPC(oop ref, address pc);
1004 static inline jint maxSize(oop ref);
1005 static inline void set_maxSize(oop ref, jint i);
1006 static inline jshort numFrames(oop ref);
1007 static inline void set_numFrames(oop ref, jshort i);
1008 static inline jshort numInterpretedFrames(oop ref);
1009 static inline void set_numInterpretedFrames(oop ref, jshort i);
1010 static unsigned char flags(oop ref);
1011 static void set_flags(oop ref, unsigned char flags);
1012 static inline int stack_size(oop ref);
1013 static inline void* stack_base(oop ref);
1014 static inline HeapWord* refStack_base(oop ref);
1015 static bool on_local_stack(oop ref, address adr);
1016 };
1017
1018 // Interface to java.lang.invoke.MethodHandle objects
1019
1020 class MethodHandleEntry;
1021
1022 class java_lang_invoke_MethodHandle: AllStatic {
1023 friend class JavaClasses;
1024
1025 private:
1026 static int _type_offset; // the MethodType of this MH
1027 static int _form_offset; // the LambdaForm of this MH
1028
1029 static void compute_offsets();
1030
1031 public:
1032 static void serialize(SerializeClosure* f) NOT_CDS_RETURN;
1033
1034 // Accessors
1035 static oop type(oop mh);
1036 static void set_type(oop mh, oop mtype);
1037
|