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 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 | 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 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 /test/lib / 33 * @modules java.base/jdk.internal.misc 34 * java.management 35 * @build sun.hotspot.WhiteBox 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.process.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 |