Search in sources :

Example 31 with OptOptions

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

the class OptTestHarnessTest method readingEmptyFilesDoesNotCauseProblems.

@Test
public void readingEmptyFilesDoesNotCauseProblems() throws Exception {
    String fileName = "emptyFile";
    fileAccess = new TestFileAccess();
    fileAccess.putContentForFile(fileName, "");
    String[] longCommandLine = { "-longcommandline", fileName };
    output = new TestOutput();
    OptTestHarness oth = new OptTestHarness(output, new OptOptions(), fileAccess);
    oth.mainMethod(longCommandLine);
    assertThatNumberOfBaselineCompiledMethodsIs(0);
    assertThatNumberOfOptCompiledMethodsIs(0);
    assertThatRemainingOutputIsEmptyWhenTrimmed();
    assertThatNoAdditionalErrorsHaveOccurred();
}
Also used : OptOptions(org.jikesrvm.compilers.opt.OptOptions) Test(org.junit.Test)

Example 32 with OptOptions

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

the class InvocationCounts method createOptimizationPlan.

/**
 * Create the default set of <optimization plan, options> pairs
 * Process optimizing compiler command line options.
 */
static void createOptimizationPlan() {
    _options = new OptOptions();
    int optLevel = Controller.options.INVOCATION_COUNT_OPT_LEVEL;
    String[] optCompilerOptions = Controller.getOptCompilerOptions();
    _options.setOptLevel(optLevel);
    RecompilationStrategy.processCommandLineOptions(_options, optLevel, optLevel, optCompilerOptions);
    _optPlan = OptimizationPlanner.createOptimizationPlan(_options);
}
Also used : OptOptions(org.jikesrvm.compilers.opt.OptOptions) Entrypoint(org.vmmagic.pragma.Entrypoint)

Example 33 with OptOptions

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

the class RecompilationStrategy method createOptimizationPlans.

/**
 * Creates the default set of <optimization plan, options> pairs.
 * Processes optimizing compiler command line options.
 */
void createOptimizationPlans() {
    OptOptions options = new OptOptions();
    int maxOptLevel = getMaxOptLevel();
    _options = new OptOptions[maxOptLevel + 1];
    _optPlans = new OptimizationPlanElement[maxOptLevel + 1][];
    String[] optCompilerOptions = Controller.getOptCompilerOptions();
    for (int i = 0; i <= maxOptLevel; i++) {
        _options[i] = options.dup();
        // set optimization level specific optimizations
        _options[i].setOptLevel(i);
        processCommandLineOptions(_options[i], i, maxOptLevel, optCompilerOptions);
        _optPlans[i] = OptimizationPlanner.createOptimizationPlan(_options[i]);
    }
}
Also used : OptOptions(org.jikesrvm.compilers.opt.OptOptions)

Example 34 with OptOptions

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

the class InvokeeThreadLocalContext method init.

/**
 * Initialize static members.
 */
public static void init() {
    options = new OptOptions();
    optimizationPlan = OptimizationPlanner.createOptimizationPlan(options);
    // all objects in the specialized method will be thread local
    options.ESCAPE_INVOKEE_THREAD_LOCAL = true;
}
Also used : OptOptions(org.jikesrvm.compilers.opt.OptOptions)

Example 35 with OptOptions

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

the class GenerationContextTest method prologueAndEpilogueForSynchronizedStaticMethodHaveMonitorEnterAndExit.

@Test
public void prologueAndEpilogueForSynchronizedStaticMethodHaveMonitorEnterAndExit() throws Exception {
    NormalMethod nm = getNormalMethodForTest("emptySynchronizedStaticMethod");
    CompiledMethod cm = new OptCompiledMethod(-1, nm);
    OptOptions opts = new OptOptions();
    InlineOracle io = new DefaultInlineOracle();
    GenerationContext gc = new GenerationContext(nm, null, cm, opts, io);
    InlineSequence inlineSequence = new InlineSequence(nm);
    assertThatInlineSequenceWasSetCorrectly(gc, inlineSequence);
    assertThatNumberOfParametersIs(gc, 0);
    BasicBlock prologue = gc.getPrologue();
    assertThatPrologueBlockIsSetupCorrectly(gc, inlineSequence, prologue);
    assertThatFirstInstructionInPrologueIsPrologue(inlineSequence, prologue);
    Enumeration<Instruction> prologueInstructions = prologue.forwardRealInstrEnumerator();
    prologueInstructions.nextElement();
    Instruction secondInstruction = prologueInstructions.nextElement();
    assertInstructionIsMonitorEnterInPrologue(secondInstruction, inlineSequence);
    assertThatGuardIsCorrectForMonitorEnter(secondInstruction);
    Operand lockObject = MonitorOp.getRef(secondInstruction);
    Operand expectedLockObject = buildLockObjectForStaticMethod(nm);
    assertTrue(expectedLockObject.similar(lockObject));
    assertThatNumberOfRealInstructionsMatches(prologue, 2);
    BasicBlock epilogue = gc.getEpilogue();
    assertThatEpilogueBlockIsSetupCorrectly(gc, inlineSequence, epilogue);
    assertThatFirstInstructionEpilogueIsMonitorExit(inlineSequence, epilogue);
    assertThatLastInstructionInEpilogueIsReturn(gc, epilogue);
    assertThatReturnInstructionReturnsVoid(epilogue);
    assertThatNumberOfRealInstructionsMatches(epilogue, 2);
    assertThatExitBlockIsSetCorrectly(gc);
    assertThatRegisterPoolExists(gc);
    assertThatDataIsSavedCorrectly(nm, cm, io, gc);
    assertThatReturnValueIsVoid(gc);
    assertThatExceptionHandlersWereGenerated(gc);
    assertThatUnlockAndRethrowBlockIsCorrect(gc, inlineSequence, prologue, expectedLockObject, epilogue);
    assertThatChecksWontBeSkipped(gc);
}
Also used : OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) DefaultInlineOracle(org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle) InlineOracle(org.jikesrvm.compilers.opt.inlining.InlineOracle) MethodOperand(org.jikesrvm.compilers.opt.ir.operand.MethodOperand) TypeOperand(org.jikesrvm.compilers.opt.ir.operand.TypeOperand) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) TrueGuardOperand(org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand) Operand(org.jikesrvm.compilers.opt.ir.operand.Operand) ObjectConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ObjectConstantOperand) ClassConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ClassConstantOperand) NormalMethod(org.jikesrvm.classloader.NormalMethod) DefaultInlineOracle(org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle) BasicBlock(org.jikesrvm.compilers.opt.ir.BasicBlock) ExceptionHandlerBasicBlock(org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlock) InlineSequence(org.jikesrvm.compilers.opt.inlining.InlineSequence) OptOptions(org.jikesrvm.compilers.opt.OptOptions) Instruction(org.jikesrvm.compilers.opt.ir.Instruction) OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) 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