< prev index next >

src/hotspot/share/classfile/javaClasses.hpp

Print this page




  40 // startup since the layout here differs between JDK1.2 and JDK1.3.
  41 //
  42 // Note that fields (static and non-static) are arranged with oops before non-oops
  43 // on a per class basis. The offsets below have to reflect this ordering.
  44 //
  45 // When editing the layouts please update the check_offset verification code
  46 // correspondingly. The names in the enums must be identical to the actual field
  47 // names in order for the verification code to work.
  48 
  49 #define BASIC_JAVA_CLASSES_DO_PART1(f) \
  50   f(java_lang_Class) \
  51   f(java_lang_String) \
  52   //end
  53 
  54 #define BASIC_JAVA_CLASSES_DO_PART2(f) \
  55   f(java_lang_System) \
  56   f(java_lang_ClassLoader) \
  57   f(java_lang_Throwable) \
  58   f(java_lang_Thread) \
  59   f(java_lang_ThreadGroup) \

  60   f(java_lang_AssertionStatusDirectives) \
  61   f(java_lang_ref_SoftReference) \
  62   f(java_lang_invoke_MethodHandle) \
  63   f(java_lang_invoke_DirectMethodHandle) \
  64   f(java_lang_invoke_MemberName) \
  65   f(java_lang_invoke_ResolvedMethodName) \
  66   f(java_lang_invoke_LambdaForm) \
  67   f(java_lang_invoke_MethodType) \
  68   f(java_lang_invoke_CallSite) \
  69   f(java_lang_invoke_MethodHandleNatives_CallSiteContext) \
  70   f(java_security_AccessControlContext) \
  71   f(java_lang_reflect_AccessibleObject) \
  72   f(java_lang_reflect_Method) \
  73   f(java_lang_reflect_Constructor) \
  74   f(java_lang_reflect_Field) \
  75   f(java_nio_Buffer) \
  76   f(reflect_ConstantPool) \
  77   f(reflect_UnsafeStaticFieldAccessorImpl) \
  78   f(java_lang_reflect_Parameter) \
  79   f(java_lang_Module) \
  80   f(java_lang_StackTraceElement) \
  81   f(java_lang_StackFrameInfo) \
  82   f(java_lang_LiveStackFrameInfo) \


  83   f(java_util_concurrent_locks_AbstractOwnableSynchronizer) \
  84   f(jdk_internal_misc_UnsafeConstants) \
  85   //end
  86 
  87 #define BASIC_JAVA_CLASSES_DO(f) \
  88         BASIC_JAVA_CLASSES_DO_PART1(f) \
  89         BASIC_JAVA_CLASSES_DO_PART2(f)
  90 
  91 // Interface to java.lang.String objects
  92 
  93 class java_lang_String : AllStatic {
  94  private:
  95   static int value_offset;
  96   static int hash_offset;
  97   static int hashIsZero_offset;
  98   static int coder_offset;
  99 
 100   static bool initialized;
 101 
 102   static Handle basic_create(int length, bool byte_arr, TRAPS);


 352   friend class InstanceKlass;   // verification code accesses offsets
 353   friend class ClassFileParser; // access to number_of_fake_fields
 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)


 480   // ("name as oop" accessor is not necessary)
 481   // Number of threads in group
 482   static int nthreads(oop java_thread_group);
 483   // threads
 484   static objArrayOop threads(oop java_thread_group);
 485   // Number of threads in group
 486   static int ngroups(oop java_thread_group);
 487   // groups
 488   static objArrayOop groups(oop java_thread_group);
 489   // maxPriority in group
 490   static ThreadPriority maxPriority(oop java_thread_group);
 491   // Destroyed
 492   static bool is_destroyed(oop java_thread_group);
 493   // Daemon
 494   static bool is_daemon(oop java_thread_group);
 495   // Debugging
 496   friend class JavaClasses;
 497 };
 498 
 499 






















 500 
 501 // Interface to java.lang.Throwable objects
 502 
 503 class java_lang_Throwable: AllStatic {
 504   friend class BacktraceBuilder;
 505   friend class BacktraceIterator;
 506 
 507  private:
 508   // Offsets
 509   enum {
 510     hc_backtrace_offset     =  0,
 511     hc_detailMessage_offset =  1,
 512     hc_cause_offset         =  2,  // New since 1.4
 513     hc_stackTrace_offset    =  3   // New since 1.4
 514   };
 515   // Trace constants
 516   enum {
 517     trace_methods_offset = 0,
 518     trace_bcis_offset    = 1,
 519     trace_mirrors_offset = 2,
 520     trace_names_offset   = 3,
 521     trace_next_offset    = 4,
 522     trace_size           = 5,

 523     trace_chunk_size     = 32
 524   };
 525 
 526   static int backtrace_offset;
 527   static int detailMessage_offset;
 528   static int stackTrace_offset;
 529   static int depth_offset;
 530   static int static_unassigned_stacktrace_offset;
 531 
 532   // StackTrace (programmatic access, new since 1.4)
 533   static void clear_stacktrace(oop throwable);
 534   // Stacktrace (post JDK 1.7.0 to allow immutability protocol to be followed)
 535   static void set_stacktrace(oop throwable, oop st_element_array);
 536   static oop unassigned_stacktrace();
 537 
 538  public:
 539   // Backtrace
 540   static oop backtrace(oop throwable);
 541   static void set_backtrace(oop throwable, oop value);
 542   static int depth(oop throwable);
 543   static void set_depth(oop throwable, int value);
 544   // Needed by JVMTI to filter out this internal field.
 545   static int get_backtrace_offset() { return backtrace_offset;}
 546   static int get_detailMessage_offset() { return detailMessage_offset;}
 547   // Message
 548   static oop message(oop throwable);
 549   static void set_message(oop throwable, oop value);
 550   static Symbol* detail_message(oop throwable);
 551   static void print_stack_element(outputStream *st, const methodHandle& method, int bci);
 552   static void print_stack_usage(Handle stream);
 553 
 554   static void compute_offsets();
 555   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 556 
 557   // Allocate space for backtrace (created but stack trace not filled in)
 558   static void allocate_backtrace(Handle throwable, TRAPS);
 559   // Fill in current stack trace for throwable with preallocated backtrace (no GC)
 560   static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable);
 561   // Fill in current stack trace, can cause GC
 562   static void fill_in_stack_trace(Handle throwable, const methodHandle& method, TRAPS);
 563   static void fill_in_stack_trace(Handle throwable, const methodHandle& method = methodHandle());

 564   // Programmatic access to stack trace
 565   static void get_stack_trace_elements(Handle throwable, objArrayHandle stack_trace, TRAPS);
 566   // Printing
 567   static void print(oop throwable, outputStream* st);
 568   static void print_stack_trace(Handle throwable, outputStream* st);
 569   static void java_printStackTrace(Handle throwable, TRAPS);
 570   // Debugging
 571   friend class JavaClasses;
 572 };
 573 
 574 
 575 // Interface to java.lang.reflect.AccessibleObject objects
 576 
 577 class java_lang_reflect_AccessibleObject: AllStatic {
 578  private:
 579   // Note that to reduce dependencies on the JDK we compute these
 580   // offsets at run-time.
 581   static int override_offset;
 582 
 583   static void compute_offsets();


 927 
 928 
 929 // Interface to java.lang.ref.SoftReference objects
 930 
 931 class java_lang_ref_SoftReference: public java_lang_ref_Reference {
 932  public:
 933   static int timestamp_offset;
 934   static int static_clock_offset;
 935 
 936   // Accessors
 937   static jlong timestamp(oop ref);
 938 
 939   // Accessors for statics
 940   static jlong clock();
 941   static void set_clock(jlong value);
 942 
 943   static void compute_offsets();
 944   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 945 };
 946 




























































































 947 // Interface to java.lang.invoke.MethodHandle objects
 948 
 949 class MethodHandleEntry;
 950 
 951 class java_lang_invoke_MethodHandle: AllStatic {
 952   friend class JavaClasses;
 953 
 954  private:
 955   static int _type_offset;               // the MethodType of this MH
 956   static int _form_offset;               // the LambdaForm of this MH
 957 
 958   static void compute_offsets();
 959 
 960  public:
 961   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 962 
 963   // Accessors
 964   static oop            type(oop mh);
 965   static void       set_type(oop mh, oop mtype);
 966 


1330   static void compute_offsets();
1331   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1332 
1333   // Debugging
1334   friend class JavaClasses;
1335 };
1336 
1337 
1338 // Interface to java.lang.StackTraceElement objects
1339 
1340 class java_lang_StackTraceElement: AllStatic {
1341  private:
1342   static int declaringClassObject_offset;
1343   static int classLoaderName_offset;
1344   static int moduleName_offset;
1345   static int moduleVersion_offset;
1346   static int declaringClass_offset;
1347   static int methodName_offset;
1348   static int fileName_offset;
1349   static int lineNumber_offset;

1350 
1351   // Setters
1352   static void set_classLoaderName(oop element, oop value);
1353   static void set_moduleName(oop element, oop value);
1354   static void set_moduleVersion(oop element, oop value);
1355   static void set_declaringClass(oop element, oop value);
1356   static void set_methodName(oop element, oop value);
1357   static void set_fileName(oop element, oop value);
1358   static void set_lineNumber(oop element, int value);
1359   static void set_declaringClassObject(oop element, oop value);

1360 
1361  public:
1362   // Create an instance of StackTraceElement
1363   static oop create(const methodHandle& method, int bci, TRAPS);
1364 
1365   static void fill_in(Handle element, InstanceKlass* holder, const methodHandle& method,
1366                       int version, int bci, Symbol* name, TRAPS);
1367 
1368   static void compute_offsets();
1369   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1370 
1371 #if INCLUDE_JVMCI
1372   static void decode(Handle mirror, int method, int version, int bci, int cpref, Symbol*& methodName, Symbol*& fileName, int& lineNumber);
1373   static void decode(Handle mirror, methodHandle method, int bci, Symbol*& methodName, Symbol*& fileName, int& lineNumber);
1374 #endif
1375 
1376   // Debugging
1377   friend class JavaClasses;
1378 };
1379 
1380 
1381 class Backtrace: AllStatic {
1382  public:
1383   // Helper backtrace functions to store bci|version together.
1384   static int merge_bci_and_version(int bci, int version);
1385   static int merge_mid_and_cpref(int mid, int cpref);
1386   static int bci_at(unsigned int merged);
1387   static int version_at(unsigned int merged);
1388   static int mid_at(unsigned int merged);
1389   static int cpref_at(unsigned int merged);
1390   static int get_line_number(const methodHandle& method, int bci);
1391   static Symbol* get_source_file_name(InstanceKlass* holder, int version);
1392 
1393   // Debugging
1394   friend class JavaClasses;
1395 };
1396 
1397 // Interface to java.lang.StackFrameInfo objects
1398 
1399 #define STACKFRAMEINFO_INJECTED_FIELDS(macro)                      \
1400   macro(java_lang_StackFrameInfo, version, short_signature, false)
1401 
1402 class java_lang_StackFrameInfo: AllStatic {
1403 private:
1404   static int _memberName_offset;
1405   static int _bci_offset;
1406   static int _version_offset;

1407 
1408   static Method* get_method(Handle stackFrame, InstanceKlass* holder, TRAPS);
1409 
1410 public:
1411   // Setters
1412   static void set_method_and_bci(Handle stackFrame, const methodHandle& method, int bci, TRAPS);
1413   static void set_bci(oop info, int value);
1414 
1415   static void set_version(oop info, short value);

1416 
1417   static void compute_offsets();
1418   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1419 
1420   static void to_stack_trace_element(Handle stackFrame, Handle stack_trace_element, TRAPS);
1421 
1422   // Debugging
1423   friend class JavaClasses;
1424 };
1425 
1426 class java_lang_LiveStackFrameInfo: AllStatic {
1427  private:
1428   static int _monitors_offset;
1429   static int _locals_offset;
1430   static int _operands_offset;
1431   static int _mode_offset;
1432 
1433  public:
1434   static void set_monitors(oop info, oop value);
1435   static void set_locals(oop info, oop value);




  40 // startup since the layout here differs between JDK1.2 and JDK1.3.
  41 //
  42 // Note that fields (static and non-static) are arranged with oops before non-oops
  43 // on a per class basis. The offsets below have to reflect this ordering.
  44 //
  45 // When editing the layouts please update the check_offset verification code
  46 // correspondingly. The names in the enums must be identical to the actual field
  47 // names in order for the verification code to work.
  48 
  49 #define BASIC_JAVA_CLASSES_DO_PART1(f) \
  50   f(java_lang_Class) \
  51   f(java_lang_String) \
  52   //end
  53 
  54 #define BASIC_JAVA_CLASSES_DO_PART2(f) \
  55   f(java_lang_System) \
  56   f(java_lang_ClassLoader) \
  57   f(java_lang_Throwable) \
  58   f(java_lang_Thread) \
  59   f(java_lang_ThreadGroup) \
  60   f(java_lang_Fiber) \
  61   f(java_lang_AssertionStatusDirectives) \
  62   f(java_lang_ref_SoftReference) \
  63   f(java_lang_invoke_MethodHandle) \
  64   f(java_lang_invoke_DirectMethodHandle) \
  65   f(java_lang_invoke_MemberName) \
  66   f(java_lang_invoke_ResolvedMethodName) \
  67   f(java_lang_invoke_LambdaForm) \
  68   f(java_lang_invoke_MethodType) \
  69   f(java_lang_invoke_CallSite) \
  70   f(java_lang_invoke_MethodHandleNatives_CallSiteContext) \
  71   f(java_security_AccessControlContext) \
  72   f(java_lang_reflect_AccessibleObject) \
  73   f(java_lang_reflect_Method) \
  74   f(java_lang_reflect_Constructor) \
  75   f(java_lang_reflect_Field) \
  76   f(java_nio_Buffer) \
  77   f(reflect_ConstantPool) \
  78   f(reflect_UnsafeStaticFieldAccessorImpl) \
  79   f(java_lang_reflect_Parameter) \
  80   f(java_lang_Module) \
  81   f(java_lang_StackTraceElement) \
  82   f(java_lang_StackFrameInfo) \
  83   f(java_lang_LiveStackFrameInfo) \
  84   f(java_lang_ContinuationScope) \
  85   f(java_lang_Continuation) \
  86   f(java_util_concurrent_locks_AbstractOwnableSynchronizer) \
  87   f(jdk_internal_misc_UnsafeConstants) \
  88   //end
  89 
  90 #define BASIC_JAVA_CLASSES_DO(f) \
  91         BASIC_JAVA_CLASSES_DO_PART1(f) \
  92         BASIC_JAVA_CLASSES_DO_PART2(f)
  93 
  94 // Interface to java.lang.String objects
  95 
  96 class java_lang_String : AllStatic {
  97  private:
  98   static int value_offset;
  99   static int hash_offset;
 100   static int hashIsZero_offset;
 101   static int coder_offset;
 102 
 103   static bool initialized;
 104 
 105   static Handle basic_create(int length, bool byte_arr, TRAPS);


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


 490   // ("name as oop" accessor is not necessary)
 491   // Number of threads in group
 492   static int nthreads(oop java_thread_group);
 493   // threads
 494   static objArrayOop threads(oop java_thread_group);
 495   // Number of threads in group
 496   static int ngroups(oop java_thread_group);
 497   // groups
 498   static objArrayOop groups(oop java_thread_group);
 499   // maxPriority in group
 500   static ThreadPriority maxPriority(oop java_thread_group);
 501   // Destroyed
 502   static bool is_destroyed(oop java_thread_group);
 503   // Daemon
 504   static bool is_daemon(oop java_thread_group);
 505   // Debugging
 506   friend class JavaClasses;
 507 };
 508 
 509 
 510 // Interface to java.lang.Fiber objects
 511 
 512 class java_lang_Fiber : AllStatic {
 513  private:
 514   static int static_notify_jvmti_events_offset;
 515   static int _carrierThread_offset;
 516   static int _continuation_offset;
 517  public:
 518   static void compute_offsets();
 519   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 520 
 521   // Testers
 522   static bool is_subclass(Klass* klass) {
 523     return klass->is_subclass_of(SystemDictionary::Fiber_klass());
 524   }
 525   static bool is_instance(oop obj);
 526   static oop carrier_thread(oop fiber);
 527   static oop continuation(oop fiber);
 528   static void set_notify_jvmti_events(jboolean enable);
 529   static void init_static_notify_jvmti_events();
 530 };
 531 
 532 
 533 // Interface to java.lang.Throwable objects
 534 
 535 class java_lang_Throwable: AllStatic {
 536   friend class BacktraceBuilder;
 537   friend class BacktraceIterator;
 538 
 539  private:
 540   // Offsets
 541   enum {
 542     hc_backtrace_offset     =  0,
 543     hc_detailMessage_offset =  1,
 544     hc_cause_offset         =  2,  // New since 1.4
 545     hc_stackTrace_offset    =  3   // New since 1.4
 546   };
 547   // Trace constants
 548   enum {
 549     trace_methods_offset = 0,
 550     trace_bcis_offset    = 1,
 551     trace_mirrors_offset = 2,
 552     trace_names_offset   = 3,
 553     trace_conts_offset   = 4,
 554     trace_next_offset    = 5,
 555     trace_size           = 6,
 556     trace_chunk_size     = 32
 557   };
 558 
 559   static int backtrace_offset;
 560   static int detailMessage_offset;
 561   static int stackTrace_offset;
 562   static int depth_offset;
 563   static int static_unassigned_stacktrace_offset;
 564 
 565   // StackTrace (programmatic access, new since 1.4)
 566   static void clear_stacktrace(oop throwable);
 567   // Stacktrace (post JDK 1.7.0 to allow immutability protocol to be followed)
 568   static void set_stacktrace(oop throwable, oop st_element_array);
 569   static oop unassigned_stacktrace();
 570 
 571  public:
 572   // Backtrace
 573   static oop backtrace(oop throwable);
 574   static void set_backtrace(oop throwable, oop value);
 575   static int depth(oop throwable);
 576   static void set_depth(oop throwable, int value);
 577   // Needed by JVMTI to filter out this internal field.
 578   static int get_backtrace_offset() { return backtrace_offset;}
 579   static int get_detailMessage_offset() { return detailMessage_offset;}
 580   // Message
 581   static oop message(oop throwable);
 582   static void set_message(oop throwable, oop value);
 583   static Symbol* detail_message(oop throwable);
 584   static void print_stack_element(outputStream *st, const methodHandle& method, int bci);
 585   static void print_stack_usage(Handle stream);
 586 
 587   static void compute_offsets();
 588   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 589 
 590   // Allocate space for backtrace (created but stack trace not filled in)
 591   static void allocate_backtrace(Handle throwable, TRAPS);
 592   // Fill in current stack trace for throwable with preallocated backtrace (no GC)
 593   static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable);
 594   // Fill in current stack trace, can cause GC
 595   static void fill_in_stack_trace(Handle throwable, Handle contScope, const methodHandle& method, TRAPS);
 596   static void fill_in_stack_trace(Handle throwable, Handle contScope, const methodHandle& method = methodHandle());
 597   static void fill_in_stack_trace(Handle throwable, const methodHandle& method = methodHandle()) { fill_in_stack_trace(throwable, Handle(), method); }
 598   // Programmatic access to stack trace
 599   static void get_stack_trace_elements(Handle throwable, objArrayHandle stack_trace, TRAPS);
 600   // Printing
 601   static void print(oop throwable, outputStream* st);
 602   static void print_stack_trace(Handle throwable, outputStream* st);
 603   static void java_printStackTrace(Handle throwable, TRAPS);
 604   // Debugging
 605   friend class JavaClasses;
 606 };
 607 
 608 
 609 // Interface to java.lang.reflect.AccessibleObject objects
 610 
 611 class java_lang_reflect_AccessibleObject: AllStatic {
 612  private:
 613   // Note that to reduce dependencies on the JDK we compute these
 614   // offsets at run-time.
 615   static int override_offset;
 616 
 617   static void compute_offsets();


 961 
 962 
 963 // Interface to java.lang.ref.SoftReference objects
 964 
 965 class java_lang_ref_SoftReference: public java_lang_ref_Reference {
 966  public:
 967   static int timestamp_offset;
 968   static int static_clock_offset;
 969 
 970   // Accessors
 971   static jlong timestamp(oop ref);
 972 
 973   // Accessors for statics
 974   static jlong clock();
 975   static void set_clock(jlong value);
 976 
 977   static void compute_offsets();
 978   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 979 };
 980 
 981 // Interface to java.lang.ContinuationScope objects
 982 class java_lang_ContinuationScope: AllStatic {
 983   friend class JavaClasses;
 984  private:
 985   static int _name_offset;
 986 
 987   static void compute_offsets();
 988  public:
 989   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 990 
 991   static inline oop name(oop ref);
 992 };
 993   
 994 // Interface to java.lang.Continuation objects
 995 class java_lang_Continuation: AllStatic {
 996   friend class JavaClasses;
 997  private:
 998   //  enum {
 999   //   hc_fp_offset      = 0,
1000   //   hc_sp_offset      = 11,
1001   //   hc_entrySP_offset = 1,
1002   //   hc_entryFP_offset = 3,
1003   //   hc_target_offset  = 13,
1004   //   hc_parent_offset  = 14,
1005   //   hc_stack_offset   = 15,
1006   // };
1007   static int _scope_offset;
1008   static int _target_offset;
1009   static int _parent_offset;
1010   static int _yieldInfo_offset;
1011   static int _entrySP_offset;
1012   static int _entryFP_offset;
1013   static int _entryPC_offset;
1014   static int _stack_offset;
1015   static int _maxSize_offset;
1016   static int _numFrames_offset;
1017   static int _numInterpretedFrames_offset;
1018   static int _refStack_offset;
1019   static int _fp_offset;
1020   static int _sp_offset;
1021   static int _pc_offset;
1022   static int _refSP_offset;
1023   static int _cs_offset;
1024   static int _flags_offset;
1025   static int _reset_offset;
1026   static int _mounted_offset;
1027 
1028   static void compute_offsets();
1029  public:
1030   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1031   // Accessors
1032   static inline oop scope(oop ref);
1033   static inline oop target(oop ref);
1034   static inline oop parent(oop ref);
1035   static inline oop yieldInfo(oop ref);
1036   static inline void set_yieldInfo(oop ref, oop value);
1037   static inline typeArrayOop stack(oop ref);
1038   static inline objArrayOop refStack(oop ref);
1039   static inline void set_stack(oop obj, oop value);
1040   static inline void set_refStack(oop obj, oop value);
1041   static inline jlong fp(oop ref);
1042   static inline void set_fp(oop ref, const jlong i);
1043   static inline jint sp(oop ref);
1044   static inline void set_sp(oop ref, const jint i);
1045   static inline void* pc(oop ref);
1046   static inline void  set_pc(oop ref, const void* pc);
1047   static inline jint refSP(oop ref);
1048   static inline void set_refSP(oop ref, jint i);
1049   static inline intptr_t* entrySP(oop ref);
1050   static inline void set_entrySP(oop ref, intptr_t* sp);
1051   static inline intptr_t* entryFP(oop ref);
1052   static inline void set_entryFP(oop ref, intptr_t* fp);
1053   static inline address entryPC(oop ref);
1054   static inline void set_entryPC(oop ref, address pc);
1055   static inline address* entryPC_addr(oop ref);
1056   static inline jint maxSize(oop ref);
1057   static inline void set_maxSize(oop ref, jint i);
1058   static inline jshort numFrames(oop ref);
1059   static inline void set_numFrames(oop ref, jshort i);
1060   static inline jshort numInterpretedFrames(oop ref);
1061   static inline void set_numInterpretedFrames(oop ref, jshort i);
1062   static unsigned char flags(oop ref);
1063   static void set_flags(oop ref, unsigned char flags);
1064   static inline int stack_size(oop ref);
1065   static inline void* stack_base(oop ref);
1066   static inline HeapWord* refStack_base(oop ref);
1067   static inline jshort critical_section(oop ref);
1068   static bool on_local_stack(oop ref, address adr);
1069   static bool is_reset(oop ref);
1070   static bool is_mounted(oop ref);
1071 };
1072 
1073 // Interface to java.lang.invoke.MethodHandle objects
1074 
1075 class MethodHandleEntry;
1076 
1077 class java_lang_invoke_MethodHandle: AllStatic {
1078   friend class JavaClasses;
1079 
1080  private:
1081   static int _type_offset;               // the MethodType of this MH
1082   static int _form_offset;               // the LambdaForm of this MH
1083 
1084   static void compute_offsets();
1085 
1086  public:
1087   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1088 
1089   // Accessors
1090   static oop            type(oop mh);
1091   static void       set_type(oop mh, oop mtype);
1092 


1456   static void compute_offsets();
1457   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1458 
1459   // Debugging
1460   friend class JavaClasses;
1461 };
1462 
1463 
1464 // Interface to java.lang.StackTraceElement objects
1465 
1466 class java_lang_StackTraceElement: AllStatic {
1467  private:
1468   static int declaringClassObject_offset;
1469   static int classLoaderName_offset;
1470   static int moduleName_offset;
1471   static int moduleVersion_offset;
1472   static int declaringClass_offset;
1473   static int methodName_offset;
1474   static int fileName_offset;
1475   static int lineNumber_offset;
1476   static int contScope_offset;
1477 
1478   // Setters
1479   static void set_classLoaderName(oop element, oop value);
1480   static void set_moduleName(oop element, oop value);
1481   static void set_moduleVersion(oop element, oop value);
1482   static void set_declaringClass(oop element, oop value);
1483   static void set_methodName(oop element, oop value);
1484   static void set_fileName(oop element, oop value);
1485   static void set_lineNumber(oop element, int value);
1486   static void set_declaringClassObject(oop element, oop value);
1487   static void set_contScopeName(oop element, oop value);
1488 
1489  public:
1490   // Create an instance of StackTraceElement
1491   static oop create(const methodHandle& method, int bci, Handle contScope, TRAPS);
1492 
1493   static void fill_in(Handle element, InstanceKlass* holder, const methodHandle& method,
1494                       int version, int bci, Symbol* name, Handle contScopeName, TRAPS);
1495 
1496   static void compute_offsets();
1497   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1498 
1499 #if INCLUDE_JVMCI
1500   static void decode(Handle mirror, int method, int version, int bci, int cpref, Symbol*& methodName, Symbol*& fileName, int& lineNumber);
1501   static void decode(Handle mirror, methodHandle method, int bci, Symbol*& methodName, Symbol*& fileName, int& lineNumber);
1502 #endif
1503 
1504   // Debugging
1505   friend class JavaClasses;
1506 };
1507 
1508 
1509 class Backtrace: AllStatic {
1510  public:
1511   // Helper backtrace functions to store bci|version together.
1512   static int merge_bci_and_version(int bci, int version);
1513   static int merge_mid_and_cpref(int mid, int cpref);
1514   static int bci_at(unsigned int merged);
1515   static int version_at(unsigned int merged);
1516   static int mid_at(unsigned int merged);
1517   static int cpref_at(unsigned int merged);
1518   static int get_line_number(const methodHandle& method, int bci);
1519   static Symbol* get_source_file_name(InstanceKlass* holder, int version);
1520 
1521   // Debugging
1522   friend class JavaClasses;
1523 };
1524 
1525 // Interface to java.lang.StackFrameInfo objects
1526 
1527 #define STACKFRAMEINFO_INJECTED_FIELDS(macro)                      \
1528   macro(java_lang_StackFrameInfo, version, short_signature, false)
1529 
1530 class java_lang_StackFrameInfo: AllStatic {
1531 private:
1532   static int _memberName_offset;
1533   static int _bci_offset;
1534   static int _version_offset;
1535   static int _contScope_offset;
1536 
1537   static Method* get_method(Handle stackFrame, InstanceKlass* holder, TRAPS);
1538 
1539 public:
1540   // Setters
1541   static void set_method_and_bci(Handle stackFrame, const methodHandle& method, int bci, oop cont, TRAPS);
1542   static void set_bci(oop info, int value);
1543 
1544   static void set_version(oop info, short value);
1545   static void set_contScope(oop info, oop value);
1546 
1547   static void compute_offsets();
1548   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1549 
1550   static void to_stack_trace_element(Handle stackFrame, Handle stack_trace_element, TRAPS);
1551 
1552   // Debugging
1553   friend class JavaClasses;
1554 };
1555 
1556 class java_lang_LiveStackFrameInfo: AllStatic {
1557  private:
1558   static int _monitors_offset;
1559   static int _locals_offset;
1560   static int _operands_offset;
1561   static int _mode_offset;
1562 
1563  public:
1564   static void set_monitors(oop info, oop value);
1565   static void set_locals(oop info, oop value);


< prev index next >