1 /*
   2  * Copyright (c) 2015, 2023, 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 "precompiled.hpp"
  26 #include "code/codeCache.hpp"
  27 #include "code/compiledIC.hpp"
  28 #include "compiler/compileBroker.hpp"
  29 #include "gc/shared/collectedHeap.hpp"
  30 #include "jvmci/jvmciCodeInstaller.hpp"
  31 #include "jvmci/jvmciCompilerToVM.hpp"
  32 #include "jvmci/jvmciRuntime.hpp"
  33 #include "jvmci/vmStructs_jvmci.hpp"
  34 #include "oops/klassVtable.hpp"
  35 #include "oops/methodCounters.hpp"
  36 #include "oops/objArrayKlass.hpp"
  37 #include "prims/jvmtiThreadState.hpp"
  38 #include "runtime/deoptimization.hpp"
  39 #include "runtime/flags/jvmFlag.hpp"
  40 #include "runtime/objectMonitor.hpp"
  41 #include "runtime/osThread.hpp"
  42 #include "runtime/sharedRuntime.hpp"
  43 #include "runtime/stubRoutines.hpp"
  44 #include "runtime/vm_version.hpp"
  45 #if INCLUDE_G1GC
  46 #include "gc/g1/g1CardTable.hpp"
  47 #include "gc/g1/heapRegion.hpp"
  48 #include "gc/g1/g1ThreadLocalData.hpp"
  49 #endif
  50 
  51 #define VM_STRUCTS(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field) \
  52   static_field(CompilerToVM::Data,             Klass_vtable_start_offset,              int)                                          \
  53   static_field(CompilerToVM::Data,             Klass_vtable_length_offset,             int)                                          \
  54                                                                                                                                      \
  55   static_field(CompilerToVM::Data,             Method_extra_stack_entries,             int)                                          \
  56                                                                                                                                      \
  57   static_field(CompilerToVM::Data,             SharedRuntime_ic_miss_stub,             address)                                      \
  58   static_field(CompilerToVM::Data,             SharedRuntime_handle_wrong_method_stub, address)                                      \
  59   static_field(CompilerToVM::Data,             SharedRuntime_deopt_blob_unpack,        address)                                      \
  60   static_field(CompilerToVM::Data,             SharedRuntime_deopt_blob_unpack_with_exception_in_tls,                                \
  61                                                                                        address)                                      \
  62   static_field(CompilerToVM::Data,             SharedRuntime_deopt_blob_uncommon_trap, address)                                      \
  63   static_field(CompilerToVM::Data,             SharedRuntime_polling_page_return_handler,                                            \
  64                                                                                        address)                                      \
  65                                                                                                                                      \
  66   static_field(CompilerToVM::Data,             nmethod_entry_barrier, address)                                                       \
  67   static_field(CompilerToVM::Data,             thread_disarmed_guard_value_offset, int)                                              \
  68   static_field(CompilerToVM::Data,             thread_address_bad_mask_offset, int)                                                  \
  69   AARCH64_ONLY(static_field(CompilerToVM::Data, BarrierSetAssembler_nmethod_patching_type, int))                                     \
  70                                                                                                                                      \
  71   static_field(CompilerToVM::Data,             ZBarrierSetRuntime_load_barrier_on_oop_field_preloaded, address)                      \
  72   static_field(CompilerToVM::Data,             ZBarrierSetRuntime_load_barrier_on_weak_oop_field_preloaded, address)                 \
  73   static_field(CompilerToVM::Data,             ZBarrierSetRuntime_load_barrier_on_phantom_oop_field_preloaded, address)              \
  74   static_field(CompilerToVM::Data,             ZBarrierSetRuntime_weak_load_barrier_on_oop_field_preloaded, address)                 \
  75   static_field(CompilerToVM::Data,             ZBarrierSetRuntime_weak_load_barrier_on_weak_oop_field_preloaded, address)            \
  76   static_field(CompilerToVM::Data,             ZBarrierSetRuntime_weak_load_barrier_on_phantom_oop_field_preloaded, address)         \
  77   static_field(CompilerToVM::Data,             ZBarrierSetRuntime_load_barrier_on_oop_array, address)                                \
  78   static_field(CompilerToVM::Data,             ZBarrierSetRuntime_clone, address)                                                    \
  79                                                                                                                                      \
  80   static_field(CompilerToVM::Data,             continuations_enabled, bool)                                                          \
  81                                                                                                                                      \
  82   static_field(CompilerToVM::Data,             ThreadLocalAllocBuffer_alignment_reserve, size_t)                                     \
  83                                                                                                                                      \
  84   static_field(CompilerToVM::Data,             Universe_collectedHeap,                 CollectedHeap*)                               \
  85   static_field(CompilerToVM::Data,             Universe_base_vtable_size,              int)                                          \
  86   static_field(CompilerToVM::Data,             Universe_narrow_oop_base,               address)                                      \
  87   static_field(CompilerToVM::Data,             Universe_narrow_oop_shift,              int)                                          \
  88   static_field(CompilerToVM::Data,             Universe_narrow_klass_base,             address)                                      \
  89   static_field(CompilerToVM::Data,             Universe_narrow_klass_shift,            int)                                          \
  90   static_field(CompilerToVM::Data,             Universe_non_oop_bits,                  void*)                                        \
  91   static_field(CompilerToVM::Data,             Universe_verify_oop_mask,               uintptr_t)                                    \
  92   static_field(CompilerToVM::Data,             Universe_verify_oop_bits,               uintptr_t)                                    \
  93                                                                                                                                      \
  94   static_field(CompilerToVM::Data,             _supports_inline_contig_alloc,          bool)                                         \
  95   static_field(CompilerToVM::Data,             _heap_end_addr,                         HeapWord**)                                   \
  96   static_field(CompilerToVM::Data,             _heap_top_addr,                         HeapWord* volatile*)                          \
  97                                                                                                                                      \
  98   static_field(CompilerToVM::Data,             _max_oop_map_stack_offset,              int)                                          \
  99   static_field(CompilerToVM::Data,             _fields_annotations_base_offset,        int)                                          \
 100                                                                                                                                      \
 101   static_field(CompilerToVM::Data,             cardtable_start_address,                CardTable::CardValue*)                        \
 102   static_field(CompilerToVM::Data,             cardtable_shift,                        int)                                          \
 103                                                                                                                                      \
 104   static_field(CompilerToVM::Data,             vm_page_size,                           size_t)                                       \
 105                                                                                                                                      \
 106   static_field(CompilerToVM::Data,             sizeof_vtableEntry,                     int)                                          \
 107   static_field(CompilerToVM::Data,             sizeof_ExceptionTableElement,           int)                                          \
 108   static_field(CompilerToVM::Data,             sizeof_LocalVariableTableElement,       int)                                          \
 109   static_field(CompilerToVM::Data,             sizeof_ConstantPool,                    int)                                          \
 110   static_field(CompilerToVM::Data,             sizeof_narrowKlass,                     int)                                          \
 111   static_field(CompilerToVM::Data,             sizeof_arrayOopDesc,                    int)                                          \
 112   static_field(CompilerToVM::Data,             sizeof_BasicLock,                       int)                                          \
 113                                                                                                                                      \
 114   static_field(CompilerToVM::Data,             dsin,                                   address)                                      \
 115   static_field(CompilerToVM::Data,             dcos,                                   address)                                      \
 116   static_field(CompilerToVM::Data,             dtan,                                   address)                                      \
 117   static_field(CompilerToVM::Data,             dexp,                                   address)                                      \
 118   static_field(CompilerToVM::Data,             dlog,                                   address)                                      \
 119   static_field(CompilerToVM::Data,             dlog10,                                 address)                                      \
 120   static_field(CompilerToVM::Data,             dpow,                                   address)                                      \
 121                                                                                                                                      \
 122   static_field(CompilerToVM::Data,             symbol_init,                            address)                                      \
 123   static_field(CompilerToVM::Data,             symbol_clinit,                          address)                                      \
 124                                                                                                                                      \
 125   static_field(CompilerToVM::Data,             data_section_item_alignment,            int)                                          \
 126                                                                                                                                      \
 127   static_field(CompilerToVM::Data,             _should_notify_object_alloc,            int*)                                         \
 128                                                                                                                                      \
 129   static_field(Abstract_VM_Version,            _features,                              uint64_t)                                     \
 130                                                                                                                                      \
 131   nonstatic_field(Annotations,                 _class_annotations,                     AnnotationArray*)                             \
 132   nonstatic_field(Annotations,                 _fields_annotations,                    Array<AnnotationArray*>*)                     \
 133                                                                                                                                      \
 134   nonstatic_field(Array<int>,                  _length,                                int)                                          \
 135   unchecked_nonstatic_field(Array<u1>,         _data,                                  sizeof(u1))                                   \
 136   unchecked_nonstatic_field(Array<u2>,         _data,                                  sizeof(u2))                                   \
 137   nonstatic_field(Array<Klass*>,               _length,                                int)                                          \
 138   nonstatic_field(Array<Klass*>,               _data[0],                               Klass*)                                       \
 139                                                                                                                                      \
 140   volatile_nonstatic_field(BasicLock,          _displaced_header,                      markWord)                                     \
 141                                                                                                                                      \
 142   static_field(CodeCache,                      _low_bound,                             address)                                      \
 143   static_field(CodeCache,                      _high_bound,                            address)                                      \
 144                                                                                                                                      \
 145   nonstatic_field(CollectedHeap,               _total_collections,                     unsigned int)                                 \
 146                                                                                                                                      \
 147   nonstatic_field(CompileTask,                 _num_inlined_bytecodes,                 int)                                          \
 148                                                                                                                                      \
 149   volatile_nonstatic_field(CompiledICData,     _speculated_method,                     Method*)                                      \
 150   volatile_nonstatic_field(CompiledICData,     _speculated_klass,                      uintptr_t)                                    \
 151   nonstatic_field(CompiledICData,              _itable_defc_klass,                     Klass*)                                       \
 152   nonstatic_field(CompiledICData,              _itable_refc_klass,                     Klass*)                                       \
 153                                                                                                                                      \
 154   nonstatic_field(ConstantPool,                _tags,                                  Array<u1>*)                                   \
 155   nonstatic_field(ConstantPool,                _pool_holder,                           InstanceKlass*)                               \
 156   nonstatic_field(ConstantPool,                _length,                                int)                                          \
 157   nonstatic_field(ConstantPool,                _flags,                                 u2)                                           \
 158   nonstatic_field(ConstantPool,                _source_file_name_index,                u2)                                           \
 159                                                                                                                                      \
 160   nonstatic_field(ConstMethod,                 _constants,                             ConstantPool*)                                \
 161   nonstatic_field(ConstMethod,                 _flags._flags,                          u4)                                           \
 162   nonstatic_field(ConstMethod,                 _code_size,                             u2)                                           \
 163   nonstatic_field(ConstMethod,                 _name_index,                            u2)                                           \
 164   nonstatic_field(ConstMethod,                 _signature_index,                       u2)                                           \
 165   nonstatic_field(ConstMethod,                 _method_idnum,                          u2)                                           \
 166   nonstatic_field(ConstMethod,                 _max_stack,                             u2)                                           \
 167   nonstatic_field(ConstMethod,                 _max_locals,                            u2)                                           \
 168                                                                                                                                      \
 169   nonstatic_field(DataLayout,                  _header._struct._tag,                   u1)                                           \
 170   nonstatic_field(DataLayout,                  _header._struct._flags,                 u1)                                           \
 171   nonstatic_field(DataLayout,                  _header._struct._bci,                   u2)                                           \
 172   nonstatic_field(DataLayout,                  _header._struct._traps,                 u4)                                           \
 173   nonstatic_field(DataLayout,                  _cells[0],                              intptr_t)                                     \
 174                                                                                                                                      \
 175   nonstatic_field(Deoptimization::UnrollBlock, _size_of_deoptimized_frame,             int)                                          \
 176   nonstatic_field(Deoptimization::UnrollBlock, _caller_adjustment,                     int)                                          \
 177   nonstatic_field(Deoptimization::UnrollBlock, _number_of_frames,                      int)                                          \
 178   nonstatic_field(Deoptimization::UnrollBlock, _total_frame_sizes,                     int)                                          \
 179   nonstatic_field(Deoptimization::UnrollBlock, _frame_sizes,                           intptr_t*)                                    \
 180   nonstatic_field(Deoptimization::UnrollBlock, _frame_pcs,                             address*)                                     \
 181   nonstatic_field(Deoptimization::UnrollBlock, _initial_info,                          intptr_t)                                     \
 182   nonstatic_field(Deoptimization::UnrollBlock, _unpack_kind,                           int)                                          \
 183                                                                                                                                      \
 184   nonstatic_field(ExceptionTableElement,       start_pc,                                      u2)                                    \
 185   nonstatic_field(ExceptionTableElement,       end_pc,                                        u2)                                    \
 186   nonstatic_field(ExceptionTableElement,       handler_pc,                                    u2)                                    \
 187   nonstatic_field(ExceptionTableElement,       catch_type_index,                              u2)                                    \
 188                                                                                                                                      \
 189   nonstatic_field(InstanceKlass,               _fieldinfo_stream,                             Array<u1>*)                            \
 190   nonstatic_field(InstanceKlass,               _constants,                                    ConstantPool*)                         \
 191   volatile_nonstatic_field(InstanceKlass,      _init_state,                                   InstanceKlass::ClassState)             \
 192   volatile_nonstatic_field(InstanceKlass,      _init_thread,                                  JavaThread*)                           \
 193   nonstatic_field(InstanceKlass,               _misc_flags._flags,                            u2)                                    \
 194   nonstatic_field(InstanceKlass,               _annotations,                                  Annotations*)                          \
 195                                                                                                                                      \
 196   volatile_nonstatic_field(JavaFrameAnchor,    _last_Java_sp,                                 intptr_t*)                             \
 197   volatile_nonstatic_field(JavaFrameAnchor,    _last_Java_pc,                                 address)                               \
 198                                                                                                                                      \
 199   nonstatic_field(JVMCICompileState,           _jvmti_can_hotswap_or_post_breakpoint,         jbyte)                                 \
 200   nonstatic_field(JVMCICompileState,           _jvmti_can_access_local_variables,             jbyte)                                 \
 201   nonstatic_field(JVMCICompileState,           _jvmti_can_post_on_exceptions,                 jbyte)                                 \
 202   nonstatic_field(JVMCICompileState,           _jvmti_can_pop_frame,                          jbyte)                                 \
 203   nonstatic_field(JVMCICompileState,           _compilation_ticks,                            jint)                                  \
 204                                                                                                                                      \
 205   nonstatic_field(JavaThread,                  _threadObj,                                    OopHandle)                             \
 206   nonstatic_field(JavaThread,                  _vthread,                                      OopHandle)                             \
 207   nonstatic_field(JavaThread,                  _scopedValueCache,                             OopHandle)                             \
 208   nonstatic_field(JavaThread,                  _anchor,                                       JavaFrameAnchor)                       \
 209   nonstatic_field(JavaThread,                  _vm_result,                                    oop)                                   \
 210   nonstatic_field(JavaThread,                  _stack_overflow_state._stack_overflow_limit,   address)                               \
 211   volatile_nonstatic_field(JavaThread,         _exception_oop,                                oop)                                   \
 212   volatile_nonstatic_field(JavaThread,         _exception_pc,                                 address)                               \
 213   volatile_nonstatic_field(JavaThread,         _is_method_handle_return,                      int)                                   \
 214   volatile_nonstatic_field(JavaThread,         _doing_unsafe_access,                          bool)                                  \
 215   nonstatic_field(JavaThread,                  _osthread,                                     OSThread*)                             \
 216   nonstatic_field(JavaThread,                  _saved_exception_pc,                           address)                               \
 217   nonstatic_field(JavaThread,                  _pending_deoptimization,                       int)                                   \
 218   nonstatic_field(JavaThread,                  _pending_failed_speculation,                   jlong)                                 \
 219   nonstatic_field(JavaThread,                  _pending_transfer_to_interpreter,              bool)                                  \
 220   nonstatic_field(JavaThread,                  _jvmci_counters,                               jlong*)                                \
 221   nonstatic_field(JavaThread,                  _jvmci_reserved0,                              jlong)                                 \
 222   nonstatic_field(JavaThread,                  _jvmci_reserved1,                              jlong)                                 \
 223   nonstatic_field(JavaThread,                  _jvmci_reserved_oop0,                          oop)                                   \
 224   nonstatic_field(JavaThread,                  _should_post_on_exceptions_flag,               int)                                   \
 225   nonstatic_field(JavaThread,                  _jni_environment,                              JNIEnv)                                \
 226   nonstatic_field(JavaThread,                  _poll_data,                                    SafepointMechanism::ThreadData)        \
 227   nonstatic_field(JavaThread,                  _stack_overflow_state._reserved_stack_activation, address)                            \
 228   nonstatic_field(JavaThread,                  _held_monitor_count,                           intx)                                  \
 229   nonstatic_field(JavaThread,                  _lock_stack,                                   LockStack)                             \
 230   JVMTI_ONLY(nonstatic_field(JavaThread,       _is_in_VTMS_transition,                        bool))                                 \
 231   JVMTI_ONLY(nonstatic_field(JavaThread,       _is_in_tmp_VTMS_transition,                    bool))                                 \
 232   JVMTI_ONLY(nonstatic_field(JavaThread,       _is_disable_suspend,                           bool))                                 \
 233                                                                                                                                      \
 234   nonstatic_field(LockStack,                   _top,                                          uint32_t)                              \
 235                                                                                                                                      \
 236   JVMTI_ONLY(static_field(JvmtiVTMSTransitionDisabler, _VTMS_notify_jvmti_events,             bool))                                 \
 237                                                                                                                                      \
 238   static_field(java_lang_Class,                _klass_offset,                                 int)                                   \
 239   static_field(java_lang_Class,                _array_klass_offset,                           int)                                   \
 240                                                                                                                                      \
 241   nonstatic_field(InvocationCounter,           _counter,                                      unsigned int)                          \
 242                                                                                                                                      \
 243   nonstatic_field(Klass,                       _secondary_super_cache,                        Klass*)                                \
 244   nonstatic_field(Klass,                       _secondary_supers,                             Array<Klass*>*)                        \
 245   nonstatic_field(Klass,                       _super,                                        Klass*)                                \
 246   nonstatic_field(Klass,                       _super_check_offset,                           juint)                                 \
 247   volatile_nonstatic_field(Klass,              _subklass,                                     Klass*)                                \
 248   nonstatic_field(Klass,                       _layout_helper,                                jint)                                  \
 249   nonstatic_field(Klass,                       _name,                                         Symbol*)                               \
 250   volatile_nonstatic_field(Klass,              _next_sibling,                                 Klass*)                                \
 251   nonstatic_field(Klass,                       _java_mirror,                                  OopHandle)                             \
 252   nonstatic_field(Klass,                       _modifier_flags,                               jint)                                  \
 253   nonstatic_field(Klass,                       _access_flags,                                 AccessFlags)                           \
 254   nonstatic_field(Klass,                       _class_loader_data,                            ClassLoaderData*)                      \
 255                                                                                                                                      \
 256   nonstatic_field(LocalVariableTableElement,   start_bci,                                     u2)                                    \
 257   nonstatic_field(LocalVariableTableElement,   length,                                        u2)                                    \
 258   nonstatic_field(LocalVariableTableElement,   name_cp_index,                                 u2)                                    \
 259   nonstatic_field(LocalVariableTableElement,   descriptor_cp_index,                           u2)                                    \
 260   nonstatic_field(LocalVariableTableElement,   signature_cp_index,                            u2)                                    \
 261   nonstatic_field(LocalVariableTableElement,   slot,                                          u2)                                    \
 262                                                                                                                                      \
 263   nonstatic_field(Method,                      _constMethod,                                  ConstMethod*)                          \
 264   nonstatic_field(Method,                      _method_data,                                  MethodData*)                           \
 265   nonstatic_field(Method,                      _method_counters,                              MethodCounters*)                       \
 266   nonstatic_field(Method,                      _access_flags,                                 AccessFlags)                           \
 267   nonstatic_field(Method,                      _vtable_index,                                 int)                                   \
 268   nonstatic_field(Method,                      _intrinsic_id,                                 u2)                                    \
 269   nonstatic_field(Method,                      _flags._status,                                u4)                                    \
 270   volatile_nonstatic_field(Method,             _code,                                         CompiledMethod*)                       \
 271   volatile_nonstatic_field(Method,             _from_compiled_entry,                          address)                               \
 272                                                                                                                                      \
 273   nonstatic_field(MethodCounters,              _invoke_mask,                                  int)                                   \
 274   nonstatic_field(MethodCounters,              _backedge_mask,                                int)                                   \
 275   nonstatic_field(MethodCounters,              _interpreter_throwout_count,                   u2)                                    \
 276   JVMTI_ONLY(nonstatic_field(MethodCounters,   _number_of_breakpoints,                        u2))                                   \
 277   nonstatic_field(MethodCounters,              _invocation_counter,                           InvocationCounter)                     \
 278   nonstatic_field(MethodCounters,              _backedge_counter,                             InvocationCounter)                     \
 279                                                                                                                                      \
 280   nonstatic_field(MethodData,                  _size,                                         int)                                   \
 281   nonstatic_field(MethodData,                  _method,                                       Method*)                               \
 282   nonstatic_field(MethodData,                  _data_size,                                    int)                                   \
 283   nonstatic_field(MethodData,                  _data[0],                                      intptr_t)                              \
 284   nonstatic_field(MethodData,                  _parameters_type_data_di,                      int)                                   \
 285   nonstatic_field(MethodData,                  _compiler_counters._nof_decompiles,            uint)                                  \
 286   nonstatic_field(MethodData,                  _compiler_counters._nof_overflow_recompiles,   uint)                                  \
 287   nonstatic_field(MethodData,                  _compiler_counters._nof_overflow_traps,        uint)                                  \
 288   nonstatic_field(MethodData,                  _compiler_counters._trap_hist._array[0],       u1)                                    \
 289   nonstatic_field(MethodData,                  _eflags,                                       intx)                                  \
 290   nonstatic_field(MethodData,                  _arg_local,                                    intx)                                  \
 291   nonstatic_field(MethodData,                  _arg_stack,                                    intx)                                  \
 292   nonstatic_field(MethodData,                  _arg_returned,                                 intx)                                  \
 293   nonstatic_field(MethodData,                  _tenure_traps,                                 uint)                                  \
 294   nonstatic_field(MethodData,                  _invoke_mask,                                  int)                                   \
 295   nonstatic_field(MethodData,                  _backedge_mask,                                int)                                   \
 296   nonstatic_field(MethodData,                  _jvmci_ir_size,                                int)                                   \
 297                                                                                                                                      \
 298   nonstatic_field(nmethod,                     _verified_entry_point,                         address)                               \
 299   nonstatic_field(nmethod,                     _comp_level,                                   CompLevel)                             \
 300                                                                                                                                      \
 301   nonstatic_field(ObjArrayKlass,               _element_klass,                                Klass*)                                \
 302                                                                                                                                      \
 303   unchecked_nonstatic_field(ObjectMonitor,     _owner,                                        sizeof(void *)) /* NOTE: no type */    \
 304   volatile_nonstatic_field(ObjectMonitor,      _recursions,                                   intptr_t)                              \
 305   volatile_nonstatic_field(ObjectMonitor,      _cxq,                                          ObjectWaiter*)                         \
 306   volatile_nonstatic_field(ObjectMonitor,      _EntryList,                                    ObjectWaiter*)                         \
 307   volatile_nonstatic_field(ObjectMonitor,      _succ,                                         JavaThread*)                           \
 308                                                                                                                                      \
 309   volatile_nonstatic_field(oopDesc,            _mark,                                         markWord)                              \
 310   volatile_nonstatic_field(oopDesc,            _metadata._klass,                              Klass*)                                \
 311                                                                                                                                      \
 312   static_field(StubRoutines,                _verify_oop_count,                                jint)                                  \
 313                                                                                                                                      \
 314   static_field(StubRoutines,                _throw_delayed_StackOverflowError_entry,          address)                               \
 315                                                                                                                                      \
 316   static_field(StubRoutines,                _jbyte_arraycopy,                                 address)                               \
 317   static_field(StubRoutines,                _jshort_arraycopy,                                address)                               \
 318   static_field(StubRoutines,                _jint_arraycopy,                                  address)                               \
 319   static_field(StubRoutines,                _jlong_arraycopy,                                 address)                               \
 320   static_field(StubRoutines,                _oop_arraycopy,                                   address)                               \
 321   static_field(StubRoutines,                _oop_arraycopy_uninit,                            address)                               \
 322   static_field(StubRoutines,                _jbyte_disjoint_arraycopy,                        address)                               \
 323   static_field(StubRoutines,                _jshort_disjoint_arraycopy,                       address)                               \
 324   static_field(StubRoutines,                _jint_disjoint_arraycopy,                         address)                               \
 325   static_field(StubRoutines,                _jlong_disjoint_arraycopy,                        address)                               \
 326   static_field(StubRoutines,                _oop_disjoint_arraycopy,                          address)                               \
 327   static_field(StubRoutines,                _oop_disjoint_arraycopy_uninit,                   address)                               \
 328   static_field(StubRoutines,                _arrayof_jbyte_arraycopy,                         address)                               \
 329   static_field(StubRoutines,                _arrayof_jshort_arraycopy,                        address)                               \
 330   static_field(StubRoutines,                _arrayof_jint_arraycopy,                          address)                               \
 331   static_field(StubRoutines,                _arrayof_jlong_arraycopy,                         address)                               \
 332   static_field(StubRoutines,                _arrayof_oop_arraycopy,                           address)                               \
 333   static_field(StubRoutines,                _arrayof_oop_arraycopy_uninit,                    address)                               \
 334   static_field(StubRoutines,                _arrayof_jbyte_disjoint_arraycopy,                address)                               \
 335   static_field(StubRoutines,                _arrayof_jshort_disjoint_arraycopy,               address)                               \
 336   static_field(StubRoutines,                _arrayof_jint_disjoint_arraycopy,                 address)                               \
 337   static_field(StubRoutines,                _arrayof_jlong_disjoint_arraycopy,                address)                               \
 338   static_field(StubRoutines,                _arrayof_oop_disjoint_arraycopy,                  address)                               \
 339   static_field(StubRoutines,                _arrayof_oop_disjoint_arraycopy_uninit,           address)                               \
 340   static_field(StubRoutines,                _checkcast_arraycopy,                             address)                               \
 341   static_field(StubRoutines,                _checkcast_arraycopy_uninit,                      address)                               \
 342   static_field(StubRoutines,                _unsafe_arraycopy,                                address)                               \
 343   static_field(StubRoutines,                _generic_arraycopy,                               address)                               \
 344   static_field(StubRoutines,                _array_sort,                                      address)                               \
 345   static_field(StubRoutines,                _array_partition,                                 address)                               \
 346                                                                                                                                      \
 347   static_field(StubRoutines,                _aescrypt_encryptBlock,                           address)                               \
 348   static_field(StubRoutines,                _aescrypt_decryptBlock,                           address)                               \
 349   static_field(StubRoutines,                _cipherBlockChaining_encryptAESCrypt,             address)                               \
 350   static_field(StubRoutines,                _cipherBlockChaining_decryptAESCrypt,             address)                               \
 351   static_field(StubRoutines,                _electronicCodeBook_encryptAESCrypt,              address)                               \
 352   static_field(StubRoutines,                _electronicCodeBook_decryptAESCrypt,              address)                               \
 353   static_field(StubRoutines,                _counterMode_AESCrypt,                            address)                               \
 354   static_field(StubRoutines,                _galoisCounterMode_AESCrypt,                      address)                               \
 355   static_field(StubRoutines,                _base64_encodeBlock,                              address)                               \
 356   static_field(StubRoutines,                _base64_decodeBlock,                              address)                               \
 357   static_field(StubRoutines,                _ghash_processBlocks,                             address)                               \
 358   static_field(StubRoutines,                _md5_implCompress,                                address)                               \
 359   static_field(StubRoutines,                _md5_implCompressMB,                              address)                               \
 360   static_field(StubRoutines,                _chacha20Block,                                   address)                               \
 361   static_field(StubRoutines,                _poly1305_processBlocks,                          address)                               \
 362   static_field(StubRoutines,                _sha1_implCompress,                               address)                               \
 363   static_field(StubRoutines,                _sha1_implCompressMB,                             address)                               \
 364   static_field(StubRoutines,                _sha256_implCompress,                             address)                               \
 365   static_field(StubRoutines,                _sha256_implCompressMB,                           address)                               \
 366   static_field(StubRoutines,                _sha512_implCompress,                             address)                               \
 367   static_field(StubRoutines,                _sha512_implCompressMB,                           address)                               \
 368   static_field(StubRoutines,                _sha3_implCompress,                               address)                               \
 369   static_field(StubRoutines,                _sha3_implCompressMB,                             address)                               \
 370   static_field(StubRoutines,                _updateBytesCRC32,                                address)                               \
 371   static_field(StubRoutines,                _crc_table_adr,                                   address)                               \
 372   static_field(StubRoutines,                _crc32c_table_addr,                               address)                               \
 373   static_field(StubRoutines,                _updateBytesCRC32C,                               address)                               \
 374   static_field(StubRoutines,                _updateBytesAdler32,                              address)                               \
 375   static_field(StubRoutines,                _multiplyToLen,                                   address)                               \
 376   static_field(StubRoutines,                _squareToLen,                                     address)                               \
 377   static_field(StubRoutines,                _mulAdd,                                          address)                               \
 378   static_field(StubRoutines,                _montgomeryMultiply,                              address)                               \
 379   static_field(StubRoutines,                _montgomerySquare,                                address)                               \
 380   static_field(StubRoutines,                _vectorizedMismatch,                              address)                               \
 381   static_field(StubRoutines,                _bigIntegerRightShiftWorker,                      address)                               \
 382   static_field(StubRoutines,                _bigIntegerLeftShiftWorker,                       address)                               \
 383   static_field(StubRoutines,                _cont_thaw,                                       address)                               \
 384                                                                                                                                      \
 385   nonstatic_field(Thread,                   _tlab,                                            ThreadLocalAllocBuffer)                \
 386   nonstatic_field(Thread,                   _allocated_bytes,                                 jlong)                                 \
 387   JFR_ONLY(nonstatic_field(Thread,          _jfr_thread_local,                                JfrThreadLocal))                       \
 388                                                                                                                                      \
 389   static_field(java_lang_Thread,            _tid_offset,                                      int)                                   \
 390   static_field(java_lang_Thread,            _jvmti_is_in_VTMS_transition_offset,              int)                                   \
 391   JFR_ONLY(static_field(java_lang_Thread,   _jfr_epoch_offset,                                int))                                  \
 392                                                                                                                                      \
 393   JFR_ONLY(nonstatic_field(JfrThreadLocal,  _vthread_id,                                      traceid))                              \
 394   JFR_ONLY(nonstatic_field(JfrThreadLocal,  _vthread_epoch,                                   u2))                                   \
 395   JFR_ONLY(nonstatic_field(JfrThreadLocal,  _vthread_excluded,                                bool))                                 \
 396   JFR_ONLY(nonstatic_field(JfrThreadLocal,  _vthread,                                         bool))                                 \
 397                                                                                                                                      \
 398   nonstatic_field(ThreadLocalAllocBuffer,   _start,                                           HeapWord*)                             \
 399   nonstatic_field(ThreadLocalAllocBuffer,   _top,                                             HeapWord*)                             \
 400   nonstatic_field(ThreadLocalAllocBuffer,   _end,                                             HeapWord*)                             \
 401   nonstatic_field(ThreadLocalAllocBuffer,   _pf_top,                                          HeapWord*)                             \
 402   nonstatic_field(ThreadLocalAllocBuffer,   _desired_size,                                    size_t)                                \
 403   nonstatic_field(ThreadLocalAllocBuffer,   _refill_waste_limit,                              size_t)                                \
 404   nonstatic_field(ThreadLocalAllocBuffer,   _number_of_refills,                               unsigned)                              \
 405   nonstatic_field(ThreadLocalAllocBuffer,   _slow_allocations,                                unsigned)                              \
 406                                                                                                                                      \
 407   nonstatic_field(SafepointMechanism::ThreadData, _polling_word,                              volatile uintptr_t)                    \
 408   nonstatic_field(SafepointMechanism::ThreadData, _polling_page,                              volatile uintptr_t)                    \
 409                                                                                                                                      \
 410   nonstatic_field(ThreadShadow,             _pending_exception,                               oop)                                   \
 411                                                                                                                                      \
 412   static_field(Symbol,                      _vm_symbols[0],                                   Symbol*)                               \
 413                                                                                                                                      \
 414   nonstatic_field(vtableEntry,              _method,                                          Method*)                               \
 415 
 416 #define VM_TYPES(declare_type, declare_toplevel_type, declare_integer_type, declare_unsigned_integer_type) \
 417   declare_integer_type(bool)                                              \
 418   declare_unsigned_integer_type(size_t)                                   \
 419   declare_integer_type(intx)                                              \
 420   declare_unsigned_integer_type(uintx)                                    \
 421   declare_integer_type(CompLevel)                                         \
 422                                                                           \
 423   declare_toplevel_type(BasicLock)                                        \
 424   declare_toplevel_type(CompilerToVM)                                     \
 425   declare_toplevel_type(ExceptionTableElement)                            \
 426   declare_toplevel_type(JVMFlag)                                          \
 427   declare_toplevel_type(JVMFlag*)                                         \
 428   declare_toplevel_type(InvocationCounter)                                \
 429   declare_toplevel_type(JVMCICompileState)                                \
 430   declare_toplevel_type(JVMCIEnv)                                         \
 431   declare_toplevel_type(LocalVariableTableElement)                        \
 432   declare_toplevel_type(narrowKlass)                                      \
 433   declare_toplevel_type(ObjectWaiter)                                     \
 434   declare_toplevel_type(Symbol*)                                          \
 435   declare_toplevel_type(vtableEntry)                                      \
 436                                                                           \
 437   declare_toplevel_type(oopDesc)                                          \
 438     declare_type(arrayOopDesc, oopDesc)                                   \
 439                                                                           \
 440   declare_toplevel_type(CompiledICData)                                   \
 441   declare_toplevel_type(MetaspaceObj)                                     \
 442     declare_type(Metadata, MetaspaceObj)                                  \
 443     declare_type(Klass, Metadata)                                         \
 444       declare_type(InstanceKlass, Klass)                                  \
 445     declare_type(ConstantPool, Metadata)                                  \
 446 
 447 #define VM_INT_CONSTANTS(declare_constant, declare_constant_with_value, declare_preprocessor_constant) \
 448   declare_preprocessor_constant("ASSERT", DEBUG_ONLY(1) NOT_DEBUG(0))     \
 449                                                                           \
 450   declare_constant(CompLevel_none)                                        \
 451   declare_constant(CompLevel_simple)                                      \
 452   declare_constant(CompLevel_limited_profile)                             \
 453   declare_constant(CompLevel_full_profile)                                \
 454   declare_constant(CompLevel_full_optimization)                           \
 455   declare_constant(HeapWordSize)                                          \
 456   declare_constant(InvocationEntryBci)                                    \
 457   declare_constant(LogKlassAlignmentInBytes)                              \
 458   declare_constant(JVMCINMethodData::SPECULATION_LENGTH_BITS)             \
 459                                                                           \
 460   declare_constant(JVM_ACC_WRITTEN_FLAGS)                                 \
 461   declare_constant(JVM_ACC_HAS_FINALIZER)                                 \
 462   declare_constant(JVM_ACC_IS_CLONEABLE_FAST)                             \
 463   declare_constant(JVM_ACC_IS_HIDDEN_CLASS)                               \
 464   declare_constant(JVM_ACC_IS_VALUE_BASED_CLASS)                          \
 465   declare_constant(FieldInfo::FieldFlags::_ff_injected)                   \
 466   declare_constant(FieldInfo::FieldFlags::_ff_stable)                     \
 467   declare_preprocessor_constant("JVM_ACC_VARARGS", JVM_ACC_VARARGS)       \
 468   declare_preprocessor_constant("JVM_ACC_BRIDGE", JVM_ACC_BRIDGE)         \
 469   declare_preprocessor_constant("JVM_ACC_ANNOTATION", JVM_ACC_ANNOTATION) \
 470   declare_preprocessor_constant("JVM_ACC_ENUM", JVM_ACC_ENUM)             \
 471   declare_preprocessor_constant("JVM_ACC_SYNTHETIC", JVM_ACC_SYNTHETIC)   \
 472   declare_preprocessor_constant("JVM_ACC_INTERFACE", JVM_ACC_INTERFACE)   \
 473                                                                           \
 474   declare_constant(JVM_CONSTANT_Utf8)                                     \
 475   declare_constant(JVM_CONSTANT_Unicode)                                  \
 476   declare_constant(JVM_CONSTANT_Integer)                                  \
 477   declare_constant(JVM_CONSTANT_Float)                                    \
 478   declare_constant(JVM_CONSTANT_Long)                                     \
 479   declare_constant(JVM_CONSTANT_Double)                                   \
 480   declare_constant(JVM_CONSTANT_Class)                                    \
 481   declare_constant(JVM_CONSTANT_String)                                   \
 482   declare_constant(JVM_CONSTANT_Fieldref)                                 \
 483   declare_constant(JVM_CONSTANT_Methodref)                                \
 484   declare_constant(JVM_CONSTANT_InterfaceMethodref)                       \
 485   declare_constant(JVM_CONSTANT_NameAndType)                              \
 486   declare_constant(JVM_CONSTANT_MethodHandle)                             \
 487   declare_constant(JVM_CONSTANT_MethodType)                               \
 488   declare_constant(JVM_CONSTANT_InvokeDynamic)                            \
 489   declare_constant(JVM_CONSTANT_Dynamic)                                  \
 490   declare_constant(JVM_CONSTANT_Module)                                   \
 491   declare_constant(JVM_CONSTANT_Package)                                  \
 492   declare_constant(JVM_CONSTANT_ExternalMax)                              \
 493                                                                           \
 494   declare_constant(JVM_CONSTANT_Invalid)                                  \
 495   declare_constant(JVM_CONSTANT_InternalMin)                              \
 496   declare_constant(JVM_CONSTANT_UnresolvedClass)                          \
 497   declare_constant(JVM_CONSTANT_ClassIndex)                               \
 498   declare_constant(JVM_CONSTANT_StringIndex)                              \
 499   declare_constant(JVM_CONSTANT_UnresolvedClassInError)                   \
 500   declare_constant(JVM_CONSTANT_MethodHandleInError)                      \
 501   declare_constant(JVM_CONSTANT_MethodTypeInError)                        \
 502   declare_constant(JVM_CONSTANT_DynamicInError)                           \
 503   declare_constant(JVM_CONSTANT_InternalMax)                              \
 504                                                                           \
 505   declare_constant(ArrayData::array_len_off_set)                          \
 506   declare_constant(ArrayData::array_start_off_set)                        \
 507                                                                           \
 508   declare_constant(BitData::exception_seen_flag)                          \
 509   declare_constant(BitData::null_seen_flag)                               \
 510   declare_constant(BranchData::not_taken_off_set)                         \
 511                                                                           \
 512   declare_constant_with_value("CardTable::dirty_card", CardTable::dirty_card_val()) \
 513   declare_constant_with_value("LockStack::_end_offset", LockStack::end_offset()) \
 514                                                                           \
 515   declare_constant(CodeInstaller::VERIFIED_ENTRY)                         \
 516   declare_constant(CodeInstaller::UNVERIFIED_ENTRY)                       \
 517   declare_constant(CodeInstaller::OSR_ENTRY)                              \
 518   declare_constant(CodeInstaller::EXCEPTION_HANDLER_ENTRY)                \
 519   declare_constant(CodeInstaller::DEOPT_HANDLER_ENTRY)                    \
 520   declare_constant(CodeInstaller::FRAME_COMPLETE)                         \
 521   declare_constant(CodeInstaller::ENTRY_BARRIER_PATCH)                    \
 522   declare_constant(CodeInstaller::INVOKEINTERFACE)                        \
 523   declare_constant(CodeInstaller::INVOKEVIRTUAL)                          \
 524   declare_constant(CodeInstaller::INVOKESTATIC)                           \
 525   declare_constant(CodeInstaller::INVOKESPECIAL)                          \
 526   declare_constant(CodeInstaller::INLINE_INVOKE)                          \
 527   declare_constant(CodeInstaller::POLL_NEAR)                              \
 528   declare_constant(CodeInstaller::POLL_RETURN_NEAR)                       \
 529   declare_constant(CodeInstaller::POLL_FAR)                               \
 530   declare_constant(CodeInstaller::POLL_RETURN_FAR)                        \
 531   declare_constant(CodeInstaller::CARD_TABLE_SHIFT)                       \
 532   declare_constant(CodeInstaller::CARD_TABLE_ADDRESS)                     \
 533   declare_constant(CodeInstaller::HEAP_TOP_ADDRESS)                       \
 534   declare_constant(CodeInstaller::HEAP_END_ADDRESS)                       \
 535   declare_constant(CodeInstaller::NARROW_KLASS_BASE_ADDRESS)              \
 536   declare_constant(CodeInstaller::NARROW_OOP_BASE_ADDRESS)                \
 537   declare_constant(CodeInstaller::CRC_TABLE_ADDRESS)                      \
 538   declare_constant(CodeInstaller::LOG_OF_HEAP_REGION_GRAIN_BYTES)         \
 539   declare_constant(CodeInstaller::INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED) \
 540   declare_constant(CodeInstaller::DEOPT_MH_HANDLER_ENTRY)                 \
 541   declare_constant(CodeInstaller::VERIFY_OOP_COUNT_ADDRESS)               \
 542   declare_constant(CodeInstaller::VERIFY_OOPS)                            \
 543   declare_constant(CodeInstaller::VERIFY_OOP_BITS)                        \
 544   declare_constant(CodeInstaller::VERIFY_OOP_MASK)                        \
 545   declare_constant(CodeInstaller::INVOKE_INVALID)                         \
 546                                                                           \
 547   declare_constant(CodeInstaller::ILLEGAL)                                \
 548   declare_constant(CodeInstaller::REGISTER_PRIMITIVE)                     \
 549   declare_constant(CodeInstaller::REGISTER_OOP)                           \
 550   declare_constant(CodeInstaller::REGISTER_NARROW_OOP)                    \
 551   declare_constant(CodeInstaller::REGISTER_VECTOR)                        \
 552   declare_constant(CodeInstaller::STACK_SLOT_PRIMITIVE)                   \
 553   declare_constant(CodeInstaller::STACK_SLOT_OOP)                         \
 554   declare_constant(CodeInstaller::STACK_SLOT_NARROW_OOP)                  \
 555   declare_constant(CodeInstaller::STACK_SLOT_VECTOR)                      \
 556   declare_constant(CodeInstaller::VIRTUAL_OBJECT_ID)                      \
 557   declare_constant(CodeInstaller::VIRTUAL_OBJECT_ID2)                     \
 558   declare_constant(CodeInstaller::NULL_CONSTANT)                          \
 559   declare_constant(CodeInstaller::RAW_CONSTANT)                           \
 560   declare_constant(CodeInstaller::PRIMITIVE_0)                            \
 561   declare_constant(CodeInstaller::PRIMITIVE4)                             \
 562   declare_constant(CodeInstaller::PRIMITIVE8)                             \
 563   declare_constant(CodeInstaller::JOBJECT)                                \
 564   declare_constant(CodeInstaller::OBJECT_ID)                              \
 565   declare_constant(CodeInstaller::OBJECT_ID2)                             \
 566                                                                           \
 567   declare_constant(CodeInstaller::NO_FINALIZABLE_SUBCLASS)                \
 568   declare_constant(CodeInstaller::CONCRETE_SUBTYPE)                       \
 569   declare_constant(CodeInstaller::LEAF_TYPE)                              \
 570   declare_constant(CodeInstaller::CONCRETE_METHOD)                        \
 571   declare_constant(CodeInstaller::CALLSITE_TARGET_VALUE)                  \
 572                                                                           \
 573   declare_constant(CodeInstaller::PATCH_OBJECT_ID)                        \
 574   declare_constant(CodeInstaller::PATCH_OBJECT_ID2)                       \
 575   declare_constant(CodeInstaller::PATCH_NARROW_OBJECT_ID)                 \
 576   declare_constant(CodeInstaller::PATCH_NARROW_OBJECT_ID2)                \
 577   declare_constant(CodeInstaller::PATCH_JOBJECT)                          \
 578   declare_constant(CodeInstaller::PATCH_NARROW_JOBJECT)                   \
 579   declare_constant(CodeInstaller::PATCH_KLASS)                            \
 580   declare_constant(CodeInstaller::PATCH_NARROW_KLASS)                     \
 581   declare_constant(CodeInstaller::PATCH_METHOD)                           \
 582   declare_constant(CodeInstaller::PATCH_DATA_SECTION_REFERENCE)           \
 583                                                                           \
 584   declare_constant(CodeInstaller::SITE_CALL)                              \
 585   declare_constant(CodeInstaller::SITE_FOREIGN_CALL)                      \
 586   declare_constant(CodeInstaller::SITE_FOREIGN_CALL_NO_DEBUG_INFO)        \
 587   declare_constant(CodeInstaller::SITE_SAFEPOINT)                         \
 588   declare_constant(CodeInstaller::SITE_INFOPOINT)                         \
 589   declare_constant(CodeInstaller::SITE_IMPLICIT_EXCEPTION)                \
 590   declare_constant(CodeInstaller::SITE_IMPLICIT_EXCEPTION_DISPATCH)       \
 591   declare_constant(CodeInstaller::SITE_MARK)                              \
 592   declare_constant(CodeInstaller::SITE_DATA_PATCH)                        \
 593   declare_constant(CodeInstaller::SITE_EXCEPTION_HANDLER)                 \
 594                                                                           \
 595   declare_constant(CodeInstaller::DI_HAS_REFERENCE_MAP)                   \
 596   declare_constant(CodeInstaller::DI_HAS_CALLEE_SAVE_INFO)                \
 597   declare_constant(CodeInstaller::DI_HAS_FRAMES)                          \
 598                                                                           \
 599   declare_constant(CodeInstaller::DIF_HAS_LOCALS)                         \
 600   declare_constant(CodeInstaller::DIF_HAS_STACK)                          \
 601   declare_constant(CodeInstaller::DIF_HAS_LOCKS)                          \
 602   declare_constant(CodeInstaller::DIF_DURING_CALL)                        \
 603   declare_constant(CodeInstaller::DIF_RETHROW_EXCEPTION)                  \
 604                                                                           \
 605   declare_constant(CodeInstaller::HCC_IS_NMETHOD)                         \
 606   declare_constant(CodeInstaller::HCC_HAS_ASSUMPTIONS)                    \
 607   declare_constant(CodeInstaller::HCC_HAS_METHODS)                        \
 608   declare_constant(CodeInstaller::HCC_HAS_DEOPT_RESCUE_SLOT)              \
 609   declare_constant(CodeInstaller::HCC_HAS_COMMENTS)                       \
 610                                                                           \
 611   declare_constant(CodeInstaller::NO_REGISTER)                            \
 612                                                                           \
 613   declare_constant(CollectedHeap::None)                                   \
 614   declare_constant(CollectedHeap::Serial)                                 \
 615   declare_constant(CollectedHeap::Parallel)                               \
 616   declare_constant(CollectedHeap::G1)                                     \
 617   declare_constant(CollectedHeap::Epsilon)                                \
 618   declare_constant(CollectedHeap::Z)                                      \
 619   declare_constant(CollectedHeap::Shenandoah)                             \
 620                                                                           \
 621   declare_constant(vmIntrinsics::FIRST_MH_SIG_POLY)                       \
 622   declare_constant(vmIntrinsics::LAST_MH_SIG_POLY)                        \
 623   declare_constant(vmIntrinsics::_invokeGeneric)                          \
 624   declare_constant(vmIntrinsics::_compiledLambdaForm)                     \
 625                                                                           \
 626   declare_constant(ConstantPool::_has_dynamic_constant)                   \
 627                                                                           \
 628   declare_constant(ConstMethodFlags::_misc_has_linenumber_table)          \
 629   declare_constant(ConstMethodFlags::_misc_has_localvariable_table)       \
 630   declare_constant(ConstMethodFlags::_misc_has_exception_table)           \
 631   declare_constant(ConstMethodFlags::_misc_has_method_annotations)        \
 632   declare_constant(ConstMethodFlags::_misc_has_parameter_annotations)     \
 633   declare_constant(ConstMethodFlags::_misc_caller_sensitive)              \
 634   declare_constant(ConstMethodFlags::_misc_is_hidden)                     \
 635   declare_constant(ConstMethodFlags::_misc_intrinsic_candidate)           \
 636   declare_constant(ConstMethodFlags::_misc_reserved_stack_access)         \
 637   declare_constant(ConstMethodFlags::_misc_changes_current_thread)        \
 638                                                                           \
 639   declare_constant(CounterData::count_off)                                \
 640                                                                           \
 641   declare_constant(DataLayout::cell_size)                                 \
 642   declare_constant(DataLayout::no_tag)                                    \
 643   declare_constant(DataLayout::bit_data_tag)                              \
 644   declare_constant(DataLayout::counter_data_tag)                          \
 645   declare_constant(DataLayout::jump_data_tag)                             \
 646   declare_constant(DataLayout::receiver_type_data_tag)                    \
 647   declare_constant(DataLayout::virtual_call_data_tag)                     \
 648   declare_constant(DataLayout::ret_data_tag)                              \
 649   declare_constant(DataLayout::branch_data_tag)                           \
 650   declare_constant(DataLayout::multi_branch_data_tag)                     \
 651   declare_constant(DataLayout::arg_info_data_tag)                         \
 652   declare_constant(DataLayout::call_type_data_tag)                        \
 653   declare_constant(DataLayout::virtual_call_type_data_tag)                \
 654   declare_constant(DataLayout::parameters_type_data_tag)                  \
 655   declare_constant(DataLayout::speculative_trap_data_tag)                 \
 656                                                                           \
 657   declare_constant(Deoptimization::Unpack_deopt)                          \
 658   declare_constant(Deoptimization::Unpack_exception)                      \
 659   declare_constant(Deoptimization::Unpack_uncommon_trap)                  \
 660   declare_constant(Deoptimization::Unpack_reexecute)                      \
 661                                                                           \
 662   declare_constant(Deoptimization::_action_bits)                          \
 663   declare_constant(Deoptimization::_reason_bits)                          \
 664   declare_constant(Deoptimization::_debug_id_bits)                        \
 665   declare_constant(Deoptimization::_action_shift)                         \
 666   declare_constant(Deoptimization::_reason_shift)                         \
 667   declare_constant(Deoptimization::_debug_id_shift)                       \
 668                                                                           \
 669   declare_constant(Deoptimization::Action_none)                           \
 670   declare_constant(Deoptimization::Action_maybe_recompile)                \
 671   declare_constant(Deoptimization::Action_reinterpret)                    \
 672   declare_constant(Deoptimization::Action_make_not_entrant)               \
 673   declare_constant(Deoptimization::Action_make_not_compilable)            \
 674                                                                           \
 675   declare_constant(Deoptimization::Reason_none)                           \
 676   declare_constant(Deoptimization::Reason_null_check)                     \
 677   declare_constant(Deoptimization::Reason_range_check)                    \
 678   declare_constant(Deoptimization::Reason_class_check)                    \
 679   declare_constant(Deoptimization::Reason_array_check)                    \
 680   declare_constant(Deoptimization::Reason_unreached0)                     \
 681   declare_constant(Deoptimization::Reason_constraint)                     \
 682   declare_constant(Deoptimization::Reason_div0_check)                     \
 683   declare_constant(Deoptimization::Reason_loop_limit_check)               \
 684   declare_constant(Deoptimization::Reason_type_checked_inlining)          \
 685   declare_constant(Deoptimization::Reason_optimized_type_check)           \
 686   declare_constant(Deoptimization::Reason_aliasing)                       \
 687   declare_constant(Deoptimization::Reason_transfer_to_interpreter)        \
 688   declare_constant(Deoptimization::Reason_not_compiled_exception_handler) \
 689   declare_constant(Deoptimization::Reason_unresolved)                     \
 690   declare_constant(Deoptimization::Reason_jsr_mismatch)                   \
 691   declare_constant(Deoptimization::Reason_TRAP_HISTORY_LENGTH)            \
 692   declare_constant(Deoptimization::_support_large_access_byte_array_virtualization) \
 693                                                                           \
 694                                                                           \
 695   declare_constant(InstanceKlass::linked)                                 \
 696   declare_constant(InstanceKlass::being_initialized)                      \
 697   declare_constant(InstanceKlass::fully_initialized)                      \
 698                                                                           \
 699   declare_constant(LockingMode::LM_MONITOR)                               \
 700   declare_constant(LockingMode::LM_LEGACY)                                \
 701   declare_constant(LockingMode::LM_LIGHTWEIGHT)                           \
 702                                                                           \
 703   /*********************************/                                     \
 704   /* InstanceKlass _misc_flags */                                         \
 705   /*********************************/                                     \
 706                                                                           \
 707   declare_constant(InstanceKlassFlags::_misc_has_nonstatic_concrete_methods)   \
 708   declare_constant(InstanceKlassFlags::_misc_declares_nonstatic_concrete_methods) \
 709                                                                           \
 710   declare_constant(JumpData::taken_off_set)                               \
 711   declare_constant(JumpData::displacement_off_set)                        \
 712                                                                           \
 713   declare_preprocessor_constant("JVMCI::ok",                      JVMCI::ok)                      \
 714   declare_preprocessor_constant("JVMCI::dependencies_failed",     JVMCI::dependencies_failed)     \
 715   declare_preprocessor_constant("JVMCI::cache_full",              JVMCI::cache_full)              \
 716   declare_preprocessor_constant("JVMCI::code_too_large",          JVMCI::code_too_large)          \
 717   declare_preprocessor_constant("JVMCI::nmethod_reclaimed",       JVMCI::nmethod_reclaimed)       \
 718   declare_preprocessor_constant("JVMCI::first_permanent_bailout", JVMCI::first_permanent_bailout) \
 719                                                                           \
 720   declare_constant(JVMCIRuntime::none)                                    \
 721   declare_constant(JVMCIRuntime::by_holder)                               \
 722   declare_constant(JVMCIRuntime::by_full_signature)                       \
 723                                                                           \
 724   declare_constant(Klass::_lh_neutral_value)                              \
 725   declare_constant(Klass::_lh_instance_slow_path_bit)                     \
 726   declare_constant(Klass::_lh_log2_element_size_shift)                    \
 727   declare_constant(Klass::_lh_log2_element_size_mask)                     \
 728   declare_constant(Klass::_lh_element_type_shift)                         \
 729   declare_constant(Klass::_lh_element_type_mask)                          \
 730   declare_constant(Klass::_lh_header_size_shift)                          \
 731   declare_constant(Klass::_lh_header_size_mask)                           \
 732   declare_constant(Klass::_lh_array_tag_shift)                            \
 733   declare_constant(Klass::_lh_array_tag_type_value)                       \
 734   declare_constant(Klass::_lh_array_tag_obj_value)                        \
 735                                                                           \
 736   declare_constant(markWord::no_hash)                                     \
 737                                                                           \
 738   declare_constant(MethodFlags::_misc_force_inline)                       \
 739   declare_constant(MethodFlags::_misc_dont_inline)                        \
 740                                                                           \
 741   declare_constant(Method::nonvirtual_vtable_index)                       \
 742   declare_constant(Method::invalid_vtable_index)                          \
 743                                                                           \
 744   declare_constant(MultiBranchData::per_case_cell_count)                  \
 745                                                                           \
 746   AARCH64_ONLY(declare_constant(NMethodPatchingType::stw_instruction_and_data_patch))  \
 747   AARCH64_ONLY(declare_constant(NMethodPatchingType::conc_instruction_and_data_patch)) \
 748   AARCH64_ONLY(declare_constant(NMethodPatchingType::conc_data_patch))                 \
 749                                                                           \
 750   declare_constant(ObjectMonitor::ANONYMOUS_OWNER)                        \
 751                                                                           \
 752   declare_constant(ReceiverTypeData::receiver_type_row_cell_count)        \
 753   declare_constant(ReceiverTypeData::receiver0_offset)                    \
 754   declare_constant(ReceiverTypeData::count0_offset)                       \
 755                                                                           \
 756   declare_constant(vmIntrinsics::_invokeBasic)                            \
 757   declare_constant(vmIntrinsics::_linkToVirtual)                          \
 758   declare_constant(vmIntrinsics::_linkToStatic)                           \
 759   declare_constant(vmIntrinsics::_linkToSpecial)                          \
 760   declare_constant(vmIntrinsics::_linkToInterface)                        \
 761                                                                           \
 762   declare_constant(vmSymbols::FIRST_SID)                                  \
 763   declare_constant(vmSymbols::SID_LIMIT)                                  \
 764 
 765 #define VM_LONG_CONSTANTS(declare_constant, declare_preprocessor_constant) \
 766   declare_constant(InvocationCounter::count_increment)                    \
 767   declare_constant(InvocationCounter::count_shift)                        \
 768                                                                           \
 769   declare_constant(markWord::hash_shift)                                  \
 770   declare_constant(markWord::monitor_value)                               \
 771                                                                           \
 772   declare_constant(markWord::lock_mask_in_place)                          \
 773   declare_constant(markWord::age_mask_in_place)                           \
 774   declare_constant(markWord::hash_mask)                                   \
 775   declare_constant(markWord::hash_mask_in_place)                          \
 776                                                                           \
 777   declare_constant(markWord::unlocked_value)                              \
 778                                                                           \
 779   declare_constant(markWord::no_hash_in_place)                            \
 780   declare_constant(markWord::no_lock_in_place)                            \
 781 
 782 #define VM_ADDRESSES(declare_address, declare_preprocessor_address, declare_function) \
 783   declare_function(SharedRuntime::register_finalizer)                     \
 784   declare_function(SharedRuntime::exception_handler_for_return_address)   \
 785   declare_function(SharedRuntime::OSR_migration_end)                      \
 786   declare_function(SharedRuntime::enable_stack_reserved_zone)             \
 787   declare_function(SharedRuntime::frem)                                   \
 788   declare_function(SharedRuntime::drem)                                   \
 789   JVMTI_ONLY(declare_function(SharedRuntime::notify_jvmti_vthread_start)) \
 790   JVMTI_ONLY(declare_function(SharedRuntime::notify_jvmti_vthread_end))   \
 791   JVMTI_ONLY(declare_function(SharedRuntime::notify_jvmti_vthread_mount)) \
 792   JVMTI_ONLY(declare_function(SharedRuntime::notify_jvmti_vthread_unmount)) \
 793                                                                           \
 794   declare_function(os::dll_load)                                          \
 795   declare_function(os::dll_lookup)                                        \
 796   declare_function(os::javaTimeMillis)                                    \
 797   declare_function(os::javaTimeNanos)                                     \
 798                                                                           \
 799   declare_function(Deoptimization::fetch_unroll_info)                     \
 800   declare_function(Deoptimization::uncommon_trap)                         \
 801   declare_function(Deoptimization::unpack_frames)                         \
 802                                                                           \
 803   declare_function(JVMCIRuntime::new_instance) \
 804   declare_function(JVMCIRuntime::new_array) \
 805   declare_function(JVMCIRuntime::new_multi_array) \
 806   declare_function(JVMCIRuntime::dynamic_new_array) \
 807   declare_function(JVMCIRuntime::dynamic_new_instance) \
 808   \
 809   declare_function(JVMCIRuntime::new_instance_or_null) \
 810   declare_function(JVMCIRuntime::new_array_or_null) \
 811   declare_function(JVMCIRuntime::new_multi_array_or_null) \
 812   declare_function(JVMCIRuntime::dynamic_new_array_or_null) \
 813   declare_function(JVMCIRuntime::dynamic_new_instance_or_null) \
 814   \
 815   declare_function(JVMCIRuntime::invoke_static_method_one_arg) \
 816   \
 817   declare_function(JVMCIRuntime::vm_message) \
 818   declare_function(JVMCIRuntime::identity_hash_code) \
 819   declare_function(JVMCIRuntime::exception_handler_for_pc) \
 820   declare_function(JVMCIRuntime::monitorenter) \
 821   declare_function(JVMCIRuntime::monitorexit) \
 822   declare_function(JVMCIRuntime::object_notify) \
 823   declare_function(JVMCIRuntime::object_notifyAll) \
 824   declare_function(JVMCIRuntime::throw_and_post_jvmti_exception) \
 825   declare_function(JVMCIRuntime::throw_klass_external_name_exception) \
 826   declare_function(JVMCIRuntime::throw_class_cast_exception) \
 827   declare_function(JVMCIRuntime::log_primitive) \
 828   declare_function(JVMCIRuntime::log_object) \
 829   declare_function(JVMCIRuntime::log_printf) \
 830   declare_function(JVMCIRuntime::vm_error) \
 831   declare_function(JVMCIRuntime::load_and_clear_exception) \
 832   G1GC_ONLY(declare_function(JVMCIRuntime::write_barrier_pre)) \
 833   G1GC_ONLY(declare_function(JVMCIRuntime::write_barrier_post)) \
 834   declare_function(JVMCIRuntime::validate_object) \
 835   \
 836   declare_function(JVMCIRuntime::test_deoptimize_call_int)
 837 
 838 
 839 #if INCLUDE_G1GC
 840 
 841 #define VM_STRUCTS_JVMCI_G1GC(nonstatic_field, static_field) \
 842   static_field(HeapRegion, LogOfHRGrainBytes, uint)
 843 
 844 #define VM_INT_CONSTANTS_JVMCI_G1GC(declare_constant, declare_constant_with_value, declare_preprocessor_constant) \
 845   declare_constant_with_value("G1CardTable::g1_young_gen", G1CardTable::g1_young_card_val()) \
 846   declare_constant_with_value("G1ThreadLocalData::satb_mark_queue_active_offset", in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset())) \
 847   declare_constant_with_value("G1ThreadLocalData::satb_mark_queue_index_offset", in_bytes(G1ThreadLocalData::satb_mark_queue_index_offset())) \
 848   declare_constant_with_value("G1ThreadLocalData::satb_mark_queue_buffer_offset", in_bytes(G1ThreadLocalData::satb_mark_queue_buffer_offset())) \
 849   declare_constant_with_value("G1ThreadLocalData::dirty_card_queue_index_offset", in_bytes(G1ThreadLocalData::dirty_card_queue_index_offset())) \
 850   declare_constant_with_value("G1ThreadLocalData::dirty_card_queue_buffer_offset", in_bytes(G1ThreadLocalData::dirty_card_queue_buffer_offset()))
 851 
 852 #endif // INCLUDE_G1GC
 853 
 854 
 855 #ifdef LINUX
 856 
 857 #define VM_ADDRESSES_OS(declare_address, declare_preprocessor_address, declare_function) \
 858   declare_preprocessor_address("RTLD_DEFAULT", RTLD_DEFAULT)
 859 
 860 #endif
 861 
 862 
 863 #ifdef BSD
 864 
 865 #define VM_ADDRESSES_OS(declare_address, declare_preprocessor_address, declare_function) \
 866   declare_preprocessor_address("RTLD_DEFAULT", RTLD_DEFAULT)
 867 
 868 #endif
 869 
 870 #ifdef AARCH64
 871 
 872 #define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
 873   static_field(VM_Version, _zva_length, int)                            \
 874   static_field(StubRoutines::aarch64, _count_positives, address)        \
 875   static_field(StubRoutines::aarch64, _count_positives_long, address)   \
 876   static_field(VM_Version, _rop_protection, bool)                       \
 877   volatile_nonstatic_field(JavaFrameAnchor, _last_Java_fp, intptr_t*)
 878 
 879 #define DECLARE_INT_CPU_FEATURE_CONSTANT(id, name, bit) GENERATE_VM_INT_CONSTANT_ENTRY(VM_Version::CPU_##id)
 880 #define VM_INT_CPU_FEATURE_CONSTANTS CPU_FEATURE_FLAGS(DECLARE_INT_CPU_FEATURE_CONSTANT)
 881 
 882 #endif
 883 
 884 #ifdef X86
 885 
 886 #define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
 887   volatile_nonstatic_field(JavaFrameAnchor, _last_Java_fp, intptr_t*) \
 888   static_field(VM_Version, _has_intel_jcc_erratum, bool)
 889 
 890 #define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \
 891   LP64_ONLY(declare_constant(frame::arg_reg_save_area_bytes))       \
 892   declare_constant(frame::interpreter_frame_sender_sp_offset)       \
 893   declare_constant(frame::interpreter_frame_last_sp_offset)
 894 
 895 #define DECLARE_LONG_CPU_FEATURE_CONSTANT(id, name, bit) GENERATE_VM_LONG_CONSTANT_ENTRY(VM_Version::CPU_##id)
 896 #define VM_LONG_CPU_FEATURE_CONSTANTS CPU_FEATURE_FLAGS(DECLARE_LONG_CPU_FEATURE_CONSTANT)
 897 
 898 #endif
 899 
 900 /*
 901  * Dummy defines for architectures that don't use these.
 902  */
 903 #ifndef VM_STRUCTS_CPU
 904 #define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field)
 905 #endif
 906 
 907 #ifndef VM_INT_CONSTANTS_CPU
 908 #define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 909 #endif
 910 
 911 #ifndef VM_LONG_CONSTANTS_CPU
 912 #define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 913 #endif
 914 
 915 #ifndef VM_ADDRESSES_OS
 916 #define VM_ADDRESSES_OS(declare_address, declare_preprocessor_address, declare_function)
 917 #endif
 918 
 919 //
 920 // Instantiation of VMStructEntries, VMTypeEntries and VMIntConstantEntries
 921 //
 922 
 923 // These initializers are allowed to access private fields in classes
 924 // as long as class VMStructs is a friend
 925 VMStructEntry JVMCIVMStructs::localHotSpotVMStructs[] = {
 926   VM_STRUCTS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
 927              GENERATE_STATIC_VM_STRUCT_ENTRY,
 928              GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
 929              GENERATE_NONSTATIC_VM_STRUCT_ENTRY)
 930 
 931   VM_STRUCTS_CPU(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
 932                  GENERATE_STATIC_VM_STRUCT_ENTRY,
 933                  GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
 934                  GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
 935                  GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
 936                  GENERATE_C2_NONSTATIC_VM_STRUCT_ENTRY,
 937                  GENERATE_C1_UNCHECKED_STATIC_VM_STRUCT_ENTRY,
 938                  GENERATE_C2_UNCHECKED_STATIC_VM_STRUCT_ENTRY)
 939 
 940 #if INCLUDE_G1GC
 941   VM_STRUCTS_JVMCI_G1GC(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
 942                         GENERATE_STATIC_VM_STRUCT_ENTRY)
 943 #endif
 944 
 945   GENERATE_VM_STRUCT_LAST_ENTRY()
 946 };
 947 
 948 VMTypeEntry JVMCIVMStructs::localHotSpotVMTypes[] = {
 949   VM_TYPES(GENERATE_VM_TYPE_ENTRY,
 950            GENERATE_TOPLEVEL_VM_TYPE_ENTRY,
 951            GENERATE_INTEGER_VM_TYPE_ENTRY,
 952            GENERATE_UNSIGNED_INTEGER_VM_TYPE_ENTRY)
 953 
 954   GENERATE_VM_TYPE_LAST_ENTRY()
 955 };
 956 
 957 VMIntConstantEntry JVMCIVMStructs::localHotSpotVMIntConstants[] = {
 958   VM_INT_CONSTANTS(GENERATE_VM_INT_CONSTANT_ENTRY,
 959                    GENERATE_VM_INT_CONSTANT_WITH_VALUE_ENTRY,
 960                    GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY)
 961 
 962   VM_INT_CONSTANTS_CPU(GENERATE_VM_INT_CONSTANT_ENTRY,
 963                        GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY,
 964                        GENERATE_C1_VM_INT_CONSTANT_ENTRY,
 965                        GENERATE_C2_VM_INT_CONSTANT_ENTRY,
 966                        GENERATE_C2_PREPROCESSOR_VM_INT_CONSTANT_ENTRY)
 967 
 968 #if INCLUDE_G1GC
 969   VM_INT_CONSTANTS_JVMCI_G1GC(GENERATE_VM_INT_CONSTANT_ENTRY,
 970                               GENERATE_VM_INT_CONSTANT_WITH_VALUE_ENTRY,
 971                               GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY)
 972 #endif
 973 #ifdef VM_INT_CPU_FEATURE_CONSTANTS
 974   VM_INT_CPU_FEATURE_CONSTANTS
 975 #endif
 976   GENERATE_VM_INT_CONSTANT_LAST_ENTRY()
 977 };
 978 
 979 VMLongConstantEntry JVMCIVMStructs::localHotSpotVMLongConstants[] = {
 980   VM_LONG_CONSTANTS(GENERATE_VM_LONG_CONSTANT_ENTRY,
 981                     GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY)
 982 
 983   VM_LONG_CONSTANTS_CPU(GENERATE_VM_LONG_CONSTANT_ENTRY,
 984                         GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY,
 985                         GENERATE_C1_VM_LONG_CONSTANT_ENTRY,
 986                         GENERATE_C2_VM_LONG_CONSTANT_ENTRY,
 987                         GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY)
 988 #ifdef VM_LONG_CPU_FEATURE_CONSTANTS
 989   VM_LONG_CPU_FEATURE_CONSTANTS
 990 #endif
 991   GENERATE_VM_LONG_CONSTANT_LAST_ENTRY()
 992 };
 993 #undef DECLARE_CPU_FEATURE_FLAG
 994 
 995 VMAddressEntry JVMCIVMStructs::localHotSpotVMAddresses[] = {
 996   VM_ADDRESSES(GENERATE_VM_ADDRESS_ENTRY,
 997                GENERATE_PREPROCESSOR_VM_ADDRESS_ENTRY,
 998                GENERATE_VM_FUNCTION_ENTRY)
 999   VM_ADDRESSES_OS(GENERATE_VM_ADDRESS_ENTRY,
1000                   GENERATE_PREPROCESSOR_VM_ADDRESS_ENTRY,
1001                   GENERATE_VM_FUNCTION_ENTRY)
1002 
1003   GENERATE_VM_ADDRESS_LAST_ENTRY()
1004 };
1005 
1006 int JVMCIVMStructs::localHotSpotVMStructs_count() {
1007   // Ignore sentinel entry at the end
1008   return (sizeof(localHotSpotVMStructs) / sizeof(VMStructEntry)) - 1;
1009 }
1010 int JVMCIVMStructs::localHotSpotVMTypes_count() {
1011   // Ignore sentinel entry at the end
1012   return (sizeof(localHotSpotVMTypes) / sizeof(VMTypeEntry)) - 1;
1013 }
1014 int JVMCIVMStructs::localHotSpotVMIntConstants_count() {
1015   // Ignore sentinel entry at the end
1016   return (sizeof(localHotSpotVMIntConstants) / sizeof(VMIntConstantEntry)) - 1;
1017 }
1018 int JVMCIVMStructs::localHotSpotVMLongConstants_count() {
1019   // Ignore sentinel entry at the end
1020   return (sizeof(localHotSpotVMLongConstants) / sizeof(VMLongConstantEntry)) - 1;
1021 }
1022 int JVMCIVMStructs::localHotSpotVMAddresses_count() {
1023   // Ignore sentinel entry at the end
1024   return (sizeof(localHotSpotVMAddresses) / sizeof(VMAddressEntry)) - 1;
1025 }
1026 
1027 extern "C" {
1028 JNIEXPORT VMStructEntry* jvmciHotSpotVMStructs = JVMCIVMStructs::localHotSpotVMStructs;
1029 JNIEXPORT VMTypeEntry* jvmciHotSpotVMTypes = JVMCIVMStructs::localHotSpotVMTypes;
1030 JNIEXPORT VMIntConstantEntry* jvmciHotSpotVMIntConstants = JVMCIVMStructs::localHotSpotVMIntConstants;
1031 JNIEXPORT VMLongConstantEntry* jvmciHotSpotVMLongConstants = JVMCIVMStructs::localHotSpotVMLongConstants;
1032 JNIEXPORT VMAddressEntry* jvmciHotSpotVMAddresses = JVMCIVMStructs::localHotSpotVMAddresses;
1033 }
1034 
1035 #ifdef ASSERT
1036 // This is used both to check the types of referenced fields and
1037 // to ensure that all of the field types are present.
1038 void JVMCIVMStructs::init() {
1039   VM_STRUCTS(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
1040              CHECK_STATIC_VM_STRUCT_ENTRY,
1041              CHECK_NO_OP,
1042              CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY);
1043 
1044 
1045   VM_STRUCTS_CPU(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
1046                  CHECK_STATIC_VM_STRUCT_ENTRY,
1047                  CHECK_NO_OP,
1048                  CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY,
1049                  CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
1050                  CHECK_C2_NONSTATIC_VM_STRUCT_ENTRY,
1051                  CHECK_NO_OP,
1052                  CHECK_NO_OP);
1053 
1054 #if INCLUDE_G1GC
1055   VM_STRUCTS_JVMCI_G1GC(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
1056                         CHECK_STATIC_VM_STRUCT_ENTRY)
1057 #endif
1058 
1059   VM_TYPES(CHECK_VM_TYPE_ENTRY,
1060            CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
1061            CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
1062            CHECK_SINGLE_ARG_VM_TYPE_NO_OP);
1063 }
1064 
1065 void jvmci_vmStructs_init() {
1066   JVMCIVMStructs::init();
1067 }
1068 #endif // ASSERT