@@ -1408,17 +1408,10 @@ } } #endif // _LP64 } - void Arguments::set_use_compressed_klass_ptrs() { - #ifdef _LP64 - assert(!UseCompressedClassPointers || CompressedClassSpaceSize <= KlassEncodingMetaspaceMax, - "CompressedClassSpaceSize is too large for UseCompressedClassPointers"); - #endif // _LP64 - } - void Arguments::set_conservative_max_heap_alignment() { // The conservative maximum required alignment for the heap is the maximum of // the alignments imposed by several sources: any requirements from the heap // itself and the maximum page size we may run the VM with. size_t heap_alignment = GCConfig::arguments()->conservative_max_heap_alignment();
@@ -1433,11 +1426,10 @@ set_conservative_max_heap_alignment(); #ifdef _LP64 set_use_compressed_oops(); - set_use_compressed_klass_ptrs(); // Also checks that certain machines are slower with compressed oops // in vm_version initialization code. #endif // _LP64
@@ -2932,10 +2924,41 @@ #ifndef CAN_SHOW_REGISTERS_ON_ASSERT UNSUPPORTED_OPTION(ShowRegistersOnAssert); #endif // CAN_SHOW_REGISTERS_ON_ASSERT + if (UseObjectMonitorTable && LockingMode != LM_LIGHTWEIGHT) { + // ObjectMonitorTable requires lightweight locking. + FLAG_SET_DEFAULT(LockingMode, LM_LIGHTWEIGHT); + } + + #ifdef _LP64 + if (UseCompactObjectHeaders && FLAG_IS_CMDLINE(UseCompressedClassPointers) && !UseCompressedClassPointers) { + warning("Compact object headers require compressed class pointers. Disabling compact object headers."); + FLAG_SET_DEFAULT(UseCompactObjectHeaders, false); + } + if (UseCompactObjectHeaders && LockingMode != LM_LIGHTWEIGHT) { + FLAG_SET_DEFAULT(LockingMode, LM_LIGHTWEIGHT); + } + if (UseCompactObjectHeaders && !UseObjectMonitorTable) { + // If UseCompactObjectHeaders is on the command line, turn on UseObjectMonitorTable. + if (FLAG_IS_CMDLINE(UseCompactObjectHeaders)) { + FLAG_SET_DEFAULT(UseObjectMonitorTable, true); + + // If UseObjectMonitorTable is on the command line, turn off UseCompactObjectHeaders. + } else if (FLAG_IS_CMDLINE(UseObjectMonitorTable)) { + FLAG_SET_DEFAULT(UseCompactObjectHeaders, false); + // If neither on the command line, the defaults are incompatible, but turn on UseObjectMonitorTable. + } else { + FLAG_SET_DEFAULT(UseObjectMonitorTable, true); + } + } + if (UseCompactObjectHeaders && !UseCompressedClassPointers) { + FLAG_SET_DEFAULT(UseCompressedClassPointers, true); + } + #endif + return JNI_OK; } // Helper class for controlling the lifetime of JavaVMInitArgs // objects. The contents of the JavaVMInitArgs are guaranteed to be
@@ -3641,10 +3664,14 @@ // Set heap size based on available physical memory set_heap_size(); GCConfig::arguments()->initialize(); + if (UseCompressedClassPointers) { + CompressedKlassPointers::pre_initialize(); + } + CDSConfig::initialize(); // Initialize Metaspace flags and alignments Metaspace::ergo_initialize();