mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8184800: Streamline RTM flag validity testing with generic flag testing support
Reviewed-by: kvn, lucy
This commit is contained in:
parent
9148262d0e
commit
d3ae772868
11 changed files with 31 additions and 207 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2016 SAP SE. All rights reserved.
|
||||
* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2017 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -193,11 +193,12 @@ define_pd_global(intx, InitArrayShortSize, 9*BytesPerLong);
|
|||
\
|
||||
experimental(int, RTMAbortRatio, 50, \
|
||||
"Lock abort ratio at which to stop use RTM lock eliding") \
|
||||
range(0, 100) /* natural range, checked in vm_version_ppc.cpp */ \
|
||||
range(0, 100) /* natural range */ \
|
||||
\
|
||||
experimental(int, RTMTotalCountIncrRate, 64, \
|
||||
"Increment total RTM attempted lock count once every n times") \
|
||||
range(1, 32767) /* immediate operand limit on ppc */ \
|
||||
constraint(RTMTotalCountIncrRateConstraintFunc,AfterErgo) \
|
||||
\
|
||||
experimental(intx, RTMLockingCalculationDelay, 0, \
|
||||
"Number of milliseconds to wait before start calculating aborts " \
|
||||
|
|
|
@ -327,18 +327,6 @@ void VM_Version::initialize() {
|
|||
// high lock contention. For now we do not use it by default.
|
||||
vm_exit_during_initialization("UseRTMLocking flag should be only set on command line");
|
||||
}
|
||||
if (!is_power_of_2(RTMTotalCountIncrRate)) {
|
||||
warning("RTMTotalCountIncrRate must be a power of 2, resetting it to 64");
|
||||
FLAG_SET_DEFAULT(RTMTotalCountIncrRate, 64);
|
||||
}
|
||||
if (RTMAbortRatio < 0 || RTMAbortRatio > 100) {
|
||||
warning("RTMAbortRatio must be in the range 0 to 100, resetting it to 50");
|
||||
FLAG_SET_DEFAULT(RTMAbortRatio, 50);
|
||||
}
|
||||
if (RTMSpinLoopCount < 0) {
|
||||
warning("RTMSpinLoopCount must not be a negative value, resetting it to 0");
|
||||
FLAG_SET_DEFAULT(RTMSpinLoopCount, 0);
|
||||
}
|
||||
#else
|
||||
// Only C2 does RTM locking optimization.
|
||||
// Can't continue because UseRTMLocking affects UseBiasedLocking flag
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -179,11 +179,12 @@ define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong);
|
|||
\
|
||||
experimental(int, RTMAbortRatio, 50, \
|
||||
"Lock abort ratio at which to stop use RTM lock eliding") \
|
||||
range(0, 100) /* natural range, checked in vm_version_x86.cpp */ \
|
||||
range(0, 100) /* natural range */ \
|
||||
\
|
||||
experimental(int, RTMTotalCountIncrRate, 64, \
|
||||
"Increment total RTM attempted lock count once every n times") \
|
||||
range(1, max_jint) \
|
||||
constraint(RTMTotalCountIncrRateConstraintFunc,AfterErgo) \
|
||||
\
|
||||
experimental(intx, RTMLockingCalculationDelay, 0, \
|
||||
"Number of milliseconds to wait before start calculating aborts " \
|
||||
|
|
|
@ -884,7 +884,8 @@ void VM_Version::get_processor_features() {
|
|||
(_model == CPU_MODEL_BROADWELL && _stepping < 4)) {
|
||||
// currently a collision between SKL and HSW_E3
|
||||
if (!UnlockExperimentalVMOptions && UseAVX < 3) {
|
||||
vm_exit_during_initialization("UseRTMLocking is only available as experimental option on this platform. It must be enabled via -XX:+UnlockExperimentalVMOptions flag.");
|
||||
vm_exit_during_initialization("UseRTMLocking is only available as experimental option on this "
|
||||
"platform. It must be enabled via -XX:+UnlockExperimentalVMOptions flag.");
|
||||
} else {
|
||||
warning("UseRTMLocking is only available as experimental option on this platform.");
|
||||
}
|
||||
|
@ -895,14 +896,6 @@ void VM_Version::get_processor_features() {
|
|||
// high lock contention. For now we do not use it by default.
|
||||
vm_exit_during_initialization("UseRTMLocking flag should be only set on command line");
|
||||
}
|
||||
if (!is_power_of_2(RTMTotalCountIncrRate)) {
|
||||
warning("RTMTotalCountIncrRate must be a power of 2, resetting it to 64");
|
||||
FLAG_SET_DEFAULT(RTMTotalCountIncrRate, 64);
|
||||
}
|
||||
if (RTMAbortRatio < 0 || RTMAbortRatio > 100) {
|
||||
warning("RTMAbortRatio must be in the range 0 to 100, resetting it to 50");
|
||||
FLAG_SET_DEFAULT(RTMAbortRatio, 50);
|
||||
}
|
||||
} else { // !UseRTMLocking
|
||||
if (UseRTMForStackLocks) {
|
||||
if (!FLAG_IS_DEFAULT(UseRTMForStackLocks)) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -389,3 +389,17 @@ Flag::Error NodeLimitFudgeFactorConstraintFunc(intx value, bool verbose) {
|
|||
return Flag::SUCCESS;
|
||||
}
|
||||
#endif // COMPILER2
|
||||
|
||||
Flag::Error RTMTotalCountIncrRateConstraintFunc(int value, bool verbose) {
|
||||
#if INCLUDE_RTM_OPT
|
||||
if (UseRTMLocking && !is_power_of_2(RTMTotalCountIncrRate)) {
|
||||
CommandLineError::print(verbose,
|
||||
"RTMTotalCountIncrRate (" INTX_FORMAT
|
||||
") must be a power of 2, resetting it to 64\n",
|
||||
RTMTotalCountIncrRate);
|
||||
FLAG_SET_DEFAULT(RTMTotalCountIncrRate, 64);
|
||||
}
|
||||
#endif
|
||||
|
||||
return Flag::SUCCESS;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -70,4 +70,6 @@ Flag::Error InteriorEntryAlignmentConstraintFunc(intx value, bool verbose);
|
|||
Flag::Error NodeLimitFudgeFactorConstraintFunc(intx value, bool verbose);
|
||||
#endif
|
||||
|
||||
Flag::Error RTMTotalCountIncrRateConstraintFunc(int value, bool verbose);
|
||||
|
||||
#endif /* SHARE_VM_RUNTIME_COMMANDLINEFLAGCONSTRAINTSCOMPILER_HPP */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -38,13 +38,11 @@ public abstract class RTMGenericCommandLineOptionTest {
|
|||
= "RTM instructions are not available on this CPU";
|
||||
protected static final String RTM_UNSUPPORTED_VM_ERROR
|
||||
= "RTM locking optimization is not supported in this VM";
|
||||
protected static final String RTM_ABORT_RATIO_WARNING
|
||||
= "RTMAbortRatio must be in the range 0 to 100, resetting it to 50";
|
||||
protected static final String RTM_FOR_STACK_LOCKS_WARNING
|
||||
= "UseRTMForStackLocks flag should be off when UseRTMLocking "
|
||||
+ "flag is off";
|
||||
protected static final String RTM_COUNT_INCR_WARNING
|
||||
= "RTMTotalCountIncrRate must be a power of 2, resetting it to 64";
|
||||
= "must be a power of 2, resetting it to 64";
|
||||
protected static final String RTM_BIASED_LOCKING_WARNING
|
||||
= "Biased locking is not supported with RTM locking; "
|
||||
+ "ignoring UseBiasedLocking flag";
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8031320
|
||||
* @summary Verify RTMAbortRatio option processing on CPU with rtm
|
||||
* support and on VM with rtm locking support.
|
||||
* @library /test/lib /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
* @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
|
||||
* @build sun.hotspot.WhiteBox
|
||||
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI
|
||||
* compiler.rtm.cli.TestRTMAbortRatioOptionOnSupportedConfig
|
||||
*/
|
||||
|
||||
package compiler.rtm.cli;
|
||||
|
||||
public class TestRTMAbortRatioOptionOnSupportedConfig
|
||||
extends RTMLockingAwareTest {
|
||||
private static final String DEFAULT_VALUE = "50";
|
||||
|
||||
private TestRTMAbortRatioOptionOnSupportedConfig() {
|
||||
super("RTMAbortRatio", false, true,
|
||||
TestRTMAbortRatioOptionOnSupportedConfig.DEFAULT_VALUE,
|
||||
/* correct values */
|
||||
new String[] { "0", "20", "100" },
|
||||
/* incorrect values */
|
||||
new String[] { "-1", "101" },
|
||||
RTMGenericCommandLineOptionTest.RTM_ABORT_RATIO_WARNING);
|
||||
}
|
||||
|
||||
public static void main(String args[]) throws Throwable {
|
||||
new TestRTMAbortRatioOptionOnSupportedConfig().runTestCases();
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8031320
|
||||
* @summary Verify RTMAbortRatio option processing on CPU without rtm
|
||||
* support or on VM that does not support rtm locking.
|
||||
* @library /test/lib /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
* @requires !(vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os)
|
||||
* @build sun.hotspot.WhiteBox
|
||||
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI
|
||||
* compiler.rtm.cli.TestRTMAbortRatioOptionOnUnsupportedConfig
|
||||
*/
|
||||
|
||||
package compiler.rtm.cli;
|
||||
|
||||
public class TestRTMAbortRatioOptionOnUnsupportedConfig
|
||||
extends RTMGenericCommandLineOptionTest {
|
||||
private static final String DEFAULT_VALUE = "50";
|
||||
|
||||
private TestRTMAbortRatioOptionOnUnsupportedConfig() {
|
||||
super("RTMAbortRatio", false, true,
|
||||
TestRTMAbortRatioOptionOnUnsupportedConfig.DEFAULT_VALUE,
|
||||
"0", "10", "100");
|
||||
}
|
||||
|
||||
public static void main(String args[]) throws Throwable {
|
||||
new TestRTMAbortRatioOptionOnUnsupportedConfig().runTestCases();
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -50,7 +50,7 @@ public class TestRTMTotalCountIncrRateOptionOnSupportedConfig
|
|||
/* correct values */
|
||||
new String[] { "1", "2", "128", "1024" },
|
||||
/* incorrect values */
|
||||
new String[] { "-1", "0", "3", "42" },
|
||||
new String[] { "3", "5", "7", "42" },
|
||||
RTMGenericCommandLineOptionTest.RTM_COUNT_INCR_WARNING);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8031320
|
||||
* @summary Verify RTMTotalCountIncrRate option processing on CPU without
|
||||
* rtm support and/or on VM without rtm locking support.
|
||||
* @library /test/lib /
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
* @requires !(vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os)
|
||||
* @build sun.hotspot.WhiteBox
|
||||
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI
|
||||
* compiler.rtm.cli.TestRTMTotalCountIncrRateOptionOnUnsupportedConfig
|
||||
*/
|
||||
|
||||
package compiler.rtm.cli;
|
||||
|
||||
public class TestRTMTotalCountIncrRateOptionOnUnsupportedConfig
|
||||
extends RTMGenericCommandLineOptionTest {
|
||||
private static final String DEFAULT_VALUE = "64";
|
||||
|
||||
private TestRTMTotalCountIncrRateOptionOnUnsupportedConfig() {
|
||||
super("RTMTotalCountIncrRate", false, true,
|
||||
TestRTMTotalCountIncrRateOptionOnUnsupportedConfig
|
||||
.DEFAULT_VALUE,
|
||||
"1", "42", "128");
|
||||
}
|
||||
|
||||
public static void main(String args[]) throws Throwable {
|
||||
new TestRTMTotalCountIncrRateOptionOnUnsupportedConfig().runTestCases();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue