1 /*
   2  * Copyright (c) 2000, 2025, 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 #include "cds/filemap.hpp"
  26 #include "classfile/classLoaderDataGraph.hpp"
  27 #include "classfile/javaClasses.hpp"
  28 #include "classfile/javaThreadStatus.hpp"
  29 #include "classfile/vmClasses.hpp"
  30 #include "classfile/vmSymbols.hpp"
  31 #include "code/codeBlob.hpp"
  32 #include "code/codeCache.hpp"
  33 #include "code/compiledIC.hpp"
  34 #include "code/compressedStream.hpp"
  35 #include "code/location.hpp"
  36 #include "code/nmethod.hpp"
  37 #include "code/pcDesc.hpp"
  38 #include "code/stubs.hpp"
  39 #include "code/vmreg.hpp"
  40 #include "compiler/compileBroker.hpp"
  41 #include "compiler/oopMap.hpp"
  42 #include "gc/shared/stringdedup/stringDedupThread.hpp"
  43 #include "gc/shared/vmStructs_gc.hpp"
  44 #include "interpreter/bytecodes.hpp"
  45 #include "interpreter/interpreter.hpp"
  46 #include "jfr/recorder/service/jfrRecorderThread.hpp"
  47 #include "logging/logAsyncWriter.hpp"
  48 #include "memory/allocation.inline.hpp"
  49 #include "memory/heap.hpp"
  50 #include "memory/padded.hpp"
  51 #include "memory/referenceType.hpp"
  52 #include "memory/universe.hpp"
  53 #include "memory/virtualspace.hpp"
  54 #include "oops/array.hpp"
  55 #include "oops/arrayKlass.hpp"
  56 #include "oops/arrayOop.hpp"
  57 #include "oops/constantPool.hpp"
  58 #include "oops/constMethod.hpp"
  59 #include "oops/cpCache.hpp"
  60 #include "oops/fieldInfo.hpp"
  61 #include "oops/flatArrayKlass.hpp"
  62 #include "oops/inlineKlass.hpp"
  63 #include "oops/instanceKlass.hpp"
  64 #include "oops/instanceOop.hpp"
  65 #include "oops/klass.hpp"
  66 #include "oops/klassVtable.hpp"
  67 #include "oops/markWord.hpp"
  68 #include "oops/method.hpp"
  69 #include "oops/methodCounters.hpp"
  70 #include "oops/methodData.hpp"
  71 #include "oops/objArrayKlass.hpp"
  72 #include "oops/objArrayOop.hpp"
  73 #include "oops/oop.inline.hpp"
  74 #include "oops/oopHandle.hpp"
  75 #include "oops/resolvedFieldEntry.hpp"
  76 #include "oops/resolvedIndyEntry.hpp"
  77 #include "oops/resolvedMethodEntry.hpp"
  78 #include "oops/symbol.hpp"
  79 #include "oops/typeArrayKlass.hpp"
  80 #include "oops/typeArrayOop.hpp"
  81 #include "prims/jvmtiAgentThread.hpp"
  82 #include "runtime/arguments.hpp"
  83 #include "runtime/deoptimization.hpp"
  84 #include "runtime/flags/jvmFlag.hpp"
  85 #include "runtime/globals.hpp"
  86 #include "runtime/javaCalls.hpp"
  87 #include "runtime/javaThread.hpp"
  88 #include "runtime/jniHandles.hpp"
  89 #include "runtime/monitorDeflationThread.hpp"
  90 #include "runtime/notificationThread.hpp"
  91 #include "runtime/os.hpp"
  92 #include "runtime/osThread.hpp"
  93 #include "runtime/perfMemory.hpp"
  94 #include "runtime/serviceThread.hpp"
  95 #include "runtime/stubRoutines.hpp"
  96 #include "runtime/synchronizer.hpp"
  97 #include "runtime/vframeArray.hpp"
  98 #include "runtime/vm_version.hpp"
  99 #include "runtime/vmStructs.hpp"
 100 #include "services/attachListener.hpp"
 101 #include "utilities/globalDefinitions.hpp"
 102 #include "utilities/macros.hpp"
 103 #include "utilities/vmError.hpp"
 104 #ifdef COMPILER2
 105 #include "opto/optoreg.hpp"
 106 #endif // COMPILER2
 107 
 108 #include CPU_HEADER(vmStructs)
 109 #include OS_HEADER(vmStructs)
 110 
 111 // Note: the cross-product of (c1, c2, product, nonproduct, ...),
 112 // (nonstatic, static), and (unchecked, checked) has not been taken.
 113 // Only the macros currently needed have been defined.
 114 
 115 // A field whose type is not checked is given a null string as the
 116 // type name, indicating an "opaque" type to the serviceability agent.
 117 
 118 // NOTE: there is an interdependency between this file and
 119 // HotSpotTypeDataBase.java, which parses the type strings.
 120 
 121 #ifndef REG_COUNT
 122   #define REG_COUNT 0
 123 #endif
 124 
 125 #if INCLUDE_JVMTI
 126   #define JVMTI_STRUCTS(static_field) \
 127     static_field(JvmtiExport,                     _can_access_local_variables,                  bool)                                  \
 128     static_field(JvmtiExport,                     _can_hotswap_or_post_breakpoint,              bool)                                  \
 129     static_field(JvmtiExport,                     _can_post_on_exceptions,                      bool)                                  \
 130     static_field(JvmtiExport,                     _can_walk_any_space,                          bool)
 131 #else
 132   #define JVMTI_STRUCTS(static_field)
 133 #endif // INCLUDE_JVMTI
 134 
 135 //--------------------------------------------------------------------------------
 136 // VM_STRUCTS
 137 //
 138 // This list enumerates all of the fields the serviceability agent
 139 // needs to know about. Be sure to see also the type table below this one.
 140 // NOTE that there are platform-specific additions to this table in
 141 // vmStructs_<os>_<cpu>.hpp.
 142 
 143 #define VM_STRUCTS(nonstatic_field,                                                                                                  \
 144                    static_field,                                                                                                     \
 145                    volatile_static_field,                                                                                            \
 146                    unchecked_nonstatic_field,                                                                                        \
 147                    volatile_nonstatic_field,                                                                                         \
 148                    nonproduct_nonstatic_field)                                                                                       \
 149                                                                                                                                      \
 150   /*************/                                                                                                                    \
 151   /* GC fields */                                                                                                                    \
 152   /*************/                                                                                                                    \
 153                                                                                                                                      \
 154   VM_STRUCTS_GC(nonstatic_field,                                                                                                     \
 155                 volatile_static_field,                                                                                               \
 156                 volatile_nonstatic_field,                                                                                            \
 157                 static_field,                                                                                                        \
 158                 unchecked_nonstatic_field)                                                                                           \
 159                                                                                                                                      \
 160   /******************************************************************/                                                               \
 161   /* OopDesc and Klass hierarchies (NOTE: MethodData* incomplete)   */                                                               \
 162   /******************************************************************/                                                               \
 163                                                                                                                                      \
 164   volatile_nonstatic_field(oopDesc,            _mark,                                         markWord)                              \
 165   volatile_nonstatic_field(oopDesc,            _metadata._klass,                              Klass*)                                \
 166   volatile_nonstatic_field(oopDesc,            _metadata._compressed_klass,                   narrowKlass)                           \
 167   static_field(BarrierSet,                     _barrier_set,                                  BarrierSet*)                           \
 168   nonstatic_field(ArrayKlass,                  _dimension,                                    int)                                   \
 169   volatile_nonstatic_field(ArrayKlass,         _higher_dimension,                             ObjArrayKlass*)                        \
 170   volatile_nonstatic_field(ArrayKlass,         _lower_dimension,                              ArrayKlass*)                           \
 171   nonstatic_field(ConstantPool,                _tags,                                         Array<u1>*)                            \
 172   nonstatic_field(ConstantPool,                _cache,                                        ConstantPoolCache*)                    \
 173   nonstatic_field(ConstantPool,                _pool_holder,                                  InstanceKlass*)                        \
 174   nonstatic_field(ConstantPool,                _operands,                                     Array<u2>*)                            \
 175   nonstatic_field(ConstantPool,                _resolved_klasses,                             Array<Klass*>*)                        \
 176   nonstatic_field(ConstantPool,                _length,                                       int)                                   \
 177   nonstatic_field(ConstantPool,                _minor_version,                                u2)                                    \
 178   nonstatic_field(ConstantPool,                _major_version,                                u2)                                    \
 179   nonstatic_field(ConstantPool,                _generic_signature_index,                      u2)                                    \
 180   nonstatic_field(ConstantPool,                _source_file_name_index,                       u2)                                    \
 181   nonstatic_field(ConstantPoolCache,           _resolved_references,                          OopHandle)                             \
 182   nonstatic_field(ConstantPoolCache,           _reference_map,                                Array<u2>*)                            \
 183   nonstatic_field(ConstantPoolCache,           _constant_pool,                                ConstantPool*)                         \
 184   nonstatic_field(ConstantPoolCache,           _resolved_field_entries,                       Array<ResolvedFieldEntry>*)            \
 185   nonstatic_field(ResolvedFieldEntry,          _cpool_index,                                  u2)                                    \
 186   nonstatic_field(ConstantPoolCache,           _resolved_method_entries,                      Array<ResolvedMethodEntry>*)           \
 187   nonstatic_field(ResolvedMethodEntry,         _cpool_index,                                  u2)                                    \
 188   nonstatic_field(ConstantPoolCache,           _resolved_indy_entries,                        Array<ResolvedIndyEntry>*)             \
 189   nonstatic_field(ResolvedIndyEntry,           _cpool_index,                                  u2)                                    \
 190   volatile_nonstatic_field(InstanceKlass,      _array_klasses,                                ObjArrayKlass*)                        \
 191   nonstatic_field(InstanceKlass,               _methods,                                      Array<Method*>*)                       \
 192   nonstatic_field(InstanceKlass,               _default_methods,                              Array<Method*>*)                       \
 193   nonstatic_field(InstanceKlass,               _local_interfaces,                             Array<InstanceKlass*>*)                \
 194   nonstatic_field(InstanceKlass,               _transitive_interfaces,                        Array<InstanceKlass*>*)                \
 195   nonstatic_field(InstanceKlass,               _fieldinfo_stream,                             Array<u1>*)                            \
 196   nonstatic_field(InstanceKlass,               _constants,                                    ConstantPool*)                         \
 197   nonstatic_field(InstanceKlass,               _source_debug_extension,                       const char*)                           \
 198   nonstatic_field(InstanceKlass,               _inner_classes,                                Array<jushort>*)                       \
 199   nonstatic_field(InstanceKlass,               _nest_members,                                 Array<jushort>*)                       \
 200   nonstatic_field(InstanceKlass,               _nonstatic_field_size,                         int)                                   \
 201   nonstatic_field(InstanceKlass,               _static_field_size,                            int)                                   \
 202   nonstatic_field(InstanceKlass,               _static_oop_field_count,                       u2)                                    \
 203   nonstatic_field(InstanceKlass,               _nonstatic_oop_map_size,                       int)                                   \
 204   volatile_nonstatic_field(InstanceKlass,      _init_state,                                   InstanceKlass::ClassState)             \
 205   volatile_nonstatic_field(InstanceKlass,      _init_thread,                                  JavaThread*)                           \
 206   nonstatic_field(InstanceKlass,               _itable_len,                                   int)                                   \
 207   nonstatic_field(InstanceKlass,               _nest_host_index,                              u2)                                    \
 208   nonstatic_field(InstanceKlass,               _reference_type,                               u1)                                    \
 209   volatile_nonstatic_field(InstanceKlass,      _oop_map_cache,                                OopMapCache*)                          \
 210   nonstatic_field(InstanceKlass,               _jni_ids,                                      JNIid*)                                \
 211   nonstatic_field(InstanceKlass,               _osr_nmethods_head,                            nmethod*)                              \
 212   JVMTI_ONLY(nonstatic_field(InstanceKlass,    _breakpoints,                                  BreakpointInfo*))                      \
 213   volatile_nonstatic_field(InstanceKlass,      _methods_jmethod_ids,                          jmethodID*)                            \
 214   volatile_nonstatic_field(InstanceKlass,      _idnum_allocated_count,                        u2)                                    \
 215   nonstatic_field(InstanceKlass,               _annotations,                                  Annotations*)                          \
 216   nonstatic_field(InstanceKlass,               _method_ordering,                              Array<int>*)                           \
 217   nonstatic_field(InstanceKlass,               _default_vtable_indices,                       Array<int>*)                           \
 218   nonstatic_field(Klass,                       _super_check_offset,                           juint)                                 \
 219   nonstatic_field(Klass,                       _secondary_super_cache,                        Klass*)                                \
 220   nonstatic_field(Klass,                       _secondary_supers,                             Array<Klass*>*)                        \
 221   nonstatic_field(Klass,                       _primary_supers[0],                            Klass*)                                \
 222   nonstatic_field(Klass,                       _java_mirror,                                  OopHandle)                             \
 223   nonstatic_field(Klass,                       _super,                                        Klass*)                                \
 224   volatile_nonstatic_field(Klass,              _subklass,                                     Klass*)                                \
 225   nonstatic_field(Klass,                       _layout_helper,                                jint)                                  \
 226   nonstatic_field(Klass,                       _name,                                         Symbol*)                               \
 227   nonstatic_field(Klass,                       _access_flags,                                 AccessFlags)                           \
 228   volatile_nonstatic_field(Klass,              _next_sibling,                                 Klass*)                                \
 229   nonstatic_field(Klass,                       _next_link,                                    Klass*)                                \
 230   nonstatic_field(Klass,                       _vtable_len,                                   int)                                   \
 231   nonstatic_field(Klass,                       _class_loader_data,                            ClassLoaderData*)                      \
 232   nonstatic_field(vtableEntry,                 _method,                                       Method*)                               \
 233   nonstatic_field(MethodData,                  _size,                                         int)                                   \
 234   nonstatic_field(MethodData,                  _method,                                       Method*)                               \
 235   nonstatic_field(MethodData,                  _data_size,                                    int)                                   \
 236   nonstatic_field(MethodData,                  _data[0],                                      intptr_t)                              \
 237   nonstatic_field(MethodData,                  _parameters_type_data_di,                      int)                                   \
 238   nonstatic_field(MethodData,                  _compiler_counters._nof_decompiles,            uint)                                  \
 239   nonstatic_field(MethodData,                  _compiler_counters._nof_overflow_recompiles,   uint)                                  \
 240   nonstatic_field(MethodData,                  _compiler_counters._nof_overflow_traps,        uint)                                  \
 241   nonstatic_field(MethodData,                  _compiler_counters._trap_hist._array[0],       u1)                                    \
 242   nonstatic_field(MethodData,                  _eflags,                                       intx)                                  \
 243   nonstatic_field(MethodData,                  _arg_local,                                    intx)                                  \
 244   nonstatic_field(MethodData,                  _arg_stack,                                    intx)                                  \
 245   nonstatic_field(MethodData,                  _arg_returned,                                 intx)                                  \
 246   nonstatic_field(MethodData,                  _tenure_traps,                                 uint)                                  \
 247   nonstatic_field(MethodData,                  _invoke_mask,                                  int)                                   \
 248   nonstatic_field(MethodData,                  _backedge_mask,                                int)                                   \
 249   nonstatic_field(DataLayout,                  _header._struct._tag,                          u1)                                    \
 250   nonstatic_field(DataLayout,                  _header._struct._flags,                        u1)                                    \
 251   nonstatic_field(DataLayout,                  _header._struct._bci,                          u2)                                    \
 252   nonstatic_field(DataLayout,                  _header._struct._traps,                        u4)                                    \
 253   nonstatic_field(DataLayout,                  _cells[0],                                     intptr_t)                              \
 254   nonstatic_field(MethodCounters,              _invoke_mask,                                  int)                                   \
 255   nonstatic_field(MethodCounters,              _backedge_mask,                                int)                                   \
 256   COMPILER2_OR_JVMCI_PRESENT(nonstatic_field(MethodCounters, _interpreter_throwout_count,     u2))                                   \
 257   JVMTI_ONLY(nonstatic_field(MethodCounters,   _number_of_breakpoints,                        u2))                                   \
 258   nonstatic_field(MethodCounters,              _invocation_counter,                           InvocationCounter)                     \
 259   nonstatic_field(MethodCounters,              _backedge_counter,                             InvocationCounter)                     \
 260   nonstatic_field(Method,                      _constMethod,                                  ConstMethod*)                          \
 261   nonstatic_field(Method,                      _method_data,                                  MethodData*)                           \
 262   nonstatic_field(Method,                      _method_counters,                              MethodCounters*)                       \
 263   nonstatic_field(Method,                      _access_flags,                                 AccessFlags)                           \
 264   nonstatic_field(Method,                      _vtable_index,                                 int)                                   \
 265   nonstatic_field(Method,                      _intrinsic_id,                                 u2)                                    \
 266   volatile_nonstatic_field(Method,             _code,                                         nmethod*)                              \
 267   nonstatic_field(Method,                      _i2i_entry,                                    address)                               \
 268   volatile_nonstatic_field(Method,             _from_compiled_entry,                          address)                               \
 269   volatile_nonstatic_field(Method,             _from_interpreted_entry,                       address)                               \
 270   volatile_nonstatic_field(ConstMethod,        _fingerprint,                                  uint64_t)                              \
 271   nonstatic_field(ConstMethod,                 _constants,                                    ConstantPool*)                         \
 272   nonstatic_field(ConstMethod,                 _stackmap_data,                                Array<u1>*)                            \
 273   nonstatic_field(ConstMethod,                 _constMethod_size,                             int)                                   \
 274   nonstatic_field(ConstMethod,                 _flags._flags,                                 u4)                                    \
 275   nonstatic_field(ConstMethod,                 _code_size,                                    u2)                                    \
 276   nonstatic_field(ConstMethod,                 _name_index,                                   u2)                                    \
 277   nonstatic_field(ConstMethod,                 _signature_index,                              u2)                                    \
 278   nonstatic_field(ConstMethod,                 _method_idnum,                                 u2)                                    \
 279   nonstatic_field(ConstMethod,                 _max_stack,                                    u2)                                    \
 280   nonstatic_field(ConstMethod,                 _max_locals,                                   u2)                                    \
 281   nonstatic_field(ConstMethod,                 _size_of_parameters,                           u2)                                    \
 282   nonstatic_field(ConstMethod,                 _num_stack_arg_slots,                          u2)                                    \
 283   nonstatic_field(ObjArrayKlass,               _element_klass,                                Klass*)                                \
 284   nonstatic_field(ObjArrayKlass,               _bottom_klass,                                 Klass*)                                \
 285   volatile_nonstatic_field(Symbol,             _hash_and_refcount,                            unsigned int)                          \
 286   nonstatic_field(Symbol,                      _length,                                       u2)                                    \
 287   unchecked_nonstatic_field(Symbol,            _body,                                         sizeof(u1)) /* NOTE: no type */        \
 288   nonstatic_field(Symbol,                      _body[0],                                      u1)                                    \
 289   nonstatic_field(TypeArrayKlass,              _max_length,                                   jint)                                  \
 290   nonstatic_field(OopHandle,                   _obj,                                          oop*)                                  \
 291   nonstatic_field(Annotations,                 _class_annotations,                            Array<u1>*)                            \
 292   nonstatic_field(Annotations,                 _fields_annotations,                           Array<Array<u1>*>*)                    \
 293   nonstatic_field(Annotations,                 _class_type_annotations,                       Array<u1>*)                            \
 294   nonstatic_field(Annotations,                 _fields_type_annotations,                      Array<Array<u1>*>*)                    \
 295                                                                                                                                      \
 296   /*****************************/                                                                                                    \
 297   /* Method related structures */                                                                                                    \
 298   /*****************************/                                                                                                    \
 299                                                                                                                                      \
 300   nonstatic_field(CheckedExceptionElement,     class_cp_index,                                u2)                                    \
 301   nonstatic_field(LocalVariableTableElement,   start_bci,                                     u2)                                    \
 302   nonstatic_field(LocalVariableTableElement,   length,                                        u2)                                    \
 303   nonstatic_field(LocalVariableTableElement,   name_cp_index,                                 u2)                                    \
 304   nonstatic_field(LocalVariableTableElement,   descriptor_cp_index,                           u2)                                    \
 305   nonstatic_field(LocalVariableTableElement,   signature_cp_index,                            u2)                                    \
 306   nonstatic_field(LocalVariableTableElement,   slot,                                          u2)                                    \
 307   nonstatic_field(ExceptionTableElement,       start_pc,                                      u2)                                    \
 308   nonstatic_field(ExceptionTableElement,       end_pc,                                        u2)                                    \
 309   nonstatic_field(ExceptionTableElement,       handler_pc,                                    u2)                                    \
 310   nonstatic_field(ExceptionTableElement,       catch_type_index,                              u2)                                    \
 311   JVMTI_ONLY(nonstatic_field(BreakpointInfo,   _orig_bytecode,                                Bytecodes::Code))                      \
 312   JVMTI_ONLY(nonstatic_field(BreakpointInfo,   _bci,                                          int))                                  \
 313   JVMTI_ONLY(nonstatic_field(BreakpointInfo,   _name_index,                                   u2))                                   \
 314   JVMTI_ONLY(nonstatic_field(BreakpointInfo,   _signature_index,                              u2))                                   \
 315   JVMTI_ONLY(nonstatic_field(BreakpointInfo,   _next,                                         BreakpointInfo*))                      \
 316   /***********/                                                                                                                      \
 317   /* JNI IDs */                                                                                                                      \
 318   /***********/                                                                                                                      \
 319                                                                                                                                      \
 320   nonstatic_field(JNIid,                       _holder,                                       InstanceKlass*)                        \
 321   nonstatic_field(JNIid,                       _next,                                         JNIid*)                                \
 322   nonstatic_field(JNIid,                       _offset,                                       int)                                   \
 323                                                                                                                                      \
 324   /************/                                                                                                                     \
 325   /* Universe */                                                                                                                     \
 326   /************/                                                                                                                     \
 327      static_field(Universe,                    _collectedHeap,                                CollectedHeap*)                        \
 328   /******************/                                                                                                               \
 329   /* CompressedOops */                                                                                                               \
 330   /******************/                                                                                                               \
 331                                                                                                                                      \
 332      static_field(CompressedOops,              _base,                                         address)                               \
 333      static_field(CompressedOops,              _shift,                                        int)                                   \
 334      static_field(CompressedOops,              _use_implicit_null_checks,                     bool)                                  \
 335                                                                                                                                      \
 336   /***************************/                                                                                                      \
 337   /* CompressedKlassPointers */                                                                                                      \
 338   /***************************/                                                                                                      \
 339                                                                                                                                      \
 340      static_field(CompressedKlassPointers,     _base,                                         address)                               \
 341      static_field(CompressedKlassPointers,     _shift,                                        int)                                   \
 342                                                                                                                                      \
 343   /**********/                                                                                                                       \
 344   /* Memory */                                                                                                                       \
 345   /**********/                                                                                                                       \
 346                                                                                                                                      \
 347      static_field(MetaspaceObj,                _aot_metaspace_base,                           void*)                                 \
 348      static_field(MetaspaceObj,                _aot_metaspace_top,                            void*)                                 \
 349   nonstatic_field(ThreadLocalAllocBuffer,      _start,                                        HeapWord*)                             \
 350   nonstatic_field(ThreadLocalAllocBuffer,      _top,                                          HeapWord*)                             \
 351   nonstatic_field(ThreadLocalAllocBuffer,      _end,                                          HeapWord*)                             \
 352   nonstatic_field(ThreadLocalAllocBuffer,      _pf_top,                                       HeapWord*)                             \
 353   nonstatic_field(ThreadLocalAllocBuffer,      _desired_size,                                 size_t)                                \
 354   nonstatic_field(ThreadLocalAllocBuffer,      _refill_waste_limit,                           size_t)                                \
 355      static_field(ThreadLocalAllocBuffer,      _reserve_for_allocation_prefetch,              int)                                   \
 356      static_field(ThreadLocalAllocBuffer,      _target_refills,                               unsigned)                              \
 357   nonstatic_field(ThreadLocalAllocBuffer,      _number_of_refills,                            unsigned)                              \
 358   nonstatic_field(ThreadLocalAllocBuffer,      _refill_waste,                                 unsigned)                              \
 359   nonstatic_field(ThreadLocalAllocBuffer,      _gc_waste,                                     unsigned)                              \
 360   nonstatic_field(ThreadLocalAllocBuffer,      _slow_allocations,                             unsigned)                              \
 361   nonstatic_field(VirtualSpace,                _low_boundary,                                 char*)                                 \
 362   nonstatic_field(VirtualSpace,                _high_boundary,                                char*)                                 \
 363   nonstatic_field(VirtualSpace,                _low,                                          char*)                                 \
 364   nonstatic_field(VirtualSpace,                _high,                                         char*)                                 \
 365   nonstatic_field(VirtualSpace,                _lower_high,                                   char*)                                 \
 366   nonstatic_field(VirtualSpace,                _middle_high,                                  char*)                                 \
 367   nonstatic_field(VirtualSpace,                _upper_high,                                   char*)                                 \
 368                                                                                                                                      \
 369   /************************/                                                                                                         \
 370   /* PerfMemory - jvmstat */                                                                                                         \
 371   /************************/                                                                                                         \
 372                                                                                                                                      \
 373   nonstatic_field(PerfDataPrologue,            magic,                                         jint)                                  \
 374   nonstatic_field(PerfDataPrologue,            byte_order,                                    jbyte)                                 \
 375   nonstatic_field(PerfDataPrologue,            major_version,                                 jbyte)                                 \
 376   nonstatic_field(PerfDataPrologue,            minor_version,                                 jbyte)                                 \
 377   nonstatic_field(PerfDataPrologue,            accessible,                                    jbyte)                                 \
 378   nonstatic_field(PerfDataPrologue,            used,                                          jint)                                  \
 379   nonstatic_field(PerfDataPrologue,            overflow,                                      jint)                                  \
 380   nonstatic_field(PerfDataPrologue,            mod_time_stamp,                                jlong)                                 \
 381   nonstatic_field(PerfDataPrologue,            entry_offset,                                  jint)                                  \
 382   nonstatic_field(PerfDataPrologue,            num_entries,                                   jint)                                  \
 383                                                                                                                                      \
 384   nonstatic_field(PerfDataEntry,               entry_length,                                  jint)                                  \
 385   nonstatic_field(PerfDataEntry,               name_offset,                                   jint)                                  \
 386   nonstatic_field(PerfDataEntry,               vector_length,                                 jint)                                  \
 387   nonstatic_field(PerfDataEntry,               data_type,                                     jbyte)                                 \
 388   nonstatic_field(PerfDataEntry,               flags,                                         jbyte)                                 \
 389   nonstatic_field(PerfDataEntry,               data_units,                                    jbyte)                                 \
 390   nonstatic_field(PerfDataEntry,               data_variability,                              jbyte)                                 \
 391   nonstatic_field(PerfDataEntry,               data_offset,                                   jint)                                  \
 392                                                                                                                                      \
 393      static_field(PerfMemory,                  _start,                                        char*)                                 \
 394      static_field(PerfMemory,                  _end,                                          char*)                                 \
 395      static_field(PerfMemory,                  _top,                                          char*)                                 \
 396      static_field(PerfMemory,                  _capacity,                                     size_t)                                \
 397      static_field(PerfMemory,                  _prologue,                                     PerfDataPrologue*)                     \
 398      volatile_static_field(PerfMemory,         _initialized,                                  int)                                   \
 399                                                                                                                                      \
 400   /********************/                                                                                                             \
 401   /* VM Classes       */                                                                                                             \
 402   /********************/                                                                                                             \
 403                                                                                                                                      \
 404      static_field(vmClasses,                   VM_CLASS_AT(Object_klass),                        InstanceKlass*)                     \
 405      static_field(vmClasses,                   VM_CLASS_AT(String_klass),                        InstanceKlass*)                     \
 406      static_field(vmClasses,                   VM_CLASS_AT(Class_klass),                         InstanceKlass*)                     \
 407      static_field(vmClasses,                   VM_CLASS_AT(ClassLoader_klass),                   InstanceKlass*)                     \
 408      static_field(vmClasses,                   VM_CLASS_AT(System_klass),                        InstanceKlass*)                     \
 409      static_field(vmClasses,                   VM_CLASS_AT(Thread_klass),                        InstanceKlass*)                     \
 410      static_field(vmClasses,                   VM_CLASS_AT(Thread_FieldHolder_klass),            InstanceKlass*)                     \
 411      static_field(vmClasses,                   VM_CLASS_AT(ThreadGroup_klass),                   InstanceKlass*)                     \
 412      static_field(vmClasses,                   VM_CLASS_AT(MethodHandle_klass),                  InstanceKlass*)                     \
 413                                                                                                                                      \
 414   /*************/                                                                                                                    \
 415   /* vmSymbols */                                                                                                                    \
 416   /*************/                                                                                                                    \
 417                                                                                                                                      \
 418      static_field(Symbol,                      _vm_symbols[0],                                Symbol*)                               \
 419                                                                                                                                      \
 420   /*******************/                                                                                                              \
 421   /* ClassLoaderData */                                                                                                              \
 422   /*******************/                                                                                                              \
 423   nonstatic_field(ClassLoaderData,             _class_loader,                                 OopHandle)                             \
 424   nonstatic_field(ClassLoaderData,             _next,                                         ClassLoaderData*)                      \
 425   volatile_nonstatic_field(ClassLoaderData,    _klasses,                                      Klass*)                                \
 426   nonstatic_field(ClassLoaderData,             _has_class_mirror_holder,                      bool)                                  \
 427                                                                                                                                      \
 428   volatile_static_field(ClassLoaderDataGraph, _head,                                          ClassLoaderData*)                      \
 429                                                                                                                                      \
 430   /**********/                                                                                                                       \
 431   /* Arrays */                                                                                                                       \
 432   /**********/                                                                                                                       \
 433                                                                                                                                      \
 434   nonstatic_field(Array<Klass*>,               _length,                                       int)                                   \
 435   nonstatic_field(Array<Klass*>,               _data[0],                                      Klass*)                                \
 436   nonstatic_field(Array<ResolvedFieldEntry>,   _length,                                       int)                                   \
 437   nonstatic_field(Array<ResolvedFieldEntry>,   _data[0],                                      ResolvedFieldEntry)                    \
 438   nonstatic_field(Array<ResolvedMethodEntry>,  _length,                                       int)                                   \
 439   nonstatic_field(Array<ResolvedMethodEntry>,  _data[0],                                      ResolvedMethodEntry)                   \
 440   nonstatic_field(Array<ResolvedIndyEntry>,    _length,                                       int)                                   \
 441   nonstatic_field(Array<ResolvedIndyEntry>,    _data[0],                                      ResolvedIndyEntry)                     \
 442                                                                                                                                      \
 443   /*******************/                                                                                                              \
 444   /* GrowableArrays  */                                                                                                              \
 445   /*******************/                                                                                                              \
 446                                                                                                                                      \
 447   nonstatic_field(GrowableArrayBase,           _len,                                          int)                                   \
 448   nonstatic_field(GrowableArrayBase,           _capacity,                                     int)                                   \
 449   nonstatic_field(GrowableArray<int>,          _data,                                         int*)                                  \
 450                                                                                                                                      \
 451   /********************************/                                                                                                 \
 452   /* CodeCache (NOTE: incomplete) */                                                                                                 \
 453   /********************************/                                                                                                 \
 454                                                                                                                                      \
 455      static_field(CodeCache,                   _heaps,                                        GrowableArray<CodeHeap*>*)             \
 456      static_field(CodeCache,                   _low_bound,                                    address)                               \
 457      static_field(CodeCache,                   _high_bound,                                   address)                               \
 458                                                                                                                                      \
 459   /*******************************/                                                                                                  \
 460   /* CodeHeap (NOTE: incomplete) */                                                                                                  \
 461   /*******************************/                                                                                                  \
 462                                                                                                                                      \
 463   nonstatic_field(CodeHeap,                    _memory,                                       VirtualSpace)                          \
 464   nonstatic_field(CodeHeap,                    _segmap,                                       VirtualSpace)                          \
 465   nonstatic_field(CodeHeap,                    _log2_segment_size,                            int)                                   \
 466   nonstatic_field(HeapBlock,                   _header,                                       HeapBlock::Header)                     \
 467   nonstatic_field(HeapBlock::Header,           _length,                                       uint32_t)                              \
 468   nonstatic_field(HeapBlock::Header,           _used,                                         bool)                                  \
 469                                                                                                                                      \
 470   /**********************************/                                                                                               \
 471   /* Interpreter (NOTE: incomplete) */                                                                                               \
 472   /**********************************/                                                                                               \
 473                                                                                                                                      \
 474      static_field(AbstractInterpreter,         _code,                                         StubQueue*)                            \
 475                                                                                                                                      \
 476   /****************************/                                                                                                     \
 477   /* Stubs (NOTE: incomplete) */                                                                                                     \
 478   /****************************/                                                                                                     \
 479                                                                                                                                      \
 480   nonstatic_field(StubQueue,                   _stub_buffer,                                  address)                               \
 481   nonstatic_field(StubQueue,                   _buffer_limit,                                 int)                                   \
 482   nonstatic_field(StubQueue,                   _queue_begin,                                  int)                                   \
 483   nonstatic_field(StubQueue,                   _queue_end,                                    int)                                   \
 484   nonstatic_field(StubQueue,                   _number_of_stubs,                              int)                                   \
 485   nonstatic_field(InterpreterCodelet,          _size,                                         int)                                   \
 486   nonstatic_field(InterpreterCodelet,          _description,                                  const char*)                           \
 487   nonstatic_field(InterpreterCodelet,          _bytecode,                                     Bytecodes::Code)                       \
 488                                                                                                                                      \
 489   /***********************************/                                                                                              \
 490   /* StubRoutine for stack walking.  */                                                                                              \
 491   /***********************************/                                                                                              \
 492                                                                                                                                      \
 493      static_field(StubRoutines,                _call_stub_return_address,                     address)                               \
 494                                                                                                                                      \
 495   /***************************************/                                                                                          \
 496   /* PcDesc and other compiled code info */                                                                                          \
 497   /***************************************/                                                                                          \
 498                                                                                                                                      \
 499   nonstatic_field(PcDesc,                      _pc_offset,                                    int)                                   \
 500   nonstatic_field(PcDesc,                      _scope_decode_offset,                          int)                                   \
 501   nonstatic_field(PcDesc,                      _obj_decode_offset,                            int)                                   \
 502   nonstatic_field(PcDesc,                      _flags,                                        int)                                   \
 503                                                                                                                                      \
 504   /***************************************************/                                                                              \
 505   /* CodeBlobs (NOTE: incomplete, but only a little) */                                                                              \
 506   /***************************************************/                                                                              \
 507                                                                                                                                      \
 508   nonstatic_field(CodeBlob,                    _name,                                         const char*)                           \
 509   nonstatic_field(CodeBlob,                    _size,                                         int)                                   \
 510   nonstatic_field(CodeBlob,                    _kind,                                         CodeBlobKind)                          \
 511   nonstatic_field(CodeBlob,                    _header_size,                                  u2)                                    \
 512   nonstatic_field(CodeBlob,                    _relocation_size,                              int)                                   \
 513   nonstatic_field(CodeBlob,                    _content_offset,                               int)                                   \
 514   nonstatic_field(CodeBlob,                    _code_offset,                                  int)                                   \
 515   nonstatic_field(CodeBlob,                    _frame_complete_offset,                        int16_t)                               \
 516   nonstatic_field(CodeBlob,                    _data_offset,                                  int)                                   \
 517   nonstatic_field(CodeBlob,                    _frame_size,                                   int)                                   \
 518   nonstatic_field(CodeBlob,                    _oop_maps,                                     ImmutableOopMapSet*)                   \
 519   nonstatic_field(CodeBlob,                    _caller_must_gc_arguments,                     bool)                                  \
 520   nonstatic_field(CodeBlob,                    _mutable_data,                                 address)                               \
 521   nonstatic_field(CodeBlob,                    _mutable_data_size,                            int)                                   \
 522                                                                                                                                      \
 523   nonstatic_field(DeoptimizationBlob,          _unpack_offset,                                int)                                   \
 524                                                                                                                                      \
 525   /*****************************************************/                                                                            \
 526   /* UpcallStubs (NOTE: incomplete, but only a little) */                                                                            \
 527   /*****************************************************/                                                                            \
 528                                                                                                                                      \
 529   nonstatic_field(UpcallStub,                  _frame_data_offset,                            ByteSize)                              \
 530                                                                                                                                      \
 531   /**************************************************/                                                                               \
 532   /* NMethods (NOTE: incomplete, but only a little) */                                                                               \
 533   /**************************************************/                                                                               \
 534                                                                                                                                      \
 535   nonstatic_field(nmethod,                     _method,                                       Method*)                               \
 536   nonstatic_field(nmethod,                     _entry_bci,                                    int)                                   \
 537   nonstatic_field(nmethod,                     _osr_link,                                     nmethod*)                              \
 538   nonstatic_field(nmethod,                     _state,                                        volatile signed char)                  \
 539   nonstatic_field(nmethod,                     _exception_offset,                             int)                                   \
 540   nonstatic_field(nmethod,                     _deopt_handler_offset,                         int)                                   \
 541   nonstatic_field(nmethod,                     _orig_pc_offset,                               int)                                   \
 542   nonstatic_field(nmethod,                     _stub_offset,                                  int)                                   \
 543   nonstatic_field(nmethod,                     _scopes_pcs_offset,                            int)                                   \
 544   nonstatic_field(nmethod,                     _scopes_data_offset,                           int)                                   \
 545   nonstatic_field(nmethod,                     _handler_table_offset,                         u2)                                    \
 546   nonstatic_field(nmethod,                     _nul_chk_table_offset,                         u2)                                    \
 547   nonstatic_field(nmethod,                     _entry_offset,                                 u2)                                    \
 548   nonstatic_field(nmethod,                     _verified_entry_offset,                        u2)                                    \
 549   nonstatic_field(nmethod,                     _osr_entry_point,                              address)                               \
 550   nonstatic_field(nmethod,                     _immutable_data,                               address)                               \
 551   nonstatic_field(nmethod,                     _immutable_data_size,                          int)                                   \
 552   nonstatic_field(nmethod,                     _compile_id,                                   int)                                   \
 553   nonstatic_field(nmethod,                     _comp_level,                                   CompLevel)                             \
 554   volatile_nonstatic_field(nmethod,            _exception_cache,                              ExceptionCache*)                       \
 555                                                                                                                                      \
 556   nonstatic_field(Deoptimization::UnrollBlock, _size_of_deoptimized_frame,                    int)                                   \
 557   nonstatic_field(Deoptimization::UnrollBlock, _caller_adjustment,                            int)                                   \
 558   nonstatic_field(Deoptimization::UnrollBlock, _number_of_frames,                             int)                                   \
 559   nonstatic_field(Deoptimization::UnrollBlock, _total_frame_sizes,                            int)                                   \
 560   nonstatic_field(Deoptimization::UnrollBlock, _unpack_kind,                                  int)                                   \
 561   nonstatic_field(Deoptimization::UnrollBlock, _frame_sizes,                                  intptr_t*)                             \
 562   nonstatic_field(Deoptimization::UnrollBlock, _frame_pcs,                                    address*)                              \
 563   nonstatic_field(Deoptimization::UnrollBlock, _register_block,                               intptr_t*)                             \
 564   nonstatic_field(Deoptimization::UnrollBlock, _return_type,                                  BasicType)                             \
 565   nonstatic_field(Deoptimization::UnrollBlock, _initial_info,                                 intptr_t)                              \
 566   nonstatic_field(Deoptimization::UnrollBlock, _caller_actual_parameters,                     int)                                   \
 567                                                                                                                                      \
 568   /********************************/                                                                                                 \
 569   /* JavaCalls (NOTE: incomplete) */                                                                                                 \
 570   /********************************/                                                                                                 \
 571                                                                                                                                      \
 572   nonstatic_field(JavaCallWrapper,             _anchor,                                       JavaFrameAnchor)                       \
 573   /********************************/                                                                                                 \
 574   /* JavaFrameAnchor (NOTE: incomplete) */                                                                                           \
 575   /********************************/                                                                                                 \
 576   volatile_nonstatic_field(JavaFrameAnchor,    _last_Java_sp,                                 intptr_t*)                             \
 577   volatile_nonstatic_field(JavaFrameAnchor,    _last_Java_pc,                                 address)                               \
 578                                                                                                                                      \
 579   /******************************/                                                                                                   \
 580   /* Threads (NOTE: incomplete) */                                                                                                   \
 581   /******************************/                                                                                                   \
 582                                                                                                                                      \
 583   static_field(Threads,                     _number_of_threads,                               int)                                   \
 584   static_field(Threads,                     _number_of_non_daemon_threads,                    int)                                   \
 585   static_field(Threads,                     _return_code,                                     int)                                   \
 586                                                                                                                                      \
 587   volatile_static_field(ThreadsSMRSupport, _java_thread_list,                                 ThreadsList*)                          \
 588   nonstatic_field(ThreadsList,                 _length,                                       const uint)                            \
 589   nonstatic_field(ThreadsList,                 _threads,                                      JavaThread *const *const)              \
 590                                                                                                                                      \
 591   nonstatic_field(ThreadShadow,                _pending_exception,                            oop)                                   \
 592   nonstatic_field(ThreadShadow,                _exception_file,                               const char*)                           \
 593   nonstatic_field(ThreadShadow,                _exception_line,                               int)                                   \
 594   nonstatic_field(Thread,                      _tlab,                                         ThreadLocalAllocBuffer)                \
 595   nonstatic_field(Thread,                      _allocated_bytes,                              jlong)                                 \
 596   nonstatic_field(JavaThread,                  _lock_stack,                                   LockStack)                             \
 597   nonstatic_field(LockStack,                   _top,                                          uint32_t)                              \
 598   nonstatic_field(LockStack,                   _base[0],                                      oop)                                   \
 599   nonstatic_field(NamedThread,                 _name,                                         char*)                                 \
 600   nonstatic_field(NamedThread,                 _processed_thread,                             Thread*)                               \
 601   nonstatic_field(JavaThread,                  _threadObj,                                    OopHandle)                             \
 602   nonstatic_field(JavaThread,                  _vthread,                                      OopHandle)                             \
 603   nonstatic_field(JavaThread,                  _jvmti_vthread,                                OopHandle)                             \
 604   nonstatic_field(JavaThread,                  _scopedValueCache,                              OopHandle)                            \
 605   nonstatic_field(JavaThread,                  _anchor,                                       JavaFrameAnchor)                       \
 606   volatile_nonstatic_field(JavaThread,         _current_pending_monitor,                      ObjectMonitor*)                        \
 607   nonstatic_field(JavaThread,                  _current_pending_monitor_is_from_java,         bool)                                  \
 608   volatile_nonstatic_field(JavaThread,         _current_waiting_monitor,                      ObjectMonitor*)                        \
 609   volatile_nonstatic_field(JavaThread,         _suspend_flags,                                uint32_t)                              \
 610   volatile_nonstatic_field(JavaThread,         _exception_oop,                                oop)                                   \
 611   volatile_nonstatic_field(JavaThread,         _exception_pc,                                 address)                               \
 612   nonstatic_field(JavaThread,                  _saved_exception_pc,                           address)                               \
 613   volatile_nonstatic_field(JavaThread,         _thread_state,                                 JavaThreadState)                       \
 614   nonstatic_field(JavaThread,                  _stack_base,                                   address)                               \
 615   nonstatic_field(JavaThread,                  _stack_size,                                   size_t)                                \
 616   nonstatic_field(JavaThread,                  _vframe_array_head,                            vframeArray*)                          \
 617   nonstatic_field(JavaThread,                  _vframe_array_last,                            vframeArray*)                          \
 618   nonstatic_field(JavaThread,                  _active_handles,                               JNIHandleBlock*)                       \
 619   nonstatic_field(JavaThread,                  _monitor_owner_id,                             int64_t)                               \
 620   volatile_nonstatic_field(JavaThread,         _terminated,                                   JavaThread::TerminatedTypes)           \
 621   nonstatic_field(JavaThread,                  _cont_entry,                                   ContinuationEntry*)                    \
 622   nonstatic_field(Thread,                      _osthread,                                     OSThread*)                             \
 623                                                                                                                                      \
 624   /************/                                                                                                                     \
 625   /* OSThread */                                                                                                                     \
 626   /************/                                                                                                                     \
 627                                                                                                                                      \
 628   volatile_nonstatic_field(OSThread,           _state,                                        ThreadState)                           \
 629                                                                                                                                      \
 630   /************************/                                                                                                         \
 631   /* ImmutableOopMap      */                                                                                                         \
 632   /************************/                                                                                                         \
 633                                                                                                                                      \
 634   nonstatic_field(ImmutableOopMapSet,          _count,                                        int)                                   \
 635   nonstatic_field(ImmutableOopMapSet,          _size,                                         int)                                   \
 636                                                                                                                                      \
 637   nonstatic_field(ImmutableOopMapPair,         _pc_offset,                                    int)                                   \
 638   nonstatic_field(ImmutableOopMapPair,         _oopmap_offset,                                int)                                   \
 639                                                                                                                                      \
 640   nonstatic_field(ImmutableOopMap,             _count,                                        int)                                   \
 641                                                                                                                                      \
 642   /*********************************/                                                                                                \
 643   /* JNIHandles and JNIHandleBlock */                                                                                                \
 644   /*********************************/                                                                                                \
 645   static_field(JNIHandles,                     _global_handles,                               OopStorage*)                           \
 646   static_field(JNIHandles,                     _weak_global_handles,                          OopStorage*)                           \
 647   unchecked_nonstatic_field(JNIHandleBlock,    _handles,       JNIHandleBlock::block_size_in_oops * sizeof(Oop)) /* Note: no type */ \
 648   nonstatic_field(JNIHandleBlock,              _top,                                          int)                                   \
 649   nonstatic_field(JNIHandleBlock,              _next,                                         JNIHandleBlock*)                       \
 650                                                                                                                                      \
 651   /********************/                                                                                                             \
 652   /* CompressedStream */                                                                                                             \
 653   /********************/                                                                                                             \
 654                                                                                                                                      \
 655   nonstatic_field(CompressedStream,            _buffer,                                       u_char*)                               \
 656   nonstatic_field(CompressedStream,            _position,                                     int)                                   \
 657                                                                                                                                      \
 658   /*********************************/                                                                                                \
 659   /* VMRegImpl (NOTE: incomplete) */                                                                                                 \
 660   /*********************************/                                                                                                \
 661                                                                                                                                      \
 662      static_field(VMRegImpl,                   regName[0],                                    const char*)                           \
 663      static_field(VMRegImpl,                   stack0,                                        VMReg)                                 \
 664                                                                                                                                      \
 665   /******************************************************************************************/                                       \
 666   /* CI (NOTE: these CI fields are retained in VMStructs for the benefit of external tools, */                                       \
 667   /* to ease their migration to a future alternative.)                                      */                                       \
 668   /******************************************************************************************/                                       \
 669                                                                                                                                      \
 670   nonstatic_field(CompilerThread,              _env,                                          ciEnv*)                                \
 671   nonstatic_field(ciEnv,                       _task,                                         CompileTask*)                          \
 672                                                                                                                                      \
 673   /************/                                                                                                                     \
 674   /* Monitors */                                                                                                                     \
 675   /************/                                                                                                                     \
 676                                                                                                                                      \
 677   volatile_nonstatic_field(ObjectMonitor,      _metadata,                                     uintptr_t)                             \
 678   unchecked_nonstatic_field(ObjectMonitor,     _object,                                       sizeof(void *)) /* NOTE: no type */    \
 679   volatile_nonstatic_field(ObjectMonitor,      _owner,                                        int64_t)                               \
 680   volatile_nonstatic_field(ObjectMonitor,      _next_om,                                      ObjectMonitor*)                        \
 681   nonstatic_field(ObjectMonitor,               _contentions,                                  int)                                   \
 682   volatile_nonstatic_field(ObjectMonitor,      _waiters,                                      int)                                   \
 683   volatile_nonstatic_field(ObjectMonitor,      _recursions,                                   intx)                                  \
 684   nonstatic_field(BasicObjectLock,             _lock,                                         BasicLock)                             \
 685   nonstatic_field(BasicObjectLock,             _obj,                                          oop)                                   \
 686   static_field(ObjectSynchronizer,             _in_use_list,                                  MonitorList)                           \
 687   volatile_nonstatic_field(MonitorList,        _head,                                         ObjectMonitor*)                        \
 688                                                                                                                                      \
 689   /*********************/                                                                                                            \
 690   /* -XX flags         */                                                                                                            \
 691   /*********************/                                                                                                            \
 692                                                                                                                                      \
 693   nonstatic_field(JVMFlag,                     _type,                                         int)                                   \
 694   nonstatic_field(JVMFlag,                     _name,                                         const char*)                           \
 695   unchecked_nonstatic_field(JVMFlag,           _addr,                                         sizeof(void*)) /* NOTE: no type */     \
 696   nonstatic_field(JVMFlag,                     _flags,                                        JVMFlag::Flags)                        \
 697      static_field(JVMFlag,                     flags,                                         JVMFlag*)                              \
 698      static_field(JVMFlag,                     numFlags,                                      size_t)                                \
 699                                                                                                                                      \
 700   /*************************/                                                                                                        \
 701   /* JDK / VM version info */                                                                                                        \
 702   /*************************/                                                                                                        \
 703                                                                                                                                      \
 704      static_field(Abstract_VM_Version,         _s_vm_release,                                 const char*)                           \
 705      static_field(Abstract_VM_Version,         _s_internal_vm_info_string,                    const char*)                           \
 706      static_field(Abstract_VM_Version,         _features,                                     uint64_t)                              \
 707      static_field(Abstract_VM_Version,         _features_string,                              const char*)                           \
 708      static_field(Abstract_VM_Version,         _cpu_info_string,                              const char*)                           \
 709      static_field(Abstract_VM_Version,         _vm_major_version,                             int)                                   \
 710      static_field(Abstract_VM_Version,         _vm_minor_version,                             int)                                   \
 711      static_field(Abstract_VM_Version,         _vm_security_version,                          int)                                   \
 712      static_field(Abstract_VM_Version,         _vm_build_number,                              int)                                   \
 713                                                                                                                                      \
 714   /*************************/                                                                                                        \
 715   /* JVMTI */                                                                                                                        \
 716   /*************************/                                                                                                        \
 717                                                                                                                                      \
 718   JVMTI_STRUCTS(static_field)                                                                                                        \
 719                                                                                                                                      \
 720   /*************/                                                                                                                    \
 721   /* Arguments */                                                                                                                    \
 722   /*************/                                                                                                                    \
 723                                                                                                                                      \
 724      static_field(Arguments,                   _jvm_flags_array,                              char**)                                \
 725      static_field(Arguments,                   _num_jvm_flags,                                int)                                   \
 726      static_field(Arguments,                   _jvm_args_array,                               char**)                                \
 727      static_field(Arguments,                   _num_jvm_args,                                 int)                                   \
 728      static_field(Arguments,                   _java_command,                                 char*)                                 \
 729                                                                                                                                      \
 730   /************/                                                                                                                     \
 731   /* Array<T> */                                                                                                                     \
 732   /************/                                                                                                                     \
 733                                                                                                                                      \
 734   nonstatic_field(Array<int>,                          _length,                               int)                                   \
 735   unchecked_nonstatic_field(Array<int>,                _data,                                 sizeof(int))                           \
 736   unchecked_nonstatic_field(Array<u1>,                 _data,                                 sizeof(u1))                            \
 737   unchecked_nonstatic_field(Array<u2>,                 _data,                                 sizeof(u2))                            \
 738   unchecked_nonstatic_field(Array<Method*>,            _data,                                 sizeof(Method*))                       \
 739   unchecked_nonstatic_field(Array<Klass*>,             _data,                                 sizeof(Klass*))                        \
 740   unchecked_nonstatic_field(Array<ResolvedFieldEntry>, _data,                                 sizeof(ResolvedFieldEntry))            \
 741   unchecked_nonstatic_field(Array<ResolvedMethodEntry>,_data,                                 sizeof(ResolvedMethodEntry))           \
 742   unchecked_nonstatic_field(Array<ResolvedIndyEntry>,  _data,                                 sizeof(ResolvedIndyEntry))             \
 743   unchecked_nonstatic_field(Array<Array<u1>*>,         _data,                                 sizeof(Array<u1>*))                    \
 744                                                                                                                                      \
 745   /*********************************/                                                                                                \
 746   /* java_lang_Class fields        */                                                                                                \
 747   /*********************************/                                                                                                \
 748                                                                                                                                      \
 749      static_field(java_lang_Class,             _klass_offset,                                 int)                                   \
 750      static_field(java_lang_Class,             _array_klass_offset,                           int)                                   \
 751      static_field(java_lang_Class,             _oop_size_offset,                              int)                                   \
 752      static_field(java_lang_Class,             _static_oop_field_count_offset,                int)                                   \
 753                                                                                                                                      \
 754   /********************************************/                                                                                     \
 755   /* FileMapInfo fields (CDS archive related) */                                                                                     \
 756   /********************************************/                                                                                     \
 757                                                                                                                                      \
 758   CDS_ONLY(nonstatic_field(FileMapInfo,        _header,                   FileMapHeader*))                                           \
 759   CDS_ONLY(   static_field(FileMapInfo,        _current_info,             FileMapInfo*))                                             \
 760   CDS_ONLY(nonstatic_field(FileMapHeader,      _regions[0],               CDSFileMapRegion))                                         \
 761   CDS_ONLY(nonstatic_field(FileMapHeader,      _cloned_vtables_offset,    size_t))                                                   \
 762   CDS_ONLY(nonstatic_field(FileMapHeader,      _mapped_base_address,      char*))                                                    \
 763   CDS_ONLY(nonstatic_field(CDSFileMapRegion,   _mapped_base,              char*))                                                    \
 764   CDS_ONLY(nonstatic_field(CDSFileMapRegion,   _used,                     size_t))                                                   \
 765                                                                                                                                      \
 766   /******************/                                                                                                               \
 767   /* VMError fields */                                                                                                               \
 768   /******************/                                                                                                               \
 769                                                                                                                                      \
 770      static_field(VMError,                     _thread,                                       Thread*)                               \
 771                                                                                                                                      \
 772   /************************/                                                                                                         \
 773   /* Miscellaneous fields */                                                                                                         \
 774   /************************/                                                                                                         \
 775                                                                                                                                      \
 776   nonstatic_field(CompileTask,                 _method,                                       Method*)                               \
 777   nonstatic_field(CompileTask,                 _osr_bci,                                      int)                                   \
 778   nonstatic_field(CompileTask,                 _comp_level,                                   int)                                   \
 779   nonstatic_field(CompileTask,                 _compile_id,                                   int)                                   \
 780   nonstatic_field(CompileTask,                 _num_inlined_bytecodes,                        int)                                   \
 781   nonstatic_field(CompileTask,                 _next,                                         CompileTask*)                          \
 782   nonstatic_field(CompileTask,                 _prev,                                         CompileTask*)                          \
 783                                                                                                                                      \
 784   nonstatic_field(vframeArray,                 _original,                                     frame)                                 \
 785   nonstatic_field(vframeArray,                 _caller,                                       frame)                                 \
 786   nonstatic_field(vframeArray,                 _frames,                                       int)                                   \
 787                                                                                                                                      \
 788   nonstatic_field(vframeArrayElement,          _frame,                                        frame)                                 \
 789   nonstatic_field(vframeArrayElement,          _bci,                                          int)                                   \
 790   nonstatic_field(vframeArrayElement,          _method,                                       Method*)                               \
 791                                                                                                                                      \
 792   nonstatic_field(AccessFlags,                 _flags,                                        u2)                                    \
 793   nonstatic_field(elapsedTimer,                _counter,                                      jlong)                                 \
 794   nonstatic_field(elapsedTimer,                _active,                                       bool)                                  \
 795   nonstatic_field(InvocationCounter,           _counter,                                      unsigned int)                          \
 796                                                                                                                                      \
 797   nonstatic_field(UpcallStub::FrameData,       jfa,                                           JavaFrameAnchor)                       \
 798                                                                                                                                      \
 799   nonstatic_field(Mutex,                       _name,                                         const char*)                           \
 800   static_field(Mutex,                          _mutex_array,                                  Mutex**)                               \
 801   static_field(Mutex,                          _num_mutex,                                    int)                                   \
 802   volatile_nonstatic_field(Mutex,              _owner,                                        Thread*)                               \
 803   static_field(ContinuationEntry,              _return_pc,                                    address)
 804 
 805 //--------------------------------------------------------------------------------
 806 // VM_TYPES
 807 //
 808 // This list must enumerate at least all of the types in the above
 809 // list. For the types in the above list, the entry below must have
 810 // exactly the same spacing since string comparisons are done in the
 811 // code which verifies the consistency of these tables (in the debug
 812 // build).
 813 //
 814 // In addition to the above types, this list is required to enumerate
 815 // the JNI's java types, which are used to indicate the size of Java
 816 // fields in this VM to the SA. Further, oop types are currently
 817 // distinguished by name (i.e., ends with "oop") over in the SA.
 818 //
 819 // The declare_toplevel_type macro should be used to declare types
 820 // which do not have a superclass.
 821 //
 822 // The declare_integer_type and declare_unsigned_integer_type macros
 823 // are required in order to properly identify C integer types over in
 824 // the SA. They should be used for any type which is otherwise opaque
 825 // and which it is necessary to coerce into an integer value. This
 826 // includes, for example, the type uintptr_t. Note that while they
 827 // will properly identify the type's size regardless of the platform,
 828 // since it is does not seem possible to deduce or check signedness at
 829 // compile time using the pointer comparison tricks, it is currently
 830 // required that the given types have the same signedness across all
 831 // platforms.
 832 //
 833 // NOTE that there are platform-specific additions to this table in
 834 // vmStructs_<os>_<cpu>.hpp.
 835 
 836 #define VM_TYPES(declare_type,                                            \
 837                  declare_toplevel_type,                                   \
 838                  declare_oop_type,                                        \
 839                  declare_integer_type,                                    \
 840                  declare_unsigned_integer_type)                           \
 841                                                                           \
 842   /*************************************************************/         \
 843   /* Java primitive types -- required by the SA implementation */         \
 844   /* in order to determine the size of Java fields in this VM  */         \
 845   /* (the implementation looks up these names specifically)    */         \
 846   /* NOTE: since we fetch these sizes from the remote VM, we   */         \
 847   /* have a bootstrapping sequence during which it is not      */         \
 848   /* valid to fetch Java values from the remote process, only  */         \
 849   /* C integer values (of known size). NOTE also that we do    */         \
 850   /* NOT include "Java unsigned" types like juint here; since  */         \
 851   /* Java does not have unsigned primitive types, those can    */         \
 852   /* not be mapped directly and are considered to be C integer */         \
 853   /* types in this system (see the "other types" section,      */         \
 854   /* below.)                                                   */         \
 855   /*************************************************************/         \
 856                                                                           \
 857   declare_toplevel_type(jboolean)                                         \
 858   declare_toplevel_type(jbyte)                                            \
 859   declare_toplevel_type(jchar)                                            \
 860   declare_toplevel_type(jdouble)                                          \
 861   declare_toplevel_type(jfloat)                                           \
 862   declare_toplevel_type(jint)                                             \
 863   declare_toplevel_type(jlong)                                            \
 864   declare_toplevel_type(jshort)                                           \
 865                                                                           \
 866   /*********************************************************************/ \
 867   /* C integer types. User-defined typedefs (like "size_t" or          */ \
 868   /* "intptr_t") are guaranteed to be present with the same names over */ \
 869   /* in the SA's type database. Names like "unsigned short" are not    */ \
 870   /* guaranteed to be visible through the SA's type database lookup    */ \
 871   /* mechanism, though they will have a Type object created for them   */ \
 872   /* and are valid types for Fields.                                   */ \
 873   /*********************************************************************/ \
 874   declare_integer_type(bool)                                              \
 875   declare_integer_type(short)                                             \
 876   declare_integer_type(int)                                               \
 877   declare_integer_type(long)                                              \
 878   declare_integer_type(char)                                              \
 879   declare_integer_type(volatile signed char)                              \
 880   declare_unsigned_integer_type(unsigned char)                            \
 881   declare_unsigned_integer_type(u_char)                                   \
 882   declare_unsigned_integer_type(unsigned int)                             \
 883   declare_unsigned_integer_type(uint)                                     \
 884   declare_unsigned_integer_type(volatile uint)                            \
 885   declare_unsigned_integer_type(unsigned short)                           \
 886   declare_unsigned_integer_type(jushort)                                  \
 887   declare_unsigned_integer_type(unsigned long)                            \
 888   /* The compiler thinks this is a different type than */                 \
 889   /* unsigned short on Win32 */                                           \
 890   declare_unsigned_integer_type(u1)                                       \
 891   declare_unsigned_integer_type(u2)                                       \
 892   declare_unsigned_integer_type(u4)                                       \
 893   declare_unsigned_integer_type(u8)                                       \
 894   declare_unsigned_integer_type(unsigned)                                 \
 895                                                                           \
 896   /*****************************/                                         \
 897   /* C primitive pointer types */                                         \
 898   /*****************************/                                         \
 899                                                                           \
 900   declare_toplevel_type(void*)                                            \
 901   declare_toplevel_type(int*)                                             \
 902   declare_toplevel_type(char*)                                            \
 903   declare_toplevel_type(char**)                                           \
 904   declare_toplevel_type(u_char*)                                          \
 905   declare_toplevel_type(unsigned char*)                                   \
 906   declare_toplevel_type(volatile unsigned char*)                          \
 907                                                                           \
 908   /*******************************************************************/   \
 909   /* Types which it will be handy to have available over in the SA   */   \
 910   /* in order to do platform-independent address -> integer coercion */   \
 911   /* (note: these will be looked up by name)                         */   \
 912   /*******************************************************************/   \
 913                                                                           \
 914   declare_unsigned_integer_type(size_t)                                   \
 915   declare_integer_type(ssize_t)                                           \
 916   declare_integer_type(intx)                                              \
 917   declare_integer_type(intptr_t)                                          \
 918   declare_integer_type(int16_t)                                           \
 919   declare_integer_type(int64_t)                                           \
 920   declare_unsigned_integer_type(uintx)                                    \
 921   declare_unsigned_integer_type(uintptr_t)                                \
 922   declare_unsigned_integer_type(uint8_t)                                  \
 923   declare_unsigned_integer_type(uint32_t)                                 \
 924   declare_unsigned_integer_type(uint64_t)                                 \
 925                                                                           \
 926   /******************************************/                            \
 927   /* OopDesc hierarchy (NOTE: some missing) */                            \
 928   /******************************************/                            \
 929                                                                           \
 930   declare_toplevel_type(oopDesc)                                          \
 931     declare_type(arrayOopDesc, oopDesc)                                   \
 932       declare_type(objArrayOopDesc, arrayOopDesc)                         \
 933     declare_type(instanceOopDesc, oopDesc)                                \
 934                                                                           \
 935   /**************************************************/                    \
 936   /* MetadataOopDesc hierarchy (NOTE: some missing) */                    \
 937   /**************************************************/                    \
 938                                                                           \
 939   declare_toplevel_type(MetaspaceObj)                                     \
 940     declare_type(Metadata, MetaspaceObj)                                  \
 941     declare_type(Klass, Metadata)                                         \
 942            declare_type(ArrayKlass, Klass)                                \
 943            declare_type(TypeArrayKlass, ArrayKlass)                       \
 944            declare_type(ObjArrayKlass, ArrayKlass)                        \
 945              declare_type(FlatArrayKlass, ArrayKlass)                     \
 946              declare_type(RefArrayKlass, ArrayKlass)                      \
 947       declare_type(InstanceKlass, Klass)                                  \
 948         declare_type(InlineKlass, InstanceKlass)                          \
 949         declare_type(InstanceClassLoaderKlass, InstanceKlass)             \
 950         declare_type(InstanceMirrorKlass, InstanceKlass)                  \
 951         declare_type(InstanceRefKlass, InstanceKlass)                     \
 952         declare_type(InstanceStackChunkKlass, InstanceKlass)              \
 953     declare_type(ConstantPool, Metadata)                                  \
 954     declare_type(ConstantPoolCache, MetaspaceObj)                         \
 955     declare_type(MethodData, Metadata)                                    \
 956     declare_type(Method, Metadata)                                        \
 957     declare_type(MethodCounters, MetaspaceObj)                            \
 958     declare_type(ConstMethod, MetaspaceObj)                               \
 959     declare_type(Annotations, MetaspaceObj)                               \
 960                                                                           \
 961   declare_toplevel_type(MethodData::CompilerCounters)                     \
 962                                                                           \
 963   declare_toplevel_type(narrowKlass)                                      \
 964                                                                           \
 965   declare_toplevel_type(vtableEntry)                                      \
 966                                                                           \
 967            declare_toplevel_type(Symbol)                                  \
 968            declare_toplevel_type(Symbol*)                                 \
 969   declare_toplevel_type(volatile Metadata*)                               \
 970                                                                           \
 971   declare_toplevel_type(DataLayout)                                       \
 972                                                                           \
 973   /********/                                                              \
 974   /* Oops */                                                              \
 975   /********/                                                              \
 976                                                                           \
 977   declare_oop_type(objArrayOop)                                           \
 978   declare_oop_type(oop)                                                   \
 979   declare_oop_type(narrowOop)                                             \
 980   declare_oop_type(typeArrayOop)                                          \
 981                                                                           \
 982   declare_toplevel_type(OopHandle)                                        \
 983                                                                           \
 984   /**********************************/                                    \
 985   /* Method related data structures */                                    \
 986   /**********************************/                                    \
 987                                                                           \
 988   declare_toplevel_type(CheckedExceptionElement)                          \
 989   declare_toplevel_type(LocalVariableTableElement)                        \
 990   declare_toplevel_type(ExceptionTableElement)                            \
 991   declare_toplevel_type(MethodParametersElement)                          \
 992                                                                           \
 993   declare_toplevel_type(ClassLoaderData)                                  \
 994   declare_toplevel_type(ClassLoaderDataGraph)                             \
 995                                                                           \
 996   /************************/                                              \
 997   /* PerfMemory - jvmstat */                                              \
 998   /************************/                                              \
 999                                                                           \
1000   declare_toplevel_type(PerfDataPrologue)                                 \
1001   declare_toplevel_type(PerfDataPrologue*)                                \
1002   declare_toplevel_type(PerfDataEntry)                                    \
1003   declare_toplevel_type(PerfMemory)                                       \
1004   declare_type(PerfData, CHeapObj<mtInternal>)                            \
1005                                                                           \
1006   /********************/                                                  \
1007   /* VM Classes       */                                                  \
1008   /********************/                                                  \
1009                                                                           \
1010   declare_toplevel_type(vmClasses)                                        \
1011   declare_toplevel_type(vmSymbols)                                        \
1012                                                                           \
1013   declare_toplevel_type(GrowableArrayBase)                                \
1014   declare_toplevel_type(GrowableArray<int>)                               \
1015                                                                           \
1016   /***********************************************************/           \
1017   /* Thread hierarchy (needed for run-time type information) */           \
1018   /***********************************************************/           \
1019                                                                           \
1020   declare_toplevel_type(Threads)                                          \
1021   declare_toplevel_type(ThreadShadow)                                     \
1022     declare_type(Thread, ThreadShadow)                                    \
1023       declare_type(NonJavaThread, Thread)                                 \
1024         declare_type(NamedThread, NonJavaThread)                          \
1025         declare_type(WatcherThread, NonJavaThread)                        \
1026         declare_type(AsyncLogWriter, NonJavaThread)                       \
1027       declare_type(JavaThread, Thread)                                    \
1028         declare_type(JvmtiAgentThread, JavaThread)                        \
1029         declare_type(MonitorDeflationThread, JavaThread)                  \
1030         declare_type(ServiceThread, JavaThread)                           \
1031         declare_type(NotificationThread, JavaThread)                      \
1032         declare_type(CompilerThread, JavaThread)                          \
1033         declare_type(TrainingReplayThread, JavaThread)                    \
1034         declare_type(StringDedupThread, JavaThread)                       \
1035         declare_type(AttachListenerThread, JavaThread)                    \
1036         declare_type(JfrRecorderThread, JavaThread)                       \
1037         DEBUG_ONLY(COMPILER2_OR_JVMCI_PRESENT(                            \
1038           declare_type(DeoptimizeObjectsALotThread, JavaThread)))         \
1039   declare_toplevel_type(OSThread)                                         \
1040   declare_toplevel_type(JavaFrameAnchor)                                  \
1041                                                                           \
1042   declare_toplevel_type(ThreadsSMRSupport)                                \
1043   declare_toplevel_type(ThreadsList)                                      \
1044   declare_toplevel_type(LockStack)                                        \
1045                                                                           \
1046   /***************/                                                       \
1047   /* Interpreter */                                                       \
1048   /***************/                                                       \
1049                                                                           \
1050   declare_toplevel_type(AbstractInterpreter)                              \
1051                                                                           \
1052   /*********/                                                             \
1053   /* Stubs */                                                             \
1054   /*********/                                                             \
1055                                                                           \
1056   declare_toplevel_type(StubQueue)                                        \
1057   declare_toplevel_type(StubRoutines)                                     \
1058   declare_toplevel_type(Stub)                                             \
1059            declare_type(InterpreterCodelet, Stub)                         \
1060                                                                           \
1061   /*************/                                                         \
1062   /* JavaCalls */                                                         \
1063   /*************/                                                         \
1064                                                                           \
1065   declare_toplevel_type(JavaCallWrapper)                                  \
1066                                                                           \
1067   /*************/                                                         \
1068   /* CodeCache */                                                         \
1069   /*************/                                                         \
1070                                                                           \
1071   declare_toplevel_type(CodeCache)                                        \
1072                                                                           \
1073   /************/                                                          \
1074   /* CodeHeap */                                                          \
1075   /************/                                                          \
1076                                                                           \
1077   declare_toplevel_type(CodeHeap)                                         \
1078   declare_toplevel_type(CodeHeap*)                                        \
1079   declare_toplevel_type(HeapBlock)                                        \
1080   declare_toplevel_type(HeapBlock::Header)                                \
1081            declare_type(FreeBlock, HeapBlock)                             \
1082                                                                           \
1083   /*************************************************************/         \
1084   /* CodeBlob hierarchy (needed for run-time type information) */         \
1085   /*************************************************************/         \
1086                                                                           \
1087   declare_toplevel_type(CodeBlob)                                         \
1088   declare_type(RuntimeBlob,              CodeBlob)                        \
1089   declare_type(BufferBlob,               RuntimeBlob)                     \
1090   declare_type(AdapterBlob,              BufferBlob)                      \
1091   declare_type(MethodHandlesAdapterBlob, BufferBlob)                      \
1092   declare_type(VtableBlob,               BufferBlob)                      \
1093   declare_type(nmethod,                  CodeBlob)                        \
1094   declare_type(RuntimeStub,              RuntimeBlob)                     \
1095   declare_type(SingletonBlob,            RuntimeBlob)                     \
1096   declare_type(UpcallStub,               RuntimeBlob)                     \
1097   declare_type(SafepointBlob,            SingletonBlob)                   \
1098   declare_type(DeoptimizationBlob,       SingletonBlob)                   \
1099   COMPILER2_PRESENT(declare_type(ExceptionBlob,    SingletonBlob))        \
1100   COMPILER2_PRESENT(declare_type(UncommonTrapBlob, RuntimeBlob))          \
1101                                                                           \
1102   /***************************************/                               \
1103   /* PcDesc and other compiled code info */                               \
1104   /***************************************/                               \
1105                                                                           \
1106   declare_toplevel_type(PcDesc)                                           \
1107   declare_toplevel_type(ExceptionCache)                                   \
1108   declare_toplevel_type(PcDescCache)                                      \
1109   declare_toplevel_type(Dependencies)                                     \
1110   declare_toplevel_type(CompileTask)                                      \
1111   declare_toplevel_type(Deoptimization)                                   \
1112   declare_toplevel_type(Deoptimization::UnrollBlock)                      \
1113                                                                           \
1114   /************************/                                              \
1115   /* ImmutableOopMap      */                                              \
1116   /************************/                                              \
1117                                                                           \
1118   declare_toplevel_type(ImmutableOopMapSet)                               \
1119   declare_toplevel_type(ImmutableOopMapPair)                              \
1120   declare_toplevel_type(ImmutableOopMap)                                  \
1121                                                                           \
1122   /********************/                                                  \
1123   /* CompressedStream */                                                  \
1124   /********************/                                                  \
1125                                                                           \
1126   declare_toplevel_type(CompressedStream)                                 \
1127                                                                           \
1128   /**************/                                                        \
1129   /* VMRegImpl  */                                                        \
1130   /**************/                                                        \
1131                                                                           \
1132   declare_toplevel_type(VMRegImpl)                                        \
1133                                                                           \
1134   /*********************************/                                     \
1135   /* JNIHandles and JNIHandleBlock */                                     \
1136   /*********************************/                                     \
1137                                                                           \
1138   declare_toplevel_type(JNIHandles)                                       \
1139   declare_toplevel_type(JNIHandleBlock)                                   \
1140   declare_toplevel_type(jobject)                                          \
1141                                                                           \
1142   /**************/                                                        \
1143   /* OopStorage */                                                        \
1144   /**************/                                                        \
1145                                                                           \
1146   declare_toplevel_type(OopStorage)                                       \
1147                                                                           \
1148   /************/                                                          \
1149   /* Monitors */                                                          \
1150   /************/                                                          \
1151                                                                           \
1152   declare_toplevel_type(ObjectMonitor)                                    \
1153   declare_toplevel_type(MonitorList)                                      \
1154   declare_toplevel_type(ObjectSynchronizer)                               \
1155   declare_toplevel_type(BasicLock)                                        \
1156   declare_toplevel_type(BasicObjectLock)                                  \
1157                                                                           \
1158   /*********************/                                                 \
1159   /* CI */                                                                \
1160   /*********************/                                                 \
1161                                                                           \
1162   declare_toplevel_type(ciEnv)                                            \
1163                                                                           \
1164   /********************/                                                  \
1165   /* -XX flags        */                                                  \
1166   /********************/                                                  \
1167                                                                           \
1168   declare_toplevel_type(JVMFlag)                                          \
1169   declare_toplevel_type(JVMFlag*)                                         \
1170                                                                           \
1171   /********************/                                                  \
1172   /* JVMTI            */                                                  \
1173   /********************/                                                  \
1174                                                                           \
1175   declare_toplevel_type(JvmtiExport)                                      \
1176                                                                           \
1177   /********************/                                                  \
1178   /* JDK/VM version   */                                                  \
1179   /********************/                                                  \
1180                                                                           \
1181   declare_toplevel_type(Abstract_VM_Version)                              \
1182   declare_toplevel_type(VM_Version)                                       \
1183                                                                           \
1184   /*************/                                                         \
1185   /* Arguments */                                                         \
1186   /*************/                                                         \
1187                                                                           \
1188   declare_toplevel_type(Arguments)                                        \
1189                                                                           \
1190   /***********/                                                           \
1191   /* VMError */                                                           \
1192   /***********/                                                           \
1193                                                                           \
1194   declare_toplevel_type(VMError)                                          \
1195                                                                           \
1196   /***************/                                                       \
1197   /* Other types */                                                       \
1198   /***************/                                                       \
1199                                                                           \
1200   /* all enum types */                                                    \
1201                                                                           \
1202    declare_integer_type(Bytecodes::Code)                                  \
1203    declare_integer_type(InstanceKlass::ClassState)                        \
1204    declare_integer_type(JavaThreadState)                                  \
1205    declare_integer_type(ThreadState)                                      \
1206    declare_integer_type(Location::Type)                                   \
1207    declare_integer_type(Location::Where)                                  \
1208    declare_integer_type(JVMFlag::Flags)                                   \
1209                                                                           \
1210    declare_toplevel_type(CHeapObj<mtInternal>)                            \
1211             declare_type(Array<int>, MetaspaceObj)                        \
1212             declare_type(Array<u1>, MetaspaceObj)                         \
1213             declare_type(Array<u2>, MetaspaceObj)                         \
1214             declare_type(Array<Klass*>, MetaspaceObj)                     \
1215             declare_type(Array<Method*>, MetaspaceObj)                    \
1216             declare_type(Array<ResolvedFieldEntry>, MetaspaceObj)         \
1217             declare_type(Array<ResolvedMethodEntry>, MetaspaceObj)        \
1218             declare_type(Array<ResolvedIndyEntry>, MetaspaceObj)          \
1219             declare_type(Array<Array<u1>*>, MetaspaceObj)                 \
1220                                                                           \
1221    declare_toplevel_type(BitMap)                                          \
1222             declare_type(BitMapView, BitMap)                              \
1223                                                                           \
1224   declare_integer_type(markWord)                                          \
1225   declare_integer_type(AccessFlags)  /* FIXME: wrong type (not integer) */\
1226   declare_toplevel_type(address)      /* FIXME: should this be an integer type? */\
1227   declare_integer_type(BasicType)   /* FIXME: wrong type (not integer) */ \
1228                                                                           \
1229   declare_integer_type(CompLevel)                                         \
1230   declare_integer_type(ByteSize)                                          \
1231   declare_integer_type(CodeBlobKind)                                      \
1232   JVMTI_ONLY(declare_toplevel_type(BreakpointInfo))                       \
1233   JVMTI_ONLY(declare_toplevel_type(BreakpointInfo*))                      \
1234   declare_toplevel_type(CodeBlob*)                                        \
1235   declare_toplevel_type(RuntimeBlob*)                                     \
1236   declare_toplevel_type(CompressedWriteStream*)                           \
1237   declare_toplevel_type(ResolvedFieldEntry)                               \
1238   declare_toplevel_type(ResolvedMethodEntry)                              \
1239   declare_toplevel_type(ResolvedIndyEntry)                                \
1240   declare_toplevel_type(elapsedTimer)                                     \
1241   declare_toplevel_type(frame)                                            \
1242   declare_toplevel_type(intptr_t*)                                        \
1243    declare_unsigned_integer_type(InvocationCounter) /* FIXME: wrong type (not integer) */ \
1244   declare_toplevel_type(JavaThread*)                                      \
1245   declare_toplevel_type(JavaThread *const *const)                         \
1246   declare_toplevel_type(java_lang_Class)                                  \
1247   declare_integer_type(JavaThread::TerminatedTypes)                       \
1248   declare_toplevel_type(jbyte*)                                           \
1249   declare_toplevel_type(jbyte**)                                          \
1250   declare_toplevel_type(jint*)                                            \
1251   declare_unsigned_integer_type(juint)                                    \
1252   declare_unsigned_integer_type(julong)                                   \
1253   declare_toplevel_type(JNIHandleBlock*)                                  \
1254   declare_toplevel_type(JNIid)                                            \
1255   declare_toplevel_type(JNIid*)                                           \
1256   declare_toplevel_type(jmethodID*)                                       \
1257   declare_toplevel_type(Mutex)                                            \
1258   declare_toplevel_type(Mutex*)                                           \
1259   declare_toplevel_type(nmethod*)                                         \
1260   declare_toplevel_type(ObjectMonitor*)                                   \
1261   declare_toplevel_type(oop*)                                             \
1262   declare_toplevel_type(OopMapCache*)                                     \
1263   declare_toplevel_type(VMReg)                                            \
1264   declare_toplevel_type(OSThread*)                                        \
1265    declare_integer_type(ReferenceType)                                    \
1266   declare_toplevel_type(StubQueue*)                                       \
1267   declare_toplevel_type(Thread*)                                          \
1268   declare_toplevel_type(Universe)                                         \
1269   declare_toplevel_type(CompressedOops)                                   \
1270   declare_toplevel_type(CompressedKlassPointers)                          \
1271   declare_toplevel_type(os)                                               \
1272   declare_toplevel_type(vframeArray)                                      \
1273   declare_toplevel_type(vframeArrayElement)                               \
1274   declare_toplevel_type(Annotations*)                                     \
1275   declare_toplevel_type(OopMapValue)                                      \
1276   declare_type(FileMapInfo, CHeapObj<mtInternal>)                         \
1277   declare_toplevel_type(FileMapHeader)                                    \
1278   declare_toplevel_type(CDSFileMapRegion)                                 \
1279   declare_toplevel_type(UpcallStub::FrameData)                            \
1280   declare_toplevel_type(ContinuationEntry)                                \
1281                                                                           \
1282   /************/                                                          \
1283   /* GC types */                                                          \
1284   /************/                                                          \
1285                                                                           \
1286   VM_TYPES_GC(declare_type,                                               \
1287               declare_toplevel_type,                                      \
1288               declare_integer_type)
1289 
1290 //--------------------------------------------------------------------------------
1291 // VM_INT_CONSTANTS
1292 //
1293 // This table contains integer constants required over in the
1294 // serviceability agent. The "declare_constant" macro is used for all
1295 // enums, etc., while "declare_preprocessor_constant" must be used for
1296 // all #defined constants.
1297 
1298 #define VM_INT_CONSTANTS(declare_constant,                                \
1299                          declare_constant_with_value,                     \
1300                          declare_preprocessor_constant)                   \
1301                                                                           \
1302   /****************/                                                      \
1303   /* GC constants */                                                      \
1304   /****************/                                                      \
1305                                                                           \
1306   VM_INT_CONSTANTS_GC(declare_constant,                                   \
1307                       declare_constant_with_value)                        \
1308                                                                           \
1309   /******************/                                                    \
1310   /* Useful globals */                                                    \
1311   /******************/                                                    \
1312                                                                           \
1313   declare_preprocessor_constant("ASSERT", DEBUG_ONLY(1) NOT_DEBUG(0))     \
1314   declare_preprocessor_constant("COMPILER2", COMPILER2_PRESENT(1) NOT_COMPILER2(0)) \
1315                                                                           \
1316   /****************/                                                      \
1317   /* Object sizes */                                                      \
1318   /****************/                                                      \
1319                                                                           \
1320   declare_constant(oopSize)                                               \
1321   declare_constant(LogBytesPerWord)                                       \
1322   declare_constant(BytesPerWord)                                          \
1323   declare_constant(BytesPerLong)                                          \
1324                                                                           \
1325   declare_constant(HeapWordSize)                                          \
1326   declare_constant(LogHeapWordSize)                                       \
1327                                                                           \
1328                                                                           \
1329   /************************/                                              \
1330   /* PerfMemory - jvmstat */                                              \
1331   /************************/                                              \
1332                                                                           \
1333   declare_preprocessor_constant("PERFDATA_MAJOR_VERSION", PERFDATA_MAJOR_VERSION) \
1334   declare_preprocessor_constant("PERFDATA_MINOR_VERSION", PERFDATA_MINOR_VERSION) \
1335   declare_preprocessor_constant("PERFDATA_BIG_ENDIAN", PERFDATA_BIG_ENDIAN)       \
1336   declare_preprocessor_constant("PERFDATA_LITTLE_ENDIAN", PERFDATA_LITTLE_ENDIAN) \
1337                                                                           \
1338                                                                           \
1339   /************************************************************/          \
1340   /* HotSpot specific JVM_ACC constants from global anon enum */          \
1341   /************************************************************/          \
1342                                                                           \
1343   declare_constant(JVM_CONSTANT_Utf8)                                     \
1344   declare_constant(JVM_CONSTANT_Unicode)                                  \
1345   declare_constant(JVM_CONSTANT_Integer)                                  \
1346   declare_constant(JVM_CONSTANT_Float)                                    \
1347   declare_constant(JVM_CONSTANT_Long)                                     \
1348   declare_constant(JVM_CONSTANT_Double)                                   \
1349   declare_constant(JVM_CONSTANT_Class)                                    \
1350   declare_constant(JVM_CONSTANT_String)                                   \
1351   declare_constant(JVM_CONSTANT_Fieldref)                                 \
1352   declare_constant(JVM_CONSTANT_Methodref)                                \
1353   declare_constant(JVM_CONSTANT_InterfaceMethodref)                       \
1354   declare_constant(JVM_CONSTANT_NameAndType)                              \
1355   declare_constant(JVM_CONSTANT_MethodHandle)                             \
1356   declare_constant(JVM_CONSTANT_MethodType)                               \
1357   declare_constant(JVM_CONSTANT_Dynamic)                                  \
1358   declare_constant(JVM_CONSTANT_InvokeDynamic)                            \
1359   declare_constant(JVM_CONSTANT_Module)                                   \
1360   declare_constant(JVM_CONSTANT_Package)                                  \
1361   declare_constant(JVM_CONSTANT_ExternalMax)                              \
1362                                                                           \
1363   declare_constant(JVM_CONSTANT_Invalid)                                  \
1364   declare_constant(JVM_CONSTANT_InternalMin)                              \
1365   declare_constant(JVM_CONSTANT_UnresolvedClass)                          \
1366   declare_constant(JVM_CONSTANT_ClassIndex)                               \
1367   declare_constant(JVM_CONSTANT_StringIndex)                              \
1368   declare_constant(JVM_CONSTANT_UnresolvedClassInError)                   \
1369   declare_constant(JVM_CONSTANT_MethodHandleInError)                      \
1370   declare_constant(JVM_CONSTANT_MethodTypeInError)                        \
1371   declare_constant(JVM_CONSTANT_DynamicInError)                           \
1372   declare_constant(JVM_CONSTANT_InternalMax)                              \
1373                                                                           \
1374   /*******************/                                                   \
1375   /* JavaThreadState */                                                   \
1376   /*******************/                                                   \
1377                                                                           \
1378   declare_constant(_thread_uninitialized)                                 \
1379   declare_constant(_thread_new)                                           \
1380   declare_constant(_thread_new_trans)                                     \
1381   declare_constant(_thread_in_native)                                     \
1382   declare_constant(_thread_in_native_trans)                               \
1383   declare_constant(_thread_in_vm)                                         \
1384   declare_constant(_thread_in_vm_trans)                                   \
1385   declare_constant(_thread_in_Java)                                       \
1386   declare_constant(_thread_in_Java_trans)                                 \
1387   declare_constant(_thread_blocked)                                       \
1388   declare_constant(_thread_blocked_trans)                                 \
1389   declare_constant(JavaThread::_not_terminated)                           \
1390   declare_constant(JavaThread::_thread_exiting)                           \
1391                                                                           \
1392   /*******************/                                                   \
1393   /* JavaThreadState */                                                   \
1394   /*******************/                                                   \
1395                                                                           \
1396   declare_constant(ALLOCATED)                                             \
1397   declare_constant(INITIALIZED)                                           \
1398   declare_constant(RUNNABLE)                                              \
1399   declare_constant(MONITOR_WAIT)                                          \
1400   declare_constant(CONDVAR_WAIT)                                          \
1401   declare_constant(OBJECT_WAIT)                                           \
1402   declare_constant(BREAKPOINTED)                                          \
1403   declare_constant(SLEEPING)                                              \
1404   declare_constant(ZOMBIE)                                                \
1405                                                                           \
1406   /******************************/                                        \
1407   /* Klass misc. enum constants */                                        \
1408   /******************************/                                        \
1409                                                                           \
1410   declare_constant(Klass::_primary_super_limit)                           \
1411   declare_constant(Klass::_lh_neutral_value)                              \
1412   declare_constant(Klass::_lh_instance_slow_path_bit)                     \
1413   declare_constant(Klass::_lh_log2_element_size_shift)                    \
1414   declare_constant(Klass::_lh_log2_element_size_mask)                     \
1415   declare_constant(Klass::_lh_element_type_shift)                         \
1416   declare_constant(Klass::_lh_element_type_mask)                          \
1417   declare_constant(Klass::_lh_header_size_shift)                          \
1418   declare_constant(Klass::_lh_header_size_mask)                           \
1419   declare_constant(Klass::_lh_array_tag_shift)                            \
1420   declare_constant(Klass::_lh_array_tag_type_value)                       \
1421   declare_constant(Klass::_lh_array_tag_ref_value)                        \
1422                                                                           \
1423   declare_constant(Method::nonvirtual_vtable_index)                       \
1424   declare_constant(Method::extra_stack_entries_for_jsr292)                \
1425                                                                           \
1426   /********************************/                                      \
1427   /* ConstMethod anon-enum */                                             \
1428   /********************************/                                      \
1429                                                                           \
1430   declare_constant(ConstMethodFlags::_misc_has_linenumber_table)          \
1431   declare_constant(ConstMethodFlags::_misc_has_checked_exceptions)        \
1432   declare_constant(ConstMethodFlags::_misc_has_localvariable_table)       \
1433   declare_constant(ConstMethodFlags::_misc_has_exception_table)           \
1434   declare_constant(ConstMethodFlags::_misc_has_generic_signature)         \
1435   declare_constant(ConstMethodFlags::_misc_has_method_parameters)         \
1436   declare_constant(ConstMethodFlags::_misc_has_method_annotations)        \
1437   declare_constant(ConstMethodFlags::_misc_has_parameter_annotations)     \
1438   declare_constant(ConstMethodFlags::_misc_has_default_annotations)       \
1439   declare_constant(ConstMethodFlags::_misc_has_type_annotations)          \
1440                                                                           \
1441   /**************/                                                        \
1442   /* DataLayout */                                                        \
1443   /**************/                                                        \
1444                                                                           \
1445   declare_constant(DataLayout::cell_size)                                 \
1446   declare_constant(DataLayout::no_tag)                                    \
1447   declare_constant(DataLayout::bit_data_tag)                              \
1448   declare_constant(DataLayout::counter_data_tag)                          \
1449   declare_constant(DataLayout::jump_data_tag)                             \
1450   declare_constant(DataLayout::receiver_type_data_tag)                    \
1451   declare_constant(DataLayout::virtual_call_data_tag)                     \
1452   declare_constant(DataLayout::ret_data_tag)                              \
1453   declare_constant(DataLayout::branch_data_tag)                           \
1454   declare_constant(DataLayout::multi_branch_data_tag)                     \
1455   declare_constant(DataLayout::arg_info_data_tag)                         \
1456   declare_constant(DataLayout::call_type_data_tag)                        \
1457   declare_constant(DataLayout::virtual_call_type_data_tag)                \
1458   declare_constant(DataLayout::parameters_type_data_tag)                  \
1459   declare_constant(DataLayout::speculative_trap_data_tag)                 \
1460                                                                           \
1461   /*************************************/                                 \
1462   /* InstanceKlass enum                */                                 \
1463   /*************************************/                                 \
1464                                                                           \
1465                                                                           \
1466                                                                           \
1467   /************************************************/                      \
1468   /* InstanceKlass InnerClassAttributeOffset enum */                      \
1469   /************************************************/                      \
1470                                                                           \
1471   declare_constant(InstanceKlass::inner_class_inner_class_info_offset)    \
1472   declare_constant(InstanceKlass::inner_class_outer_class_info_offset)    \
1473   declare_constant(InstanceKlass::inner_class_inner_name_offset)          \
1474   declare_constant(InstanceKlass::inner_class_access_flags_offset)        \
1475   declare_constant(InstanceKlass::inner_class_next_offset)                \
1476                                                                           \
1477   /*****************************************************/                 \
1478   /* InstanceKlass EnclosingMethodAttributeOffset enum */                 \
1479   /*****************************************************/                 \
1480                                                                           \
1481   declare_constant(InstanceKlass::enclosing_method_attribute_size)        \
1482                                                                           \
1483   /*********************************/                                     \
1484   /* InstanceKlass ClassState enum */                                     \
1485   /*********************************/                                     \
1486                                                                           \
1487   declare_constant(InstanceKlass::allocated)                              \
1488   declare_constant(InstanceKlass::loaded)                                 \
1489   declare_constant(InstanceKlass::linked)                                 \
1490   declare_constant(InstanceKlass::being_initialized)                      \
1491   declare_constant(InstanceKlass::fully_initialized)                      \
1492   declare_constant(InstanceKlass::initialization_error)                   \
1493                                                                           \
1494   /*********************************/                                     \
1495   /* Symbol* - symbol max length */                                       \
1496   /*********************************/                                     \
1497                                                                           \
1498   declare_constant(Symbol::max_symbol_length)                             \
1499                                                                           \
1500   /******************************************************/                \
1501   /* BSMAttributeEntry* - layout enum for InvokeDynamic */                \
1502   /******************************************************/                \
1503                                                                           \
1504   declare_constant(BSMAttributeEntry::_bsmi_offset)                       \
1505   declare_constant(BSMAttributeEntry::_argc_offset)                       \
1506   declare_constant(BSMAttributeEntry::_argv_offset)                       \
1507                                                                           \
1508   /***************************************/                               \
1509   /* JavaThreadStatus enum               */                               \
1510   /***************************************/                               \
1511                                                                           \
1512   declare_constant(JavaThreadStatus::NEW)                                 \
1513   declare_constant(JavaThreadStatus::RUNNABLE)                            \
1514   declare_constant(JavaThreadStatus::SLEEPING)                            \
1515   declare_constant(JavaThreadStatus::IN_OBJECT_WAIT)                      \
1516   declare_constant(JavaThreadStatus::IN_OBJECT_WAIT_TIMED)                \
1517   declare_constant(JavaThreadStatus::PARKED)                              \
1518   declare_constant(JavaThreadStatus::PARKED_TIMED)                        \
1519   declare_constant(JavaThreadStatus::BLOCKED_ON_MONITOR_ENTER)            \
1520   declare_constant(JavaThreadStatus::TERMINATED)                          \
1521                                                                           \
1522                                                                           \
1523   /******************************/                                        \
1524   /* FieldFlags enum            */                                        \
1525   /******************************/                                        \
1526                                                                           \
1527   declare_constant(FieldInfo::FieldFlags::_ff_initialized)                \
1528   declare_constant(FieldInfo::FieldFlags::_ff_injected)                   \
1529   declare_constant(FieldInfo::FieldFlags::_ff_generic)                    \
1530   declare_constant(FieldInfo::FieldFlags::_ff_stable)                     \
1531   declare_constant(FieldInfo::FieldFlags::_ff_contended)                  \
1532                                                                           \
1533   /******************************/                                        \
1534   /* Debug info                 */                                        \
1535   /******************************/                                        \
1536                                                                           \
1537   declare_constant(Location::OFFSET_MASK)                                 \
1538   declare_constant(Location::OFFSET_SHIFT)                                \
1539   declare_constant(Location::TYPE_MASK)                                   \
1540   declare_constant(Location::TYPE_SHIFT)                                  \
1541   declare_constant(Location::WHERE_MASK)                                  \
1542   declare_constant(Location::WHERE_SHIFT)                                 \
1543                                                                           \
1544   /* constants from Location::Type enum  */                               \
1545                                                                           \
1546   declare_constant(Location::normal)                                      \
1547   declare_constant(Location::oop)                                         \
1548   declare_constant(Location::narrowoop)                                   \
1549   declare_constant(Location::int_in_long)                                 \
1550   declare_constant(Location::lng)                                         \
1551   declare_constant(Location::float_in_dbl)                                \
1552   declare_constant(Location::dbl)                                         \
1553   declare_constant(Location::addr)                                        \
1554   declare_constant(Location::invalid)                                     \
1555                                                                           \
1556   /* constants from Location::Where enum */                               \
1557                                                                           \
1558   declare_constant(Location::on_stack)                                    \
1559   declare_constant(Location::in_register)                                 \
1560                                                                           \
1561   declare_constant(Deoptimization::Reason_many)                           \
1562   declare_constant(Deoptimization::Reason_none)                           \
1563   declare_constant(Deoptimization::Reason_null_check)                     \
1564   declare_constant(Deoptimization::Reason_null_assert)                    \
1565   declare_constant(Deoptimization::Reason_range_check)                    \
1566   declare_constant(Deoptimization::Reason_class_check)                    \
1567   declare_constant(Deoptimization::Reason_array_check)                    \
1568   declare_constant(Deoptimization::Reason_intrinsic)                      \
1569   declare_constant(Deoptimization::Reason_bimorphic)                      \
1570   declare_constant(Deoptimization::Reason_profile_predicate)              \
1571   declare_constant(Deoptimization::Reason_unloaded)                       \
1572   declare_constant(Deoptimization::Reason_uninitialized)                  \
1573   declare_constant(Deoptimization::Reason_initialized)                    \
1574   declare_constant(Deoptimization::Reason_unreached)                      \
1575   declare_constant(Deoptimization::Reason_unhandled)                      \
1576   declare_constant(Deoptimization::Reason_constraint)                     \
1577   declare_constant(Deoptimization::Reason_div0_check)                     \
1578   declare_constant(Deoptimization::Reason_age)                            \
1579   declare_constant(Deoptimization::Reason_predicate)                      \
1580   declare_constant(Deoptimization::Reason_loop_limit_check)               \
1581   declare_constant(Deoptimization::Reason_short_running_long_loop)        \
1582   declare_constant(Deoptimization::Reason_auto_vectorization_check)       \
1583   declare_constant(Deoptimization::Reason_speculate_class_check)          \
1584   declare_constant(Deoptimization::Reason_speculate_null_check)           \
1585   declare_constant(Deoptimization::Reason_speculate_null_assert)          \
1586   declare_constant(Deoptimization::Reason_unstable_if)                    \
1587   declare_constant(Deoptimization::Reason_unstable_fused_if)              \
1588   declare_constant(Deoptimization::Reason_receiver_constraint)            \
1589   declare_constant(Deoptimization::Reason_not_compiled_exception_handler) \
1590   NOT_ZERO(JVMCI_ONLY(declare_constant(Deoptimization::Reason_transfer_to_interpreter)))        \
1591   NOT_ZERO(JVMCI_ONLY(declare_constant(Deoptimization::Reason_unresolved)))                     \
1592   NOT_ZERO(JVMCI_ONLY(declare_constant(Deoptimization::Reason_jsr_mismatch)))                   \
1593   declare_constant(Deoptimization::Reason_tenured)                        \
1594   declare_constant(Deoptimization::Reason_LIMIT)                          \
1595   declare_constant(Deoptimization::Reason_RECORDED_LIMIT)                 \
1596                                                                           \
1597   declare_constant(Deoptimization::Action_none)                           \
1598   declare_constant(Deoptimization::Action_maybe_recompile)                \
1599   declare_constant(Deoptimization::Action_reinterpret)                    \
1600   declare_constant(Deoptimization::Action_make_not_entrant)               \
1601   declare_constant(Deoptimization::Action_make_not_compilable)            \
1602   declare_constant(Deoptimization::Action_LIMIT)                          \
1603                                                                           \
1604   declare_constant(Deoptimization::Unpack_deopt)                          \
1605   declare_constant(Deoptimization::Unpack_exception)                      \
1606   declare_constant(Deoptimization::Unpack_uncommon_trap)                  \
1607   declare_constant(Deoptimization::Unpack_reexecute)                      \
1608                                                                           \
1609   declare_constant(Deoptimization::_action_bits)                          \
1610   declare_constant(Deoptimization::_reason_bits)                          \
1611   declare_constant(Deoptimization::_debug_id_bits)                        \
1612   declare_constant(Deoptimization::_action_shift)                         \
1613   declare_constant(Deoptimization::_reason_shift)                         \
1614   declare_constant(Deoptimization::_debug_id_shift)                       \
1615                                                                           \
1616   /******************************************/                            \
1617   /* BasicType enum (globalDefinitions.hpp) */                            \
1618   /******************************************/                            \
1619                                                                           \
1620   declare_constant(T_BOOLEAN)                                             \
1621   declare_constant(T_CHAR)                                                \
1622   declare_constant(T_FLOAT)                                               \
1623   declare_constant(T_DOUBLE)                                              \
1624   declare_constant(T_BYTE)                                                \
1625   declare_constant(T_SHORT)                                               \
1626   declare_constant(T_INT)                                                 \
1627   declare_constant(T_LONG)                                                \
1628   declare_constant(T_OBJECT)                                              \
1629   declare_constant(T_ARRAY)                                               \
1630   declare_constant(T_VOID)                                                \
1631   declare_constant(T_ADDRESS)                                             \
1632   declare_constant(T_NARROWOOP)                                           \
1633   declare_constant(T_METADATA)                                            \
1634   declare_constant(T_NARROWKLASS)                                         \
1635   declare_constant(T_CONFLICT)                                            \
1636   declare_constant(T_ILLEGAL)                                             \
1637                                                                           \
1638   /**********************************************/                        \
1639   /* BasicTypeSize enum (globalDefinitions.hpp) */                        \
1640   /**********************************************/                        \
1641                                                                           \
1642   declare_constant(T_BOOLEAN_size)                                        \
1643   declare_constant(T_CHAR_size)                                           \
1644   declare_constant(T_FLOAT_size)                                          \
1645   declare_constant(T_DOUBLE_size)                                         \
1646   declare_constant(T_BYTE_size)                                           \
1647   declare_constant(T_SHORT_size)                                          \
1648   declare_constant(T_INT_size)                                            \
1649   declare_constant(T_LONG_size)                                           \
1650   declare_constant(T_OBJECT_size)                                         \
1651   declare_constant(T_ARRAY_size)                                          \
1652   declare_constant(T_NARROWOOP_size)                                      \
1653   declare_constant(T_NARROWKLASS_size)                                    \
1654   declare_constant(T_VOID_size)                                           \
1655                                                                           \
1656   /*********************************************/                         \
1657   /* MethodCompilation (globalDefinitions.hpp) */                         \
1658   /*********************************************/                         \
1659                                                                           \
1660   declare_constant(InvocationEntryBci)                                    \
1661                                                                           \
1662   /*************/                                                         \
1663   /* CompLevel */                                                         \
1664   /*************/                                                         \
1665                                                                           \
1666   declare_constant(CompLevel_any)                                         \
1667   declare_constant(CompLevel_all)                                         \
1668   declare_constant(CompLevel_none)                                        \
1669   declare_constant(CompLevel_simple)                                      \
1670   declare_constant(CompLevel_limited_profile)                             \
1671   declare_constant(CompLevel_full_profile)                                \
1672   declare_constant(CompLevel_full_optimization)                           \
1673                                                                           \
1674   /****************/                                                      \
1675   /* CodeBlobKind */                                                      \
1676   /****************/                                                      \
1677                                                                           \
1678   declare_constant(CodeBlobKind::Nmethod)                                 \
1679   declare_constant(CodeBlobKind::Buffer)                                  \
1680   declare_constant(CodeBlobKind::Adapter)                                 \
1681   declare_constant(CodeBlobKind::Vtable)                                  \
1682   declare_constant(CodeBlobKind::MHAdapter)                               \
1683   declare_constant(CodeBlobKind::RuntimeStub)                             \
1684   declare_constant(CodeBlobKind::Deoptimization)                          \
1685   declare_constant(CodeBlobKind::Safepoint)                               \
1686   COMPILER2_PRESENT(declare_constant(CodeBlobKind::Exception))            \
1687   COMPILER2_PRESENT(declare_constant(CodeBlobKind::UncommonTrap))         \
1688   declare_constant(CodeBlobKind::Upcall)                                  \
1689   declare_constant(CodeBlobKind::Number_Of_Kinds)                         \
1690                                                                           \
1691   /***************/                                                       \
1692   /* OopMapValue */                                                       \
1693   /***************/                                                       \
1694                                                                           \
1695   declare_constant(OopMapValue::type_bits)                                \
1696   declare_constant(OopMapValue::register_bits)                            \
1697   declare_constant(OopMapValue::type_shift)                               \
1698   declare_constant(OopMapValue::register_shift)                           \
1699   declare_constant(OopMapValue::type_mask)                                \
1700   declare_constant(OopMapValue::type_mask_in_place)                       \
1701   declare_constant(OopMapValue::register_mask)                            \
1702   declare_constant(OopMapValue::register_mask_in_place)                   \
1703   declare_constant(OopMapValue::unused_value)                             \
1704   declare_constant(OopMapValue::oop_value)                                \
1705   declare_constant(OopMapValue::narrowoop_value)                          \
1706   declare_constant(OopMapValue::callee_saved_value)                       \
1707   declare_constant(OopMapValue::derived_oop_value)                        \
1708                                                                           \
1709   /******************/                                                    \
1710   /* JNIHandleBlock */                                                    \
1711   /******************/                                                    \
1712                                                                           \
1713   declare_constant(JNIHandleBlock::block_size_in_oops)                    \
1714                                                                           \
1715   /**********************/                                                \
1716   /* PcDesc             */                                                \
1717   /**********************/                                                \
1718                                                                           \
1719   declare_constant(PcDesc::PCDESC_reexecute)                              \
1720   declare_constant(PcDesc::PCDESC_return_oop)                             \
1721                                                                           \
1722   /**********************/                                                \
1723   /* frame              */                                                \
1724   /**********************/                                                \
1725   NOT_ZERO(PPC64_ONLY(declare_constant(frame::entry_frame_locals_size)))  \
1726                                                                           \
1727   declare_constant(frame::pc_return_offset)                               \
1728                                                                           \
1729   /*************/                                                         \
1730   /* vmSymbols */                                                         \
1731   /*************/                                                         \
1732                                                                           \
1733   declare_constant(vmSymbols::FIRST_SID)                                  \
1734   declare_constant(vmSymbols::SID_LIMIT)                                  \
1735                                                                           \
1736   /****************/                                                      \
1737   /* vmIntrinsics */                                                      \
1738   /****************/                                                      \
1739                                                                           \
1740   declare_constant(vmIntrinsics::_invokeBasic)                            \
1741   declare_constant(vmIntrinsics::_linkToVirtual)                          \
1742   declare_constant(vmIntrinsics::_linkToStatic)                           \
1743   declare_constant(vmIntrinsics::_linkToSpecial)                          \
1744   declare_constant(vmIntrinsics::_linkToInterface)                        \
1745   declare_constant(vmIntrinsics::_linkToNative)                           \
1746                                                                           \
1747   /********************************/                                      \
1748   /* Calling convention constants */                                      \
1749   /********************************/                                      \
1750                                                                           \
1751   declare_constant(ConcreteRegisterImpl::number_of_registers)             \
1752   declare_preprocessor_constant("REG_COUNT", REG_COUNT)                   \
1753   COMPILER2_PRESENT(declare_preprocessor_constant("SAVED_ON_ENTRY_REG_COUNT", SAVED_ON_ENTRY_REG_COUNT)) \
1754   COMPILER2_PRESENT(declare_preprocessor_constant("C_SAVED_ON_ENTRY_REG_COUNT", C_SAVED_ON_ENTRY_REG_COUNT)) \
1755                                                                           \
1756   /************/                                                          \
1757   /* PerfData */                                                          \
1758   /************/                                                          \
1759                                                                           \
1760   /***********************/                                               \
1761   /* PerfData Units enum */                                               \
1762   /***********************/                                               \
1763                                                                           \
1764   declare_constant(PerfData::U_None)                                      \
1765   declare_constant(PerfData::U_Bytes)                                     \
1766   declare_constant(PerfData::U_Ticks)                                     \
1767   declare_constant(PerfData::U_Events)                                    \
1768   declare_constant(PerfData::U_String)                                    \
1769   declare_constant(PerfData::U_Hertz)                                     \
1770                                                                           \
1771   /****************/                                                      \
1772   /* JVMCI */                                                             \
1773   /****************/                                                      \
1774                                                                           \
1775   declare_preprocessor_constant("INCLUDE_JVMCI", INCLUDE_JVMCI)           \
1776                                                                           \
1777   /****************/                                                      \
1778   /*  VMRegImpl   */                                                      \
1779   /****************/                                                      \
1780   declare_constant(VMRegImpl::stack_slot_size)                            \
1781                                                                           \
1782   /******************************/                                        \
1783   /*  -XX flags (value origin)  */                                        \
1784   /******************************/                                        \
1785   declare_constant(JVMFlagOrigin::DEFAULT)                                \
1786   declare_constant(JVMFlagOrigin::COMMAND_LINE)                           \
1787   declare_constant(JVMFlagOrigin::ENVIRON_VAR)                            \
1788   declare_constant(JVMFlagOrigin::CONFIG_FILE)                            \
1789   declare_constant(JVMFlagOrigin::MANAGEMENT)                             \
1790   declare_constant(JVMFlagOrigin::ERGONOMIC)                              \
1791   declare_constant(JVMFlagOrigin::ATTACH_ON_DEMAND)                       \
1792   declare_constant(JVMFlagOrigin::INTERNAL)                               \
1793   declare_constant(JVMFlagOrigin::JIMAGE_RESOURCE)                        \
1794   declare_constant(JVMFlag::VALUE_ORIGIN_MASK)                            \
1795   declare_constant(JVMFlag::WAS_SET_ON_COMMAND_LINE)
1796 
1797 //--------------------------------------------------------------------------------
1798 // VM_LONG_CONSTANTS
1799 //
1800 // This table contains long constants required over in the
1801 // serviceability agent. The "declare_constant" macro is used for all
1802 // enums, etc., while "declare_preprocessor_constant" must be used for
1803 // all #defined constants.
1804 
1805 #define VM_LONG_CONSTANTS(declare_constant, declare_preprocessor_constant) \
1806                                                                           \
1807   /****************/                                                      \
1808   /* GC constants */                                                      \
1809   /****************/                                                      \
1810                                                                           \
1811   VM_LONG_CONSTANTS_GC(declare_constant)                                  \
1812                                                                           \
1813   /*********************/                                                 \
1814   /* markWord constants */                                                \
1815   /*********************/                                                 \
1816                                                                           \
1817   /* Note: some of these are declared as long constants just for */       \
1818   /* consistency. The mask constants are the only ones requiring */       \
1819   /* 64 bits (on 64-bit platforms). */                                    \
1820                                                                           \
1821   declare_constant(markWord::age_bits)                                    \
1822   declare_constant(markWord::lock_bits)                                   \
1823   declare_constant(markWord::max_hash_bits)                               \
1824   declare_constant(markWord::hash_bits)                                   \
1825                                                                           \
1826   declare_constant(markWord::lock_shift)                                  \
1827   declare_constant(markWord::age_shift)                                   \
1828   declare_constant(markWord::hash_shift)                                  \
1829   LP64_ONLY(declare_constant(markWord::klass_shift))                      \
1830                                                                           \
1831   declare_constant(markWord::lock_mask)                                   \
1832   declare_constant(markWord::lock_mask_in_place)                          \
1833   declare_constant(markWord::age_mask)                                    \
1834   declare_constant(markWord::age_mask_in_place)                           \
1835   declare_constant(markWord::hash_mask)                                   \
1836   declare_constant(markWord::hash_mask_in_place)                          \
1837                                                                           \
1838   declare_constant(markWord::locked_value)                                \
1839   declare_constant(markWord::unlocked_value)                              \
1840   declare_constant(markWord::monitor_value)                               \
1841   declare_constant(markWord::marked_value)                                \
1842                                                                           \
1843   declare_constant(markWord::no_hash)                                     \
1844   declare_constant(markWord::no_hash_in_place)                            \
1845   declare_constant(markWord::no_lock_in_place)                            \
1846   declare_constant(markWord::max_age)                                     \
1847                                                                           \
1848   /* InvocationCounter constants */                                       \
1849   declare_constant(InvocationCounter::count_increment)                    \
1850   declare_constant(InvocationCounter::count_shift)                        \
1851                                                                           \
1852   /* ObjectMonitor constants */                                           \
1853   declare_constant(ObjectMonitor::NO_OWNER)                               \
1854   declare_constant(ObjectMonitor::ANONYMOUS_OWNER)                        \
1855   declare_constant(ObjectMonitor::DEFLATER_MARKER)                        \
1856 
1857 //--------------------------------------------------------------------------------
1858 //
1859 
1860 // Generate and check a nonstatic field in non-product builds
1861 #ifndef PRODUCT
1862 # define GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY(a, b, c) GENERATE_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)
1863 # define CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)    CHECK_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)
1864 # define ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT(a, b, c)          ENSURE_FIELD_TYPE_PRESENT(a, b, c)
1865 #else
1866 # define GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)
1867 # define CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)
1868 # define ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT(a, b, c)
1869 #endif /* PRODUCT */
1870 
1871 //
1872 // Instantiation of VMStructEntries, VMTypeEntries and VMIntConstantEntries
1873 //
1874 
1875 // These initializers are allowed to access private fields in classes
1876 // as long as class VMStructs is a friend
1877 VMStructEntry VMStructs::localHotSpotVMStructs[] = {
1878 
1879   VM_STRUCTS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
1880              GENERATE_STATIC_VM_STRUCT_ENTRY,
1881              GENERATE_VOLATILE_STATIC_VM_STRUCT_ENTRY,
1882              GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
1883              GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
1884              GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY)
1885 
1886 
1887   VM_STRUCTS_OS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
1888                 GENERATE_STATIC_VM_STRUCT_ENTRY,
1889                 GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
1890                 GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
1891                 GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY)
1892 
1893   VM_STRUCTS_CPU(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
1894                  GENERATE_STATIC_VM_STRUCT_ENTRY,
1895                  GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
1896                  GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
1897                  GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY)
1898 
1899   GENERATE_VM_STRUCT_LAST_ENTRY()
1900 };
1901 
1902 size_t VMStructs::localHotSpotVMStructsLength() {
1903   return sizeof(localHotSpotVMStructs) / sizeof(VMStructEntry);
1904 }
1905 
1906 VMTypeEntry VMStructs::localHotSpotVMTypes[] = {
1907 
1908   VM_TYPES(GENERATE_VM_TYPE_ENTRY,
1909            GENERATE_TOPLEVEL_VM_TYPE_ENTRY,
1910            GENERATE_OOP_VM_TYPE_ENTRY,
1911            GENERATE_INTEGER_VM_TYPE_ENTRY,
1912            GENERATE_UNSIGNED_INTEGER_VM_TYPE_ENTRY)
1913 
1914   VM_TYPES_OS(GENERATE_VM_TYPE_ENTRY,
1915               GENERATE_TOPLEVEL_VM_TYPE_ENTRY,
1916               GENERATE_OOP_VM_TYPE_ENTRY,
1917               GENERATE_INTEGER_VM_TYPE_ENTRY,
1918               GENERATE_UNSIGNED_INTEGER_VM_TYPE_ENTRY)
1919 
1920   VM_TYPES_CPU(GENERATE_VM_TYPE_ENTRY,
1921                GENERATE_TOPLEVEL_VM_TYPE_ENTRY,
1922                GENERATE_OOP_VM_TYPE_ENTRY,
1923                GENERATE_INTEGER_VM_TYPE_ENTRY,
1924                GENERATE_UNSIGNED_INTEGER_VM_TYPE_ENTRY)
1925 
1926   GENERATE_VM_TYPE_LAST_ENTRY()
1927 };
1928 
1929 size_t VMStructs::localHotSpotVMTypesLength() {
1930   return sizeof(localHotSpotVMTypes) / sizeof(VMTypeEntry);
1931 }
1932 
1933 VMIntConstantEntry VMStructs::localHotSpotVMIntConstants[] = {
1934 
1935   VM_INT_CONSTANTS(GENERATE_VM_INT_CONSTANT_ENTRY,
1936                    GENERATE_VM_INT_CONSTANT_WITH_VALUE_ENTRY,
1937                    GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY)
1938 
1939   VM_INT_CONSTANTS_OS(GENERATE_VM_INT_CONSTANT_ENTRY,
1940                       GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY)
1941 
1942   VM_INT_CONSTANTS_CPU(GENERATE_VM_INT_CONSTANT_ENTRY,
1943                        GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY)
1944 
1945 #ifdef VM_INT_CPU_FEATURE_CONSTANTS
1946   VM_INT_CPU_FEATURE_CONSTANTS
1947 #endif
1948 
1949   GENERATE_VM_INT_CONSTANT_LAST_ENTRY()
1950 };
1951 
1952 size_t VMStructs::localHotSpotVMIntConstantsLength() {
1953   return sizeof(localHotSpotVMIntConstants) / sizeof(VMIntConstantEntry);
1954 }
1955 
1956 VMLongConstantEntry VMStructs::localHotSpotVMLongConstants[] = {
1957 
1958   VM_LONG_CONSTANTS(GENERATE_VM_LONG_CONSTANT_ENTRY,
1959                     GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY)
1960 
1961   VM_LONG_CONSTANTS_OS(GENERATE_VM_LONG_CONSTANT_ENTRY,
1962                        GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY)
1963 
1964   VM_LONG_CONSTANTS_CPU(GENERATE_VM_LONG_CONSTANT_ENTRY,
1965                         GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY)
1966 
1967 #ifdef VM_LONG_CPU_FEATURE_CONSTANTS
1968   VM_LONG_CPU_FEATURE_CONSTANTS
1969 #endif
1970 
1971   GENERATE_VM_LONG_CONSTANT_LAST_ENTRY()
1972 };
1973 
1974 size_t VMStructs::localHotSpotVMLongConstantsLength() {
1975   return sizeof(localHotSpotVMLongConstants) / sizeof(VMLongConstantEntry);
1976 }
1977 
1978 extern "C" {
1979 
1980 #define STRIDE(array) ((char*)&array[1] - (char*)&array[0])
1981 
1982 JNIEXPORT VMStructEntry* gHotSpotVMStructs = VMStructs::localHotSpotVMStructs;
1983 JNIEXPORT uint64_t gHotSpotVMStructEntryTypeNameOffset = offset_of(VMStructEntry, typeName);
1984 JNIEXPORT uint64_t gHotSpotVMStructEntryFieldNameOffset = offset_of(VMStructEntry, fieldName);
1985 JNIEXPORT uint64_t gHotSpotVMStructEntryTypeStringOffset = offset_of(VMStructEntry, typeString);
1986 JNIEXPORT uint64_t gHotSpotVMStructEntryIsStaticOffset = offset_of(VMStructEntry, isStatic);
1987 JNIEXPORT uint64_t gHotSpotVMStructEntryOffsetOffset = offset_of(VMStructEntry, offset);
1988 JNIEXPORT uint64_t gHotSpotVMStructEntryAddressOffset = offset_of(VMStructEntry, address);
1989 JNIEXPORT uint64_t gHotSpotVMStructEntryArrayStride = STRIDE(gHotSpotVMStructs);
1990 
1991 JNIEXPORT VMTypeEntry* gHotSpotVMTypes = VMStructs::localHotSpotVMTypes;
1992 JNIEXPORT uint64_t gHotSpotVMTypeEntryTypeNameOffset = offset_of(VMTypeEntry, typeName);
1993 JNIEXPORT uint64_t gHotSpotVMTypeEntrySuperclassNameOffset = offset_of(VMTypeEntry, superclassName);
1994 JNIEXPORT uint64_t gHotSpotVMTypeEntryIsOopTypeOffset = offset_of(VMTypeEntry, isOopType);
1995 JNIEXPORT uint64_t gHotSpotVMTypeEntryIsIntegerTypeOffset = offset_of(VMTypeEntry, isIntegerType);
1996 JNIEXPORT uint64_t gHotSpotVMTypeEntryIsUnsignedOffset = offset_of(VMTypeEntry, isUnsigned);
1997 JNIEXPORT uint64_t gHotSpotVMTypeEntrySizeOffset = offset_of(VMTypeEntry, size);
1998 JNIEXPORT uint64_t gHotSpotVMTypeEntryArrayStride = STRIDE(gHotSpotVMTypes);
1999 
2000 JNIEXPORT VMIntConstantEntry* gHotSpotVMIntConstants = VMStructs::localHotSpotVMIntConstants;
2001 JNIEXPORT uint64_t gHotSpotVMIntConstantEntryNameOffset = offset_of(VMIntConstantEntry, name);
2002 JNIEXPORT uint64_t gHotSpotVMIntConstantEntryValueOffset = offset_of(VMIntConstantEntry, value);
2003 JNIEXPORT uint64_t gHotSpotVMIntConstantEntryArrayStride = STRIDE(gHotSpotVMIntConstants);
2004 
2005 JNIEXPORT VMLongConstantEntry* gHotSpotVMLongConstants = VMStructs::localHotSpotVMLongConstants;
2006 JNIEXPORT uint64_t gHotSpotVMLongConstantEntryNameOffset = offset_of(VMLongConstantEntry, name);
2007 JNIEXPORT uint64_t gHotSpotVMLongConstantEntryValueOffset = offset_of(VMLongConstantEntry, value);
2008 JNIEXPORT uint64_t gHotSpotVMLongConstantEntryArrayStride = STRIDE(gHotSpotVMLongConstants);
2009 } // "C"
2010 
2011 #ifdef ASSERT
2012 // This is used both to check the types of referenced fields and
2013 // to ensure that all of the field types are present.
2014 void VMStructs::init() {
2015   VM_STRUCTS(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
2016              CHECK_STATIC_VM_STRUCT_ENTRY,
2017              CHECK_VOLATILE_STATIC_VM_STRUCT_ENTRY,
2018              CHECK_NO_OP,
2019              CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY,
2020              CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY)
2021 
2022   VM_STRUCTS_CPU(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
2023                  CHECK_STATIC_VM_STRUCT_ENTRY,
2024                  CHECK_NO_OP,
2025                  CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY,
2026                  CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY)
2027 
2028   VM_TYPES(CHECK_VM_TYPE_ENTRY,
2029            CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
2030            CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
2031            CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
2032            CHECK_SINGLE_ARG_VM_TYPE_NO_OP)
2033 
2034 
2035   VM_TYPES_CPU(CHECK_VM_TYPE_ENTRY,
2036                CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
2037                CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
2038                CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
2039                CHECK_SINGLE_ARG_VM_TYPE_NO_OP)
2040 
2041   //
2042   // Split VM_STRUCTS() invocation into two parts to allow MS VC++ 6.0
2043   // to build with the source mounted over SNC3.2. Symptom was that
2044   // debug build failed with an internal compiler error. Has been seen
2045   // mounting sources from Solaris 2.6 and 2.7 hosts, but so far not
2046   // 2.8 hosts. Appears to occur because line is too long.
2047   //
2048   // If an assertion failure is triggered here it means that an entry
2049   // in VMStructs::localHotSpotVMStructs[] was not found in
2050   // VMStructs::localHotSpotVMTypes[]. (The assertion itself had to be
2051   // made less descriptive because of this above bug -- see the
2052   // definition of ENSURE_FIELD_TYPE_PRESENT.)
2053   //
2054   // NOTE: taken out because this was just not working on everyone's
2055   // Solstice NFS setup. If everyone switches to local workspaces on
2056   // Win32, we can put this back in.
2057 #ifndef _WINDOWS
2058   VM_STRUCTS(ENSURE_FIELD_TYPE_PRESENT,
2059              CHECK_NO_OP,
2060              CHECK_NO_OP,
2061              CHECK_NO_OP,
2062              CHECK_NO_OP,
2063              CHECK_NO_OP)
2064 
2065   VM_STRUCTS(CHECK_NO_OP,
2066              ENSURE_FIELD_TYPE_PRESENT,
2067              ENSURE_FIELD_TYPE_PRESENT,
2068              CHECK_NO_OP,
2069              ENSURE_FIELD_TYPE_PRESENT,
2070              ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT)
2071 
2072   VM_STRUCTS_CPU(ENSURE_FIELD_TYPE_PRESENT,
2073                  ENSURE_FIELD_TYPE_PRESENT,
2074                  CHECK_NO_OP,
2075                  ENSURE_FIELD_TYPE_PRESENT,
2076                  ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT)
2077 #endif // !_WINDOWS
2078 }
2079 
2080 static int recursiveFindType(VMTypeEntry* origtypes, const char* typeName, bool isRecurse) {
2081   {
2082     VMTypeEntry* types = origtypes;
2083     while (types->typeName != nullptr) {
2084       if (strcmp(typeName, types->typeName) == 0) {
2085         // Found it
2086         return 1;
2087       }
2088       ++types;
2089     }
2090   }
2091   // Search for the base type by peeling off const and *
2092   size_t len = strlen(typeName);
2093   if (typeName[len-1] == '*') {
2094     char * s = NEW_C_HEAP_ARRAY(char, len, mtInternal);
2095     strncpy(s, typeName, len - 1);
2096     s[len-1] = '\0';
2097     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
2098     if (recursiveFindType(origtypes, s, true) == 1) {
2099       FREE_C_HEAP_ARRAY(char, s);
2100       return 1;
2101     }
2102     FREE_C_HEAP_ARRAY(char, s);
2103   }
2104   const char* start = nullptr;
2105   if (strstr(typeName, "GrowableArray<") == typeName) {
2106     start = typeName + strlen("GrowableArray<");
2107   } else if (strstr(typeName, "Array<") == typeName) {
2108     start = typeName + strlen("Array<");
2109   }
2110   if (start != nullptr) {
2111     const char * end = strrchr(typeName, '>');
2112     int len = pointer_delta_as_int(end, start) + 1;
2113     char * s = NEW_C_HEAP_ARRAY(char, len, mtInternal);
2114     strncpy(s, start, len - 1);
2115     s[len-1] = '\0';
2116     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
2117     if (recursiveFindType(origtypes, s, true) == 1) {
2118       FREE_C_HEAP_ARRAY(char, s);
2119       return 1;
2120     }
2121     FREE_C_HEAP_ARRAY(char, s);
2122   }
2123   if (strstr(typeName, "const ") == typeName) {
2124     const char * s = typeName + strlen("const ");
2125     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
2126     if (recursiveFindType(origtypes, s, true) == 1) {
2127       return 1;
2128     }
2129   }
2130   if (strstr(typeName, " const") == typeName + len - 6) {
2131     char * s = os::strdup_check_oom(typeName);
2132     s[len - 6] = '\0';
2133     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
2134     if (recursiveFindType(origtypes, s, true) == 1) {
2135       os::free(s);
2136       return 1;
2137     }
2138     os::free(s);
2139   }
2140   if (!isRecurse) {
2141     tty->print_cr("type \"%s\" not found", typeName);
2142   }
2143   return 0;
2144 }
2145 
2146 int VMStructs::findType(const char* typeName) {
2147   VMTypeEntry* types = gHotSpotVMTypes;
2148 
2149   return recursiveFindType(types, typeName, false);
2150 }
2151 
2152 void vmStructs_init() {
2153   VMStructs::init();
2154 }
2155 #endif // ASSERT
2156