240 typedef HashtableEntry<intptr_t, mtInternal> IntptrHashtableEntry;
241 typedef Hashtable<intptr_t, mtInternal> IntptrHashtable;
242 typedef Hashtable<Symbol*, mtSymbol> SymbolHashtable;
243 typedef HashtableEntry<Symbol*, mtClass> SymbolHashtableEntry;
244 typedef Hashtable<oop, mtSymbol> StringHashtable;
245 typedef TwoOopHashtable<Klass*, mtClass> KlassTwoOopHashtable;
246 typedef Hashtable<Klass*, mtClass> KlassHashtable;
247 typedef HashtableEntry<Klass*, mtClass> KlassHashtableEntry;
248 typedef TwoOopHashtable<Symbol*, mtClass> SymbolTwoOopHashtable;
249
250 //--------------------------------------------------------------------------------
251 // VM_STRUCTS
252 //
253 // This list enumerates all of the fields the serviceability agent
254 // needs to know about. Be sure to see also the type table below this one.
255 // NOTE that there are platform-specific additions to this table in
256 // vmStructs_<os>_<cpu>.hpp.
257
258 #define VM_STRUCTS(nonstatic_field, \
259 static_field, \
260 unchecked_nonstatic_field, \
261 volatile_nonstatic_field, \
262 nonproduct_nonstatic_field, \
263 c1_nonstatic_field, \
264 c2_nonstatic_field, \
265 unchecked_c1_static_field, \
266 unchecked_c2_static_field) \
267 \
268 /******************************************************************/ \
269 /* OopDesc and Klass hierarchies (NOTE: MethodData* incomplete) */ \
270 /******************************************************************/ \
271 \
272 volatile_nonstatic_field(oopDesc, _mark, markOop) \
273 volatile_nonstatic_field(oopDesc, _metadata._klass, Klass*) \
274 volatile_nonstatic_field(oopDesc, _metadata._compressed_klass, narrowOop) \
275 static_field(oopDesc, _bs, BarrierSet*) \
276 nonstatic_field(ArrayKlass, _dimension, int) \
277 volatile_nonstatic_field(ArrayKlass, _higher_dimension, Klass*) \
278 volatile_nonstatic_field(ArrayKlass, _lower_dimension, Klass*) \
279 nonstatic_field(ArrayKlass, _vtable_len, int) \
1064 nonstatic_field(ciConstant, _value._int, jint) \
1065 nonstatic_field(ciConstant, _value._long, jlong) \
1066 nonstatic_field(ciConstant, _value._float, jfloat) \
1067 nonstatic_field(ciConstant, _value._double, jdouble) \
1068 nonstatic_field(ciConstant, _value._object, ciObject*) \
1069 \
1070 /************/ \
1071 /* Monitors */ \
1072 /************/ \
1073 \
1074 volatile_nonstatic_field(ObjectMonitor, _header, markOop) \
1075 unchecked_nonstatic_field(ObjectMonitor, _object, sizeof(void *)) /* NOTE: no type */ \
1076 unchecked_nonstatic_field(ObjectMonitor, _owner, sizeof(void *)) /* NOTE: no type */ \
1077 volatile_nonstatic_field(ObjectMonitor, _count, intptr_t) \
1078 volatile_nonstatic_field(ObjectMonitor, _waiters, intptr_t) \
1079 volatile_nonstatic_field(ObjectMonitor, _recursions, intptr_t) \
1080 nonstatic_field(ObjectMonitor, FreeNext, ObjectMonitor*) \
1081 volatile_nonstatic_field(BasicLock, _displaced_header, markOop) \
1082 nonstatic_field(BasicObjectLock, _lock, BasicLock) \
1083 nonstatic_field(BasicObjectLock, _obj, oop) \
1084 static_field(ObjectSynchronizer, gBlockList, ObjectMonitor*) \
1085 \
1086 /*********************/ \
1087 /* Matcher (C2 only) */ \
1088 /*********************/ \
1089 \
1090 unchecked_c2_static_field(Matcher, _regEncode, sizeof(Matcher::_regEncode)) /* NOTE: no type */ \
1091 \
1092 c2_nonstatic_field(Node, _in, Node**) \
1093 c2_nonstatic_field(Node, _out, Node**) \
1094 c2_nonstatic_field(Node, _cnt, node_idx_t) \
1095 c2_nonstatic_field(Node, _max, node_idx_t) \
1096 c2_nonstatic_field(Node, _outcnt, node_idx_t) \
1097 c2_nonstatic_field(Node, _outmax, node_idx_t) \
1098 c2_nonstatic_field(Node, _idx, const node_idx_t) \
1099 c2_nonstatic_field(Node, _class_id, jushort) \
1100 c2_nonstatic_field(Node, _flags, jushort) \
1101 \
1102 c2_nonstatic_field(Compile, _root, RootNode*) \
1103 c2_nonstatic_field(Compile, _unique, uint) \
1104 c2_nonstatic_field(Compile, _entry_bci, int) \
2649
2650 //--------------------------------------------------------------------------------
2651 // Macros operating on the above lists
2652 //--------------------------------------------------------------------------------
2653
2654 // This utility macro quotes the passed string
2655 #define QUOTE(x) #x
2656
2657 //--------------------------------------------------------------------------------
2658 // VMStructEntry macros
2659 //
2660
2661 // This macro generates a VMStructEntry line for a nonstatic field
2662 #define GENERATE_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
2663 { QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 0, cast_uint64_t(offset_of(typeName, fieldName)), NULL },
2664
2665 // This macro generates a VMStructEntry line for a static field
2666 #define GENERATE_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
2667 { QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, &typeName::fieldName },
2668
2669 // This macro generates a VMStructEntry line for an unchecked
2670 // nonstatic field, in which the size of the type is also specified.
2671 // The type string is given as NULL, indicating an "opaque" type.
2672 #define GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, size) \
2673 { QUOTE(typeName), QUOTE(fieldName), NULL, 0, cast_uint64_t(offset_of(typeName, fieldName)), NULL },
2674
2675 // This macro generates a VMStructEntry line for an unchecked
2676 // static field, in which the size of the type is also specified.
2677 // The type string is given as NULL, indicating an "opaque" type.
2678 #define GENERATE_UNCHECKED_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, size) \
2679 { QUOTE(typeName), QUOTE(fieldName), NULL, 1, 0, (void*) &typeName::fieldName },
2680
2681 // This macro generates the sentinel value indicating the end of the list
2682 #define GENERATE_VM_STRUCT_LAST_ENTRY() \
2683 { NULL, NULL, NULL, 0, 0, NULL }
2684
2685 // This macro checks the type of a VMStructEntry by comparing pointer types
2686 #define CHECK_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
2687 {typeName *dummyObj = NULL; type* dummy = &dummyObj->fieldName; \
2688 assert(offset_of(typeName, fieldName) < sizeof(typeName), "Illegal nonstatic struct entry, field offset too large"); }
2689
2690 // This macro checks the type of a volatile VMStructEntry by comparing pointer types
2691 #define CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
2692 {typedef type dummyvtype; typeName *dummyObj = NULL; volatile dummyvtype* dummy = &dummyObj->fieldName; }
2693
2694 // This macro checks the type of a VMStructEntry by comparing pointer types
2695 #define CHECK_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
2696 {type* dummy = &typeName::fieldName; }
2697
2698 // This macro ensures the type of a field and its containing type are
2699 // present in the type table. The assertion string is shorter than
2700 // preferable because (incredibly) of a bug in Solstice NFS client
2701 // which seems to prevent very long lines from compiling. This assertion
2702 // means that an entry in VMStructs::localHotSpotVMStructs[] was not
2703 // found in VMStructs::localHotSpotVMTypes[].
2704 #define ENSURE_FIELD_TYPE_PRESENT(typeName, fieldName, type) \
2705 { assert(findType(QUOTE(typeName)) != 0, "type \"" QUOTE(typeName) "\" not found in type table"); \
2706 assert(findType(QUOTE(type)) != 0, "type \"" QUOTE(type) "\" not found in type table"); }
2707
2708 // This is a no-op macro for unchecked fields
2709 #define CHECK_NO_OP(a, b, c)
2710
2711 //
2712 // Build-specific macros:
2713 //
2714
2715 // Generate and check a nonstatic field in non-product builds
2716 #ifndef PRODUCT
2717 # define GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY(a, b, c) GENERATE_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)
2871
2872 // Generate a long constant for a C2 build
2873 #ifdef COMPILER2
2874 # define GENERATE_C2_VM_LONG_CONSTANT_ENTRY(name) GENERATE_VM_LONG_CONSTANT_ENTRY(name)
2875 # define GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY(name, value) GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY(name, value)
2876 #else
2877 # define GENERATE_C2_VM_LONG_CONSTANT_ENTRY(name)
2878 # define GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY(name, value)
2879 #endif /* COMPILER1 */
2880
2881 //
2882 // Instantiation of VMStructEntries, VMTypeEntries and VMIntConstantEntries
2883 //
2884
2885 // These initializers are allowed to access private fields in classes
2886 // as long as class VMStructs is a friend
2887 VMStructEntry VMStructs::localHotSpotVMStructs[] = {
2888
2889 VM_STRUCTS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
2890 GENERATE_STATIC_VM_STRUCT_ENTRY,
2891 GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
2892 GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
2893 GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
2894 GENERATE_C1_NONSTATIC_VM_STRUCT_ENTRY,
2895 GENERATE_C2_NONSTATIC_VM_STRUCT_ENTRY,
2896 GENERATE_C1_UNCHECKED_STATIC_VM_STRUCT_ENTRY,
2897 GENERATE_C2_UNCHECKED_STATIC_VM_STRUCT_ENTRY)
2898
2899 #if INCLUDE_ALL_GCS
2900 VM_STRUCTS_PARALLELGC(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
2901 GENERATE_STATIC_VM_STRUCT_ENTRY)
2902
2903 VM_STRUCTS_CMS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
2904 GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
2905 GENERATE_STATIC_VM_STRUCT_ENTRY)
2906
2907 VM_STRUCTS_G1(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
2908 GENERATE_STATIC_VM_STRUCT_ENTRY)
2909 #endif // INCLUDE_ALL_GCS
2910
3029 GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY,
3030 GENERATE_C1_VM_LONG_CONSTANT_ENTRY,
3031 GENERATE_C2_VM_LONG_CONSTANT_ENTRY,
3032 GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY)
3033
3034 VM_LONG_CONSTANTS_OS_CPU(GENERATE_VM_LONG_CONSTANT_ENTRY,
3035 GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY,
3036 GENERATE_C1_VM_LONG_CONSTANT_ENTRY,
3037 GENERATE_C2_VM_LONG_CONSTANT_ENTRY,
3038 GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY)
3039
3040 GENERATE_VM_LONG_CONSTANT_LAST_ENTRY()
3041 };
3042
3043 // This is used both to check the types of referenced fields and, in
3044 // debug builds, to ensure that all of the field types are present.
3045 void
3046 VMStructs::init() {
3047 VM_STRUCTS(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
3048 CHECK_STATIC_VM_STRUCT_ENTRY,
3049 CHECK_NO_OP,
3050 CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY,
3051 CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
3052 CHECK_C1_NONSTATIC_VM_STRUCT_ENTRY,
3053 CHECK_C2_NONSTATIC_VM_STRUCT_ENTRY,
3054 CHECK_NO_OP,
3055 CHECK_NO_OP);
3056
3057 #if INCLUDE_ALL_GCS
3058 VM_STRUCTS_PARALLELGC(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
3059 CHECK_STATIC_VM_STRUCT_ENTRY);
3060
3061 VM_STRUCTS_CMS(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
3062 CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY,
3063 CHECK_STATIC_VM_STRUCT_ENTRY);
3064
3065 VM_STRUCTS_G1(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
3066 CHECK_STATIC_VM_STRUCT_ENTRY);
3067
3068 #endif // INCLUDE_ALL_GCS
3144 // 2.8 hosts. Appears to occur because line is too long.
3145 //
3146 // If an assertion failure is triggered here it means that an entry
3147 // in VMStructs::localHotSpotVMStructs[] was not found in
3148 // VMStructs::localHotSpotVMTypes[]. (The assertion itself had to be
3149 // made less descriptive because of this above bug -- see the
3150 // definition of ENSURE_FIELD_TYPE_PRESENT.)
3151 //
3152 // NOTE: taken out because this was just not working on everyone's
3153 // Solstice NFS setup. If everyone switches to local workspaces on
3154 // Win32, we can put this back in.
3155 #ifndef _WINDOWS
3156 debug_only(VM_STRUCTS(ENSURE_FIELD_TYPE_PRESENT,
3157 CHECK_NO_OP,
3158 CHECK_NO_OP,
3159 CHECK_NO_OP,
3160 CHECK_NO_OP,
3161 CHECK_NO_OP,
3162 CHECK_NO_OP,
3163 CHECK_NO_OP,
3164 CHECK_NO_OP));
3165 debug_only(VM_STRUCTS(CHECK_NO_OP,
3166 ENSURE_FIELD_TYPE_PRESENT,
3167 CHECK_NO_OP,
3168 ENSURE_FIELD_TYPE_PRESENT,
3169 ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT,
3170 ENSURE_C1_FIELD_TYPE_PRESENT,
3171 ENSURE_C2_FIELD_TYPE_PRESENT,
3172 CHECK_NO_OP,
3173 CHECK_NO_OP));
3174 #if INCLUDE_ALL_GCS
3175 debug_only(VM_STRUCTS_PARALLELGC(ENSURE_FIELD_TYPE_PRESENT,
3176 ENSURE_FIELD_TYPE_PRESENT));
3177 debug_only(VM_STRUCTS_CMS(ENSURE_FIELD_TYPE_PRESENT,
3178 ENSURE_FIELD_TYPE_PRESENT,
3179 ENSURE_FIELD_TYPE_PRESENT));
3180 debug_only(VM_STRUCTS_G1(ENSURE_FIELD_TYPE_PRESENT,
3181 ENSURE_FIELD_TYPE_PRESENT));
3182 #endif // INCLUDE_ALL_GCS
3183
3184 #if INCLUDE_TRACE
3185 debug_only(VM_STRUCTS_TRACE(ENSURE_FIELD_TYPE_PRESENT,
|
240 typedef HashtableEntry<intptr_t, mtInternal> IntptrHashtableEntry;
241 typedef Hashtable<intptr_t, mtInternal> IntptrHashtable;
242 typedef Hashtable<Symbol*, mtSymbol> SymbolHashtable;
243 typedef HashtableEntry<Symbol*, mtClass> SymbolHashtableEntry;
244 typedef Hashtable<oop, mtSymbol> StringHashtable;
245 typedef TwoOopHashtable<Klass*, mtClass> KlassTwoOopHashtable;
246 typedef Hashtable<Klass*, mtClass> KlassHashtable;
247 typedef HashtableEntry<Klass*, mtClass> KlassHashtableEntry;
248 typedef TwoOopHashtable<Symbol*, mtClass> SymbolTwoOopHashtable;
249
250 //--------------------------------------------------------------------------------
251 // VM_STRUCTS
252 //
253 // This list enumerates all of the fields the serviceability agent
254 // needs to know about. Be sure to see also the type table below this one.
255 // NOTE that there are platform-specific additions to this table in
256 // vmStructs_<os>_<cpu>.hpp.
257
258 #define VM_STRUCTS(nonstatic_field, \
259 static_field, \
260 static_ptr_volatile_field, \
261 unchecked_nonstatic_field, \
262 volatile_nonstatic_field, \
263 nonproduct_nonstatic_field, \
264 c1_nonstatic_field, \
265 c2_nonstatic_field, \
266 unchecked_c1_static_field, \
267 unchecked_c2_static_field) \
268 \
269 /******************************************************************/ \
270 /* OopDesc and Klass hierarchies (NOTE: MethodData* incomplete) */ \
271 /******************************************************************/ \
272 \
273 volatile_nonstatic_field(oopDesc, _mark, markOop) \
274 volatile_nonstatic_field(oopDesc, _metadata._klass, Klass*) \
275 volatile_nonstatic_field(oopDesc, _metadata._compressed_klass, narrowOop) \
276 static_field(oopDesc, _bs, BarrierSet*) \
277 nonstatic_field(ArrayKlass, _dimension, int) \
278 volatile_nonstatic_field(ArrayKlass, _higher_dimension, Klass*) \
279 volatile_nonstatic_field(ArrayKlass, _lower_dimension, Klass*) \
280 nonstatic_field(ArrayKlass, _vtable_len, int) \
1065 nonstatic_field(ciConstant, _value._int, jint) \
1066 nonstatic_field(ciConstant, _value._long, jlong) \
1067 nonstatic_field(ciConstant, _value._float, jfloat) \
1068 nonstatic_field(ciConstant, _value._double, jdouble) \
1069 nonstatic_field(ciConstant, _value._object, ciObject*) \
1070 \
1071 /************/ \
1072 /* Monitors */ \
1073 /************/ \
1074 \
1075 volatile_nonstatic_field(ObjectMonitor, _header, markOop) \
1076 unchecked_nonstatic_field(ObjectMonitor, _object, sizeof(void *)) /* NOTE: no type */ \
1077 unchecked_nonstatic_field(ObjectMonitor, _owner, sizeof(void *)) /* NOTE: no type */ \
1078 volatile_nonstatic_field(ObjectMonitor, _count, intptr_t) \
1079 volatile_nonstatic_field(ObjectMonitor, _waiters, intptr_t) \
1080 volatile_nonstatic_field(ObjectMonitor, _recursions, intptr_t) \
1081 nonstatic_field(ObjectMonitor, FreeNext, ObjectMonitor*) \
1082 volatile_nonstatic_field(BasicLock, _displaced_header, markOop) \
1083 nonstatic_field(BasicObjectLock, _lock, BasicLock) \
1084 nonstatic_field(BasicObjectLock, _obj, oop) \
1085 static_ptr_volatile_field(ObjectSynchronizer,gBlockList, ObjectMonitor*) \
1086 \
1087 /*********************/ \
1088 /* Matcher (C2 only) */ \
1089 /*********************/ \
1090 \
1091 unchecked_c2_static_field(Matcher, _regEncode, sizeof(Matcher::_regEncode)) /* NOTE: no type */ \
1092 \
1093 c2_nonstatic_field(Node, _in, Node**) \
1094 c2_nonstatic_field(Node, _out, Node**) \
1095 c2_nonstatic_field(Node, _cnt, node_idx_t) \
1096 c2_nonstatic_field(Node, _max, node_idx_t) \
1097 c2_nonstatic_field(Node, _outcnt, node_idx_t) \
1098 c2_nonstatic_field(Node, _outmax, node_idx_t) \
1099 c2_nonstatic_field(Node, _idx, const node_idx_t) \
1100 c2_nonstatic_field(Node, _class_id, jushort) \
1101 c2_nonstatic_field(Node, _flags, jushort) \
1102 \
1103 c2_nonstatic_field(Compile, _root, RootNode*) \
1104 c2_nonstatic_field(Compile, _unique, uint) \
1105 c2_nonstatic_field(Compile, _entry_bci, int) \
2650
2651 //--------------------------------------------------------------------------------
2652 // Macros operating on the above lists
2653 //--------------------------------------------------------------------------------
2654
2655 // This utility macro quotes the passed string
2656 #define QUOTE(x) #x
2657
2658 //--------------------------------------------------------------------------------
2659 // VMStructEntry macros
2660 //
2661
2662 // This macro generates a VMStructEntry line for a nonstatic field
2663 #define GENERATE_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
2664 { QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 0, cast_uint64_t(offset_of(typeName, fieldName)), NULL },
2665
2666 // This macro generates a VMStructEntry line for a static field
2667 #define GENERATE_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
2668 { QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, &typeName::fieldName },
2669
2670 // This macro generates a VMStructEntry line for a static pointer volatile field,
2671 // e.g.: "static ObjectMonitor * volatile gBlockList;"
2672 #define GENERATE_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY(typeName, fieldName, type) \
2673 { QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, (void*)&typeName::fieldName },
2674
2675 // This macro generates a VMStructEntry line for an unchecked
2676 // nonstatic field, in which the size of the type is also specified.
2677 // The type string is given as NULL, indicating an "opaque" type.
2678 #define GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, size) \
2679 { QUOTE(typeName), QUOTE(fieldName), NULL, 0, cast_uint64_t(offset_of(typeName, fieldName)), NULL },
2680
2681 // This macro generates a VMStructEntry line for an unchecked
2682 // static field, in which the size of the type is also specified.
2683 // The type string is given as NULL, indicating an "opaque" type.
2684 #define GENERATE_UNCHECKED_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, size) \
2685 { QUOTE(typeName), QUOTE(fieldName), NULL, 1, 0, (void*) &typeName::fieldName },
2686
2687 // This macro generates the sentinel value indicating the end of the list
2688 #define GENERATE_VM_STRUCT_LAST_ENTRY() \
2689 { NULL, NULL, NULL, 0, 0, NULL }
2690
2691 // This macro checks the type of a VMStructEntry by comparing pointer types
2692 #define CHECK_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
2693 {typeName *dummyObj = NULL; type* dummy = &dummyObj->fieldName; \
2694 assert(offset_of(typeName, fieldName) < sizeof(typeName), "Illegal nonstatic struct entry, field offset too large"); }
2695
2696 // This macro checks the type of a volatile VMStructEntry by comparing pointer types
2697 #define CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
2698 {typedef type dummyvtype; typeName *dummyObj = NULL; volatile dummyvtype* dummy = &dummyObj->fieldName; }
2699
2700 // This macro checks the type of a static VMStructEntry by comparing pointer types
2701 #define CHECK_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
2702 {type* dummy = &typeName::fieldName; }
2703
2704 // This macro checks the type of a static pointer volatile VMStructEntry by comparing pointer types,
2705 // e.g.: "static ObjectMonitor * volatile gBlockList;"
2706 #define CHECK_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY(typeName, fieldName, type) \
2707 {type volatile * dummy = &typeName::fieldName; }
2708
2709 // This macro ensures the type of a field and its containing type are
2710 // present in the type table. The assertion string is shorter than
2711 // preferable because (incredibly) of a bug in Solstice NFS client
2712 // which seems to prevent very long lines from compiling. This assertion
2713 // means that an entry in VMStructs::localHotSpotVMStructs[] was not
2714 // found in VMStructs::localHotSpotVMTypes[].
2715 #define ENSURE_FIELD_TYPE_PRESENT(typeName, fieldName, type) \
2716 { assert(findType(QUOTE(typeName)) != 0, "type \"" QUOTE(typeName) "\" not found in type table"); \
2717 assert(findType(QUOTE(type)) != 0, "type \"" QUOTE(type) "\" not found in type table"); }
2718
2719 // This is a no-op macro for unchecked fields
2720 #define CHECK_NO_OP(a, b, c)
2721
2722 //
2723 // Build-specific macros:
2724 //
2725
2726 // Generate and check a nonstatic field in non-product builds
2727 #ifndef PRODUCT
2728 # define GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY(a, b, c) GENERATE_NONSTATIC_VM_STRUCT_ENTRY(a, b, c)
2882
2883 // Generate a long constant for a C2 build
2884 #ifdef COMPILER2
2885 # define GENERATE_C2_VM_LONG_CONSTANT_ENTRY(name) GENERATE_VM_LONG_CONSTANT_ENTRY(name)
2886 # define GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY(name, value) GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY(name, value)
2887 #else
2888 # define GENERATE_C2_VM_LONG_CONSTANT_ENTRY(name)
2889 # define GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY(name, value)
2890 #endif /* COMPILER1 */
2891
2892 //
2893 // Instantiation of VMStructEntries, VMTypeEntries and VMIntConstantEntries
2894 //
2895
2896 // These initializers are allowed to access private fields in classes
2897 // as long as class VMStructs is a friend
2898 VMStructEntry VMStructs::localHotSpotVMStructs[] = {
2899
2900 VM_STRUCTS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
2901 GENERATE_STATIC_VM_STRUCT_ENTRY,
2902 GENERATE_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY,
2903 GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
2904 GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
2905 GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
2906 GENERATE_C1_NONSTATIC_VM_STRUCT_ENTRY,
2907 GENERATE_C2_NONSTATIC_VM_STRUCT_ENTRY,
2908 GENERATE_C1_UNCHECKED_STATIC_VM_STRUCT_ENTRY,
2909 GENERATE_C2_UNCHECKED_STATIC_VM_STRUCT_ENTRY)
2910
2911 #if INCLUDE_ALL_GCS
2912 VM_STRUCTS_PARALLELGC(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
2913 GENERATE_STATIC_VM_STRUCT_ENTRY)
2914
2915 VM_STRUCTS_CMS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
2916 GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
2917 GENERATE_STATIC_VM_STRUCT_ENTRY)
2918
2919 VM_STRUCTS_G1(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
2920 GENERATE_STATIC_VM_STRUCT_ENTRY)
2921 #endif // INCLUDE_ALL_GCS
2922
3041 GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY,
3042 GENERATE_C1_VM_LONG_CONSTANT_ENTRY,
3043 GENERATE_C2_VM_LONG_CONSTANT_ENTRY,
3044 GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY)
3045
3046 VM_LONG_CONSTANTS_OS_CPU(GENERATE_VM_LONG_CONSTANT_ENTRY,
3047 GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY,
3048 GENERATE_C1_VM_LONG_CONSTANT_ENTRY,
3049 GENERATE_C2_VM_LONG_CONSTANT_ENTRY,
3050 GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY)
3051
3052 GENERATE_VM_LONG_CONSTANT_LAST_ENTRY()
3053 };
3054
3055 // This is used both to check the types of referenced fields and, in
3056 // debug builds, to ensure that all of the field types are present.
3057 void
3058 VMStructs::init() {
3059 VM_STRUCTS(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
3060 CHECK_STATIC_VM_STRUCT_ENTRY,
3061 CHECK_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY,
3062 CHECK_NO_OP,
3063 CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY,
3064 CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
3065 CHECK_C1_NONSTATIC_VM_STRUCT_ENTRY,
3066 CHECK_C2_NONSTATIC_VM_STRUCT_ENTRY,
3067 CHECK_NO_OP,
3068 CHECK_NO_OP);
3069
3070 #if INCLUDE_ALL_GCS
3071 VM_STRUCTS_PARALLELGC(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
3072 CHECK_STATIC_VM_STRUCT_ENTRY);
3073
3074 VM_STRUCTS_CMS(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
3075 CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY,
3076 CHECK_STATIC_VM_STRUCT_ENTRY);
3077
3078 VM_STRUCTS_G1(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
3079 CHECK_STATIC_VM_STRUCT_ENTRY);
3080
3081 #endif // INCLUDE_ALL_GCS
3157 // 2.8 hosts. Appears to occur because line is too long.
3158 //
3159 // If an assertion failure is triggered here it means that an entry
3160 // in VMStructs::localHotSpotVMStructs[] was not found in
3161 // VMStructs::localHotSpotVMTypes[]. (The assertion itself had to be
3162 // made less descriptive because of this above bug -- see the
3163 // definition of ENSURE_FIELD_TYPE_PRESENT.)
3164 //
3165 // NOTE: taken out because this was just not working on everyone's
3166 // Solstice NFS setup. If everyone switches to local workspaces on
3167 // Win32, we can put this back in.
3168 #ifndef _WINDOWS
3169 debug_only(VM_STRUCTS(ENSURE_FIELD_TYPE_PRESENT,
3170 CHECK_NO_OP,
3171 CHECK_NO_OP,
3172 CHECK_NO_OP,
3173 CHECK_NO_OP,
3174 CHECK_NO_OP,
3175 CHECK_NO_OP,
3176 CHECK_NO_OP,
3177 CHECK_NO_OP,
3178 CHECK_NO_OP));
3179 debug_only(VM_STRUCTS(CHECK_NO_OP,
3180 ENSURE_FIELD_TYPE_PRESENT,
3181 ENSURE_FIELD_TYPE_PRESENT,
3182 CHECK_NO_OP,
3183 ENSURE_FIELD_TYPE_PRESENT,
3184 ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT,
3185 ENSURE_C1_FIELD_TYPE_PRESENT,
3186 ENSURE_C2_FIELD_TYPE_PRESENT,
3187 CHECK_NO_OP,
3188 CHECK_NO_OP));
3189 #if INCLUDE_ALL_GCS
3190 debug_only(VM_STRUCTS_PARALLELGC(ENSURE_FIELD_TYPE_PRESENT,
3191 ENSURE_FIELD_TYPE_PRESENT));
3192 debug_only(VM_STRUCTS_CMS(ENSURE_FIELD_TYPE_PRESENT,
3193 ENSURE_FIELD_TYPE_PRESENT,
3194 ENSURE_FIELD_TYPE_PRESENT));
3195 debug_only(VM_STRUCTS_G1(ENSURE_FIELD_TYPE_PRESENT,
3196 ENSURE_FIELD_TYPE_PRESENT));
3197 #endif // INCLUDE_ALL_GCS
3198
3199 #if INCLUDE_TRACE
3200 debug_only(VM_STRUCTS_TRACE(ENSURE_FIELD_TYPE_PRESENT,
|