< prev index next >

src/hotspot/share/runtime/vmStructs.cpp

Print this page

 125 #include "opto/divnode.hpp"
 126 #include "opto/intrinsicnode.hpp"
 127 #include "opto/locknode.hpp"
 128 #include "opto/loopnode.hpp"
 129 #include "opto/machnode.hpp"
 130 #include "opto/matcher.hpp"
 131 #include "opto/mathexactnode.hpp"
 132 #include "opto/movenode.hpp"
 133 #include "opto/mulnode.hpp"
 134 #include "opto/narrowptrnode.hpp"
 135 #include "opto/opaquenode.hpp"
 136 #include "opto/optoreg.hpp"
 137 #include "opto/parse.hpp"
 138 #include "opto/phaseX.hpp"
 139 #include "opto/regalloc.hpp"
 140 #include "opto/rootnode.hpp"
 141 #include "opto/subnode.hpp"
 142 #include "opto/vectornode.hpp"
 143 #endif // COMPILER2
 144 










 145 // Note: the cross-product of (c1, c2, product, nonproduct, ...),
 146 // (nonstatic, static), and (unchecked, checked) has not been taken.
 147 // Only the macros currently needed have been defined.
 148 
 149 // A field whose type is not checked is given a null string as the
 150 // type name, indicating an "opaque" type to the serviceability agent.
 151 
 152 // NOTE: there is an interdependency between this file and
 153 // HotSpotTypeDataBase.java, which parses the type strings.
 154 
 155 #ifndef REG_COUNT
 156   #define REG_COUNT 0
 157 #endif
 158 
 159 #if INCLUDE_JVMTI
 160   #define JVMTI_STRUCTS(static_field) \
 161     static_field(JvmtiExport,                     _can_access_local_variables,                  bool)                                  \
 162     static_field(JvmtiExport,                     _can_hotswap_or_post_breakpoint,              bool)                                  \
 163     static_field(JvmtiExport,                     _can_post_on_exceptions,                      bool)                                  \
 164     static_field(JvmtiExport,                     _can_walk_any_space,                          bool)

 717   volatile_nonstatic_field(JavaFrameAnchor,    _last_Java_pc,                                 address)                               \
 718                                                                                                                                      \
 719   /******************************/                                                                                                   \
 720   /* Threads (NOTE: incomplete) */                                                                                                   \
 721   /******************************/                                                                                                   \
 722                                                                                                                                      \
 723   static_field(Threads,                     _number_of_threads,                               int)                                   \
 724   static_field(Threads,                     _number_of_non_daemon_threads,                    int)                                   \
 725   static_field(Threads,                     _return_code,                                     int)                                   \
 726                                                                                                                                      \
 727   static_ptr_volatile_field(ThreadsSMRSupport, _java_thread_list,                             ThreadsList*)                          \
 728   nonstatic_field(ThreadsList,                 _length,                                       const uint)                            \
 729   nonstatic_field(ThreadsList,                 _threads,                                      JavaThread *const *const)              \
 730                                                                                                                                      \
 731   nonstatic_field(ThreadShadow,                _pending_exception,                            oop)                                   \
 732   nonstatic_field(ThreadShadow,                _exception_file,                               const char*)                           \
 733   nonstatic_field(ThreadShadow,                _exception_line,                               int)                                   \
 734   nonstatic_field(Thread,                      _active_handles,                               JNIHandleBlock*)                       \
 735   nonstatic_field(Thread,                      _tlab,                                         ThreadLocalAllocBuffer)                \
 736   nonstatic_field(Thread,                      _allocated_bytes,                              jlong)                                 \



 737   nonstatic_field(NamedThread,                 _name,                                         char*)                                 \
 738   nonstatic_field(NamedThread,                 _processed_thread,                             Thread*)                               \
 739   nonstatic_field(JavaThread,                  _threadObj,                                    OopHandle)                             \
 740   nonstatic_field(JavaThread,                  _anchor,                                       JavaFrameAnchor)                       \
 741   nonstatic_field(JavaThread,                  _vm_result,                                    oop)                                   \
 742   nonstatic_field(JavaThread,                  _vm_result_2,                                  Metadata*)                             \
 743   volatile_nonstatic_field(JavaThread,         _current_pending_monitor,                      ObjectMonitor*)                        \
 744   nonstatic_field(JavaThread,                  _current_pending_monitor_is_from_java,         bool)                                  \
 745   volatile_nonstatic_field(JavaThread,         _current_waiting_monitor,                      ObjectMonitor*)                        \
 746   volatile_nonstatic_field(JavaThread,         _suspend_flags,                                uint32_t)                              \
 747   nonstatic_field(JavaThread,                  _async_exception_condition,                    JavaThread::AsyncExceptionCondition)   \
 748   nonstatic_field(JavaThread,                  _pending_async_exception,                      oop)                                   \
 749   volatile_nonstatic_field(JavaThread,         _exception_oop,                                oop)                                   \
 750   volatile_nonstatic_field(JavaThread,         _exception_pc,                                 address)                               \
 751   volatile_nonstatic_field(JavaThread,         _is_method_handle_return,                      int)                                   \
 752   nonstatic_field(JavaThread,                  _saved_exception_pc,                           address)                               \
 753   volatile_nonstatic_field(JavaThread,         _thread_state,                                 JavaThreadState)                       \
 754   nonstatic_field(JavaThread,                  _osthread,                                     OSThread*)                             \
 755   nonstatic_field(JavaThread,                  _stack_base,                                   address)                               \
 756   nonstatic_field(JavaThread,                  _stack_size,                                   size_t)                                \

1222                                                                           \
1223   declare_unsigned_integer_type(size_t)                                   \
1224   declare_integer_type(ssize_t)                                           \
1225   declare_integer_type(intx)                                              \
1226   declare_integer_type(intptr_t)                                          \
1227   declare_unsigned_integer_type(uintx)                                    \
1228   declare_unsigned_integer_type(uintptr_t)                                \
1229   declare_unsigned_integer_type(uint8_t)                                  \
1230   declare_unsigned_integer_type(uint32_t)                                 \
1231   declare_unsigned_integer_type(uint64_t)                                 \
1232                                                                           \
1233   /******************************************/                            \
1234   /* OopDesc hierarchy (NOTE: some missing) */                            \
1235   /******************************************/                            \
1236                                                                           \
1237   declare_toplevel_type(oopDesc)                                          \
1238     declare_type(arrayOopDesc, oopDesc)                                   \
1239       declare_type(objArrayOopDesc, arrayOopDesc)                         \
1240     declare_type(instanceOopDesc, oopDesc)                                \
1241                                                                           \


1242   /**************************************************/                    \
1243   /* MetadataOopDesc hierarchy (NOTE: some missing) */                    \
1244   /**************************************************/                    \
1245                                                                           \
1246   declare_toplevel_type(CompiledICHolder)                                 \
1247   declare_toplevel_type(MetaspaceObj)                                     \
1248     declare_type(Metadata, MetaspaceObj)                                  \
1249     declare_type(Klass, Metadata)                                         \
1250            declare_type(ArrayKlass, Klass)                                \
1251            declare_type(ObjArrayKlass, ArrayKlass)                        \
1252            declare_type(TypeArrayKlass, ArrayKlass)                       \
1253       declare_type(InstanceKlass, Klass)                                  \
1254         declare_type(InstanceClassLoaderKlass, InstanceKlass)             \
1255         declare_type(InstanceMirrorKlass, InstanceKlass)                  \
1256         declare_type(InstanceRefKlass, InstanceKlass)                     \
1257     declare_type(ConstantPool, Metadata)                                  \
1258     declare_type(ConstantPoolCache, MetaspaceObj)                         \
1259     declare_type(MethodData, Metadata)                                    \
1260     declare_type(Method, Metadata)                                        \
1261     declare_type(MethodCounters, MetaspaceObj)                            \

1333                                                                           \
1334   declare_toplevel_type(Threads)                                          \
1335   declare_toplevel_type(ThreadShadow)                                     \
1336     declare_type(Thread, ThreadShadow)                                    \
1337       declare_type(NonJavaThread, Thread)                                 \
1338         declare_type(NamedThread, NonJavaThread)                          \
1339         declare_type(WatcherThread, NonJavaThread)                        \
1340         declare_type(AsyncLogWriter, NonJavaThread)                       \
1341       declare_type(JavaThread, Thread)                                    \
1342         declare_type(JvmtiAgentThread, JavaThread)                        \
1343         declare_type(MonitorDeflationThread, JavaThread)                  \
1344         declare_type(ServiceThread, JavaThread)                           \
1345         declare_type(NotificationThread, JavaThread)                      \
1346         declare_type(CompilerThread, JavaThread)                          \
1347         declare_type(CodeCacheSweeperThread, JavaThread)                  \
1348   declare_toplevel_type(OSThread)                                         \
1349   declare_toplevel_type(JavaFrameAnchor)                                  \
1350                                                                           \
1351   declare_toplevel_type(ThreadsSMRSupport)                                \
1352   declare_toplevel_type(ThreadsList)                                      \

1353                                                                           \
1354   /***************/                                                       \
1355   /* Interpreter */                                                       \
1356   /***************/                                                       \
1357                                                                           \
1358   declare_toplevel_type(AbstractInterpreter)                              \
1359                                                                           \
1360   /*********/                                                             \
1361   /* Stubs */                                                             \
1362   /*********/                                                             \
1363                                                                           \
1364   declare_toplevel_type(StubQueue)                                        \
1365   declare_toplevel_type(StubRoutines)                                     \
1366   declare_toplevel_type(Stub)                                             \
1367            declare_type(InterpreterCodelet, Stub)                         \
1368                                                                           \
1369   /*************/                                                         \
1370   /* JavaCalls */                                                         \
1371   /*************/                                                         \
1372                                                                           \

2454   declare_constant(T_ILLEGAL)                                             \
2455                                                                           \
2456   /**********************************************/                        \
2457   /* BasicTypeSize enum (globalDefinitions.hpp) */                        \
2458   /**********************************************/                        \
2459                                                                           \
2460   declare_constant(T_BOOLEAN_size)                                        \
2461   declare_constant(T_CHAR_size)                                           \
2462   declare_constant(T_FLOAT_size)                                          \
2463   declare_constant(T_DOUBLE_size)                                         \
2464   declare_constant(T_BYTE_size)                                           \
2465   declare_constant(T_SHORT_size)                                          \
2466   declare_constant(T_INT_size)                                            \
2467   declare_constant(T_LONG_size)                                           \
2468   declare_constant(T_OBJECT_size)                                         \
2469   declare_constant(T_ARRAY_size)                                          \
2470   declare_constant(T_NARROWOOP_size)                                      \
2471   declare_constant(T_NARROWKLASS_size)                                    \
2472   declare_constant(T_VOID_size)                                           \
2473                                                                           \








2474   /*********************/                                                 \
2475   /* Matcher (C2 only) */                                                 \
2476   /*********************/                                                 \
2477                                                                           \
2478   declare_c2_preprocessor_constant("Matcher::interpreter_frame_pointer_reg", Matcher::interpreter_frame_pointer_reg()) \
2479                                                                           \
2480   /*********************************************/                         \
2481   /* MethodCompilation (globalDefinitions.hpp) */                         \
2482   /*********************************************/                         \
2483                                                                           \
2484   declare_constant(InvocationEntryBci)                                    \
2485                                                                           \
2486   /*************/                                                         \
2487   /* CompLevel */                                                         \
2488   /*************/                                                         \
2489                                                                           \
2490   declare_constant(CompLevel_any)                                         \
2491   declare_constant(CompLevel_all)                                         \
2492   declare_constant(CompLevel_none)                                        \
2493   declare_constant(CompLevel_simple)                                      \

2616                                                                           \
2617   /****************/                                                      \
2618   /* GC constants */                                                      \
2619   /****************/                                                      \
2620                                                                           \
2621   VM_LONG_CONSTANTS_GC(declare_constant)                                  \
2622                                                                           \
2623   /*********************/                                                 \
2624   /* markWord constants */                                                \
2625   /*********************/                                                 \
2626                                                                           \
2627   /* Note: some of these are declared as long constants just for */       \
2628   /* consistency. The mask constants are the only ones requiring */       \
2629   /* 64 bits (on 64-bit platforms). */                                    \
2630                                                                           \
2631   declare_constant(markWord::age_bits)                                    \
2632   declare_constant(markWord::lock_bits)                                   \
2633   declare_constant(markWord::biased_lock_bits)                            \
2634   declare_constant(markWord::max_hash_bits)                               \
2635   declare_constant(markWord::hash_bits)                                   \

2636                                                                           \
2637   declare_constant(markWord::lock_shift)                                  \
2638   declare_constant(markWord::biased_lock_shift)                           \
2639   declare_constant(markWord::age_shift)                                   \
2640   declare_constant(markWord::hash_shift)                                  \


2641                                                                           \
2642   declare_constant(markWord::lock_mask)                                   \
2643   declare_constant(markWord::lock_mask_in_place)                          \
2644   declare_constant(markWord::biased_lock_mask)                            \
2645   declare_constant(markWord::biased_lock_mask_in_place)                   \
2646   declare_constant(markWord::biased_lock_bit_in_place)                    \
2647   declare_constant(markWord::age_mask)                                    \
2648   declare_constant(markWord::age_mask_in_place)                           \
2649   declare_constant(markWord::epoch_mask)                                  \
2650   declare_constant(markWord::epoch_mask_in_place)                         \
2651   declare_constant(markWord::hash_mask)                                   \
2652   declare_constant(markWord::hash_mask_in_place)                          \


2653   declare_constant(markWord::biased_lock_alignment)                       \
2654                                                                           \
2655   declare_constant(markWord::locked_value)                                \
2656   declare_constant(markWord::unlocked_value)                              \
2657   declare_constant(markWord::monitor_value)                               \
2658   declare_constant(markWord::marked_value)                                \
2659   declare_constant(markWord::biased_lock_pattern)                         \
2660                                                                           \
2661   declare_constant(markWord::no_hash)                                     \
2662   declare_constant(markWord::no_hash_in_place)                            \
2663   declare_constant(markWord::no_lock_in_place)                            \
2664   declare_constant(markWord::max_age)                                     \
2665                                                                           \
2666   /* InvocationCounter constants */                                       \
2667   declare_constant(InvocationCounter::count_increment)                    \
2668   declare_constant(InvocationCounter::count_shift)
2669 


2670 
2671 //--------------------------------------------------------------------------------
2672 //
2673 
2674 // Generate and check a nonstatic field in non-product builds
2675 #ifndef PRODUCT
2676 # define GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY(a, b, c) GENERATE_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)
2677 # define CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)    CHECK_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)
2678 # define ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT(a, b, c)          ENSURE_FIELD_TYPE_PRESENT(a, b, c)
2679 #else
2680 # define GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)
2681 # define CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)
2682 # define ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT(a, b, c)
2683 #endif /* PRODUCT */
2684 
2685 // Generate and check a nonstatic field in C1 builds
2686 #ifdef COMPILER1
2687 # define GENERATE_C1_NONSTATIC_VM_STRUCT_ENTRY(a, b, c) GENERATE_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)
2688 # define CHECK_C1_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)    CHECK_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)
2689 # define ENSURE_C1_FIELD_TYPE_PRESENT(a, b, c)          ENSURE_FIELD_TYPE_PRESENT(a, b, c)

3169       return 1;
3170     }
3171     os::free(s);
3172   }
3173   if (!isRecurse) {
3174     tty->print_cr("type \"%s\" not found", typeName);
3175   }
3176   return 0;
3177 }
3178 
3179 int VMStructs::findType(const char* typeName) {
3180   VMTypeEntry* types = gHotSpotVMTypes;
3181 
3182   return recursiveFindType(types, typeName, false);
3183 }
3184 
3185 void vmStructs_init() {
3186   VMStructs::init();
3187 }
3188 #endif // ASSERT



























 125 #include "opto/divnode.hpp"
 126 #include "opto/intrinsicnode.hpp"
 127 #include "opto/locknode.hpp"
 128 #include "opto/loopnode.hpp"
 129 #include "opto/machnode.hpp"
 130 #include "opto/matcher.hpp"
 131 #include "opto/mathexactnode.hpp"
 132 #include "opto/movenode.hpp"
 133 #include "opto/mulnode.hpp"
 134 #include "opto/narrowptrnode.hpp"
 135 #include "opto/opaquenode.hpp"
 136 #include "opto/optoreg.hpp"
 137 #include "opto/parse.hpp"
 138 #include "opto/phaseX.hpp"
 139 #include "opto/regalloc.hpp"
 140 #include "opto/rootnode.hpp"
 141 #include "opto/subnode.hpp"
 142 #include "opto/vectornode.hpp"
 143 #endif // COMPILER2
 144 
 145 // Used by VMStructs when CompactObjectHeaders are enabled.
 146 // Must match the relevant parts from the real oopDesc.
 147 class fakeOopDesc {
 148 private:
 149   union _metadata {
 150     Klass*      _klass;
 151     narrowKlass _compressed_klass;
 152   } _metadata;
 153 };
 154 
 155 // Note: the cross-product of (c1, c2, product, nonproduct, ...),
 156 // (nonstatic, static), and (unchecked, checked) has not been taken.
 157 // Only the macros currently needed have been defined.
 158 
 159 // A field whose type is not checked is given a null string as the
 160 // type name, indicating an "opaque" type to the serviceability agent.
 161 
 162 // NOTE: there is an interdependency between this file and
 163 // HotSpotTypeDataBase.java, which parses the type strings.
 164 
 165 #ifndef REG_COUNT
 166   #define REG_COUNT 0
 167 #endif
 168 
 169 #if INCLUDE_JVMTI
 170   #define JVMTI_STRUCTS(static_field) \
 171     static_field(JvmtiExport,                     _can_access_local_variables,                  bool)                                  \
 172     static_field(JvmtiExport,                     _can_hotswap_or_post_breakpoint,              bool)                                  \
 173     static_field(JvmtiExport,                     _can_post_on_exceptions,                      bool)                                  \
 174     static_field(JvmtiExport,                     _can_walk_any_space,                          bool)

 727   volatile_nonstatic_field(JavaFrameAnchor,    _last_Java_pc,                                 address)                               \
 728                                                                                                                                      \
 729   /******************************/                                                                                                   \
 730   /* Threads (NOTE: incomplete) */                                                                                                   \
 731   /******************************/                                                                                                   \
 732                                                                                                                                      \
 733   static_field(Threads,                     _number_of_threads,                               int)                                   \
 734   static_field(Threads,                     _number_of_non_daemon_threads,                    int)                                   \
 735   static_field(Threads,                     _return_code,                                     int)                                   \
 736                                                                                                                                      \
 737   static_ptr_volatile_field(ThreadsSMRSupport, _java_thread_list,                             ThreadsList*)                          \
 738   nonstatic_field(ThreadsList,                 _length,                                       const uint)                            \
 739   nonstatic_field(ThreadsList,                 _threads,                                      JavaThread *const *const)              \
 740                                                                                                                                      \
 741   nonstatic_field(ThreadShadow,                _pending_exception,                            oop)                                   \
 742   nonstatic_field(ThreadShadow,                _exception_file,                               const char*)                           \
 743   nonstatic_field(ThreadShadow,                _exception_line,                               int)                                   \
 744   nonstatic_field(Thread,                      _active_handles,                               JNIHandleBlock*)                       \
 745   nonstatic_field(Thread,                      _tlab,                                         ThreadLocalAllocBuffer)                \
 746   nonstatic_field(Thread,                      _allocated_bytes,                              jlong)                                 \
 747   nonstatic_field(JavaThread,                  _lock_stack,                                   LockStack)                             \
 748   nonstatic_field(LockStack,                   _top,                                          uint32_t)                              \
 749   nonstatic_field(LockStack,                   _base[0],                                      oop)                                   \
 750   nonstatic_field(NamedThread,                 _name,                                         char*)                                 \
 751   nonstatic_field(NamedThread,                 _processed_thread,                             Thread*)                               \
 752   nonstatic_field(JavaThread,                  _threadObj,                                    OopHandle)                             \
 753   nonstatic_field(JavaThread,                  _anchor,                                       JavaFrameAnchor)                       \
 754   nonstatic_field(JavaThread,                  _vm_result,                                    oop)                                   \
 755   nonstatic_field(JavaThread,                  _vm_result_2,                                  Metadata*)                             \
 756   volatile_nonstatic_field(JavaThread,         _current_pending_monitor,                      ObjectMonitor*)                        \
 757   nonstatic_field(JavaThread,                  _current_pending_monitor_is_from_java,         bool)                                  \
 758   volatile_nonstatic_field(JavaThread,         _current_waiting_monitor,                      ObjectMonitor*)                        \
 759   volatile_nonstatic_field(JavaThread,         _suspend_flags,                                uint32_t)                              \
 760   nonstatic_field(JavaThread,                  _async_exception_condition,                    JavaThread::AsyncExceptionCondition)   \
 761   nonstatic_field(JavaThread,                  _pending_async_exception,                      oop)                                   \
 762   volatile_nonstatic_field(JavaThread,         _exception_oop,                                oop)                                   \
 763   volatile_nonstatic_field(JavaThread,         _exception_pc,                                 address)                               \
 764   volatile_nonstatic_field(JavaThread,         _is_method_handle_return,                      int)                                   \
 765   nonstatic_field(JavaThread,                  _saved_exception_pc,                           address)                               \
 766   volatile_nonstatic_field(JavaThread,         _thread_state,                                 JavaThreadState)                       \
 767   nonstatic_field(JavaThread,                  _osthread,                                     OSThread*)                             \
 768   nonstatic_field(JavaThread,                  _stack_base,                                   address)                               \
 769   nonstatic_field(JavaThread,                  _stack_size,                                   size_t)                                \

1235                                                                           \
1236   declare_unsigned_integer_type(size_t)                                   \
1237   declare_integer_type(ssize_t)                                           \
1238   declare_integer_type(intx)                                              \
1239   declare_integer_type(intptr_t)                                          \
1240   declare_unsigned_integer_type(uintx)                                    \
1241   declare_unsigned_integer_type(uintptr_t)                                \
1242   declare_unsigned_integer_type(uint8_t)                                  \
1243   declare_unsigned_integer_type(uint32_t)                                 \
1244   declare_unsigned_integer_type(uint64_t)                                 \
1245                                                                           \
1246   /******************************************/                            \
1247   /* OopDesc hierarchy (NOTE: some missing) */                            \
1248   /******************************************/                            \
1249                                                                           \
1250   declare_toplevel_type(oopDesc)                                          \
1251     declare_type(arrayOopDesc, oopDesc)                                   \
1252       declare_type(objArrayOopDesc, arrayOopDesc)                         \
1253     declare_type(instanceOopDesc, oopDesc)                                \
1254                                                                           \
1255   declare_toplevel_type(fakeOopDesc)                                      \
1256                                                                           \
1257   /**************************************************/                    \
1258   /* MetadataOopDesc hierarchy (NOTE: some missing) */                    \
1259   /**************************************************/                    \
1260                                                                           \
1261   declare_toplevel_type(CompiledICHolder)                                 \
1262   declare_toplevel_type(MetaspaceObj)                                     \
1263     declare_type(Metadata, MetaspaceObj)                                  \
1264     declare_type(Klass, Metadata)                                         \
1265            declare_type(ArrayKlass, Klass)                                \
1266            declare_type(ObjArrayKlass, ArrayKlass)                        \
1267            declare_type(TypeArrayKlass, ArrayKlass)                       \
1268       declare_type(InstanceKlass, Klass)                                  \
1269         declare_type(InstanceClassLoaderKlass, InstanceKlass)             \
1270         declare_type(InstanceMirrorKlass, InstanceKlass)                  \
1271         declare_type(InstanceRefKlass, InstanceKlass)                     \
1272     declare_type(ConstantPool, Metadata)                                  \
1273     declare_type(ConstantPoolCache, MetaspaceObj)                         \
1274     declare_type(MethodData, Metadata)                                    \
1275     declare_type(Method, Metadata)                                        \
1276     declare_type(MethodCounters, MetaspaceObj)                            \

1348                                                                           \
1349   declare_toplevel_type(Threads)                                          \
1350   declare_toplevel_type(ThreadShadow)                                     \
1351     declare_type(Thread, ThreadShadow)                                    \
1352       declare_type(NonJavaThread, Thread)                                 \
1353         declare_type(NamedThread, NonJavaThread)                          \
1354         declare_type(WatcherThread, NonJavaThread)                        \
1355         declare_type(AsyncLogWriter, NonJavaThread)                       \
1356       declare_type(JavaThread, Thread)                                    \
1357         declare_type(JvmtiAgentThread, JavaThread)                        \
1358         declare_type(MonitorDeflationThread, JavaThread)                  \
1359         declare_type(ServiceThread, JavaThread)                           \
1360         declare_type(NotificationThread, JavaThread)                      \
1361         declare_type(CompilerThread, JavaThread)                          \
1362         declare_type(CodeCacheSweeperThread, JavaThread)                  \
1363   declare_toplevel_type(OSThread)                                         \
1364   declare_toplevel_type(JavaFrameAnchor)                                  \
1365                                                                           \
1366   declare_toplevel_type(ThreadsSMRSupport)                                \
1367   declare_toplevel_type(ThreadsList)                                      \
1368   declare_toplevel_type(LockStack)                                        \
1369                                                                           \
1370   /***************/                                                       \
1371   /* Interpreter */                                                       \
1372   /***************/                                                       \
1373                                                                           \
1374   declare_toplevel_type(AbstractInterpreter)                              \
1375                                                                           \
1376   /*********/                                                             \
1377   /* Stubs */                                                             \
1378   /*********/                                                             \
1379                                                                           \
1380   declare_toplevel_type(StubQueue)                                        \
1381   declare_toplevel_type(StubRoutines)                                     \
1382   declare_toplevel_type(Stub)                                             \
1383            declare_type(InterpreterCodelet, Stub)                         \
1384                                                                           \
1385   /*************/                                                         \
1386   /* JavaCalls */                                                         \
1387   /*************/                                                         \
1388                                                                           \

2470   declare_constant(T_ILLEGAL)                                             \
2471                                                                           \
2472   /**********************************************/                        \
2473   /* BasicTypeSize enum (globalDefinitions.hpp) */                        \
2474   /**********************************************/                        \
2475                                                                           \
2476   declare_constant(T_BOOLEAN_size)                                        \
2477   declare_constant(T_CHAR_size)                                           \
2478   declare_constant(T_FLOAT_size)                                          \
2479   declare_constant(T_DOUBLE_size)                                         \
2480   declare_constant(T_BYTE_size)                                           \
2481   declare_constant(T_SHORT_size)                                          \
2482   declare_constant(T_INT_size)                                            \
2483   declare_constant(T_LONG_size)                                           \
2484   declare_constant(T_OBJECT_size)                                         \
2485   declare_constant(T_ARRAY_size)                                          \
2486   declare_constant(T_NARROWOOP_size)                                      \
2487   declare_constant(T_NARROWKLASS_size)                                    \
2488   declare_constant(T_VOID_size)                                           \
2489                                                                           \
2490   /**********************************************/                        \
2491   /* LockingMode enum (globalDefinitions.hpp) */                          \
2492   /**********************************************/                        \
2493                                                                           \
2494   declare_constant(LM_MONITOR)                                            \
2495   declare_constant(LM_LEGACY)                                             \
2496   declare_constant(LM_LIGHTWEIGHT)                                        \
2497                                                                           \
2498   /*********************/                                                 \
2499   /* Matcher (C2 only) */                                                 \
2500   /*********************/                                                 \
2501                                                                           \
2502   declare_c2_preprocessor_constant("Matcher::interpreter_frame_pointer_reg", Matcher::interpreter_frame_pointer_reg()) \
2503                                                                           \
2504   /*********************************************/                         \
2505   /* MethodCompilation (globalDefinitions.hpp) */                         \
2506   /*********************************************/                         \
2507                                                                           \
2508   declare_constant(InvocationEntryBci)                                    \
2509                                                                           \
2510   /*************/                                                         \
2511   /* CompLevel */                                                         \
2512   /*************/                                                         \
2513                                                                           \
2514   declare_constant(CompLevel_any)                                         \
2515   declare_constant(CompLevel_all)                                         \
2516   declare_constant(CompLevel_none)                                        \
2517   declare_constant(CompLevel_simple)                                      \

2640                                                                           \
2641   /****************/                                                      \
2642   /* GC constants */                                                      \
2643   /****************/                                                      \
2644                                                                           \
2645   VM_LONG_CONSTANTS_GC(declare_constant)                                  \
2646                                                                           \
2647   /*********************/                                                 \
2648   /* markWord constants */                                                \
2649   /*********************/                                                 \
2650                                                                           \
2651   /* Note: some of these are declared as long constants just for */       \
2652   /* consistency. The mask constants are the only ones requiring */       \
2653   /* 64 bits (on 64-bit platforms). */                                    \
2654                                                                           \
2655   declare_constant(markWord::age_bits)                                    \
2656   declare_constant(markWord::lock_bits)                                   \
2657   declare_constant(markWord::biased_lock_bits)                            \
2658   declare_constant(markWord::max_hash_bits)                               \
2659   declare_constant(markWord::hash_bits)                                   \
2660   declare_constant(markWord::hash_bits_compact)                           \
2661                                                                           \
2662   declare_constant(markWord::lock_shift)                                  \
2663   declare_constant(markWord::biased_lock_shift)                           \
2664   declare_constant(markWord::age_shift)                                   \
2665   declare_constant(markWord::hash_shift)                                  \
2666   declare_constant(markWord::hash_shift_compact)                          \
2667   LP64_ONLY(declare_constant(markWord::klass_shift))                      \
2668                                                                           \
2669   declare_constant(markWord::lock_mask)                                   \
2670   declare_constant(markWord::lock_mask_in_place)                          \
2671   declare_constant(markWord::biased_lock_mask)                            \
2672   declare_constant(markWord::biased_lock_mask_in_place)                   \
2673   declare_constant(markWord::biased_lock_bit_in_place)                    \
2674   declare_constant(markWord::age_mask)                                    \
2675   declare_constant(markWord::age_mask_in_place)                           \
2676   declare_constant(markWord::epoch_mask)                                  \
2677   declare_constant(markWord::epoch_mask_in_place)                         \
2678   declare_constant(markWord::hash_mask)                                   \
2679   declare_constant(markWord::hash_mask_in_place)                          \
2680   declare_constant(markWord::hash_mask_compact)                           \
2681   declare_constant(markWord::hash_mask_compact_in_place)                  \
2682   declare_constant(markWord::biased_lock_alignment)                       \
2683                                                                           \
2684   declare_constant(markWord::locked_value)                                \
2685   declare_constant(markWord::unlocked_value)                              \
2686   declare_constant(markWord::monitor_value)                               \
2687   declare_constant(markWord::marked_value)                                \
2688   declare_constant(markWord::biased_lock_pattern)                         \
2689                                                                           \
2690   declare_constant(markWord::no_hash)                                     \
2691   declare_constant(markWord::no_hash_in_place)                            \
2692   declare_constant(markWord::no_lock_in_place)                            \
2693   declare_constant(markWord::max_age)                                     \
2694                                                                           \
2695   /* InvocationCounter constants */                                       \
2696   declare_constant(InvocationCounter::count_increment)                    \
2697   declare_constant(InvocationCounter::count_shift)                        \
2698                                                                           \
2699   /* ObjectMonitor constants */                                           \
2700   declare_constant(ObjectMonitor::ANONYMOUS_OWNER)                        \
2701 
2702 //--------------------------------------------------------------------------------
2703 //
2704 
2705 // Generate and check a nonstatic field in non-product builds
2706 #ifndef PRODUCT
2707 # define GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY(a, b, c) GENERATE_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)
2708 # define CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)    CHECK_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)
2709 # define ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT(a, b, c)          ENSURE_FIELD_TYPE_PRESENT(a, b, c)
2710 #else
2711 # define GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)
2712 # define CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)
2713 # define ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT(a, b, c)
2714 #endif /* PRODUCT */
2715 
2716 // Generate and check a nonstatic field in C1 builds
2717 #ifdef COMPILER1
2718 # define GENERATE_C1_NONSTATIC_VM_STRUCT_ENTRY(a, b, c) GENERATE_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)
2719 # define CHECK_C1_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)    CHECK_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)
2720 # define ENSURE_C1_FIELD_TYPE_PRESENT(a, b, c)          ENSURE_FIELD_TYPE_PRESENT(a, b, c)

3200       return 1;
3201     }
3202     os::free(s);
3203   }
3204   if (!isRecurse) {
3205     tty->print_cr("type \"%s\" not found", typeName);
3206   }
3207   return 0;
3208 }
3209 
3210 int VMStructs::findType(const char* typeName) {
3211   VMTypeEntry* types = gHotSpotVMTypes;
3212 
3213   return recursiveFindType(types, typeName, false);
3214 }
3215 
3216 void vmStructs_init() {
3217   VMStructs::init();
3218 }
3219 #endif // ASSERT
3220 
3221 void VMStructs::compact_headers_overrides() {
3222   assert(UseCompactObjectHeaders, "Should have been checked before");
3223 
3224   // We cannot allow SA and other facilities to poke into VM internal fields
3225   // expecting the class pointers there. This will crash in the best case,
3226   // or yield incorrect execution in the worst case. This code hides the
3227   // risky fields from external code by replacing their original container
3228   // type to a fake one. The fake type should exist for VMStructs verification
3229   // code to work.
3230 
3231   size_t len = localHotSpotVMStructsLength();
3232   for (size_t off = 0; off < len; off++) {
3233     VMStructEntry* e = &localHotSpotVMStructs[off];
3234     if (e == nullptr) continue;
3235     if (e->typeName == nullptr) continue;
3236     if (e->fieldName == nullptr) continue;
3237 
3238     if (strcmp(e->typeName, "oopDesc") == 0) {
3239       if ((strcmp(e->fieldName, "_metadata._klass") == 0) ||
3240           (strcmp(e->fieldName, "_metadata._compressed_klass") == 0)) {
3241         e->typeName = "fakeOopDesc";
3242       }
3243     }
3244   }
3245 }
< prev index next >