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 if we use RTMDeopt, then deoptimization
29 * caused by reason other then rtm_state_change will reset
30 * method's RTM state. And if we don't use RTMDeopt, then
31 * RTM state remain the same after such deoptimization.
32 * @library /testlibrary /test/lib /
33 * @modules java.base/jdk.internal.misc
34 * java.management
35 * @build TestRTMAfterNonRTMDeopt
36 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
37 * sun.hotspot.WhiteBox$WhiteBoxPermission
38 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
39 * -XX:+WhiteBoxAPI TestRTMAfterNonRTMDeopt
40 */
41
42 import java.util.List;
43 import jdk.test.lib.*;
44 import jdk.test.lib.cli.CommandLineOptionTest;
45 import jdk.test.lib.cli.predicate.AndPredicate;
46 import compiler.testlibrary.rtm.*;
47 import compiler.testlibrary.rtm.predicate.SupportedCPU;
48 import compiler.testlibrary.rtm.predicate.SupportedVM;
49 import jdk.internal.misc.Unsafe;
50
51 /**
52 * To verify that with +UseRTMDeopt method's RTM state will be
53 * changed to ProfileRTM on deoptimization unrelated to
54 * rtm_state_change following sequence of events is used:
55 * <pre>
56 *
57 * rtm state ^
58 * |
59 * UseRTM | ******| ******
60 * | |
61 * ProfileRTM |******| |*****|
62 * | | | |
63 * 0-------|-----|-----|---------------------> time
64 * | | \ force abort
65 * | |
66 * | \ force deoptimization
67 * |
68 * \ force xabort
69 * </pre>
70 * When xabort is forced by native method call method should
|
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 if we use RTMDeopt, then deoptimization
29 * caused by reason other then rtm_state_change will reset
30 * method's RTM state. And if we don't use RTMDeopt, then
31 * RTM state remain the same after such deoptimization.
32 * @library /testlibrary /test/lib /
33 * @modules java.base/jdk.internal.misc
34 * java.management
35 * @build compiler.rtm.locking.TestRTMAfterNonRTMDeopt
36 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
37 * sun.hotspot.WhiteBox$WhiteBoxPermission
38 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
39 * -XX:+WhiteBoxAPI
40 * compiler.rtm.locking.TestRTMAfterNonRTMDeopt
41 */
42
43 package compiler.rtm.locking;
44
45 import compiler.testlibrary.rtm.AbortProvoker;
46 import compiler.testlibrary.rtm.CompilableTest;
47 import compiler.testlibrary.rtm.RTMLockingStatistics;
48 import compiler.testlibrary.rtm.RTMTestBase;
49 import compiler.testlibrary.rtm.predicate.SupportedCPU;
50 import compiler.testlibrary.rtm.predicate.SupportedVM;
51 import jdk.internal.misc.Unsafe;
52 import jdk.test.lib.Asserts;
53 import jdk.test.lib.OutputAnalyzer;
54 import jdk.test.lib.Utils;
55 import jdk.test.lib.cli.CommandLineOptionTest;
56 import jdk.test.lib.cli.predicate.AndPredicate;
57
58 import java.util.List;
59
60 /**
61 * To verify that with +UseRTMDeopt method's RTM state will be
62 * changed to ProfileRTM on deoptimization unrelated to
63 * rtm_state_change following sequence of events is used:
64 * <pre>
65 *
66 * rtm state ^
67 * |
68 * UseRTM | ******| ******
69 * | |
70 * ProfileRTM |******| |*****|
71 * | | | |
72 * 0-------|-----|-----|---------------------> time
73 * | | \ force abort
74 * | |
75 * | \ force deoptimization
76 * |
77 * \ force xabort
78 * </pre>
79 * When xabort is forced by native method call method should
|