< prev index next >

test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java

Print this page




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 /**
  26  * @test
  27  * @bug 8031320
  28  * @summary Verify that UseRTMLockEliding option could be applied to
  29  *          specified method and that such method will not be deoptimized
  30  *          on high abort ratio.
  31  * @library /testlibrary /test/lib /
  32  * @modules java.base/jdk.internal.misc
  33  *          java.management
  34  * @build compiler.rtm.method_options.TestUseRTMLockElidingOption
  35  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  36  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  37  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  38  *                   -XX:+WhiteBoxAPI
  39  *                   compiler.rtm.method_options.TestUseRTMLockElidingOption
  40  */
  41 
  42 package compiler.rtm.method_options;
  43 
  44 import compiler.testlibrary.rtm.AbortProvoker;
  45 import compiler.testlibrary.rtm.AbortType;
  46 import compiler.testlibrary.rtm.RTMLockingStatistics;
  47 import compiler.testlibrary.rtm.RTMTestBase;
  48 import compiler.testlibrary.rtm.predicate.SupportedCPU;
  49 import compiler.testlibrary.rtm.predicate.SupportedVM;
  50 import jdk.test.lib.Asserts;
  51 import jdk.test.lib.OutputAnalyzer;
  52 import jdk.test.lib.cli.CommandLineOptionTest;
  53 import jdk.test.lib.cli.predicate.AndPredicate;
  54 
  55 import java.util.List;
  56 
  57 /**
  58  * Test verifies that method tagged with option <i>UseRTMLockElidingOption</i>
  59  * will use RTM-based lock elision, but will be never deoptimized with
  60  * <i>rtm_state_change reason</i>.
  61  * Test invokes compiled method and checks that no deoptimization with
  62  * <i>rtm_state_change</i> reason had happened and that that VM output
  63  * contains RTM locking statistics for compiled method and that total locks
  64  * count equals to method's invocations.
  65  * Since last assert is pretty strict, test uses -XX:RTMRetryCount=0 in order
  66  * to avoid issue with retriable aborts described in
  67  * {@link TestUseRTMAfterLockInflation}.
  68  */
  69 public class TestUseRTMLockElidingOption extends CommandLineOptionTest {
  70     private TestUseRTMLockElidingOption() {
  71         super(new AndPredicate(new SupportedCPU(), new SupportedVM()));




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 /**
  26  * @test
  27  * @bug 8031320
  28  * @summary Verify that UseRTMLockEliding option could be applied to
  29  *          specified method and that such method will not be deoptimized
  30  *          on high abort ratio.
  31  * @library /test/lib /
  32  * @modules java.base/jdk.internal.misc
  33  *          java.management
  34  * @build sun.hotspot.WhiteBox
  35  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  36  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  37  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  38  *                   -XX:+WhiteBoxAPI
  39  *                   compiler.rtm.method_options.TestUseRTMLockElidingOption
  40  */
  41 
  42 package compiler.rtm.method_options;
  43 
  44 import compiler.testlibrary.rtm.AbortProvoker;
  45 import compiler.testlibrary.rtm.AbortType;
  46 import compiler.testlibrary.rtm.RTMLockingStatistics;
  47 import compiler.testlibrary.rtm.RTMTestBase;
  48 import compiler.testlibrary.rtm.predicate.SupportedCPU;
  49 import compiler.testlibrary.rtm.predicate.SupportedVM;
  50 import jdk.test.lib.Asserts;
  51 import jdk.test.lib.process.OutputAnalyzer;
  52 import jdk.test.lib.cli.CommandLineOptionTest;
  53 import jdk.test.lib.cli.predicate.AndPredicate;
  54 
  55 import java.util.List;
  56 
  57 /**
  58  * Test verifies that method tagged with option <i>UseRTMLockElidingOption</i>
  59  * will use RTM-based lock elision, but will be never deoptimized with
  60  * <i>rtm_state_change reason</i>.
  61  * Test invokes compiled method and checks that no deoptimization with
  62  * <i>rtm_state_change</i> reason had happened and that that VM output
  63  * contains RTM locking statistics for compiled method and that total locks
  64  * count equals to method's invocations.
  65  * Since last assert is pretty strict, test uses -XX:RTMRetryCount=0 in order
  66  * to avoid issue with retriable aborts described in
  67  * {@link TestUseRTMAfterLockInflation}.
  68  */
  69 public class TestUseRTMLockElidingOption extends CommandLineOptionTest {
  70     private TestUseRTMLockElidingOption() {
  71         super(new AndPredicate(new SupportedCPU(), new SupportedVM()));


< prev index next >