8266088: compiler/arguments/TestPrintOptoAssemblyLineNumbers test should user driver mode
Reviewed-by: kvn
This commit is contained in:
parent
f560b89233
commit
7f4a9f68bf
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
|
||||
* Copyright (c) 2021, 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
|
||||
@ -28,44 +29,46 @@
|
||||
*
|
||||
* @requires vm.compiler2.enabled & vm.debug == true
|
||||
*
|
||||
* @library /compiler/patches /test/lib
|
||||
* @run main/othervm compiler.arguments.TestPrintOptoAssemblyLineNumbers
|
||||
*/
|
||||
* @library /test/lib
|
||||
* @run driver compiler.arguments.TestPrintOptoAssemblyLineNumbers
|
||||
*/
|
||||
|
||||
package compiler.arguments;
|
||||
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
// THIS TEST IS LINE NUMBER SENSITIVE
|
||||
|
||||
public class TestPrintOptoAssemblyLineNumbers {
|
||||
public static void main(String[] args) throws Throwable {
|
||||
// create subprocess to run some code with -XX:+PrintOptoAssembly enabled
|
||||
String[] procArgs = new String[]{
|
||||
String[] procArgs = new String[] {
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:-TieredCompilation",
|
||||
"-XX:+PrintOptoAssembly",
|
||||
"compiler.arguments.TestPrintOptoAssemblyLineNumbers$CheckC2OptoAssembly"
|
||||
};
|
||||
CheckC2OptoAssembly.class.getName()
|
||||
};
|
||||
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(procArgs);
|
||||
String output = new OutputAnalyzer(pb.start()).getOutput();
|
||||
OutputAnalyzer oa = new OutputAnalyzer(pb.start());
|
||||
oa.shouldHaveExitValue(0);
|
||||
|
||||
if(output.contains("TestPrintOptoAssemblyLineNumbers$CheckC2OptoAssembly::main @ bci:11")){
|
||||
if (oa.getOutput().contains("TestPrintOptoAssemblyLineNumbers$CheckC2OptoAssembly::main @ bci:11")) {
|
||||
// if C2 optimizer invoked ensure output includes line numbers:
|
||||
Asserts.assertTrue(output.contains("TestPrintOptoAssemblyLineNumbers$CheckC2OptoAssembly::main @ bci:11 (line 68)"));
|
||||
oa.stdoutShouldContain("TestPrintOptoAssemblyLineNumbers$CheckC2OptoAssembly::main @ bci:11 (line 71)");
|
||||
}
|
||||
}
|
||||
|
||||
public static class CheckC2OptoAssembly{ // contents of this class serves to just invoke C2
|
||||
public static boolean foo(String arg){
|
||||
public static class CheckC2OptoAssembly { // contents of this class serves to just invoke C2
|
||||
public static boolean foo(String arg) {
|
||||
return arg.contains("45");
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
public static void main(String[] args) {
|
||||
int count = 0;
|
||||
for(int x = 0; x < 200_000; x++){
|
||||
if(foo("something" + x)){ // <- test expects this line of code to be on line 68
|
||||
for (int x = 0; x < 200_000; x++) {
|
||||
if (foo("something" + x)) { // <- test expects this line of code to be on line 71
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user