Search in sources :

Example 26 with OptOptions

use of org.jikesrvm.compilers.opt.OptOptions in project JikesRVM by JikesRVM.

the class OptTestHarnessTest method commandLineArgumentFileSupportsComments.

@Test
@Category(RequiresOptCompiler.class)
public void commandLineArgumentFileSupportsComments() throws Exception {
    fileAccess = new TestFileAccess();
    String fileName = "commandLineArgsForLongCommandLineTestWithComments";
    String fileContent = "-baseline\n" + "#" + "+baseline\n";
    fileAccess.putContentForFile(fileName, fileContent);
    String[] longCommandLine = { "-longcommandline", fileName };
    output = new TestOutput();
    OptTestHarness oth = new OptTestHarness(output, new OptOptions(), fileAccess);
    oth.mainMethod(longCommandLine);
    assertThatNoAdditionalErrorsHaveOccurred();
    assertThat(oth.useBaselineCompiler, is(false));
}
Also used : OptOptions(org.jikesrvm.compilers.opt.OptOptions) Category(org.junit.experimental.categories.Category) Test(org.junit.Test)

Example 27 with OptOptions

use of org.jikesrvm.compilers.opt.OptOptions in project JikesRVM by JikesRVM.

the class OptTestHarnessTest method executeOptTestHarness.

private OptTestHarness executeOptTestHarness(String[] commandLineArguments) throws InvocationTargetException, IllegalAccessException {
    output = new TestOutput();
    fileAccess = new TestFileAccess();
    OptTestHarness oth = new OptTestHarness(output, new OptOptions(), fileAccess);
    oth.mainMethod(commandLineArguments);
    return oth;
}
Also used : OptOptions(org.jikesrvm.compilers.opt.OptOptions)

Example 28 with OptOptions

use of org.jikesrvm.compilers.opt.OptOptions in project JikesRVM by JikesRVM.

the class OptTestHarnessTest method readingNonExistingFileCausesError.

@Test
public void readingNonExistingFileCausesError() throws Exception {
    String fileName = "fileWhichWillNeverExist";
    fileAccess = new TestFileAccess();
    String[] longCommandLine = { "-longcommandline", fileName };
    output = new TestOutput();
    OptTestHarness oth = new OptTestHarness(output, new OptOptions(), fileAccess);
    oth.mainMethod(longCommandLine);
    String fileNotFoundLineStart = "java.io.FileNotFoundException: ";
    String firstLineOfStackTrace = fileNotFoundLineStart + fileName + lineEnd;
    assertThat(getErrorOutput().startsWith(firstLineOfStackTrace), is(true));
}
Also used : OptOptions(org.jikesrvm.compilers.opt.OptOptions) Test(org.junit.Test)

Example 29 with OptOptions

use of org.jikesrvm.compilers.opt.OptOptions in project JikesRVM by JikesRVM.

the class OptTestHarnessTest method supportsPerformanceMeasurements.

@Test
public void supportsPerformanceMeasurements() throws Exception {
    String[] args = { "-performance" };
    output = new TestOutput();
    OptTestHarness oth = new OptTestHarness(output, new OptOptions(), new TestFileAccess());
    oth.addCallbackForPerformancePrintout = false;
    oth.mainMethod(args);
    assertThatNoAdditionalErrorsHaveOccurred();
    assertThatNumberOfBaselineCompiledMethodsIs(0);
    assertThatNumberOfOptCompiledMethodsIs(0);
    String output = getStandardOutput();
    String patternString = "\nPerformance of executed method\n" + "------------------------------\n" + "Elapsed wallclock time: ";
    patternString += "(\\d+\\.\\d+E\\d+)";
    patternString += " msec\n";
    Pattern p = Pattern.compile(patternString);
    Matcher m = p.matcher(output);
    assertThat(m.matches(), is(true));
}
Also used : Pattern(java.util.regex.Pattern) Matcher(java.util.regex.Matcher) OptOptions(org.jikesrvm.compilers.opt.OptOptions) Test(org.junit.Test)

Example 30 with OptOptions

use of org.jikesrvm.compilers.opt.OptOptions in project JikesRVM by JikesRVM.

the class OptTestHarnessTest method canReadCommandLineArgumentsFromFile.

@Test
public void canReadCommandLineArgumentsFromFile() throws Exception {
    String fileName = "commandLineArgsForLongCommandLineTest";
    fileAccess = new TestFileAccess();
    String fileContent = "-er\n" + CLASS_WITH_STATIC_METHOD + lineEnd + "printMessage\n" + "-\n";
    fileAccess.putContentForFile(fileName, fileContent);
    String[] longCommandLine = { "-longcommandline", fileName };
    try {
        output = new TestOutput();
        redirectStandardStreams();
        OptTestHarness oth = new OptTestHarness(output, new OptOptions(), fileAccess);
        oth.mainMethod(longCommandLine);
    } finally {
        resetStandardStreams();
    }
    assertThatNoAdditionalErrorsHaveOccurred();
}
Also used : OptOptions(org.jikesrvm.compilers.opt.OptOptions) Test(org.junit.Test)

Aggregations

OptOptions (org.jikesrvm.compilers.opt.OptOptions)70 Test (org.junit.Test)48 NormalMethod (org.jikesrvm.classloader.NormalMethod)45 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)32 OptCompiledMethod (org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod)29 DefaultInlineOracle (org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle)28 InlineOracle (org.jikesrvm.compilers.opt.inlining.InlineOracle)28 RegisterOperand (org.jikesrvm.compilers.opt.ir.operand.RegisterOperand)27 Instruction (org.jikesrvm.compilers.opt.ir.Instruction)19 InlineSequence (org.jikesrvm.compilers.opt.inlining.InlineSequence)17 ExceptionHandlerBasicBlockBag (org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlockBag)14 MethodOperand (org.jikesrvm.compilers.opt.ir.operand.MethodOperand)13 TypeReference (org.jikesrvm.classloader.TypeReference)12 BasicBlock (org.jikesrvm.compilers.opt.ir.BasicBlock)12 ExceptionHandlerBasicBlock (org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlock)12 Register (org.jikesrvm.compilers.opt.ir.Register)12 Operand (org.jikesrvm.compilers.opt.ir.operand.Operand)8 TrueGuardOperand (org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand)8 ClassConstantOperand (org.jikesrvm.compilers.opt.ir.operand.ClassConstantOperand)7 ObjectConstantOperand (org.jikesrvm.compilers.opt.ir.operand.ObjectConstantOperand)7