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