3645
3646 // The VMThread needs to stop now and then to execute these debug options.
3647 if ((HandshakeALot || SafepointALot) && FLAG_IS_DEFAULT(GuaranteedSafepointInterval)) {
3648 FLAG_SET_DEFAULT(GuaranteedSafepointInterval, 1000);
3649 }
3650
3651 if (log_is_enabled(Info, arguments)) {
3652 LogStream st(Log(arguments)::info());
3653 Arguments::print_on(&st);
3654 }
3655
3656 return JNI_OK;
3657 }
3658
3659 void Arguments::set_compact_headers_flags() {
3660 #ifdef _LP64
3661 if (UseCompactObjectHeaders && FLAG_IS_CMDLINE(UseCompressedClassPointers) && !UseCompressedClassPointers) {
3662 warning("Compact object headers require compressed class pointers. Disabling compact object headers.");
3663 FLAG_SET_DEFAULT(UseCompactObjectHeaders, false);
3664 }
3665 if (UseCompactObjectHeaders && !UseObjectMonitorTable) {
3666 // If UseCompactObjectHeaders is on the command line, turn on UseObjectMonitorTable.
3667 if (FLAG_IS_CMDLINE(UseCompactObjectHeaders)) {
3668 FLAG_SET_DEFAULT(UseObjectMonitorTable, true);
3669
3670 // If UseObjectMonitorTable is on the command line, turn off UseCompactObjectHeaders.
3671 } else if (FLAG_IS_CMDLINE(UseObjectMonitorTable)) {
3672 FLAG_SET_DEFAULT(UseCompactObjectHeaders, false);
3673 // If neither on the command line, the defaults are incompatible, but turn on UseObjectMonitorTable.
3674 } else {
3675 FLAG_SET_DEFAULT(UseObjectMonitorTable, true);
3676 }
3677 }
3678 if (UseCompactObjectHeaders && LockingMode != LM_LIGHTWEIGHT) {
3679 FLAG_SET_DEFAULT(LockingMode, LM_LIGHTWEIGHT);
3680 }
3681 if (UseCompactObjectHeaders && !UseCompressedClassPointers) {
3682 FLAG_SET_DEFAULT(UseCompressedClassPointers, true);
3683 }
3684 #endif
3685 }
3686
3687 jint Arguments::apply_ergo() {
3688 // Set flags based on ergonomics.
3689 jint result = set_ergonomics_flags();
3690 if (result != JNI_OK) return result;
3691
3692 // Set heap size based on available physical memory
3693 set_heap_size();
3694
3695 GCConfig::arguments()->initialize();
3696
3697 set_compact_headers_flags();
3698
3699 if (UseCompressedClassPointers) {
3700 CompressedKlassPointers::pre_initialize();
3701 }
3702
3703 CDSConfig::initialize();
|
3645
3646 // The VMThread needs to stop now and then to execute these debug options.
3647 if ((HandshakeALot || SafepointALot) && FLAG_IS_DEFAULT(GuaranteedSafepointInterval)) {
3648 FLAG_SET_DEFAULT(GuaranteedSafepointInterval, 1000);
3649 }
3650
3651 if (log_is_enabled(Info, arguments)) {
3652 LogStream st(Log(arguments)::info());
3653 Arguments::print_on(&st);
3654 }
3655
3656 return JNI_OK;
3657 }
3658
3659 void Arguments::set_compact_headers_flags() {
3660 #ifdef _LP64
3661 if (UseCompactObjectHeaders && FLAG_IS_CMDLINE(UseCompressedClassPointers) && !UseCompressedClassPointers) {
3662 warning("Compact object headers require compressed class pointers. Disabling compact object headers.");
3663 FLAG_SET_DEFAULT(UseCompactObjectHeaders, false);
3664 }
3665 if (UseCompactObjectHeaders && UseParallelGC) {
3666 warning("Parallel GC is currently not compatible with compact object headers (due to identity hash-code). Disabling compact object headers.");
3667 FLAG_SET_DEFAULT(UseCompactObjectHeaders, false);
3668 }
3669 if (UseCompactObjectHeaders && !UseObjectMonitorTable) {
3670 // If UseCompactObjectHeaders is on the command line, turn on UseObjectMonitorTable.
3671 if (FLAG_IS_CMDLINE(UseCompactObjectHeaders)) {
3672 FLAG_SET_DEFAULT(UseObjectMonitorTable, true);
3673
3674 // If UseObjectMonitorTable is on the command line, turn off UseCompactObjectHeaders.
3675 } else if (FLAG_IS_CMDLINE(UseObjectMonitorTable)) {
3676 FLAG_SET_DEFAULT(UseCompactObjectHeaders, false);
3677 // If neither on the command line, the defaults are incompatible, but turn on UseObjectMonitorTable.
3678 } else {
3679 FLAG_SET_DEFAULT(UseObjectMonitorTable, true);
3680 }
3681 }
3682 if (UseCompactObjectHeaders && LockingMode != LM_LIGHTWEIGHT) {
3683 FLAG_SET_DEFAULT(LockingMode, LM_LIGHTWEIGHT);
3684 }
3685 if (UseCompactObjectHeaders && !UseCompressedClassPointers) {
3686 FLAG_SET_DEFAULT(UseCompressedClassPointers, true);
3687 }
3688 if (UseCompactObjectHeaders && FLAG_IS_DEFAULT(hashCode)) {
3689 hashCode = 6;
3690 }
3691 #endif
3692 }
3693
3694 jint Arguments::apply_ergo() {
3695 // Set flags based on ergonomics.
3696 jint result = set_ergonomics_flags();
3697 if (result != JNI_OK) return result;
3698
3699 // Set heap size based on available physical memory
3700 set_heap_size();
3701
3702 GCConfig::arguments()->initialize();
3703
3704 set_compact_headers_flags();
3705
3706 if (UseCompressedClassPointers) {
3707 CompressedKlassPointers::pre_initialize();
3708 }
3709
3710 CDSConfig::initialize();
|