3510 }
3511
3512 return JNI_OK;
3513 }
3514
3515 void Arguments::set_compact_headers_flags() {
3516 #ifdef _LP64
3517 if (UseCompactObjectHeaders && !UseObjectMonitorTable) {
3518 // If UseCompactObjectHeaders is on the command line, turn on UseObjectMonitorTable.
3519 if (FLAG_IS_CMDLINE(UseCompactObjectHeaders)) {
3520 FLAG_SET_DEFAULT(UseObjectMonitorTable, true);
3521
3522 // If UseObjectMonitorTable is on the command line, turn off UseCompactObjectHeaders.
3523 } else if (FLAG_IS_CMDLINE(UseObjectMonitorTable)) {
3524 FLAG_SET_DEFAULT(UseCompactObjectHeaders, false);
3525 // If neither on the command line, the defaults are incompatible, but turn on UseObjectMonitorTable.
3526 } else {
3527 FLAG_SET_DEFAULT(UseObjectMonitorTable, true);
3528 }
3529 }
3530 #endif
3531 }
3532
3533 jint Arguments::apply_ergo() {
3534 // Set flags based on ergonomics.
3535 jint result = set_ergonomics_flags();
3536 if (result != JNI_OK) return result;
3537
3538 // Set heap size based on available physical memory
3539 GCConfig::arguments()->set_heap_size();
3540
3541 GCConfig::arguments()->initialize();
3542
3543 set_compact_headers_flags();
3544
3545 CompressedKlassPointers::pre_initialize();
3546
3547 CDSConfig::ergo_initialize();
3548
3549 // Initialize Metaspace flags and alignments
|
3510 }
3511
3512 return JNI_OK;
3513 }
3514
3515 void Arguments::set_compact_headers_flags() {
3516 #ifdef _LP64
3517 if (UseCompactObjectHeaders && !UseObjectMonitorTable) {
3518 // If UseCompactObjectHeaders is on the command line, turn on UseObjectMonitorTable.
3519 if (FLAG_IS_CMDLINE(UseCompactObjectHeaders)) {
3520 FLAG_SET_DEFAULT(UseObjectMonitorTable, true);
3521
3522 // If UseObjectMonitorTable is on the command line, turn off UseCompactObjectHeaders.
3523 } else if (FLAG_IS_CMDLINE(UseObjectMonitorTable)) {
3524 FLAG_SET_DEFAULT(UseCompactObjectHeaders, false);
3525 // If neither on the command line, the defaults are incompatible, but turn on UseObjectMonitorTable.
3526 } else {
3527 FLAG_SET_DEFAULT(UseObjectMonitorTable, true);
3528 }
3529 }
3530 if (UseCompactObjectHeaders && FLAG_IS_DEFAULT(hashCode)) {
3531 hashCode = 6;
3532 }
3533 if (UseCompactObjectHeaders && FLAG_IS_DEFAULT(CompressedClassSpaceSize)) {
3534 FLAG_SET_DEFAULT(CompressedClassSpaceSize, CompressedKlassPointers::max_klass_range_size_coh);
3535 }
3536 #endif
3537 }
3538
3539 jint Arguments::apply_ergo() {
3540 // Set flags based on ergonomics.
3541 jint result = set_ergonomics_flags();
3542 if (result != JNI_OK) return result;
3543
3544 // Set heap size based on available physical memory
3545 GCConfig::arguments()->set_heap_size();
3546
3547 GCConfig::arguments()->initialize();
3548
3549 set_compact_headers_flags();
3550
3551 CompressedKlassPointers::pre_initialize();
3552
3553 CDSConfig::ergo_initialize();
3554
3555 // Initialize Metaspace flags and alignments
|