提交 5aaa2d1f 编写于 作者: I iignatyev

8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul

Reviewed-by: twisti
Contributed-by: anton.ivanov@oracle.com
上级 3aca8b7b
/*
* Copyright (c) 2013, 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
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @build AddExactIntTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics AddExactIntTest
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics AddExactIntTest
* @run main Verifier hs_neg.log hs.log
*/
public class AddExactIntTest {
public static void main(String[] args) throws Exception {
new IntrinsicBase.IntTest(MathIntrinsic.IntIntrinsic.Add).test();
}
}
/*
* Copyright (c) 2013, 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
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @build AddExactLongTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics AddExactLongTest
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics AddExactLongTest
* @run main Verifier hs_neg.log hs.log
*/
public class AddExactLongTest {
public static void main(String[] args) throws Exception {
new IntrinsicBase.LongTest(MathIntrinsic.LongIntrinsic.Add).test();
}
}
/*
* Copyright (c) 2013, 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
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @build DecrementExactIntTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics DecrementExactIntTest
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics DecrementExactIntTest
* @run main Verifier hs_neg.log hs.log
*/
public class DecrementExactIntTest {
public static void main(String[] args) throws Exception {
new IntrinsicBase.IntTest(MathIntrinsic.IntIntrinsic.Decrement).test();
}
}
/*
* Copyright (c) 2013, 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
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @build DecrementExactLongTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics DecrementExactLongTest
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics DecrementExactLongTest
* @run main Verifier hs_neg.log hs.log
*/
public class DecrementExactLongTest {
public static void main(String[] args) throws Exception {
new IntrinsicBase.LongTest(MathIntrinsic.LongIntrinsic.Decrement).test();
}
}
\ No newline at end of file
/*
* Copyright (c) 2013, 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
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @build IncrementExactIntTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics IncrementExactIntTest
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics IncrementExactIntTest
* @run main Verifier hs_neg.log hs.log
*/
public class IncrementExactIntTest {
public static void main(String[] args) throws Exception {
new IntrinsicBase.IntTest(MathIntrinsic.IntIntrinsic.Increment).test();
}
}
/*
* Copyright (c) 2013, 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
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @build IncrementExactLongTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics IncrementExactLongTest
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics IncrementExactLongTest
* @run main Verifier hs_neg.log hs.log
*/
public class IncrementExactLongTest {
public static void main(String[] args) throws Exception {
new IntrinsicBase.LongTest(MathIntrinsic.LongIntrinsic.Increment).test();
}
}
/*
* Copyright (c) 2013, 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.
*/
import com.oracle.java.testlibrary.Platform;
import java.io.FileOutputStream;
import java.lang.reflect.Executable;
import java.util.Properties;
public abstract class IntrinsicBase extends CompilerWhiteBoxTest {
protected String javaVmName;
protected String useMathExactIntrinsics;
protected IntrinsicBase(TestCase testCase) {
super(testCase);
javaVmName = System.getProperty("java.vm.name");
useMathExactIntrinsics = getVMOption("UseMathExactIntrinsics");
}
@Override
protected void test() throws Exception {
//java.lang.Math should be loaded to allow a compilation of the methods that use Math's method
System.out.println("class java.lang.Math should be loaded. Proof: " + Math.class);
printEnvironmentInfo();
int expectedIntrinsicCount = 0;
switch (MODE) {
case "compiled mode":
case "mixed mode":
if (isServerVM()) {
if (TIERED_COMPILATION) {
int max_level = TIERED_STOP_AT_LEVEL;
expectedIntrinsicCount = (max_level == COMP_LEVEL_MAX) ? 1 : 0;
for (int i = CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE; i <= max_level; ++i) {
deoptimize();
compileAtLevel(i);
}
} else {
expectedIntrinsicCount = 1;
deoptimize();
compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_MAX);
}
} else {
deoptimize();
compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE);
}
if (!isIntrinsicSupported()) {
expectedIntrinsicCount = 0;
}
break;
case "interpreted mode": //test is not applicable in this mode;
System.err.println("Warning: This test is not applicable in mode: " + MODE);
break;
default:
throw new RuntimeException("Test bug, unknown VM mode: " + MODE);
}
System.out.println("Expected intrinsic count is " + expectedIntrinsicCount + " name " + getIntrinsicId());
final FileOutputStream out = new FileOutputStream(getVMOption("LogFile") + ".verify.properties");
Properties expectedProps = new Properties();
expectedProps.setProperty("intrinsic.name", getIntrinsicId());
expectedProps.setProperty("intrinsic.expectedCount", String.valueOf(expectedIntrinsicCount));
expectedProps.store(out, null);
out.close();
}
protected void printEnvironmentInfo() {
System.out.println("java.vm.name=" + javaVmName);
System.out.println("os.arch=" + Platform.getOsArch());
System.out.println("java.vm.info=" + MODE);
System.out.println("useMathExactIntrinsics=" + useMathExactIntrinsics);
}
protected void compileAtLevel(int level) {
WHITE_BOX.enqueueMethodForCompilation(method, level);
waitBackgroundCompilation();
checkCompilation(method, level);
}
protected void checkCompilation(Executable executable, int level) {
if (!WHITE_BOX.isMethodCompiled(executable)) {
throw new RuntimeException("Test bug, expected compilation (level): " + level + ", but not compiled");
}
final int compilationLevel = WHITE_BOX.getMethodCompilationLevel(executable);
if (compilationLevel != level) {
if (!(TIERED_COMPILATION && level == COMP_LEVEL_FULL_PROFILE && compilationLevel == COMP_LEVEL_LIMITED_PROFILE)) { //possible case
throw new RuntimeException("Test bug, expected compilation (level): " + level + ", but level: " + compilationLevel);
}
}
}
protected abstract boolean isIntrinsicSupported();
protected abstract String getIntrinsicId();
protected boolean isServerVM() {
return javaVmName.toLowerCase().contains("server");
}
static class IntTest extends IntrinsicBase {
protected IntTest(MathIntrinsic.IntIntrinsic testCase) {
super(testCase);
}
@Override
protected boolean isIntrinsicSupported() {
return isServerVM() && Boolean.valueOf(useMathExactIntrinsics) && (Platform.isX86() || Platform.isX64());
}
@Override
protected String getIntrinsicId() {
return "_" + testCase.name().toLowerCase() + "ExactI";
}
}
static class LongTest extends IntrinsicBase {
protected LongTest(MathIntrinsic.LongIntrinsic testCase) {
super(testCase);
}
@Override
protected boolean isIntrinsicSupported() {
return isServerVM() && Boolean.valueOf(useMathExactIntrinsics) && Platform.isX64();
}
@Override
protected String getIntrinsicId() {
return "_" + testCase.name().toLowerCase() + "ExactL";
}
}
}
/*
* Copyright (c) 2013, 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.
*/
import java.lang.reflect.Executable;
import java.util.concurrent.Callable;
public class MathIntrinsic {
enum IntIntrinsic implements CompilerWhiteBoxTest.TestCase {
Add {
@Override
Object execMathMethod() {
return intR = Math.addExact(int1, int2);
}
},
Subtract {
@Override
Object execMathMethod() {
return intR = Math.subtractExact(int1, int2);
}
},
Multiply {
@Override
Object execMathMethod() {
return intR = Math.multiplyExact(int1, int2);
}
},
Increment {
@Override
Object execMathMethod() {
return intR = Math.incrementExact(int1);
}
},
Decrement {
@Override
Object execMathMethod() {
return intR = Math.decrementExact(int1);
}
},
Negate {
@Override
Object execMathMethod() {
return intR = Math.negateExact(int1);
}
};
protected int int1;
protected int int2;
protected int intR;
abstract Object execMathMethod();
@Override
public Executable getExecutable() {
try {
return getClass().getDeclaredMethod("execMathMethod");
} catch (NoSuchMethodException e) {
throw new RuntimeException("Test bug, no such method: " + e);
}
}
@Override
public Callable<Integer> getCallable() {
return null;
}
@Override
public boolean isOsr() {
return false;
}
}
enum LongIntrinsic implements CompilerWhiteBoxTest.TestCase {
Add {
@Override
Object execMathMethod() {
return longR = Math.addExact(long1, long2);
}
},
Subtract {
@Override
Object execMathMethod() {
return longR = Math.subtractExact(long1, long2);
}
},
Multiply {
@Override
Object execMathMethod() {
return longR = Math.multiplyExact(long1, long2);
}
},
Increment {
@Override
Object execMathMethod() {
return longR = Math.incrementExact(long1);
}
},
Decrement {
@Override
Object execMathMethod() {
return longR = Math.decrementExact(long1);
}
},
Negate {
@Override
Object execMathMethod() {
return longR = Math.negateExact(long1);
}
};
protected long long1;
protected long long2;
protected long longR;
abstract Object execMathMethod();
@Override
public Executable getExecutable() {
try {
return getClass().getDeclaredMethod("execMathMethod");
} catch (NoSuchMethodException e) {
throw new RuntimeException("Test bug, no such method: " + e);
}
}
@Override
public Callable<Integer> getCallable() {
return null;
}
@Override
public boolean isOsr() {
return false;
}
}
}
/*
* Copyright (c) 2013, 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
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @build MultiplyExactIntTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics MultiplyExactIntTest
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics MultiplyExactIntTest
* @run main Verifier hs_neg.log hs.log
*/
public class MultiplyExactIntTest {
public static void main(String[] args) throws Exception {
new IntrinsicBase.IntTest(MathIntrinsic.IntIntrinsic.Multiply).test();
}
}
/*
* Copyright (c) 2013, 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
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @build MultiplyExactLongTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics MultiplyExactLongTest
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics MultiplyExactLongTest
* @run main Verifier hs_neg.log hs.log
*/
public class MultiplyExactLongTest {
public static void main(String[] args) throws Exception {
new IntrinsicBase.LongTest(MathIntrinsic.LongIntrinsic.Multiply).test();
}
}
/*
* Copyright (c) 2013, 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
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @build NegateExactIntTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics NegateExactIntTest
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics NegateExactIntTest
* @run main Verifier hs_neg.log hs.log
*/
public class NegateExactIntTest {
public static void main(String[] args) throws Exception {
new IntrinsicBase.IntTest(MathIntrinsic.IntIntrinsic.Negate).test();
}
}
/*
* Copyright (c) 2013, 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
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @build NegateExactLongTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics NegateExactLongTest
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics NegateExactLongTest
* @run main Verifier hs_neg.log hs.log
*/
public class NegateExactLongTest {
public static void main(String[] args) throws Exception {
new IntrinsicBase.LongTest(MathIntrinsic.LongIntrinsic.Negate).test();
}
}
/*
* Copyright (c) 2013, 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
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @build SubtractExactIntTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics SubtractExactIntTest
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics SubtractExactIntTest
* @run main Verifier hs_neg.log hs.log
*/
public class SubtractExactIntTest {
public static void main(String[] args) throws Exception {
new IntrinsicBase.IntTest(MathIntrinsic.IntIntrinsic.Subtract).test();
}
}
/*
* Copyright (c) 2013, 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
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @build SubtractExactLongTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs_neg.log -XX:-UseMathExactIntrinsics SubtractExactLongTest
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics SubtractExactLongTest
* @run main Verifier hs_neg.log hs.log
*/
public class SubtractExactLongTest {
public static void main(String[] args) throws Exception {
new IntrinsicBase.LongTest(MathIntrinsic.LongIntrinsic.Subtract).test();
}
}
/*
* Copyright (c) 2013, 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.
*/
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Properties;
public class Verifier {
public static void main(String[] args) throws Exception {
if (args.length == 0)
throw new RuntimeException("Test bug, nothing to verify");
for (String hsLogFile : args) {
verify(hsLogFile);
}
}
private static void verify(String hsLogFile) throws Exception {
System.out.println("Verifying " + hsLogFile);
final Properties expectedProperties = new Properties();
final FileReader reader = new FileReader(hsLogFile + ".verify.properties");
expectedProperties.load(reader);
reader.close();
int fullMatchCnt = 0;
int suspectCnt = 0;
final String intrinsicId = expectedProperties.getProperty("intrinsic.name");
final String prefix = "<intrinsic id='";
final String prefixWithId = prefix + intrinsicId + "'";
final int expectedCount = Integer.parseInt(expectedProperties.getProperty("intrinsic.expectedCount"));
BufferedReader r = new BufferedReader(new FileReader(hsLogFile));
String s;
while ((s = r.readLine()) != null) {
if (s.startsWith(prefix)) {
if (s.startsWith(prefixWithId)) {
fullMatchCnt++;
} else {
suspectCnt++;
System.out.println("WARNING: Other intrinsic detected " + s);
}
}
}
r.close();
System.out.println("Intrinsic " + intrinsicId + " verification, expected: " + expectedCount + ", matched: " + fullMatchCnt + ", suspected: " + suspectCnt);
if (expectedCount != fullMatchCnt)
throw new RuntimeException("Unexpected count of intrinsic " + prefixWithId + " expected:" + expectedCount + ", matched: " + fullMatchCnt + ", suspected: " + suspectCnt);
}
}
...@@ -30,7 +30,7 @@ import java.util.function.IntPredicate; ...@@ -30,7 +30,7 @@ import java.util.function.IntPredicate;
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:-TieredCompilation * @run main/othervm -Xbootclasspath/a:. -XX:-TieredCompilation
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:CompileCommand=compileonly,TestCase$Helper::* * -XX:CompileCommand=compileonly,SimpleTestCase$Helper::*
* NonTieredLevelsTest * NonTieredLevelsTest
* @summary Verify that only one level can be used * @summary Verify that only one level can be used
* @author igor.ignatyev@oracle.com * @author igor.ignatyev@oracle.com
...@@ -59,9 +59,7 @@ public class NonTieredLevelsTest extends CompLevelsTest { ...@@ -59,9 +59,7 @@ public class NonTieredLevelsTest extends CompLevelsTest {
+ "TieredCompilation. Skip test."); + "TieredCompilation. Skip test.");
return; return;
} }
for (TestCase test : TestCase.values()) { CompilerWhiteBoxTest.main(NonTieredLevelsTest::new, args);
new NonTieredLevelsTest(test).runTest();
}
} }
private NonTieredLevelsTest(TestCase testCase) { private NonTieredLevelsTest(TestCase testCase) {
...@@ -80,7 +78,7 @@ public class NonTieredLevelsTest extends CompLevelsTest { ...@@ -80,7 +78,7 @@ public class NonTieredLevelsTest extends CompLevelsTest {
checkLevel(AVAILABLE_COMP_LEVEL, compLevel); checkLevel(AVAILABLE_COMP_LEVEL, compLevel);
int bci = WHITE_BOX.getMethodEntryBci(method); int bci = WHITE_BOX.getMethodEntryBci(method);
deoptimize(); deoptimize();
if (!testCase.isOsr) { if (!testCase.isOsr()) {
for (int level = 1; level <= COMP_LEVEL_MAX; ++level) { for (int level = 1; level <= COMP_LEVEL_MAX; ++level) {
if (IS_AVAILABLE_COMPLEVEL.test(level)) { if (IS_AVAILABLE_COMPLEVEL.test(level)) {
testAvailableLevel(level, bci); testAvailableLevel(level, bci);
...@@ -94,3 +92,4 @@ public class NonTieredLevelsTest extends CompLevelsTest { ...@@ -94,3 +92,4 @@ public class NonTieredLevelsTest extends CompLevelsTest {
} }
} }
} }
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation * @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:CompileCommand=compileonly,TestCase$Helper::* * -XX:CompileCommand=compileonly,SimpleTestCase$Helper::*
* TieredLevelsTest * TieredLevelsTest
* @summary Verify that all levels &lt; 'TieredStopAtLevel' can be used * @summary Verify that all levels &lt; 'TieredStopAtLevel' can be used
* @author igor.ignatyev@oracle.com * @author igor.ignatyev@oracle.com
...@@ -40,9 +40,7 @@ public class TieredLevelsTest extends CompLevelsTest { ...@@ -40,9 +40,7 @@ public class TieredLevelsTest extends CompLevelsTest {
+ "TieredCompilation. Skip test."); + "TieredCompilation. Skip test.");
return; return;
} }
for (TestCase test : TestCase.values()) { CompilerWhiteBoxTest.main(TieredLevelsTest::new, args);
new TieredLevelsTest(test).runTest();
}
} }
private TieredLevelsTest(TestCase testCase) { private TieredLevelsTest(TestCase testCase) {
......
...@@ -21,25 +21,25 @@ ...@@ -21,25 +21,25 @@
* questions. * questions.
*/ */
import java.util.function.Function;
/* /*
* @test ClearMethodStateTest * @test ClearMethodStateTest
* @bug 8006683 8007288 8022832 * @bug 8006683 8007288 8022832
* @library /testlibrary /testlibrary/whitebox * @library /testlibrary /testlibrary/whitebox
* @build ClearMethodStateTest * @build ClearMethodStateTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* ClearMethodStateTest * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* ClearMethodStateTest
* @summary testing of WB::clearMethodState() * @summary testing of WB::clearMethodState()
* @author igor.ignatyev@oracle.com * @author igor.ignatyev@oracle.com
*/ */
public class ClearMethodStateTest extends CompilerWhiteBoxTest { public class ClearMethodStateTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
for (TestCase test : TestCase.values()) { CompilerWhiteBoxTest.main(ClearMethodStateTest::new, args);
new ClearMethodStateTest(test).runTest();
}
} }
public ClearMethodStateTest(TestCase testCase) { private ClearMethodStateTest(TestCase testCase) {
super(testCase); super(testCase);
// to prevent inlining of #method // to prevent inlining of #method
WHITE_BOX.testSetDontInlineMethod(method, true); WHITE_BOX.testSetDontInlineMethod(method, true);
...@@ -63,7 +63,7 @@ public class ClearMethodStateTest extends CompilerWhiteBoxTest { ...@@ -63,7 +63,7 @@ public class ClearMethodStateTest extends CompilerWhiteBoxTest {
deoptimize(); deoptimize();
checkNotCompiled(); checkNotCompiled();
if (testCase.isOsr) { if (testCase.isOsr()) {
// part test isn't applicable for OSR test case // part test isn't applicable for OSR test case
return; return;
} }
......
...@@ -31,6 +31,7 @@ import java.lang.reflect.Executable; ...@@ -31,6 +31,7 @@ import java.lang.reflect.Executable;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.function.Function;
/** /**
* Abstract class for WhiteBox testing of JIT. * Abstract class for WhiteBox testing of JIT.
...@@ -50,7 +51,7 @@ public abstract class CompilerWhiteBoxTest { ...@@ -50,7 +51,7 @@ public abstract class CompilerWhiteBoxTest {
protected static int COMP_LEVEL_FULL_PROFILE = 3; protected static int COMP_LEVEL_FULL_PROFILE = 3;
/** {@code CompLevel::CompLevel_full_optimization} -- C2 or Shark */ /** {@code CompLevel::CompLevel_full_optimization} -- C2 or Shark */
protected static int COMP_LEVEL_FULL_OPTIMIZATION = 4; protected static int COMP_LEVEL_FULL_OPTIMIZATION = 4;
/** Maximal value for CompLeveL */ /** Maximal value for CompLevel */
protected static int COMP_LEVEL_MAX = COMP_LEVEL_FULL_OPTIMIZATION; protected static int COMP_LEVEL_MAX = COMP_LEVEL_FULL_OPTIMIZATION;
/** Instance of WhiteBox */ /** Instance of WhiteBox */
...@@ -75,8 +76,7 @@ public abstract class CompilerWhiteBoxTest { ...@@ -75,8 +76,7 @@ public abstract class CompilerWhiteBoxTest {
/** count of invocation to triger OSR compilation */ /** count of invocation to triger OSR compilation */
protected static final long BACKEDGE_THRESHOLD; protected static final long BACKEDGE_THRESHOLD;
/** Value of {@code java.vm.info} (interpreted|mixed|comp mode) */ /** Value of {@code java.vm.info} (interpreted|mixed|comp mode) */
protected static final String MODE protected static final String MODE = System.getProperty("java.vm.info");
= System.getProperty("java.vm.info");
static { static {
if (TIERED_COMPILATION) { if (TIERED_COMPILATION) {
...@@ -133,6 +133,20 @@ public abstract class CompilerWhiteBoxTest { ...@@ -133,6 +133,20 @@ public abstract class CompilerWhiteBoxTest {
return compLevel == COMP_LEVEL_FULL_OPTIMIZATION; return compLevel == COMP_LEVEL_FULL_OPTIMIZATION;
} }
protected static void main(
Function<TestCase, CompilerWhiteBoxTest> constructor,
String[] args) {
if (args.length == 0) {
for (TestCase test : SimpleTestCase.values()) {
constructor.apply(test).runTest();
}
} else {
for (String name : args) {
constructor.apply(SimpleTestCase.valueOf(name)).runTest();
}
}
}
/** tested method */ /** tested method */
protected final Executable method; protected final Executable method;
protected final TestCase testCase; protected final TestCase testCase;
...@@ -145,7 +159,7 @@ public abstract class CompilerWhiteBoxTest { ...@@ -145,7 +159,7 @@ public abstract class CompilerWhiteBoxTest {
protected CompilerWhiteBoxTest(TestCase testCase) { protected CompilerWhiteBoxTest(TestCase testCase) {
Objects.requireNonNull(testCase); Objects.requireNonNull(testCase);
System.out.println("TEST CASE:" + testCase.name()); System.out.println("TEST CASE:" + testCase.name());
method = testCase.executable; method = testCase.getExecutable();
this.testCase = testCase; this.testCase = testCase;
} }
...@@ -204,7 +218,7 @@ public abstract class CompilerWhiteBoxTest { ...@@ -204,7 +218,7 @@ public abstract class CompilerWhiteBoxTest {
if (WHITE_BOX.getMethodCompilationLevel(method, true) != 0) { if (WHITE_BOX.getMethodCompilationLevel(method, true) != 0) {
throw new RuntimeException(method + " osr_comp_level must be == 0"); throw new RuntimeException(method + " osr_comp_level must be == 0");
} }
} }
/** /**
* Checks, that {@linkplain #method} is compiled. * Checks, that {@linkplain #method} is compiled.
...@@ -221,44 +235,46 @@ public abstract class CompilerWhiteBoxTest { ...@@ -221,44 +235,46 @@ public abstract class CompilerWhiteBoxTest {
method, System.currentTimeMillis() - start); method, System.currentTimeMillis() - start);
return; return;
} }
if (!WHITE_BOX.isMethodCompiled(method, testCase.isOsr)) { if (!WHITE_BOX.isMethodCompiled(method, testCase.isOsr())) {
throw new RuntimeException(method + " must be " throw new RuntimeException(method + " must be "
+ (testCase.isOsr ? "osr_" : "") + "compiled"); + (testCase.isOsr() ? "osr_" : "") + "compiled");
} }
if (WHITE_BOX.getMethodCompilationLevel(method, testCase.isOsr) == 0) { if (WHITE_BOX.getMethodCompilationLevel(method, testCase.isOsr())
== 0) {
throw new RuntimeException(method throw new RuntimeException(method
+ (testCase.isOsr ? " osr_" : " ") + (testCase.isOsr() ? " osr_" : " ")
+ "comp_level must be != 0"); + "comp_level must be != 0");
} }
} }
protected final void deoptimize() { protected final void deoptimize() {
WHITE_BOX.deoptimizeMethod(method, testCase.isOsr); WHITE_BOX.deoptimizeMethod(method, testCase.isOsr());
if (testCase.isOsr) { if (testCase.isOsr()) {
WHITE_BOX.deoptimizeMethod(method, false); WHITE_BOX.deoptimizeMethod(method, false);
} }
} }
protected final int getCompLevel() { protected final int getCompLevel() {
return WHITE_BOX.getMethodCompilationLevel(method, testCase.isOsr); return WHITE_BOX.getMethodCompilationLevel(method, testCase.isOsr());
} }
protected final boolean isCompilable() { protected final boolean isCompilable() {
return WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, return WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY,
testCase.isOsr); testCase.isOsr());
} }
protected final boolean isCompilable(int compLevel) { protected final boolean isCompilable(int compLevel) {
return WHITE_BOX.isMethodCompilable(method, compLevel, testCase.isOsr); return WHITE_BOX
.isMethodCompilable(method, compLevel, testCase.isOsr());
} }
protected final void makeNotCompilable() { protected final void makeNotCompilable() {
WHITE_BOX.makeMethodNotCompilable(method, COMP_LEVEL_ANY, WHITE_BOX.makeMethodNotCompilable(method, COMP_LEVEL_ANY,
testCase.isOsr); testCase.isOsr());
} }
protected final void makeNotCompilable(int compLevel) { protected final void makeNotCompilable(int compLevel) {
WHITE_BOX.makeMethodNotCompilable(method, compLevel, testCase.isOsr); WHITE_BOX.makeMethodNotCompilable(method, compLevel, testCase.isOsr());
} }
/** /**
...@@ -298,7 +314,7 @@ public abstract class CompilerWhiteBoxTest { ...@@ -298,7 +314,7 @@ public abstract class CompilerWhiteBoxTest {
WHITE_BOX.isMethodCompiled(method, true)); WHITE_BOX.isMethodCompiled(method, true));
System.out.printf("\tosr_comp_level:\t%d%n", System.out.printf("\tosr_comp_level:\t%d%n",
WHITE_BOX.getMethodCompilationLevel(method, true)); WHITE_BOX.getMethodCompilationLevel(method, true));
System.out.printf("\tin_queue:\t%b%n", System.out.printf("\tin_queue:\t%b%n",
WHITE_BOX.isMethodQueuedForCompilation(method)); WHITE_BOX.isMethodQueuedForCompilation(method));
System.out.printf("compile_queues_size:\t%d%n%n", System.out.printf("compile_queues_size:\t%d%n%n",
WHITE_BOX.getCompileQueuesSize()); WHITE_BOX.getCompileQueuesSize());
...@@ -311,13 +327,13 @@ public abstract class CompilerWhiteBoxTest { ...@@ -311,13 +327,13 @@ public abstract class CompilerWhiteBoxTest {
/** /**
* Tries to trigger compilation of {@linkplain #method} by call * Tries to trigger compilation of {@linkplain #method} by call
* {@linkplain #testCase.callable} enough times. * {@linkplain TestCase#getCallable()} enough times.
* *
* @return accumulated result * @return accumulated result
* @see #compile(int) * @see #compile(int)
*/ */
protected final int compile() { protected final int compile() {
if (testCase.isOsr) { if (testCase.isOsr()) {
return compile(1); return compile(1);
} else { } else {
return compile(THRESHOLD); return compile(THRESHOLD);
...@@ -326,7 +342,7 @@ public abstract class CompilerWhiteBoxTest { ...@@ -326,7 +342,7 @@ public abstract class CompilerWhiteBoxTest {
/** /**
* Tries to trigger compilation of {@linkplain #method} by call * Tries to trigger compilation of {@linkplain #method} by call
* {@linkplain #testCase.callable} specified times. * {@linkplain TestCase#getCallable()} specified times.
* *
* @param count invocation count * @param count invocation count
* @return accumulated result * @return accumulated result
...@@ -336,7 +352,7 @@ public abstract class CompilerWhiteBoxTest { ...@@ -336,7 +352,7 @@ public abstract class CompilerWhiteBoxTest {
Integer tmp; Integer tmp;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
try { try {
tmp = testCase.callable.call(); tmp = testCase.getCallable().call();
} catch (Exception e) { } catch (Exception e) {
tmp = null; tmp = null;
} }
...@@ -347,19 +363,32 @@ public abstract class CompilerWhiteBoxTest { ...@@ -347,19 +363,32 @@ public abstract class CompilerWhiteBoxTest {
} }
return result; return result;
} }
/**
* Utility interface provides tested method and object to invoke it.
*/
public interface TestCase {
/** the name of test case */
String name();
/** tested method */
Executable getExecutable();
/** object to invoke {@linkplain #getExecutable()} */
Callable<Integer> getCallable();
/** flag for OSR test case */
boolean isOsr();
}
} }
/** enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
* Utility structure containing tested method and object to invoke it.
*/
enum TestCase {
/** constructor test case */ /** constructor test case */
CONSTRUCTOR_TEST(Helper.CONSTRUCTOR, Helper.CONSTRUCTOR_CALLABLE, false), CONSTRUCTOR_TEST(Helper.CONSTRUCTOR, Helper.CONSTRUCTOR_CALLABLE, false),
/** method test case */ /** method test case */
METOD_TEST(Helper.METHOD, Helper.METHOD_CALLABLE, false), METOD_TEST(Helper.METHOD, Helper.METHOD_CALLABLE, false),
/** static method test case */ /** static method test case */
STATIC_TEST(Helper.STATIC, Helper.STATIC_CALLABLE, false), STATIC_TEST(Helper.STATIC, Helper.STATIC_CALLABLE, false),
/** OSR constructor test case */ /** OSR constructor test case */
OSR_CONSTRUCTOR_TEST(Helper.OSR_CONSTRUCTOR, OSR_CONSTRUCTOR_TEST(Helper.OSR_CONSTRUCTOR,
Helper.OSR_CONSTRUCTOR_CALLABLE, true), Helper.OSR_CONSTRUCTOR_CALLABLE, true),
...@@ -368,20 +397,32 @@ enum TestCase { ...@@ -368,20 +397,32 @@ enum TestCase {
/** OSR static method test case */ /** OSR static method test case */
OSR_STATIC_TEST(Helper.OSR_STATIC, Helper.OSR_STATIC_CALLABLE, true); OSR_STATIC_TEST(Helper.OSR_STATIC, Helper.OSR_STATIC_CALLABLE, true);
/** tested method */ private final Executable executable;
final Executable executable; private final Callable<Integer> callable;
/** object to invoke {@linkplain #executable} */ private final boolean isOsr;
final Callable<Integer> callable;
/** flag for OSR test case */
final boolean isOsr;
private TestCase(Executable executable, Callable<Integer> callable, private SimpleTestCase(Executable executable, Callable<Integer> callable,
boolean isOsr) { boolean isOsr) {
this.executable = executable; this.executable = executable;
this.callable = callable; this.callable = callable;
this.isOsr = isOsr; this.isOsr = isOsr;
} }
@Override
public Executable getExecutable() {
return executable;
}
@Override
public Callable<Integer> getCallable() {
return callable;
}
@Override
public boolean isOsr() {
return isOsr;
}
private static class Helper { private static class Helper {
private static final Callable<Integer> CONSTRUCTOR_CALLABLE private static final Callable<Integer> CONSTRUCTOR_CALLABLE
...@@ -436,7 +477,6 @@ enum TestCase { ...@@ -436,7 +477,6 @@ enum TestCase {
} }
}; };
private static final Constructor CONSTRUCTOR; private static final Constructor CONSTRUCTOR;
private static final Constructor OSR_CONSTRUCTOR; private static final Constructor OSR_CONSTRUCTOR;
private static final Method METHOD; private static final Method METHOD;
......
...@@ -27,19 +27,17 @@ ...@@ -27,19 +27,17 @@
* @library /testlibrary /testlibrary/whitebox * @library /testlibrary /testlibrary/whitebox
* @build DeoptimizeAllTest * @build DeoptimizeAllTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* DeoptimizeAllTest * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* DeoptimizeAllTest
* @summary testing of WB::deoptimizeAll() * @summary testing of WB::deoptimizeAll()
* @author igor.ignatyev@oracle.com * @author igor.ignatyev@oracle.com
*/ */
public class DeoptimizeAllTest extends CompilerWhiteBoxTest { public class DeoptimizeAllTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
for (TestCase test : TestCase.values()) { CompilerWhiteBoxTest.main(DeoptimizeAllTest::new, args);
new DeoptimizeAllTest(test).runTest();
}
} }
public DeoptimizeAllTest(TestCase testCase) { private DeoptimizeAllTest(TestCase testCase) {
super(testCase); super(testCase);
// to prevent inlining of #method // to prevent inlining of #method
WHITE_BOX.testSetDontInlineMethod(method, true); WHITE_BOX.testSetDontInlineMethod(method, true);
...@@ -53,7 +51,7 @@ public class DeoptimizeAllTest extends CompilerWhiteBoxTest { ...@@ -53,7 +51,7 @@ public class DeoptimizeAllTest extends CompilerWhiteBoxTest {
*/ */
@Override @Override
protected void test() throws Exception { protected void test() throws Exception {
if (testCase.isOsr && CompilerWhiteBoxTest.MODE.startsWith( if (testCase.isOsr() && CompilerWhiteBoxTest.MODE.startsWith(
"compiled ")) { "compiled ")) {
System.err.printf("Warning: %s is not applicable in %s%n", System.err.printf("Warning: %s is not applicable in %s%n",
testCase.name(), CompilerWhiteBoxTest.MODE); testCase.name(), CompilerWhiteBoxTest.MODE);
......
...@@ -27,19 +27,17 @@ ...@@ -27,19 +27,17 @@
* @library /testlibrary /testlibrary/whitebox * @library /testlibrary /testlibrary/whitebox
* @build DeoptimizeMethodTest * @build DeoptimizeMethodTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* DeoptimizeMethodTest * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* DeoptimizeMethodTest
* @summary testing of WB::deoptimizeMethod() * @summary testing of WB::deoptimizeMethod()
* @author igor.ignatyev@oracle.com * @author igor.ignatyev@oracle.com
*/ */
public class DeoptimizeMethodTest extends CompilerWhiteBoxTest { public class DeoptimizeMethodTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
for (TestCase test : TestCase.values()) { CompilerWhiteBoxTest.main(DeoptimizeMethodTest::new, args);
new DeoptimizeMethodTest(test).runTest();
}
} }
public DeoptimizeMethodTest(TestCase testCase) { private DeoptimizeMethodTest(TestCase testCase) {
super(testCase); super(testCase);
// to prevent inlining of #method // to prevent inlining of #method
WHITE_BOX.testSetDontInlineMethod(method, true); WHITE_BOX.testSetDontInlineMethod(method, true);
...@@ -53,7 +51,7 @@ public class DeoptimizeMethodTest extends CompilerWhiteBoxTest { ...@@ -53,7 +51,7 @@ public class DeoptimizeMethodTest extends CompilerWhiteBoxTest {
*/ */
@Override @Override
protected void test() throws Exception { protected void test() throws Exception {
if (testCase.isOsr && CompilerWhiteBoxTest.MODE.startsWith( if (testCase.isOsr() && CompilerWhiteBoxTest.MODE.startsWith(
"compiled ")) { "compiled ")) {
System.err.printf("Warning: %s is not applicable in %s%n", System.err.printf("Warning: %s is not applicable in %s%n",
testCase.name(), CompilerWhiteBoxTest.MODE); testCase.name(), CompilerWhiteBoxTest.MODE);
......
...@@ -27,19 +27,17 @@ ...@@ -27,19 +27,17 @@
* @library /testlibrary /testlibrary/whitebox * @library /testlibrary /testlibrary/whitebox
* @build EnqueueMethodForCompilationTest * @build EnqueueMethodForCompilationTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* EnqueueMethodForCompilationTest * @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* EnqueueMethodForCompilationTest
* @summary testing of WB::enqueueMethodForCompilation() * @summary testing of WB::enqueueMethodForCompilation()
* @author igor.ignatyev@oracle.com * @author igor.ignatyev@oracle.com
*/ */
public class EnqueueMethodForCompilationTest extends CompilerWhiteBoxTest { public class EnqueueMethodForCompilationTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
for (TestCase test : TestCase.values()) { CompilerWhiteBoxTest.main(EnqueueMethodForCompilationTest::new, args);
new EnqueueMethodForCompilationTest(test).runTest();
}
} }
public EnqueueMethodForCompilationTest(TestCase testCase) { private EnqueueMethodForCompilationTest(TestCase testCase) {
super(testCase); super(testCase);
// to prevent inlining of #method // to prevent inlining of #method
WHITE_BOX.testSetDontInlineMethod(method, true); WHITE_BOX.testSetDontInlineMethod(method, true);
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
* @library /testlibrary /testlibrary/whitebox * @library /testlibrary /testlibrary/whitebox
* @build IsMethodCompilableTest * @build IsMethodCompilableTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* IsMethodCompilableTest * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* IsMethodCompilableTest
* @summary testing of WB::isMethodCompilable() * @summary testing of WB::isMethodCompilable()
* @author igor.ignatyev@oracle.com * @author igor.ignatyev@oracle.com
*/ */
...@@ -48,12 +48,10 @@ public class IsMethodCompilableTest extends CompilerWhiteBoxTest { ...@@ -48,12 +48,10 @@ public class IsMethodCompilableTest extends CompilerWhiteBoxTest {
} }
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
for (TestCase test : TestCase.values()) { CompilerWhiteBoxTest.main(IsMethodCompilableTest::new, args);
new IsMethodCompilableTest(test).runTest();
}
} }
public IsMethodCompilableTest(TestCase testCase) { private IsMethodCompilableTest(TestCase testCase) {
super(testCase); super(testCase);
// to prevent inlining of #method // to prevent inlining of #method
WHITE_BOX.testSetDontInlineMethod(method, true); WHITE_BOX.testSetDontInlineMethod(method, true);
...@@ -68,7 +66,7 @@ public class IsMethodCompilableTest extends CompilerWhiteBoxTest { ...@@ -68,7 +66,7 @@ public class IsMethodCompilableTest extends CompilerWhiteBoxTest {
*/ */
@Override @Override
protected void test() throws Exception { protected void test() throws Exception {
if (testCase.isOsr && CompilerWhiteBoxTest.MODE.startsWith( if (testCase.isOsr() && CompilerWhiteBoxTest.MODE.startsWith(
"compiled ")) { "compiled ")) {
System.err.printf("Warning: %s is not applicable in %s%n", System.err.printf("Warning: %s is not applicable in %s%n",
testCase.name(), CompilerWhiteBoxTest.MODE); testCase.name(), CompilerWhiteBoxTest.MODE);
...@@ -89,7 +87,7 @@ public class IsMethodCompilableTest extends CompilerWhiteBoxTest { ...@@ -89,7 +87,7 @@ public class IsMethodCompilableTest extends CompilerWhiteBoxTest {
for (long i = 0L, n = PER_METHOD_RECOMPILATION_CUTOFF - 1; i < n; ++i) { for (long i = 0L, n = PER_METHOD_RECOMPILATION_CUTOFF - 1; i < n; ++i) {
compileAndDeoptimize(); compileAndDeoptimize();
} }
if (!testCase.isOsr && !isCompilable()) { if (!testCase.isOsr() && !isCompilable()) {
// in osr test case count of deopt maybe more than iterations // in osr test case count of deopt maybe more than iterations
throw new RuntimeException(method + " is not compilable after " throw new RuntimeException(method + " is not compilable after "
+ (PER_METHOD_RECOMPILATION_CUTOFF - 1) + " iterations"); + (PER_METHOD_RECOMPILATION_CUTOFF - 1) + " iterations");
...@@ -102,7 +100,7 @@ public class IsMethodCompilableTest extends CompilerWhiteBoxTest { ...@@ -102,7 +100,7 @@ public class IsMethodCompilableTest extends CompilerWhiteBoxTest {
&& isCompilable(); ++i) { && isCompilable(); ++i) {
compileAndDeoptimize(); compileAndDeoptimize();
} }
if (!testCase.isOsr && i != PER_METHOD_RECOMPILATION_CUTOFF) { if (!testCase.isOsr() && i != PER_METHOD_RECOMPILATION_CUTOFF) {
// in osr test case count of deopt maybe more than iterations // in osr test case count of deopt maybe more than iterations
throw new RuntimeException(method + " is not compilable after " throw new RuntimeException(method + " is not compilable after "
+ i + " iterations, but must only after " + i + " iterations, but must only after "
......
...@@ -27,26 +27,17 @@ ...@@ -27,26 +27,17 @@
* @library /testlibrary /testlibrary/whitebox * @library /testlibrary /testlibrary/whitebox
* @build MakeMethodNotCompilableTest * @build MakeMethodNotCompilableTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* MakeMethodNotCompilableTest * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* MakeMethodNotCompilableTest
* @summary testing of WB::makeMethodNotCompilable() * @summary testing of WB::makeMethodNotCompilable()
* @author igor.ignatyev@oracle.com * @author igor.ignatyev@oracle.com
*/ */
public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest { public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest {
private int bci; private int bci;
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
if (args.length == 0) { CompilerWhiteBoxTest.main(MakeMethodNotCompilableTest::new, args);
for (TestCase test : TestCase.values()) {
new MakeMethodNotCompilableTest(test).runTest();
}
} else {
for (String name : args) {
new MakeMethodNotCompilableTest(
TestCase.valueOf(name)).runTest();
}
}
} }
public MakeMethodNotCompilableTest(TestCase testCase) { private MakeMethodNotCompilableTest(TestCase testCase) {
super(testCase); super(testCase);
// to prevent inlining of #method // to prevent inlining of #method
WHITE_BOX.testSetDontInlineMethod(method, true); WHITE_BOX.testSetDontInlineMethod(method, true);
...@@ -62,7 +53,7 @@ public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest { ...@@ -62,7 +53,7 @@ public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest {
*/ */
@Override @Override
protected void test() throws Exception { protected void test() throws Exception {
if (testCase.isOsr && CompilerWhiteBoxTest.MODE.startsWith( if (testCase.isOsr() && CompilerWhiteBoxTest.MODE.startsWith(
"compiled ")) { "compiled ")) {
System.err.printf("Warning: %s is not applicable in %s%n", System.err.printf("Warning: %s is not applicable in %s%n",
testCase.name(), CompilerWhiteBoxTest.MODE); testCase.name(), CompilerWhiteBoxTest.MODE);
......
...@@ -27,19 +27,17 @@ ...@@ -27,19 +27,17 @@
* @library /testlibrary /testlibrary/whitebox * @library /testlibrary /testlibrary/whitebox
* @build SetDontInlineMethodTest * @build SetDontInlineMethodTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* SetDontInlineMethodTest * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* SetDontInlineMethodTest
* @summary testing of WB::testSetDontInlineMethod() * @summary testing of WB::testSetDontInlineMethod()
* @author igor.ignatyev@oracle.com * @author igor.ignatyev@oracle.com
*/ */
public class SetDontInlineMethodTest extends CompilerWhiteBoxTest { public class SetDontInlineMethodTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
for (TestCase test : TestCase.values()) { CompilerWhiteBoxTest.main(SetDontInlineMethodTest::new, args);
new SetDontInlineMethodTest(test).runTest();
}
} }
public SetDontInlineMethodTest(TestCase testCase) { private SetDontInlineMethodTest(TestCase testCase) {
super(testCase); super(testCase);
} }
......
...@@ -27,19 +27,17 @@ ...@@ -27,19 +27,17 @@
* @library /testlibrary /testlibrary/whitebox * @library /testlibrary /testlibrary/whitebox
* @build SetForceInlineMethodTest * @build SetForceInlineMethodTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* SetForceInlineMethodTest * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* SetForceInlineMethodTest
* @summary testing of WB::testSetForceInlineMethod() * @summary testing of WB::testSetForceInlineMethod()
* @author igor.ignatyev@oracle.com * @author igor.ignatyev@oracle.com
*/ */
public class SetForceInlineMethodTest extends CompilerWhiteBoxTest { public class SetForceInlineMethodTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
for (TestCase test : TestCase.values()) { CompilerWhiteBoxTest.main(SetForceInlineMethodTest::new, args);
new SetForceInlineMethodTest(test).runTest();
}
} }
public SetForceInlineMethodTest(TestCase testCase) { private SetForceInlineMethodTest(TestCase testCase) {
super(testCase); super(testCase);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册