8134994: use separate VMStructs databases for SA and JVMCI

Reviewed-by: kbarrett
This commit is contained in:
Christian Thalinger 2015-12-14 17:02:02 -10:00
parent c095394bce
commit bf5db72254
41 changed files with 1367 additions and 675 deletions

View file

@ -2844,104 +2844,6 @@ typedef CompactHashtable<Symbol*, char> SymbolCompactHashTable;
//--------------------------------------------------------------------------------
// VM_ADDRESSES
//
#define VM_ADDRESSES(declare_address, declare_preprocessor_address, declare_function) \
\
declare_function(SharedRuntime::register_finalizer) \
declare_function(SharedRuntime::exception_handler_for_return_address) \
declare_function(SharedRuntime::OSR_migration_end) \
declare_function(SharedRuntime::dsin) \
declare_function(SharedRuntime::dcos) \
declare_function(SharedRuntime::dtan) \
declare_function(SharedRuntime::dexp) \
declare_function(SharedRuntime::dlog) \
declare_function(SharedRuntime::dlog10) \
declare_function(SharedRuntime::dpow) \
\
declare_function(os::dll_load) \
declare_function(os::dll_lookup) \
declare_function(os::javaTimeMillis) \
declare_function(os::javaTimeNanos) \
\
declare_function(Deoptimization::fetch_unroll_info) \
COMPILER2_PRESENT(declare_function(Deoptimization::uncommon_trap)) \
declare_function(Deoptimization::unpack_frames)
//--------------------------------------------------------------------------------
// Macros operating on the above lists
//--------------------------------------------------------------------------------
// This utility macro quotes the passed string
#define QUOTE(x) #x
//--------------------------------------------------------------------------------
// VMStructEntry macros
//
// This macro generates a VMStructEntry line for a nonstatic field
#define GENERATE_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
{ QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 0, offset_of(typeName, fieldName), NULL },
// This macro generates a VMStructEntry line for a static field
#define GENERATE_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
{ QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, &typeName::fieldName },
// This macro generates a VMStructEntry line for a static pointer volatile field,
// e.g.: "static ObjectMonitor * volatile gBlockList;"
#define GENERATE_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY(typeName, fieldName, type) \
{ QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, (void *)&typeName::fieldName },
// This macro generates a VMStructEntry line for an unchecked
// nonstatic field, in which the size of the type is also specified.
// The type string is given as NULL, indicating an "opaque" type.
#define GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, size) \
{ QUOTE(typeName), QUOTE(fieldName), NULL, 0, offset_of(typeName, fieldName), NULL },
// This macro generates a VMStructEntry line for an unchecked
// static field, in which the size of the type is also specified.
// The type string is given as NULL, indicating an "opaque" type.
#define GENERATE_UNCHECKED_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, size) \
{ QUOTE(typeName), QUOTE(fieldName), NULL, 1, 0, (void*) &typeName::fieldName },
// This macro generates the sentinel value indicating the end of the list
#define GENERATE_VM_STRUCT_LAST_ENTRY() \
{ NULL, NULL, NULL, 0, 0, NULL }
// This macro checks the type of a VMStructEntry by comparing pointer types
#define CHECK_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
{typeName *dummyObj = NULL; type* dummy = &dummyObj->fieldName; \
assert(offset_of(typeName, fieldName) < sizeof(typeName), "Illegal nonstatic struct entry, field offset too large"); }
// This macro checks the type of a volatile VMStructEntry by comparing pointer types
#define CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
{typedef type dummyvtype; typeName *dummyObj = NULL; volatile dummyvtype* dummy = &dummyObj->fieldName; }
// This macro checks the type of a static VMStructEntry by comparing pointer types
#define CHECK_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
{type* dummy = &typeName::fieldName; }
// This macro checks the type of a static pointer volatile VMStructEntry by comparing pointer types,
// e.g.: "static ObjectMonitor * volatile gBlockList;"
#define CHECK_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY(typeName, fieldName, type) \
{type volatile * dummy = &typeName::fieldName; }
// This macro ensures the type of a field and its containing type are
// present in the type table. The assertion string is shorter than
// preferable because (incredibly) of a bug in Solstice NFS client
// which seems to prevent very long lines from compiling. This assertion
// means that an entry in VMStructs::localHotSpotVMStructs[] was not
// found in VMStructs::localHotSpotVMTypes[].
#define ENSURE_FIELD_TYPE_PRESENT(typeName, fieldName, type) \
{ assert(findType(QUOTE(typeName)) != 0, "type \"" QUOTE(typeName) "\" not found in type table"); \
assert(findType(QUOTE(type)) != 0, "type \"" QUOTE(type) "\" not found in type table"); }
// This is a no-op macro for unchecked fields
#define CHECK_NO_OP(a, b, c)
//
// Build-specific macros:
//
// Generate and check a nonstatic field in non-product builds
@ -2997,35 +2899,7 @@ typedef CompactHashtable<Symbol*, char> SymbolCompactHashTable;
#endif /* COMPILER2 */
//--------------------------------------------------------------------------------
// VMTypeEntry macros
//
#define GENERATE_VM_TYPE_ENTRY(type, superclass) \
{ QUOTE(type), QUOTE(superclass), 0, 0, 0, sizeof(type) },
#define GENERATE_TOPLEVEL_VM_TYPE_ENTRY(type) \
{ QUOTE(type), NULL, 0, 0, 0, sizeof(type) },
#define GENERATE_OOP_VM_TYPE_ENTRY(type) \
{ QUOTE(type), NULL, 1, 0, 0, sizeof(type) },
#define GENERATE_INTEGER_VM_TYPE_ENTRY(type) \
{ QUOTE(type), NULL, 0, 1, 0, sizeof(type) },
#define GENERATE_UNSIGNED_INTEGER_VM_TYPE_ENTRY(type) \
{ QUOTE(type), NULL, 0, 1, 1, sizeof(type) },
#define GENERATE_VM_TYPE_LAST_ENTRY() \
{ NULL, NULL, 0, 0, 0, 0 }
#define CHECK_VM_TYPE_ENTRY(type, superclass) \
{ type* dummyObj = NULL; superclass* dummySuperObj = dummyObj; }
#define CHECK_VM_TYPE_NO_OP(a)
#define CHECK_SINGLE_ARG_VM_TYPE_NO_OP(a)
//
// Build-specific macros:
// VMTypeEntry build-specific macros
//
#ifdef COMPILER1
@ -3050,23 +2924,9 @@ typedef CompactHashtable<Symbol*, char> SymbolCompactHashTable;
//--------------------------------------------------------------------------------
// VMIntConstantEntry macros
// VMIntConstantEntry build-specific macros
//
#define GENERATE_VM_INT_CONSTANT_ENTRY(name) \
{ QUOTE(name), (int32_t) name },
#define GENERATE_VM_INT_CONSTANT_WITH_VALUE_ENTRY(name, value) \
{ (name), (int32_t)(value) },
#define GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY(name, value) \
{ name, (int32_t) value },
// This macro generates the sentinel value indicating the end of the list
#define GENERATE_VM_INT_CONSTANT_LAST_ENTRY() \
{ NULL, 0 }
// Generate an int constant for a C1 build
#ifdef COMPILER1
# define GENERATE_C1_VM_INT_CONSTANT_ENTRY(name) GENERATE_VM_INT_CONSTANT_ENTRY(name)
@ -3083,20 +2943,11 @@ typedef CompactHashtable<Symbol*, char> SymbolCompactHashTable;
# define GENERATE_C2_PREPROCESSOR_VM_INT_CONSTANT_ENTRY(name, value)
#endif /* COMPILER1 */
//--------------------------------------------------------------------------------
// VMLongConstantEntry macros
// VMLongConstantEntry build-specific macros
//
#define GENERATE_VM_LONG_CONSTANT_ENTRY(name) \
{ QUOTE(name), name },
#define GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY(name, value) \
{ name, value },
// This macro generates the sentinel value indicating the end of the list
#define GENERATE_VM_LONG_CONSTANT_LAST_ENTRY() \
{ NULL, 0 }
// Generate a long constant for a C1 build
#ifdef COMPILER1
# define GENERATE_C1_VM_LONG_CONSTANT_ENTRY(name) GENERATE_VM_LONG_CONSTANT_ENTRY(name)
@ -3113,22 +2964,6 @@ typedef CompactHashtable<Symbol*, char> SymbolCompactHashTable;
# define GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY(name, value)
#endif /* COMPILER1 */
//--------------------------------------------------------------------------------
// VMAddressEntry macros
//
#define GENERATE_VM_ADDRESS_ENTRY(name) \
{ QUOTE(name), (void*) (name) },
#define GENERATE_PREPROCESSOR_VM_ADDRESS_ENTRY(name, value) \
{ name, (void*) (value) },
#define GENERATE_VM_FUNCTION_ENTRY(name) \
{ QUOTE(name), CAST_FROM_FN_PTR(void*, &(name)) },
// This macro generates the sentinel value indicating the end of the list
#define GENERATE_VM_ADDRESS_LAST_ENTRY() \
{ NULL, NULL }
//
// Instantiation of VMStructEntries, VMTypeEntries and VMIntConstantEntries
@ -3149,11 +2984,6 @@ VMStructEntry VMStructs::localHotSpotVMStructs[] = {
GENERATE_C1_UNCHECKED_STATIC_VM_STRUCT_ENTRY,
GENERATE_C2_UNCHECKED_STATIC_VM_STRUCT_ENTRY)
#if INCLUDE_JVMCI
VM_STRUCTS_JVMCI(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_STATIC_VM_STRUCT_ENTRY)
#endif
#if INCLUDE_ALL_GCS
VM_STRUCTS_PARALLELGC(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_STATIC_VM_STRUCT_ENTRY)
@ -3215,11 +3045,6 @@ VMTypeEntry VMStructs::localHotSpotVMTypes[] = {
GENERATE_C2_VM_TYPE_ENTRY,
GENERATE_C2_TOPLEVEL_VM_TYPE_ENTRY)
#if INCLUDE_JVMCI
VM_TYPES_JVMCI(GENERATE_VM_TYPE_ENTRY,
GENERATE_TOPLEVEL_VM_TYPE_ENTRY)
#endif
#if INCLUDE_ALL_GCS
VM_TYPES_PARALLELGC(GENERATE_VM_TYPE_ENTRY,
GENERATE_TOPLEVEL_VM_TYPE_ENTRY)
@ -3279,12 +3104,6 @@ VMIntConstantEntry VMStructs::localHotSpotVMIntConstants[] = {
GENERATE_C2_VM_INT_CONSTANT_ENTRY,
GENERATE_C2_PREPROCESSOR_VM_INT_CONSTANT_ENTRY)
#if INCLUDE_JVMCI
VM_INT_CONSTANTS_JVMCI(GENERATE_VM_INT_CONSTANT_ENTRY,
GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY)
#endif
#if INCLUDE_ALL_GCS
VM_INT_CONSTANTS_CMS(GENERATE_VM_INT_CONSTANT_ENTRY)
@ -3348,25 +3167,6 @@ VMLongConstantEntry VMStructs::localHotSpotVMLongConstants[] = {
GENERATE_VM_LONG_CONSTANT_LAST_ENTRY()
};
VMAddressEntry VMStructs::localHotSpotVMAddresses[] = {
VM_ADDRESSES(GENERATE_VM_ADDRESS_ENTRY,
GENERATE_PREPROCESSOR_VM_ADDRESS_ENTRY,
GENERATE_VM_FUNCTION_ENTRY)
VM_ADDRESSES_OS(GENERATE_VM_ADDRESS_ENTRY,
GENERATE_PREPROCESSOR_VM_ADDRESS_ENTRY,
GENERATE_VM_FUNCTION_ENTRY)
#if INCLUDE_JVMCI
VM_ADDRESSES_JVMCI(GENERATE_VM_ADDRESS_ENTRY,
GENERATE_PREPROCESSOR_VM_ADDRESS_ENTRY,
GENERATE_VM_FUNCTION_ENTRY)
#endif
GENERATE_VM_ADDRESS_LAST_ENTRY()
};
// This is used both to check the types of referenced fields and, in
// debug builds, to ensure that all of the field types are present.
void
@ -3575,11 +3375,6 @@ JNIEXPORT VMLongConstantEntry* gHotSpotVMLongConstants = VMStructs::localHotSpot
JNIEXPORT uint64_t gHotSpotVMLongConstantEntryNameOffset = offset_of(VMLongConstantEntry, name);
JNIEXPORT uint64_t gHotSpotVMLongConstantEntryValueOffset = offset_of(VMLongConstantEntry, value);
JNIEXPORT uint64_t gHotSpotVMLongConstantEntryArrayStride = STRIDE(gHotSpotVMLongConstants);
JNIEXPORT VMAddressEntry* gHotSpotVMAddresses = VMStructs::localHotSpotVMAddresses;
JNIEXPORT uint64_t gHotSpotVMAddressEntryNameOffset = offset_of(VMAddressEntry, name);
JNIEXPORT uint64_t gHotSpotVMAddressEntryValueOffset = offset_of(VMAddressEntry, value);
JNIEXPORT uint64_t gHotSpotVMAddressEntryArrayStride = STRIDE(gHotSpotVMAddresses);
}
#ifdef ASSERT
@ -3687,11 +3482,6 @@ void VMStructs::test() {
&long_last_entry,
sizeof(VMLongConstantEntry)) == 0, "Incorrect last entry in localHotSpotVMLongConstants");
static VMAddressEntry address_last_entry = GENERATE_VM_ADDRESS_LAST_ENTRY();
assert(memcmp(&localHotSpotVMAddresses[sizeof(localHotSpotVMAddresses) / sizeof(VMAddressEntry) - 1],
&address_last_entry,
sizeof(VMAddressEntry)) == 0, "Incorrect last entry in localHotSpotVMAddresses");
// Check for duplicate entries in type array
for (int i = 0; localHotSpotVMTypes[i].typeName != NULL; i++) {