hotspot/src/share/vm/runtime/vmStructs.cpp
changeset 33595 5830c3ae532d
parent 33230 23bb11a5cf4e
child 33602 16053580a684
equal deleted inserted replaced
33594:8c87ef3e5497 33595:5830c3ae532d
   282 // NOTE that there are platform-specific additions to this table in
   282 // NOTE that there are platform-specific additions to this table in
   283 // vmStructs_<os>_<cpu>.hpp.
   283 // vmStructs_<os>_<cpu>.hpp.
   284 
   284 
   285 #define VM_STRUCTS(nonstatic_field, \
   285 #define VM_STRUCTS(nonstatic_field, \
   286                    static_field, \
   286                    static_field, \
       
   287                    static_ptr_volatile_field, \
   287                    unchecked_nonstatic_field, \
   288                    unchecked_nonstatic_field, \
   288                    volatile_nonstatic_field, \
   289                    volatile_nonstatic_field, \
   289                    nonproduct_nonstatic_field, \
   290                    nonproduct_nonstatic_field, \
   290                    c1_nonstatic_field, \
   291                    c1_nonstatic_field, \
   291                    c2_nonstatic_field, \
   292                    c2_nonstatic_field, \
  1181   volatile_nonstatic_field(ObjectMonitor,      _recursions,                                   intptr_t)                              \
  1182   volatile_nonstatic_field(ObjectMonitor,      _recursions,                                   intptr_t)                              \
  1182   nonstatic_field(ObjectMonitor,               FreeNext,                                      ObjectMonitor*)                        \
  1183   nonstatic_field(ObjectMonitor,               FreeNext,                                      ObjectMonitor*)                        \
  1183   volatile_nonstatic_field(BasicLock,          _displaced_header,                             markOop)                               \
  1184   volatile_nonstatic_field(BasicLock,          _displaced_header,                             markOop)                               \
  1184   nonstatic_field(BasicObjectLock,             _lock,                                         BasicLock)                             \
  1185   nonstatic_field(BasicObjectLock,             _lock,                                         BasicLock)                             \
  1185   nonstatic_field(BasicObjectLock,             _obj,                                          oop)                                   \
  1186   nonstatic_field(BasicObjectLock,             _obj,                                          oop)                                   \
  1186      static_field(ObjectSynchronizer,          gBlockList,                                    ObjectMonitor*)                        \
  1187   static_ptr_volatile_field(ObjectSynchronizer, gBlockList,                                   ObjectMonitor*)                        \
  1187                                                                                                                                      \
  1188                                                                                                                                      \
  1188   /*********************/                                                                                                            \
  1189   /*********************/                                                                                                            \
  1189   /* Matcher (C2 only) */                                                                                                            \
  1190   /* Matcher (C2 only) */                                                                                                            \
  1190   /*********************/                                                                                                            \
  1191   /*********************/                                                                                                            \
  1191                                                                                                                                      \
  1192                                                                                                                                      \
  2900 
  2901 
  2901 // This macro generates a VMStructEntry line for a static field
  2902 // This macro generates a VMStructEntry line for a static field
  2902 #define GENERATE_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type)                 \
  2903 #define GENERATE_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type)                 \
  2903  { QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, &typeName::fieldName },
  2904  { QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, &typeName::fieldName },
  2904 
  2905 
       
  2906 // This macro generates a VMStructEntry line for a static pointer volatile field,
       
  2907 // e.g.: "static ObjectMonitor * volatile gBlockList;"
       
  2908 #define GENERATE_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY(typeName, fieldName, type)    \
       
  2909  { QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, (void *)&typeName::fieldName },
       
  2910 
  2905 // This macro generates a VMStructEntry line for an unchecked
  2911 // This macro generates a VMStructEntry line for an unchecked
  2906 // nonstatic field, in which the size of the type is also specified.
  2912 // nonstatic field, in which the size of the type is also specified.
  2907 // The type string is given as NULL, indicating an "opaque" type.
  2913 // The type string is given as NULL, indicating an "opaque" type.
  2908 #define GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, size)    \
  2914 #define GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, size)    \
  2909   { QUOTE(typeName), QUOTE(fieldName), NULL, 0, cast_uint64_t(offset_of(typeName, fieldName)), NULL },
  2915   { QUOTE(typeName), QUOTE(fieldName), NULL, 0, cast_uint64_t(offset_of(typeName, fieldName)), NULL },
  2925 
  2931 
  2926 // This macro checks the type of a volatile VMStructEntry by comparing pointer types
  2932 // This macro checks the type of a volatile VMStructEntry by comparing pointer types
  2927 #define CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type)        \
  2933 #define CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type)        \
  2928  {typedef type dummyvtype; typeName *dummyObj = NULL; volatile dummyvtype* dummy = &dummyObj->fieldName; }
  2934  {typedef type dummyvtype; typeName *dummyObj = NULL; volatile dummyvtype* dummy = &dummyObj->fieldName; }
  2929 
  2935 
  2930 // This macro checks the type of a VMStructEntry by comparing pointer types
  2936 // This macro checks the type of a static VMStructEntry by comparing pointer types
  2931 #define CHECK_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type)                    \
  2937 #define CHECK_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type)                    \
  2932  {type* dummy = &typeName::fieldName; }
  2938  {type* dummy = &typeName::fieldName; }
       
  2939 
       
  2940 // This macro checks the type of a static pointer volatile VMStructEntry by comparing pointer types,
       
  2941 // e.g.: "static ObjectMonitor * volatile gBlockList;"
       
  2942 #define CHECK_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY(typeName, fieldName, type)       \
       
  2943  {type volatile * dummy = &typeName::fieldName; }
  2933 
  2944 
  2934 // This macro ensures the type of a field and its containing type are
  2945 // This macro ensures the type of a field and its containing type are
  2935 // present in the type table. The assertion string is shorter than
  2946 // present in the type table. The assertion string is shorter than
  2936 // preferable because (incredibly) of a bug in Solstice NFS client
  2947 // preferable because (incredibly) of a bug in Solstice NFS client
  2937 // which seems to prevent very long lines from compiling. This assertion
  2948 // which seems to prevent very long lines from compiling. This assertion
  3139 // as long as class VMStructs is a friend
  3150 // as long as class VMStructs is a friend
  3140 VMStructEntry VMStructs::localHotSpotVMStructs[] = {
  3151 VMStructEntry VMStructs::localHotSpotVMStructs[] = {
  3141 
  3152 
  3142   VM_STRUCTS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
  3153   VM_STRUCTS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
  3143              GENERATE_STATIC_VM_STRUCT_ENTRY,
  3154              GENERATE_STATIC_VM_STRUCT_ENTRY,
       
  3155              GENERATE_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY,
  3144              GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
  3156              GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
  3145              GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
  3157              GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
  3146              GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
  3158              GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
  3147              GENERATE_C1_NONSTATIC_VM_STRUCT_ENTRY,
  3159              GENERATE_C1_NONSTATIC_VM_STRUCT_ENTRY,
  3148              GENERATE_C2_NONSTATIC_VM_STRUCT_ENTRY,
  3160              GENERATE_C2_NONSTATIC_VM_STRUCT_ENTRY,
  3368 // debug builds, to ensure that all of the field types are present.
  3380 // debug builds, to ensure that all of the field types are present.
  3369 void
  3381 void
  3370 VMStructs::init() {
  3382 VMStructs::init() {
  3371   VM_STRUCTS(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
  3383   VM_STRUCTS(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
  3372              CHECK_STATIC_VM_STRUCT_ENTRY,
  3384              CHECK_STATIC_VM_STRUCT_ENTRY,
       
  3385              CHECK_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY,
  3373              CHECK_NO_OP,
  3386              CHECK_NO_OP,
  3374              CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY,
  3387              CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY,
  3375              CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
  3388              CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
  3376              CHECK_C1_NONSTATIC_VM_STRUCT_ENTRY,
  3389              CHECK_C1_NONSTATIC_VM_STRUCT_ENTRY,
  3377              CHECK_C2_NONSTATIC_VM_STRUCT_ENTRY,
  3390              CHECK_C2_NONSTATIC_VM_STRUCT_ENTRY,
  3489                         CHECK_NO_OP,
  3502                         CHECK_NO_OP,
  3490                         CHECK_NO_OP,
  3503                         CHECK_NO_OP,
  3491                         CHECK_NO_OP,
  3504                         CHECK_NO_OP,
  3492                         CHECK_NO_OP,
  3505                         CHECK_NO_OP,
  3493                         CHECK_NO_OP,
  3506                         CHECK_NO_OP,
       
  3507                         CHECK_NO_OP,
  3494                         CHECK_NO_OP));
  3508                         CHECK_NO_OP));
  3495   debug_only(VM_STRUCTS(CHECK_NO_OP,
  3509   debug_only(VM_STRUCTS(CHECK_NO_OP,
       
  3510                         ENSURE_FIELD_TYPE_PRESENT,
  3496                         ENSURE_FIELD_TYPE_PRESENT,
  3511                         ENSURE_FIELD_TYPE_PRESENT,
  3497                         CHECK_NO_OP,
  3512                         CHECK_NO_OP,
  3498                         ENSURE_FIELD_TYPE_PRESENT,
  3513                         ENSURE_FIELD_TYPE_PRESENT,
  3499                         ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT,
  3514                         ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT,
  3500                         ENSURE_C1_FIELD_TYPE_PRESENT,
  3515                         ENSURE_C1_FIELD_TYPE_PRESENT,