1 /*
   2  * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_CLASSFILE_JAVACLASSES_HPP
  26 #define SHARE_CLASSFILE_JAVACLASSES_HPP
  27 
  28 #include "classfile/vmClasses.hpp"
  29 #include "oops/instanceKlass.hpp"
  30 #include "oops/oopsHierarchy.hpp"
  31 #include "oops/symbol.hpp"
  32 #include "runtime/handles.hpp"
  33 #include "runtime/os.hpp"
  34 #include "utilities/macros.hpp"
  35 #include "utilities/utf8.hpp"
  36 #include "utilities/vmEnums.hpp"
  37 
  38 class JvmtiThreadState;
  39 class RecordComponent;
  40 class SerializeClosure;
  41 class ObjectWaiter;
  42 class ObjectMonitor;
  43 
  44 #define CHECK_INIT(offset)  assert(offset != 0, "should be initialized"); return offset;
  45 
  46 // Interface to java.lang.Object objects
  47 
  48 class java_lang_Object : AllStatic {
  49  public:
  50   static void register_natives(TRAPS);
  51 };
  52 
  53 // Interface to java.lang.String objects
  54 
  55 // The flags field is a collection of bits representing boolean values used
  56 // internally by the VM.
  57 #define STRING_INJECTED_FIELDS(macro) \
  58   macro(java_lang_String, flags, byte_signature, false)
  59 
  60 class java_lang_String : AllStatic {
  61  private:
  62   static int _value_offset;
  63   static int _hash_offset;
  64   static int _hashIsZero_offset;
  65   static int _coder_offset;
  66   static int _flags_offset;
  67 
  68   static bool _initialized;
  69 
  70   static Handle basic_create(int length, bool byte_arr, TRAPS);
  71 
  72   static inline void set_coder(oop string, jbyte coder);
  73 
  74   // Bitmasks for values in the injected flags field.
  75   static const uint8_t _deduplication_forbidden_mask = 1 << 0;
  76   static const uint8_t _deduplication_requested_mask = 1 << 1;
  77 
  78   static int flags_offset() { CHECK_INIT(_flags_offset); }
  79   // Return the address of the injected flags field.
  80   static inline uint8_t* flags_addr(oop java_string);
  81   // Test whether the designated bit of the injected flags field is set.
  82   static inline bool is_flag_set(oop java_string, uint8_t flag_mask);
  83   // Atomically test and set the designated bit of the injected flags field,
  84   // returning true if the bit was already set.
  85   static bool test_and_set_flag(oop java_string, uint8_t flag_mask);
  86 
  87   static inline unsigned int hash_code_impl(oop java_string, bool update);
  88 
  89  public:
  90 
  91   // Coders
  92   enum Coder {
  93     CODER_LATIN1 =  0,
  94     CODER_UTF16  =  1
  95   };
  96 
  97   static void compute_offsets();
  98   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
  99 
 100   // Instance creation
 101   static Handle create_from_unicode(const jchar* unicode, int len, TRAPS);
 102   static oop    create_oop_from_unicode(const jchar* unicode, int len, TRAPS);
 103   static Handle create_from_str(const char* utf8_str, TRAPS);
 104   static oop    create_oop_from_str(const char* utf8_str, TRAPS);
 105   static Handle create_from_symbol(const Symbol* symbol, TRAPS);
 106   static Handle create_from_platform_dependent_str(const char* str, TRAPS);
 107 
 108   static void set_compact_strings(bool value);
 109 
 110   static int value_offset() { CHECK_INIT(_value_offset); }
 111   static int coder_offset() { CHECK_INIT(_coder_offset); }
 112 
 113   static inline void set_value(oop string, typeArrayOop buffer);
 114 
 115   // Set the deduplication_forbidden flag true.  This flag is sticky; once
 116   // set it never gets cleared.  This is set when a String is interned in
 117   // the StringTable, to prevent string deduplication from changing the
 118   // String's value array.
 119   static inline void set_deduplication_forbidden(oop java_string);
 120 
 121   // Test and set the deduplication_requested flag.  Returns the old value
 122   // of the flag.  This flag is sticky; once set it never gets cleared.
 123   // Some GCs may use this flag when deciding whether to request
 124   // deduplication of a String, to avoid multiple requests for the same
 125   // object.
 126   static inline bool test_and_set_deduplication_requested(oop java_string);
 127 
 128   // Accessors
 129   static inline typeArrayOop value(oop java_string);
 130   static inline typeArrayOop value_no_keepalive(oop java_string);
 131   static inline bool hash_is_set(oop string);
 132   static inline bool is_latin1(oop java_string);
 133   static inline bool deduplication_forbidden(oop java_string);
 134   static inline bool deduplication_requested(oop java_string);
 135   static inline int length(oop java_string);
 136   static inline int length(oop java_string, typeArrayOop string_value);
 137   static size_t utf8_length(oop java_string);
 138   static size_t utf8_length(oop java_string, typeArrayOop string_value);
 139   // Legacy variants that truncate the length if needed
 140   static int    utf8_length_as_int(oop java_string);
 141   static int    utf8_length_as_int(oop java_string, typeArrayOop string_value);
 142 
 143   // String converters
 144   static char*  as_utf8_string(oop java_string);
 145   // `length` is set to the length of the utf8 sequence.
 146   static char*  as_utf8_string(oop java_string, size_t& length);
 147   static char*  as_utf8_string_full(oop java_string, char* buf, size_t buflen, size_t& length);
 148   static char*  as_utf8_string(oop java_string, char* buf, size_t buflen);
 149   static char*  as_utf8_string(oop java_string, int start, int len);
 150   static char*  as_utf8_string(oop java_string, typeArrayOop value, char* buf, size_t buflen);
 151   static char*  as_utf8_string(oop java_string, typeArrayOop value, int start, int len, char* buf, size_t buflen);
 152   static char*  as_platform_dependent_str(Handle java_string, TRAPS);
 153   static jchar* as_unicode_string(oop java_string, int& length, TRAPS);
 154   static jchar* as_unicode_string_or_null(oop java_string, int& length);
 155   // produce an ascii string with all other values quoted using \u####
 156   static char*  as_quoted_ascii(oop java_string);
 157 
 158   // Compute the hash value for a java.lang.String object which would
 159   // contain the characters passed in.
 160   //
 161   // As the hash value used by the String object itself, in
 162   // String.hashCode().  This value is normally calculated in Java code
 163   // in the String.hashCode method(), but is precomputed for String
 164   // objects in the shared archive file.
 165   // hash P(31) from Kernighan & Ritchie
 166   //
 167   // For this reason, THIS ALGORITHM MUST MATCH String.hashCode().
 168   static unsigned int hash_code(const jchar* s, int len) {
 169     unsigned int h = 0;
 170     while (len-- > 0) {
 171       h = 31*h + (unsigned int) *s;
 172       s++;
 173     }
 174     return h;
 175   }
 176 
 177   static unsigned int hash_code(const jbyte* s, int len) {
 178     unsigned int h = 0;
 179     while (len-- > 0) {
 180       h = 31*h + (((unsigned int) *s) & 0xFF);
 181       s++;
 182     }
 183     return h;
 184   }
 185 
 186   static unsigned int hash_code(const char* utf8_str, size_t utf8_len) {
 187     unsigned int h = 0;
 188     int unicode_length = UTF8::unicode_length(utf8_str, utf8_len);
 189 
 190     jchar c;
 191     while (unicode_length-- > 0) {
 192       utf8_str = UTF8::next(utf8_str, &c);
 193       h = 31 * h + ((unsigned int)c);
 194     }
 195     return h;
 196   }
 197 
 198   static unsigned int hash_code(oop java_string);
 199   static unsigned int hash_code_noupdate(oop java_string);
 200 
 201   // Compare strings (of different types/encodings), length is the string (array) length
 202   static bool equals(oop java_string, const jchar* chars, int len);
 203   static bool equals(oop java_string, const char* utf8_str, size_t utf8_len);
 204   static bool equals(oop str1, oop str2);
 205   static inline bool value_equals(typeArrayOop str_value1, typeArrayOop str_value2);
 206 
 207   // Conversion between '.' and '/' formats, and allocate a String from the result.
 208   static Handle externalize_classname(Symbol* java_name, TRAPS);
 209 
 210   // Conversion
 211   static Symbol* as_symbol(oop java_string);
 212   static Symbol* as_symbol_or_null(oop java_string);
 213 
 214   // Tester
 215   static inline bool is_instance(oop obj);
 216 
 217   // Debugging
 218   static void print(oop java_string, outputStream* st, int max_length = MaxStringPrintSize);
 219   friend class JavaClasses;
 220   friend class StringTable;
 221 };
 222 
 223 
 224 // Interface to java.lang.Class objects
 225 
 226 #define CLASS_INJECTED_FIELDS(macro)                                       \
 227   macro(java_lang_Class, klass,                  intptr_signature,  false) \
 228   macro(java_lang_Class, array_klass,            intptr_signature,  false) \
 229   macro(java_lang_Class, oop_size,               int_signature,     false) \
 230   macro(java_lang_Class, static_oop_field_count, int_signature,     false) \
 231   macro(java_lang_Class, protection_domain,      object_signature,  false) \
 232   macro(java_lang_Class, source_file,            object_signature,  false) \
 233   macro(java_lang_Class, init_lock,              object_signature,  false)
 234 
 235 class java_lang_Class : AllStatic {
 236   friend class VMStructs;
 237   friend class JVMCIVMStructs;
 238 
 239  private:
 240 
 241   // The fake offsets are added by the class loader when java.lang.Class is loaded
 242 
 243   static int _klass_offset;
 244   static int _array_klass_offset;
 245 
 246   static int _oop_size_offset;
 247   static int _static_oop_field_count_offset;
 248 
 249   static int _protection_domain_offset;
 250   static int _init_lock_offset;
 251   static int _signers_offset;
 252   static int _class_loader_offset;
 253   static int _module_offset;
 254   static int _component_mirror_offset;
 255   static int _name_offset;
 256   static int _source_file_offset;
 257   static int _classData_offset;
 258   static int _classRedefinedCount_offset;
 259   static int _reflectionData_offset;
 260 
 261   static bool _offsets_computed;
 262 
 263   static GrowableArray<Klass*>* _fixup_mirror_list;
 264   static GrowableArray<Klass*>* _fixup_module_field_list;
 265 
 266   static void set_init_lock(oop java_class, oop init_lock);
 267   static void set_protection_domain(oop java_class, oop protection_domain);
 268   static void set_class_loader(oop java_class, oop class_loader);
 269   static void set_component_mirror(oop java_class, oop comp_mirror);
 270   static void initialize_mirror_fields(Klass* k, Handle mirror, Handle protection_domain,
 271                                        Handle classData, TRAPS);
 272   static void set_mirror_module_field(JavaThread* current, Klass* K, Handle mirror, Handle module);
 273  public:
 274   static void allocate_fixup_lists();
 275   static void compute_offsets();
 276 
 277   // Instance creation
 278   static void allocate_mirror(Klass* k, bool is_scratch, Handle protection_domain, Handle classData,
 279                               Handle& mirror, Handle& comp_mirror, TRAPS); // returns mirror and comp_mirror
 280   static void create_mirror(Klass* k, Handle class_loader, Handle module,
 281                             Handle protection_domain, Handle classData, TRAPS);
 282   static void fixup_mirror(Klass* k, TRAPS);
 283   static oop  create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
 284 
 285   // Archiving
 286   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 287   static void create_scratch_mirror(Klass* k, Handle protection_domain, TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
 288   static bool restore_archived_mirror(Klass *k, Handle class_loader, Handle module,
 289                                       Handle protection_domain,
 290                                       TRAPS) NOT_CDS_JAVA_HEAP_RETURN_(false);
 291 
 292   static void fixup_module_field(Klass* k, Handle module);
 293 
 294   // Conversion
 295   static Klass* as_Klass(oop java_class);
 296   static void set_klass(oop java_class, Klass* klass);
 297   static BasicType as_BasicType(oop java_class, Klass** reference_klass = nullptr);
 298   static Symbol* as_signature(oop java_class, bool intern_if_not_found);
 299   static void print_signature(oop java_class, outputStream *st);
 300   static const char* as_external_name(oop java_class);
 301   // Testing
 302   static bool is_instance(oop obj);
 303 
 304   static bool is_primitive(oop java_class);
 305   static BasicType primitive_type(oop java_class);
 306   static oop primitive_mirror(BasicType t);
 307   // JVM_NewArray support
 308   static Klass* array_klass_acquire(oop java_class);
 309   static void release_set_array_klass(oop java_class, Klass* klass);
 310   // compiler support for class operations
 311   static int klass_offset()                { CHECK_INIT(_klass_offset); }
 312   static int array_klass_offset()          { CHECK_INIT(_array_klass_offset); }
 313   // Support for classRedefinedCount field
 314   static int classRedefinedCount(oop the_class_mirror);
 315   static void set_classRedefinedCount(oop the_class_mirror, int value);
 316 
 317   // Support for embedded per-class oops
 318   static oop  protection_domain(oop java_class);
 319   static oop  init_lock(oop java_class);
 320   static void clear_init_lock(oop java_class) {
 321     set_init_lock(java_class, nullptr);
 322   }
 323   static oop  component_mirror(oop java_class);
 324   static objArrayOop signers(oop java_class);
 325   static oop  class_data(oop java_class);
 326   static void set_class_data(oop java_class, oop classData);
 327 
 328   static oop  reflection_data(oop java_class);
 329   static void set_reflection_data(oop java_class, oop reflection_data);
 330   static bool has_reflection_data(oop java_class);
 331 
 332   static int component_mirror_offset() { return _component_mirror_offset; }
 333 
 334   static oop class_loader(oop java_class);
 335   static void set_module(oop java_class, oop module);
 336   static oop module(oop java_class);
 337 
 338   static oop name(Handle java_class, TRAPS);
 339 
 340   static oop source_file(oop java_class);
 341   static void set_source_file(oop java_class, oop source_file);
 342 
 343   static size_t oop_size(oop java_class);
 344   static void set_oop_size(HeapWord* java_class, size_t size);
 345   static int static_oop_field_count(oop java_class);
 346   static void set_static_oop_field_count(oop java_class, int size);
 347 
 348   static GrowableArray<Klass*>* fixup_mirror_list() {
 349     return _fixup_mirror_list;
 350   }
 351   static void set_fixup_mirror_list(GrowableArray<Klass*>* v) {
 352     _fixup_mirror_list = v;
 353   }
 354 
 355   static GrowableArray<Klass*>* fixup_module_field_list() {
 356     return _fixup_module_field_list;
 357   }
 358   static void set_fixup_module_field_list(GrowableArray<Klass*>* v) {
 359     _fixup_module_field_list = v;
 360   }
 361 
 362   // Debugging
 363   friend class JavaClasses;
 364 };
 365 
 366 // Interface to java.lang.Thread objects
 367 
 368 #define THREAD_INJECTED_FIELDS(macro)                                  \
 369   macro(java_lang_Thread, jvmti_thread_state, intptr_signature, false) \
 370   macro(java_lang_Thread, jvmti_VTMS_transition_disable_count, int_signature, false) \
 371   macro(java_lang_Thread, jvmti_is_in_VTMS_transition, bool_signature, false) \
 372   JFR_ONLY(macro(java_lang_Thread, jfr_epoch, short_signature, false))
 373 
 374 class java_lang_Thread : AllStatic {
 375   friend class java_lang_VirtualThread;
 376   friend class JVMCIVMStructs;
 377  private:
 378   // Note that for this class the layout changed between JDK1.2 and JDK1.3,
 379   // so we compute the offsets at startup rather than hard-wiring them.
 380   static int _holder_offset;
 381   static int _name_offset;
 382   static int _contextClassLoader_offset;
 383   static int _eetop_offset;
 384   static int _jvmti_thread_state_offset;
 385   static int _jvmti_VTMS_transition_disable_count_offset;
 386   static int _jvmti_is_in_VTMS_transition_offset;
 387   static int _interrupted_offset;
 388   static int _interruptLock_offset;
 389   static int _tid_offset;
 390   static int _continuation_offset;
 391   static int _park_blocker_offset;
 392   static int _scopedValueBindings_offset;
 393   JFR_ONLY(static int _jfr_epoch_offset;)
 394 
 395   static void compute_offsets();
 396 
 397  public:
 398   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 399 
 400   // Returns the JavaThread associated with the thread obj
 401   static JavaThread* thread(oop java_thread);
 402   static JavaThread* thread_acquire(oop java_thread);
 403   // Set JavaThread for instance
 404   static void set_thread(oop java_thread, JavaThread* thread);
 405   static void release_set_thread(oop java_thread, JavaThread* thread);
 406   // FieldHolder
 407   static oop holder(oop java_thread);
 408   // interruptLock
 409   static oop interrupt_lock(oop java_thread);
 410   // Interrupted status
 411   static bool interrupted(oop java_thread);
 412   static void set_interrupted(oop java_thread, bool val);
 413   // Name
 414   static oop name(oop java_thread);
 415   static void set_name(oop java_thread, oop name);
 416   // Priority
 417   static ThreadPriority priority(oop java_thread);
 418   static void set_priority(oop java_thread, ThreadPriority priority);
 419   // Thread group
 420   static oop  threadGroup(oop java_thread);
 421   // Alive (NOTE: this is not really a field, but provides the correct
 422   // definition without doing a Java call)
 423   static bool is_alive(oop java_thread);
 424   // Daemon
 425   static bool is_daemon(oop java_thread);
 426   static void set_daemon(oop java_thread);
 427   // Context ClassLoader
 428   static oop context_class_loader(oop java_thread);
 429   // Stack size hint
 430   static jlong stackSize(oop java_thread);
 431   // Thread ID
 432   static int64_t thread_id(oop java_thread);
 433   static ByteSize thread_id_offset();
 434   // Continuation
 435   static inline oop continuation(oop java_thread);
 436 
 437   static JvmtiThreadState* jvmti_thread_state(oop java_thread);
 438   static void set_jvmti_thread_state(oop java_thread, JvmtiThreadState* state);
 439   static int  VTMS_transition_disable_count(oop java_thread);
 440   static void inc_VTMS_transition_disable_count(oop java_thread);
 441   static void dec_VTMS_transition_disable_count(oop java_thread);
 442   static bool is_in_VTMS_transition(oop java_thread);
 443   static void set_is_in_VTMS_transition(oop java_thread, bool val);
 444   static int  is_in_VTMS_transition_offset();
 445 
 446   // Clear all scoped value bindings on error
 447   static void clear_scopedValueBindings(oop java_thread);
 448 
 449   // Blocker object responsible for thread parking
 450   static oop park_blocker(oop java_thread);
 451 
 452   // Write thread status info to threadStatus field of java.lang.Thread.
 453   static void set_thread_status(oop java_thread_oop, JavaThreadStatus status);
 454   // Read thread status info from threadStatus field of java.lang.Thread.
 455   static JavaThreadStatus get_thread_status(oop java_thread_oop);
 456 
 457   static const char*  thread_status_name(oop java_thread_oop);
 458 
 459   // Fill in current stack trace, can cause GC
 460   static oop async_get_stack_trace(oop java_thread, TRAPS);
 461 
 462   JFR_ONLY(static u2 jfr_epoch(oop java_thread);)
 463   JFR_ONLY(static void set_jfr_epoch(oop java_thread, u2 epoch);)
 464   JFR_ONLY(static int jfr_epoch_offset() { CHECK_INIT(_jfr_epoch_offset); })
 465 
 466   // Debugging
 467   friend class JavaClasses;
 468 };
 469 
 470 // Interface to java.lang.Thread$FieldHolder objects
 471 
 472 class java_lang_Thread_FieldHolder : AllStatic {
 473  private:
 474   static int _group_offset;
 475   static int _priority_offset;
 476   static int _stackSize_offset;
 477   static int _daemon_offset;
 478   static int _thread_status_offset;
 479 
 480   static void compute_offsets();
 481 
 482  public:
 483   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 484 
 485   static oop threadGroup(oop holder);
 486 
 487   static ThreadPriority priority(oop holder);
 488   static void set_priority(oop holder, ThreadPriority priority);
 489 
 490   static jlong stackSize(oop holder);
 491 
 492   static bool is_daemon(oop holder);
 493   static void set_daemon(oop holder, bool val);
 494 
 495   static void set_thread_status(oop holder, JavaThreadStatus status);
 496   static JavaThreadStatus get_thread_status(oop holder);
 497 
 498   friend class JavaClasses;
 499 };
 500 
 501 // Interface to java.lang.Thread$Constants objects
 502 
 503 class java_lang_Thread_Constants : AllStatic {
 504  private:
 505   static int _static_VTHREAD_GROUP_offset;
 506   static int _static_NOT_SUPPORTED_CLASSLOADER_offset;
 507 
 508   static void compute_offsets();
 509   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 510 
 511  public:
 512   static oop get_VTHREAD_GROUP();
 513 
 514   friend class JavaClasses;
 515 };
 516 
 517 // Interface to java.lang.ThreadGroup objects
 518 
 519 class java_lang_ThreadGroup : AllStatic {
 520  private:
 521   static int _parent_offset;
 522   static int _name_offset;
 523   static int _maxPriority_offset;
 524   static int _daemon_offset;
 525 
 526   static void compute_offsets();
 527  public:
 528   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 529 
 530   // parent ThreadGroup
 531   static oop parent(oop java_thread_group);
 532   // name
 533   static const char* name(oop java_thread_group);
 534   // maxPriority in group
 535   static ThreadPriority maxPriority(oop java_thread_group);
 536   // Daemon
 537   static bool is_daemon(oop java_thread_group);
 538 
 539   // Debugging
 540   friend class JavaClasses;
 541 };
 542 
 543 
 544 // Interface to java.lang.VirtualThread objects
 545 #define VTHREAD_INJECTED_FIELDS(macro)                                           \
 546   macro(java_lang_VirtualThread,   objectWaiter,  intptr_signature,       false)
 547 
 548 class java_lang_VirtualThread : AllStatic {
 549  private:
 550   static int static_vthread_scope_offset;
 551   static int _carrierThread_offset;
 552   static int _continuation_offset;
 553   static int _state_offset;
 554   static int _next_offset;
 555   static int _onWaitingList_offset;
 556   static int _notified_offset;
 557   static int _recheckInterval_offset;
 558   static int _timeout_offset;
 559   static int _objectWaiter_offset;
 560   JFR_ONLY(static int _jfr_epoch_offset;)
 561  public:
 562   enum {
 563     NEW           = 0,
 564     STARTED       = 1,
 565     RUNNING       = 2,
 566     PARKING       = 3,
 567     PARKED        = 4,
 568     PINNED        = 5,
 569     TIMED_PARKING = 6,
 570     TIMED_PARKED  = 7,
 571     TIMED_PINNED  = 8,
 572     UNPARKED      = 9,
 573     YIELDING      = 10,
 574     YIELDED       = 11,
 575     BLOCKING      = 12,
 576     BLOCKED       = 13,
 577     UNBLOCKED     = 14,
 578     WAITING       = 15,
 579     WAIT          = 16,  // waiting in Object.wait
 580     TIMED_WAITING = 17,
 581     TIMED_WAIT    = 18,  // waiting in timed-Object.wait
 582     TERMINATED    = 99,
 583 
 584     // additional state bits
 585     SUSPENDED    = 1 << 8,   // suspended when unmounted
 586   };
 587 
 588   static void compute_offsets();
 589   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 590 
 591   // Testers
 592   static bool is_subclass(Klass* klass) {
 593     return klass->is_subclass_of(vmClasses::VirtualThread_klass());
 594   }
 595   static bool is_instance(oop obj);
 596 
 597   static oop vthread_scope();
 598   static oop carrier_thread(oop vthread);
 599   static oop continuation(oop vthread);
 600   static int state(oop vthread);
 601   static void set_state(oop vthread, int state);
 602   static int cmpxchg_state(oop vthread, int old_state, int new_state);
 603   static oop next(oop vthread);
 604   static void set_next(oop vthread, oop next_vthread);
 605   static bool set_onWaitingList(oop vthread, OopHandle& list_head);
 606   static jlong timeout(oop vthread);
 607   static void set_timeout(oop vthread, jlong value);
 608   static void set_notified(oop vthread, jboolean value);
 609   static bool is_preempted(oop vthread);
 610   static JavaThreadStatus map_state_to_thread_status(int state);
 611 
 612   static inline ObjectWaiter* objectWaiter(oop vthread);
 613   static inline void set_objectWaiter(oop vthread, ObjectWaiter* waiter);
 614   static ObjectMonitor* current_pending_monitor(oop vthread);
 615   static ObjectMonitor* current_waiting_monitor(oop vthread);
 616 };
 617 
 618 
 619 // Interface to java.lang.Throwable objects
 620 
 621 class java_lang_Throwable: AllStatic {
 622   friend class BacktraceBuilder;
 623   friend class BacktraceIterator;
 624 
 625  private:
 626   // Trace constants
 627   enum {
 628     trace_methods_offset = 0,
 629     trace_bcis_offset    = 1,
 630     trace_mirrors_offset = 2,
 631     trace_names_offset   = 3,
 632     trace_conts_offset   = 4,
 633     trace_next_offset    = 5,
 634     trace_hidden_offset  = 6,
 635     trace_size           = 7,
 636     trace_chunk_size     = 32
 637   };
 638 
 639   static int _backtrace_offset;
 640   static int _detailMessage_offset;
 641   static int _stackTrace_offset;
 642   static int _depth_offset;
 643   static int _cause_offset;
 644   static int _static_unassigned_stacktrace_offset;
 645 
 646   // StackTrace (programmatic access, new since 1.4)
 647   static void clear_stacktrace(oop throwable);
 648   // Stacktrace (post JDK 1.7.0 to allow immutability protocol to be followed)
 649   static void set_stacktrace(oop throwable, oop st_element_array);
 650   static oop unassigned_stacktrace();
 651 
 652  public:
 653   // Backtrace
 654   static oop backtrace(oop throwable);
 655   static void set_backtrace(oop throwable, oop value);
 656   static int depth(oop throwable);
 657   static void set_depth(oop throwable, int value);
 658   // Message
 659   static int get_detailMessage_offset() { CHECK_INIT(_detailMessage_offset); }
 660   static oop message(oop throwable);
 661   static const char* message_as_utf8(oop throwable);
 662   static void set_message(oop throwable, oop value);
 663 
 664   static oop cause(oop throwable);
 665 
 666   static void print_stack_element(outputStream *st, Method* method, int bci);
 667 
 668   static void compute_offsets();
 669   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 670 
 671   // Allocate space for backtrace (created but stack trace not filled in)
 672   static void allocate_backtrace(Handle throwable, TRAPS);
 673   // Fill in current stack trace for throwable with preallocated backtrace (no GC)
 674   static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable);
 675   // Fill in current stack trace, can cause GC
 676   static void fill_in_stack_trace(Handle throwable, const methodHandle& method, TRAPS);
 677   static void fill_in_stack_trace(Handle throwable, const methodHandle& method = methodHandle());
 678 
 679   // Programmatic access to stack trace
 680   static void get_stack_trace_elements(int depth, Handle backtrace, objArrayHandle stack_trace, TRAPS);
 681 
 682   // For recreating class initialization error exceptions.
 683   static Handle create_initialization_error(JavaThread* current, Handle throwable);
 684 
 685   static oop create_exception_instance(Symbol* class_name, TRAPS);
 686 
 687     // Printing
 688   static void print(oop throwable, outputStream* st);
 689   static void print_stack_trace(Handle throwable, outputStream* st);
 690   static void java_printStackTrace(Handle throwable, TRAPS);
 691   // Debugging
 692   friend class JavaClasses;
 693   // Gets the method and bci of the top frame (TOS). Returns false if this failed.
 694   static bool get_top_method_and_bci(oop throwable, Method** method, int* bci);
 695 };
 696 
 697 
 698 // Interface to java.lang.reflect.AccessibleObject objects
 699 
 700 class java_lang_reflect_AccessibleObject: AllStatic {
 701  private:
 702   // Note that to reduce dependencies on the JDK we compute these
 703   // offsets at run-time.
 704   static int _override_offset;
 705 
 706   static void compute_offsets();
 707 
 708  public:
 709   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 710 
 711   // Accessors
 712   static jboolean override(oop reflect);
 713   static void set_override(oop reflect, jboolean value);
 714 
 715   // Debugging
 716   friend class JavaClasses;
 717 };
 718 
 719 
 720 // Interface to java.lang.reflect.Method objects
 721 
 722 class java_lang_reflect_Method : public java_lang_reflect_AccessibleObject {
 723  private:
 724   // Note that to reduce dependencies on the JDK we compute these
 725   // offsets at run-time.
 726   static int _clazz_offset;
 727   static int _name_offset;
 728   static int _returnType_offset;
 729   static int _parameterTypes_offset;
 730   static int _exceptionTypes_offset;
 731   static int _slot_offset;
 732   static int _modifiers_offset;
 733   static int _signature_offset;
 734   static int _annotations_offset;
 735   static int _parameter_annotations_offset;
 736   static int _annotation_default_offset;
 737 
 738   static void compute_offsets();
 739  public:
 740   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 741 
 742   // Allocation
 743   static Handle create(TRAPS);
 744 
 745   // Accessors
 746   static oop clazz(oop reflect);
 747   static void set_clazz(oop reflect, oop value);
 748 
 749   static void set_name(oop method, oop value);
 750 
 751   static oop return_type(oop method);
 752   static void set_return_type(oop method, oop value);
 753 
 754   static oop parameter_types(oop method);
 755   static void set_parameter_types(oop method, oop value);
 756 
 757   static int slot(oop reflect);
 758   static void set_slot(oop reflect, int value);
 759 
 760   static void set_exception_types(oop method, oop value);
 761   static void set_modifiers(oop method, int value);
 762   static void set_signature(oop method, oop value);
 763   static void set_annotations(oop method, oop value);
 764   static void set_parameter_annotations(oop method, oop value);
 765   static void set_annotation_default(oop method, oop value);
 766 
 767   // Debugging
 768   friend class JavaClasses;
 769 };
 770 
 771 
 772 // Interface to java.lang.reflect.Constructor objects
 773 
 774 class java_lang_reflect_Constructor : public java_lang_reflect_AccessibleObject {
 775  private:
 776   // Note that to reduce dependencies on the JDK we compute these
 777   // offsets at run-time.
 778   static int _clazz_offset;
 779   static int _parameterTypes_offset;
 780   static int _exceptionTypes_offset;
 781   static int _slot_offset;
 782   static int _modifiers_offset;
 783   static int _signature_offset;
 784   static int _annotations_offset;
 785   static int _parameter_annotations_offset;
 786 
 787   static void compute_offsets();
 788  public:
 789   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 790 
 791   // Allocation
 792   static Handle create(TRAPS);
 793 
 794   // Accessors
 795   static oop clazz(oop reflect);
 796   static void set_clazz(oop reflect, oop value);
 797 
 798   static oop parameter_types(oop constructor);
 799   static void set_parameter_types(oop constructor, oop value);
 800 
 801   static int slot(oop reflect);
 802   static void set_slot(oop reflect, int value);
 803 
 804   static void set_exception_types(oop constructor, oop value);
 805   static void set_modifiers(oop constructor, int value);
 806   static void set_signature(oop constructor, oop value);
 807   static void set_annotations(oop constructor, oop value);
 808   static void set_parameter_annotations(oop method, oop value);
 809 
 810   // Debugging
 811   friend class JavaClasses;
 812 };
 813 
 814 
 815 // Interface to java.lang.reflect.Field objects
 816 
 817 class java_lang_reflect_Field : public java_lang_reflect_AccessibleObject {
 818  private:
 819   // Note that to reduce dependencies on the JDK we compute these
 820   // offsets at run-time.
 821   static int _clazz_offset;
 822   static int _name_offset;
 823   static int _type_offset;
 824   static int _slot_offset;
 825   static int _modifiers_offset;
 826   static int _trusted_final_offset;
 827   static int _signature_offset;
 828   static int _annotations_offset;
 829 
 830   static void compute_offsets();
 831 
 832  public:
 833   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 834 
 835   // Allocation
 836   static Handle create(TRAPS);
 837 
 838   // Accessors
 839   static oop clazz(oop reflect);
 840   static void set_clazz(oop reflect, oop value);
 841 
 842   static oop name(oop field);
 843   static void set_name(oop field, oop value);
 844 
 845   static oop type(oop field);
 846   static void set_type(oop field, oop value);
 847 
 848   static int slot(oop reflect);
 849   static void set_slot(oop reflect, int value);
 850 
 851   static int modifiers(oop field);
 852   static void set_modifiers(oop field, int value);
 853 
 854   static void set_trusted_final(oop field);
 855 
 856   static void set_signature(oop constructor, oop value);
 857   static void set_annotations(oop constructor, oop value);
 858 
 859   // Debugging
 860   friend class JavaClasses;
 861 };
 862 
 863 class java_lang_reflect_Parameter {
 864  private:
 865   // Note that to reduce dependencies on the JDK we compute these
 866   // offsets at run-time.
 867   static int _name_offset;
 868   static int _modifiers_offset;
 869   static int _index_offset;
 870   static int _executable_offset;
 871 
 872   static void compute_offsets();
 873 
 874  public:
 875   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 876 
 877   // Allocation
 878   static Handle create(TRAPS);
 879 
 880   // Accessors
 881   static oop name(oop field);
 882   static void set_name(oop field, oop value);
 883 
 884   static int index(oop reflect);
 885   static void set_index(oop reflect, int value);
 886 
 887   static int modifiers(oop reflect);
 888   static void set_modifiers(oop reflect, int value);
 889 
 890   static oop executable(oop constructor);
 891   static void set_executable(oop constructor, oop value);
 892 
 893   friend class JavaClasses;
 894 };
 895 
 896 #define MODULE_INJECTED_FIELDS(macro)                            \
 897   macro(java_lang_Module, module_entry, intptr_signature, false)
 898 
 899 class java_lang_Module {
 900   private:
 901     static int _loader_offset;
 902     static int _name_offset;
 903     static int _module_entry_offset;
 904 
 905     static void compute_offsets();
 906 
 907   public:
 908     static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 909 
 910     // Allocation
 911     static Handle create(Handle loader, Handle module_name, TRAPS);
 912 
 913     // Testers
 914     static bool is_instance(oop obj);
 915 
 916     // Accessors
 917     static oop loader(oop module);
 918     static void set_loader(oop module, oop value);
 919 
 920     // CDS
 921     static int module_entry_offset() { return _module_entry_offset; }
 922 
 923     static oop name(oop module);
 924     static void set_name(oop module, oop value);
 925 
 926     static ModuleEntry* module_entry(oop module);
 927     static ModuleEntry* module_entry_raw(oop module);
 928     static void set_module_entry(oop module, ModuleEntry* module_entry);
 929 
 930   friend class JavaClasses;
 931 };
 932 
 933 // Interface to jdk.internal.reflect.ConstantPool objects
 934 class reflect_ConstantPool {
 935  private:
 936   // Note that to reduce dependencies on the JDK we compute these
 937   // offsets at run-time.
 938   static int _oop_offset;
 939 
 940   static void compute_offsets();
 941 
 942  public:
 943   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 944 
 945   // Allocation
 946   static Handle create(TRAPS);
 947 
 948   // Accessors
 949   static void set_cp(oop reflect, ConstantPool* value);
 950   static int oop_offset() { CHECK_INIT(_oop_offset); }
 951 
 952   static ConstantPool* get_cp(oop reflect);
 953 
 954   // Debugging
 955   friend class JavaClasses;
 956 };
 957 
 958 
 959 // Interface to java.lang primitive type boxing objects:
 960 //  - java.lang.Boolean
 961 //  - java.lang.Character
 962 //  - java.lang.Float
 963 //  - java.lang.Double
 964 //  - java.lang.Byte
 965 //  - java.lang.Short
 966 //  - java.lang.Integer
 967 //  - java.lang.Long
 968 
 969 // This could be separated out into 8 individual classes.
 970 
 971 class java_lang_boxing_object: AllStatic {
 972  private:
 973   static int _value_offset;
 974   static int _long_value_offset;
 975 
 976   static void compute_offsets();
 977   static oop initialize_and_allocate(BasicType type, TRAPS);
 978  public:
 979   // Allocation. Returns a boxed value, or null for invalid type.
 980   static oop create(BasicType type, jvalue* value, TRAPS);
 981   // Accessors. Returns the basic type being boxed, or T_ILLEGAL for invalid oop.
 982   static BasicType get_value(oop box, jvalue* value);
 983   static BasicType set_value(oop box, jvalue* value);
 984   static BasicType basic_type(oop box);
 985   static bool is_instance(oop box)                 { return basic_type(box) != T_ILLEGAL; }
 986   static bool is_instance(oop box, BasicType type) { return basic_type(box) == type; }
 987   static void print(oop box, outputStream* st)     { jvalue value;  print(get_value(box, &value), &value, st); }
 988   static void print(BasicType type, jvalue* value, outputStream* st);
 989 
 990   static int value_offset(BasicType type) {
 991     return is_double_word_type(type) ? _long_value_offset : _value_offset;
 992   }
 993 
 994   static void serialize_offsets(SerializeClosure* f);
 995 
 996   // Debugging
 997   friend class JavaClasses;
 998 };
 999 
1000 
1001 
1002 // Interface to java.lang.ref.Reference objects
1003 
1004 class java_lang_ref_Reference: AllStatic {
1005   static int _referent_offset;
1006   static int _queue_offset;
1007   static int _next_offset;
1008   static int _discovered_offset;
1009 
1010   static bool _offsets_initialized;
1011 
1012  public:
1013   // Accessors
1014   static inline oop weak_referent_no_keepalive(oop ref);
1015   static inline oop weak_referent(oop ref);
1016   static inline oop phantom_referent_no_keepalive(oop ref);
1017   static inline oop unknown_referent_no_keepalive(oop ref);
1018   static inline void clear_referent(oop ref);
1019   static inline void clear_referent_raw(oop ref);
1020   static inline HeapWord* referent_addr_raw(oop ref);
1021   static inline oop next(oop ref);
1022   static inline void set_next(oop ref, oop value);
1023   static inline void set_next_raw(oop ref, oop value);
1024   static inline HeapWord* next_addr_raw(oop ref);
1025   static inline oop discovered(oop ref);
1026   static inline void set_discovered(oop ref, oop value);
1027   static inline void set_discovered_raw(oop ref, oop value);
1028   static inline HeapWord* discovered_addr_raw(oop ref);
1029   static bool is_referent_field(oop obj, ptrdiff_t offset);
1030   static inline bool is_final(oop ref);
1031   static inline bool is_phantom(oop ref);
1032   static inline bool is_weak(oop ref);
1033   static inline bool is_soft(oop ref);
1034 
1035   static int referent_offset()    { CHECK_INIT(_referent_offset); }
1036   static int queue_offset()       { CHECK_INIT(_queue_offset); }
1037   static int next_offset()        { CHECK_INIT(_next_offset); }
1038   static int discovered_offset()  { CHECK_INIT(_discovered_offset); }
1039 
1040   static void compute_offsets();
1041   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1042 };
1043 
1044 
1045 // Interface to java.lang.ref.SoftReference objects
1046 
1047 class java_lang_ref_SoftReference: public java_lang_ref_Reference {
1048   static int _timestamp_offset;
1049   static int _static_clock_offset;
1050 
1051  public:
1052   // Accessors
1053   static jlong timestamp(oop ref);
1054 
1055   // Accessors for statics
1056   static jlong clock();
1057   static void set_clock(jlong value);
1058 
1059   static void compute_offsets();
1060   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1061 };
1062 
1063 // Interface to java.lang.invoke.MethodHandle objects
1064 
1065 class java_lang_invoke_MethodHandle: AllStatic {
1066   friend class JavaClasses;
1067 
1068  private:
1069   static int _type_offset;               // the MethodType of this MH
1070   static int _form_offset;               // the LambdaForm of this MH
1071 
1072   static void compute_offsets();
1073 
1074  public:
1075   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1076 
1077   // Accessors
1078   static oop            type(oop mh);
1079   static void       set_type(oop mh, oop mtype);
1080 
1081   static oop            form(oop mh);
1082   static void       set_form(oop mh, oop lform);
1083 
1084   // Testers
1085   static bool is_subclass(Klass* klass) {
1086     return klass->is_subclass_of(vmClasses::MethodHandle_klass());
1087   }
1088   static bool is_instance(oop obj);
1089 
1090   // Accessors for code generation:
1091   static int type_offset()             { CHECK_INIT(_type_offset); }
1092   static int form_offset()             { CHECK_INIT(_form_offset); }
1093 };
1094 
1095 // Interface to java.lang.invoke.DirectMethodHandle objects
1096 
1097 class java_lang_invoke_DirectMethodHandle: AllStatic {
1098   friend class JavaClasses;
1099 
1100  private:
1101   static int _member_offset;               // the MemberName of this DMH
1102 
1103   static void compute_offsets();
1104 
1105  public:
1106   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1107 
1108   // Accessors
1109   static oop  member(oop mh);
1110 
1111   // Testers
1112   static bool is_subclass(Klass* klass) {
1113     return klass->is_subclass_of(vmClasses::DirectMethodHandle_klass());
1114   }
1115   static bool is_instance(oop obj);
1116 
1117   // Accessors for code generation:
1118   static int member_offset()           { CHECK_INIT(_member_offset); }
1119 };
1120 
1121 // Interface to java.lang.invoke.LambdaForm objects
1122 // (These are a private interface for managing adapter code generation.)
1123 
1124 class java_lang_invoke_LambdaForm: AllStatic {
1125   friend class JavaClasses;
1126 
1127  private:
1128   static int _vmentry_offset;  // type is MemberName
1129 
1130   static void compute_offsets();
1131 
1132  public:
1133   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1134 
1135   // Accessors
1136   static oop            vmentry(oop lform);
1137 
1138   // Testers
1139   static bool is_subclass(Klass* klass) {
1140     return vmClasses::LambdaForm_klass() != nullptr &&
1141       klass->is_subclass_of(vmClasses::LambdaForm_klass());
1142   }
1143   static bool is_instance(oop obj);
1144 
1145   // Accessors for code generation:
1146   static int vmentry_offset()          { CHECK_INIT(_vmentry_offset); }
1147 };
1148 
1149 // Interface to java.lang.invoke.NativeEntryPoint objects
1150 // (These are a private interface for managing adapter code generation.)
1151 
1152 class jdk_internal_foreign_abi_NativeEntryPoint: AllStatic {
1153   friend class JavaClasses;
1154 
1155  private:
1156   static int _method_type_offset;
1157   static int _downcall_stub_address_offset;
1158 
1159   static void compute_offsets();
1160 
1161  public:
1162   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1163 
1164   // Accessors
1165   static oop        method_type(oop entry);
1166   static jlong      downcall_stub_address(oop entry);
1167 
1168   // Testers
1169   static bool is_subclass(Klass* klass) {
1170     return vmClasses::NativeEntryPoint_klass() != nullptr &&
1171       klass->is_subclass_of(vmClasses::NativeEntryPoint_klass());
1172   }
1173   static bool is_instance(oop obj);
1174 
1175   // Accessors for code generation:
1176   static int method_type_offset_in_bytes()           { return _method_type_offset; }
1177   static int downcall_stub_address_offset_in_bytes() { return _downcall_stub_address_offset; }
1178 };
1179 
1180 class jdk_internal_foreign_abi_ABIDescriptor: AllStatic {
1181   friend class JavaClasses;
1182 
1183  private:
1184   static int _inputStorage_offset;
1185   static int _outputStorage_offset;
1186   static int _volatileStorage_offset;
1187   static int _stackAlignment_offset;
1188   static int _shadowSpace_offset;
1189   static int _scratch1_offset;
1190   static int _scratch2_offset;
1191 
1192   static void compute_offsets();
1193 
1194  public:
1195   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1196 
1197   // Accessors
1198   static objArrayOop inputStorage(oop entry);
1199   static objArrayOop outputStorage(oop entry);
1200   static objArrayOop volatileStorage(oop entry);
1201   static jint        stackAlignment(oop entry);
1202   static jint        shadowSpace(oop entry);
1203   static oop         scratch1(oop entry);
1204   static oop         scratch2(oop entry);
1205 
1206   // Testers
1207   static bool is_subclass(Klass* klass) {
1208     return vmClasses::ABIDescriptor_klass() != nullptr &&
1209       klass->is_subclass_of(vmClasses::ABIDescriptor_klass());
1210   }
1211   static bool is_instance(oop obj);
1212 };
1213 
1214 class jdk_internal_foreign_abi_VMStorage: AllStatic {
1215   friend class JavaClasses;
1216 
1217  private:
1218   static int _type_offset;
1219   static int _indexOrOffset_offset;
1220   static int _segmentMaskOrSize_offset;
1221   static int _debugName_offset;
1222 
1223   static void compute_offsets();
1224 
1225  public:
1226   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1227 
1228   // Accessors
1229   static jbyte  type(oop entry);
1230   static jint   index_or_offset(oop entry);
1231   static jshort segment_mask_or_size(oop entry);
1232   static oop    debugName(oop entry);
1233 
1234   // Testers
1235   static bool is_subclass(Klass* klass) {
1236     return vmClasses::VMStorage_klass() != nullptr &&
1237       klass->is_subclass_of(vmClasses::VMStorage_klass());
1238   }
1239   static bool is_instance(oop obj);
1240 };
1241 
1242 class jdk_internal_foreign_abi_CallConv: AllStatic {
1243   friend class JavaClasses;
1244 
1245  private:
1246   static int _argRegs_offset;
1247   static int _retRegs_offset;
1248 
1249   static void compute_offsets();
1250 
1251  public:
1252   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1253 
1254   // Accessors
1255   static objArrayOop argRegs(oop entry);
1256   static objArrayOop retRegs(oop entry);
1257 
1258   // Testers
1259   static bool is_subclass(Klass* klass) {
1260     return vmClasses::CallConv_klass() != nullptr &&
1261       klass->is_subclass_of(vmClasses::CallConv_klass());
1262   }
1263   static bool is_instance(oop obj);
1264 };
1265 
1266 // Interface to java.lang.invoke.MemberName objects
1267 // (These are a private interface for Java code to query the class hierarchy.)
1268 
1269 #define RESOLVEDMETHOD_INJECTED_FIELDS(macro)                                   \
1270   macro(java_lang_invoke_ResolvedMethodName, vmtarget, intptr_signature, false)
1271 
1272 class java_lang_invoke_ResolvedMethodName : AllStatic {
1273   friend class JavaClasses;
1274 
1275   static int _vmtarget_offset;
1276   static int _vmholder_offset;
1277 
1278   static void compute_offsets();
1279  public:
1280   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1281 
1282   static int vmtarget_offset() { CHECK_INIT(_vmtarget_offset); }
1283 
1284   static Method* vmtarget(oop resolved_method);
1285   static void set_vmtarget(oop resolved_method, Method* method);
1286 
1287   static void set_vmholder(oop resolved_method, oop holder);
1288 
1289   // find or create resolved member name
1290   static oop find_resolved_method(const methodHandle& m, TRAPS);
1291 
1292   static bool is_instance(oop resolved_method);
1293 };
1294 
1295 
1296 #define MEMBERNAME_INJECTED_FIELDS(macro)                               \
1297   macro(java_lang_invoke_MemberName, vmindex,  intptr_signature, false)
1298 
1299 
1300 class java_lang_invoke_MemberName: AllStatic {
1301   friend class JavaClasses;
1302 
1303  private:
1304   // From java.lang.invoke.MemberName:
1305   //    private Class<?>   clazz;       // class in which the method is defined
1306   //    private String     name;        // may be null if not yet materialized
1307   //    private Object     type;        // may be null if not yet materialized
1308   //    private int        flags;       // modifier bits; see reflect.Modifier
1309   //    private ResolvedMethodName method;    // holds VM-specific target value
1310   //    private intptr_t   vmindex;     // member index within class or interface
1311   static int _clazz_offset;
1312   static int _name_offset;
1313   static int _type_offset;
1314   static int _flags_offset;
1315   static int _method_offset;
1316   static int _vmindex_offset;
1317 
1318   static void compute_offsets();
1319 
1320  public:
1321   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1322   // Accessors
1323   static oop            clazz(oop mname);
1324   static void       set_clazz(oop mname, oop clazz);
1325 
1326   static oop            type(oop mname);
1327   static void       set_type(oop mname, oop type);
1328 
1329   static oop            name(oop mname);
1330   static void       set_name(oop mname, oop name);
1331 
1332   static int            flags(oop mname);
1333   static void       set_flags(oop mname, int flags);
1334 
1335   // Link through ResolvedMethodName field to get Method*
1336   static Method*        vmtarget(oop mname);
1337   static void       set_method(oop mname, oop method);
1338 
1339   static intptr_t       vmindex(oop mname);
1340   static void       set_vmindex(oop mname, intptr_t index);
1341 
1342   // Testers
1343   static bool is_subclass(Klass* klass) {
1344     return klass->is_subclass_of(vmClasses::MemberName_klass());
1345   }
1346   static bool is_instance(oop obj);
1347 
1348   static bool is_method(oop obj);
1349 
1350   // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
1351   enum {
1352     MN_IS_METHOD             = 0x00010000, // method (not constructor)
1353     MN_IS_CONSTRUCTOR        = 0x00020000, // constructor
1354     MN_IS_FIELD              = 0x00040000, // field
1355     MN_IS_TYPE               = 0x00080000, // nested type
1356     MN_CALLER_SENSITIVE      = 0x00100000, // @CallerSensitive annotation detected
1357     MN_TRUSTED_FINAL         = 0x00200000, // trusted final field
1358     MN_HIDDEN_MEMBER         = 0x00400000, // @Hidden annotation detected
1359     MN_REFERENCE_KIND_SHIFT  = 24, // refKind
1360     MN_REFERENCE_KIND_MASK   = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
1361     MN_NESTMATE_CLASS        = 0x00000001,
1362     MN_HIDDEN_CLASS          = 0x00000002,
1363     MN_STRONG_LOADER_LINK    = 0x00000004,
1364     MN_ACCESS_VM_ANNOTATIONS = 0x00000008,
1365     // Lookup modes
1366     MN_MODULE_MODE           = 0x00000010,
1367     MN_UNCONDITIONAL_MODE    = 0x00000020,
1368     MN_TRUSTED_MODE          = -1
1369   };
1370 
1371   // Accessors for code generation:
1372   static int clazz_offset()   { CHECK_INIT(_clazz_offset); }
1373   static int type_offset()    { CHECK_INIT(_type_offset); }
1374   static int flags_offset()   { CHECK_INIT(_flags_offset); }
1375   static int method_offset()  { CHECK_INIT(_method_offset); }
1376   static int vmindex_offset() { CHECK_INIT(_vmindex_offset); }
1377 };
1378 
1379 
1380 // Interface to java.lang.invoke.MethodType objects
1381 
1382 class java_lang_invoke_MethodType: AllStatic {
1383   friend class JavaClasses;
1384 
1385  private:
1386   static int _rtype_offset;
1387   static int _ptypes_offset;
1388 
1389   static void compute_offsets();
1390 
1391  public:
1392   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1393   // Accessors
1394   static oop            rtype(oop mt);
1395   static objArrayOop    ptypes(oop mt);
1396 
1397   static oop            ptype(oop mt, int index);
1398   static int            ptype_count(oop mt);
1399 
1400   static int            ptype_slot_count(oop mt);  // extra counts for long/double
1401   static int            rtype_slot_count(oop mt);  // extra counts for long/double
1402 
1403   static Symbol*        as_signature(oop mt, bool intern_if_not_found);
1404   static void           print_signature(oop mt, outputStream* st);
1405 
1406   static bool is_instance(oop obj);
1407 
1408   static bool equals(oop mt1, oop mt2);
1409 
1410   // Accessors for code generation:
1411   static int rtype_offset()  { CHECK_INIT(_rtype_offset); }
1412   static int ptypes_offset() { CHECK_INIT(_ptypes_offset); }
1413 };
1414 
1415 
1416 // Interface to java.lang.invoke.CallSite objects
1417 
1418 class java_lang_invoke_CallSite: AllStatic {
1419   friend class JavaClasses;
1420 
1421 private:
1422   static int _target_offset;
1423   static int _context_offset;
1424 
1425   static void compute_offsets();
1426 
1427 public:
1428   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1429   // Accessors
1430   static oop              target(          oop site);
1431   static void         set_target(          oop site, oop target);
1432   static void         set_target_volatile( oop site, oop target);
1433 
1434   static oop context_no_keepalive(oop site);
1435 
1436   // Testers
1437   static bool is_subclass(Klass* klass) {
1438     return klass->is_subclass_of(vmClasses::CallSite_klass());
1439   }
1440   static bool is_instance(oop obj);
1441 
1442   // Accessors for code generation:
1443   static int target_offset()  { CHECK_INIT(_target_offset); }
1444   static int context_offset() { CHECK_INIT(_context_offset); }
1445 };
1446 
1447 // Interface to java.lang.invoke.ConstantCallSite objects
1448 
1449 class java_lang_invoke_ConstantCallSite: AllStatic {
1450   friend class JavaClasses;
1451 
1452 private:
1453   static int _is_frozen_offset;
1454 
1455   static void compute_offsets();
1456 
1457 public:
1458   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1459   // Accessors
1460   static jboolean is_frozen(oop site);
1461 
1462   // Testers
1463   static bool is_subclass(Klass* klass) {
1464     return klass->is_subclass_of(vmClasses::ConstantCallSite_klass());
1465   }
1466   static bool is_instance(oop obj);
1467 };
1468 
1469 // Interface to java.lang.invoke.MethodHandleNatives$CallSiteContext objects
1470 
1471 #define CALLSITECONTEXT_INJECTED_FIELDS(macro) \
1472   macro(java_lang_invoke_MethodHandleNatives_CallSiteContext, vmdependencies, intptr_signature, false) \
1473   macro(java_lang_invoke_MethodHandleNatives_CallSiteContext, last_cleanup, long_signature, false)
1474 
1475 class DependencyContext;
1476 
1477 class java_lang_invoke_MethodHandleNatives_CallSiteContext : AllStatic {
1478   friend class JavaClasses;
1479 
1480 private:
1481   static int _vmdependencies_offset;
1482   static int _last_cleanup_offset;
1483 
1484   static void compute_offsets();
1485 
1486 public:
1487   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1488   // Accessors
1489   static DependencyContext vmdependencies(oop context);
1490 
1491   // Testers
1492   static bool is_subclass(Klass* klass) {
1493     return klass->is_subclass_of(vmClasses::Context_klass());
1494   }
1495   static bool is_instance(oop obj);
1496 };
1497 
1498 // Interface to java.lang.ClassLoader objects
1499 
1500 #define CLASSLOADER_INJECTED_FIELDS(macro)                            \
1501   macro(java_lang_ClassLoader, loader_data,  intptr_signature, false)
1502 
1503 class java_lang_ClassLoader : AllStatic {
1504  private:
1505   static int _loader_data_offset;
1506   static int _parent_offset;
1507   static int _parallelCapable_offset;
1508   static int _name_offset;
1509   static int _nameAndId_offset;
1510   static int _unnamedModule_offset;
1511 
1512   static void compute_offsets();
1513 
1514  public:
1515   // Support for CDS
1516   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1517   static int loader_data_offset() { return  _loader_data_offset; }
1518 
1519   static ClassLoaderData* loader_data_acquire(oop loader);
1520   static ClassLoaderData* loader_data(oop loader);
1521   static void release_set_loader_data(oop loader, ClassLoaderData* new_data);
1522 
1523   static oop parent(oop loader);
1524   static oop parent_no_keepalive(oop loader);
1525   static oop name(oop loader);
1526   static oop nameAndId(oop loader);
1527   static bool isAncestor(oop loader, oop cl);
1528 
1529   // Support for parallelCapable field
1530   static bool parallelCapable(oop the_class_mirror);
1531 
1532   static bool is_trusted_loader(oop loader);
1533 
1534   // Testers
1535   static bool is_subclass(Klass* klass) {
1536     return klass->is_subclass_of(vmClasses::ClassLoader_klass());
1537   }
1538   static bool is_instance(oop obj);
1539 
1540   static oop unnamedModule(oop loader);
1541 
1542   // Debugging
1543   friend class JavaClasses;
1544 };
1545 
1546 
1547 // Interface to java.lang.System objects
1548 
1549 class java_lang_System : AllStatic {
1550  private:
1551   static int _static_in_offset;
1552   static int _static_out_offset;
1553   static int _static_err_offset;
1554 
1555  public:
1556   static int  in_offset() { CHECK_INIT(_static_in_offset); }
1557   static int out_offset() { CHECK_INIT(_static_out_offset); }
1558   static int err_offset() { CHECK_INIT(_static_err_offset); }
1559 
1560   static void compute_offsets();
1561   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1562 
1563   // Debugging
1564   friend class JavaClasses;
1565 };
1566 
1567 
1568 // Interface to java.lang.StackTraceElement objects
1569 
1570 class java_lang_StackTraceElement: AllStatic {
1571  private:
1572   static int _declaringClassObject_offset;
1573   static int _classLoaderName_offset;
1574   static int _moduleName_offset;
1575   static int _moduleVersion_offset;
1576   static int _declaringClass_offset;
1577   static int _methodName_offset;
1578   static int _fileName_offset;
1579   static int _lineNumber_offset;
1580 
1581   // Setters
1582   static void set_classLoaderName(oop element, oop value);
1583   static void set_moduleName(oop element, oop value);
1584   static void set_moduleVersion(oop element, oop value);
1585   static void set_declaringClass(oop element, oop value);
1586   static void set_methodName(oop element, oop value);
1587   static void set_fileName(oop element, oop value);
1588   static void set_lineNumber(oop element, int value);
1589   static void set_declaringClassObject(oop element, oop value);
1590 
1591   static void decode_file_and_line(Handle java_mirror, InstanceKlass* holder, int version,
1592                                    const methodHandle& method, int bci,
1593                                    Symbol*& source, oop& source_file, int& line_number, TRAPS);
1594 
1595  public:
1596   // Create an instance of StackTraceElement
1597   static oop create(const methodHandle& method, int bci, TRAPS);
1598 
1599   static void fill_in(Handle element, InstanceKlass* holder, const methodHandle& method,
1600                       int version, int bci, Symbol* name, TRAPS);
1601 
1602   static void compute_offsets();
1603   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1604 
1605 #if INCLUDE_JVMCI
1606   static void decode(const methodHandle& method, int bci, Symbol*& fileName, int& lineNumber, TRAPS);
1607 #endif
1608 
1609   // Debugging
1610   friend class JavaClasses;
1611 };
1612 
1613 
1614 class Backtrace: AllStatic {
1615  public:
1616   // Helper backtrace functions to store bci|version together.
1617   static int merge_bci_and_version(int bci, int version);
1618   static int merge_mid_and_cpref(int mid, int cpref);
1619   static int bci_at(unsigned int merged);
1620   static int version_at(unsigned int merged);
1621   static int mid_at(unsigned int merged);
1622   static int cpref_at(unsigned int merged);
1623   static int get_line_number(Method* method, int bci);
1624   static Symbol* get_source_file_name(InstanceKlass* holder, int version);
1625 
1626   // Debugging
1627   friend class JavaClasses;
1628 };
1629 
1630 class java_lang_ClassFrameInfo: AllStatic {
1631 private:
1632   static int _classOrMemberName_offset;
1633   static int _flags_offset;
1634 
1635 public:
1636   static oop  classOrMemberName(oop info);
1637   static int  flags(oop info);
1638 
1639   // Setters
1640   static void init_class(Handle stackFrame, const methodHandle& m);
1641   static void init_method(Handle stackFrame, const methodHandle& m, TRAPS);
1642 
1643   static void compute_offsets();
1644   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1645 
1646   // Debugging
1647   friend class JavaClasses;
1648 };
1649 
1650 // Interface to java.lang.StackFrameInfo objects
1651 
1652 #define STACKFRAMEINFO_INJECTED_FIELDS(macro)                      \
1653   macro(java_lang_StackFrameInfo, version, short_signature, false)
1654 
1655 class java_lang_StackFrameInfo: AllStatic {
1656 private:
1657   static int _type_offset;
1658   static int _name_offset;
1659   static int _bci_offset;
1660   static int _version_offset;
1661   static int _contScope_offset;
1662 
1663 public:
1664   // Getters
1665   static oop name(oop info);
1666   static oop type(oop info);
1667   static Method* get_method(oop info);
1668 
1669   // Setters
1670   static void set_method_and_bci(Handle stackFrame, const methodHandle& method, int bci, oop cont, TRAPS);
1671   static void set_name(oop info, oop value);
1672   static void set_type(oop info, oop value);
1673   static void set_bci(oop info, int value);
1674 
1675   static void set_version(oop info, short value);
1676   static void set_contScope(oop info, oop value);
1677 
1678   static void compute_offsets();
1679   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1680 
1681   static void to_stack_trace_element(Handle stackFrame, Handle stack_trace_element, TRAPS);
1682 
1683   // Debugging
1684   friend class JavaClasses;
1685 };
1686 
1687 class java_lang_LiveStackFrameInfo: AllStatic {
1688  private:
1689   static int _monitors_offset;
1690   static int _locals_offset;
1691   static int _operands_offset;
1692   static int _mode_offset;
1693 
1694  public:
1695   static void set_monitors(oop info, oop value);
1696   static void set_locals(oop info, oop value);
1697   static void set_operands(oop info, oop value);
1698   static void set_mode(oop info, int value);
1699 
1700   static void compute_offsets();
1701   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1702 
1703   // Debugging
1704   friend class JavaClasses;
1705 };
1706 
1707 // Interface to java.lang.reflect.RecordComponent objects
1708 
1709 class java_lang_reflect_RecordComponent: AllStatic {
1710  private:
1711   static int _clazz_offset;
1712   static int _name_offset;
1713   static int _type_offset;
1714   static int _accessor_offset;
1715   static int _signature_offset;
1716   static int _annotations_offset;
1717   static int _typeAnnotations_offset;
1718 
1719   // Setters
1720   static void set_clazz(oop element, oop value);
1721   static void set_name(oop element, oop value);
1722   static void set_type(oop element, oop value);
1723   static void set_accessor(oop element, oop value);
1724   static void set_signature(oop element, oop value);
1725   static void set_annotations(oop element, oop value);
1726   static void set_typeAnnotations(oop element, oop value);
1727 
1728  public:
1729   // Create an instance of RecordComponent
1730   static oop create(InstanceKlass* holder, RecordComponent* component, TRAPS);
1731 
1732   static void compute_offsets();
1733   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1734 
1735   // Debugging
1736   friend class JavaClasses;
1737 };
1738 
1739 
1740 // Interface to java.lang.AssertionStatusDirectives objects
1741 
1742 class java_lang_AssertionStatusDirectives: AllStatic {
1743  private:
1744   static int _classes_offset;
1745   static int _classEnabled_offset;
1746   static int _packages_offset;
1747   static int _packageEnabled_offset;
1748   static int _deflt_offset;
1749 
1750  public:
1751   // Setters
1752   static void set_classes(oop obj, oop val);
1753   static void set_classEnabled(oop obj, oop val);
1754   static void set_packages(oop obj, oop val);
1755   static void set_packageEnabled(oop obj, oop val);
1756   static void set_deflt(oop obj, bool val);
1757 
1758   static void compute_offsets();
1759   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1760 
1761   // Debugging
1762   friend class JavaClasses;
1763 };
1764 
1765 
1766 class java_util_concurrent_locks_AbstractOwnableSynchronizer : AllStatic {
1767  private:
1768   static int  _owner_offset;
1769  public:
1770   static void compute_offsets();
1771   static oop  get_owner_threadObj(oop obj);
1772   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1773 };
1774 
1775  // Interface to jdk.internal.misc.UnsafeConsants
1776 
1777 class jdk_internal_misc_UnsafeConstants : AllStatic {
1778  public:
1779   static void set_unsafe_constants();
1780   static void compute_offsets() { }
1781   static void serialize_offsets(SerializeClosure* f) { }
1782 };
1783 
1784 // Interface to jdk.internal.vm.vector.VectorSupport.VectorPayload objects
1785 
1786 class vector_VectorPayload : AllStatic {
1787  private:
1788   static int _payload_offset;
1789  public:
1790   static void set_payload(oop o, oop val);
1791 
1792   static void compute_offsets();
1793   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1794 
1795   // Testers
1796   static bool is_subclass(Klass* klass) {
1797     return klass->is_subclass_of(vmClasses::vector_VectorPayload_klass());
1798   }
1799   static bool is_instance(oop obj);
1800 };
1801 
1802 class java_lang_Integer : AllStatic {
1803 public:
1804   static jint value(oop obj);
1805 };
1806 
1807 class java_lang_Long : AllStatic {
1808 public:
1809   static jlong value(oop obj);
1810 };
1811 
1812 class java_lang_Character : AllStatic {
1813 public:
1814   static jchar value(oop obj);
1815 };
1816 
1817 class java_lang_Short : AllStatic {
1818 public:
1819   static jshort value(oop obj);
1820 };
1821 
1822 class java_lang_Byte : AllStatic {
1823 public:
1824   static jbyte value(oop obj);
1825 };
1826 
1827 class java_lang_Boolean : AllStatic {
1828  private:
1829   static int _static_TRUE_offset;
1830   static int _static_FALSE_offset;
1831  public:
1832   static Symbol* symbol();
1833   static void compute_offsets(InstanceKlass* k);
1834   static oop  get_TRUE(InstanceKlass *k);
1835   static oop  get_FALSE(InstanceKlass *k);
1836   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1837   static jboolean value(oop obj);
1838 };
1839 
1840 class java_lang_Integer_IntegerCache : AllStatic {
1841  private:
1842   static int _static_cache_offset;
1843  public:
1844   static Symbol* symbol();
1845   static void compute_offsets(InstanceKlass* k);
1846   static objArrayOop  cache(InstanceKlass *k);
1847   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1848 };
1849 
1850 class java_lang_Long_LongCache : AllStatic {
1851  private:
1852   static int _static_cache_offset;
1853  public:
1854   static Symbol* symbol();
1855   static void compute_offsets(InstanceKlass* k);
1856   static objArrayOop  cache(InstanceKlass *k);
1857   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1858 };
1859 
1860 class java_lang_Character_CharacterCache : AllStatic {
1861  private:
1862   static int _static_cache_offset;
1863  public:
1864   static Symbol* symbol();
1865   static void compute_offsets(InstanceKlass* k);
1866   static objArrayOop  cache(InstanceKlass *k);
1867   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1868 };
1869 
1870 class java_lang_Short_ShortCache : AllStatic {
1871  private:
1872   static int _static_cache_offset;
1873  public:
1874   static Symbol* symbol();
1875   static void compute_offsets(InstanceKlass* k);
1876   static objArrayOop  cache(InstanceKlass *k);
1877   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1878 };
1879 
1880 class java_lang_Byte_ByteCache : AllStatic {
1881  private:
1882   static int _static_cache_offset;
1883  public:
1884   static Symbol* symbol();
1885   static void compute_offsets(InstanceKlass* k);
1886   static objArrayOop  cache(InstanceKlass *k);
1887   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1888 };
1889 
1890 
1891 // Interface to java.lang.InternalError objects
1892 
1893 #define INTERNALERROR_INJECTED_FIELDS(macro)                      \
1894   macro(java_lang_InternalError, during_unsafe_access, bool_signature, false)
1895 
1896 class java_lang_InternalError : AllStatic {
1897  private:
1898   static int _during_unsafe_access_offset;
1899  public:
1900   static jboolean during_unsafe_access(oop internal_error);
1901   static void set_during_unsafe_access(oop internal_error);
1902   static void compute_offsets();
1903   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
1904 };
1905 
1906 // Use to declare fields that need to be injected into Java classes
1907 // for the JVM to use.  The name_index and signature_index are
1908 // declared in vmSymbols.  The may_be_java flag is used to declare
1909 // fields that might already exist in Java but should be injected if
1910 // they don't.  Otherwise the field is unconditionally injected and
1911 // the JVM uses the injected one.  This is to ensure that name
1912 // collisions don't occur.  In general may_be_java should be false
1913 // unless there's a good reason.
1914 
1915 class InjectedField {
1916  public:
1917   const vmClassID klass_id;
1918   const vmSymbolID name_index;
1919   const vmSymbolID signature_index;
1920   const bool           may_be_java;
1921 
1922 
1923   Klass* klass() const      { return vmClasses::klass_at(klass_id); }
1924   Symbol* name() const      { return lookup_symbol(name_index); }
1925   Symbol* signature() const { return lookup_symbol(signature_index); }
1926 
1927   int compute_offset();
1928 
1929   // Find the Symbol for this index
1930   static Symbol* lookup_symbol(vmSymbolID symbol_index) {
1931     return Symbol::vm_symbol_at(symbol_index);
1932   }
1933 };
1934 
1935 
1936 // Interface to hard-coded offset checking
1937 
1938 enum class InjectedFieldID : int;
1939 
1940 class JavaClasses : AllStatic {
1941  private:
1942 
1943   static InjectedField _injected_fields[];
1944 
1945   static bool check_offset(const char *klass_name, int offset, const char *field_name, const char* field_sig) PRODUCT_RETURN0;
1946  public:
1947 
1948   static int compute_injected_offset(InjectedFieldID id);
1949 
1950   static void compute_offsets();
1951   static void check_offsets() PRODUCT_RETURN;
1952   static void serialize_offsets(SerializeClosure* soc) NOT_CDS_RETURN;
1953   static InjectedField* get_injected(Symbol* class_name, int* field_count);
1954   static bool is_supported_for_archiving(oop obj) NOT_CDS_JAVA_HEAP_RETURN_(false);
1955 
1956   static void compute_offset(int &dest_offset,
1957                              InstanceKlass* ik, Symbol* name_symbol, Symbol* signature_symbol,
1958                              bool is_static = false);
1959   static void compute_offset(int& dest_offset, InstanceKlass* ik,
1960                              const char* name_string, Symbol* signature_symbol,
1961                              bool is_static = false);
1962 };
1963 
1964 #undef CHECK_INIT
1965 
1966 #endif // SHARE_CLASSFILE_JAVACLASSES_HPP