Search in sources :

Example 46 with OptimizingCompilerException

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

the class OptimizingCompiler method init.

// //////////////////////////////////////////
// Initialization
// //////////////////////////////////////////
/**
 * Prepare compiler for use.
 * @param options options to use for compilations during initialization
 */
public static void init(OptOptions options) {
    try {
        if (!(VM.writingBootImage || VM.runningTool || VM.runningVM)) {
            // Caller failed to ensure that the VM was initialized.
            throw new OptimizingCompilerException("VM not initialized", true);
        }
        // Make a local copy so that some options can be forced off just for the
        // duration of this initialization step.
        options = options.dup();
        options.ESCAPE_SIMPLE_IPA = false;
        initializeStatics();
        // want to be notified when VM boot is done and ready to start application
        Callbacks.addStartupMonitor(new OptimizingCompiler());
        isInitialized = true;
    } catch (OptimizingCompilerException e) {
        // failures during initialization can't be ignored
        e.isFatal = true;
        throw e;
    } catch (Throwable e) {
        OptimizingCompilerException oe = new OptimizingCompilerException("Compiler", "untrapped failure during init, " + " Converting to OptimizingCompilerException");
        oe.initCause(e);
        throw oe;
    }
}
Also used : OptimizingCompilerException(org.jikesrvm.compilers.opt.OptimizingCompilerException)

Example 47 with OptimizingCompilerException

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

the class OptimizingCompiler method compile.

// //////////////////////////////////////////
// Public interface for compiling a method
// //////////////////////////////////////////
/**
 * Invoke the opt compiler to execute a compilation plan.
 *
 * @param cp the compilation plan to be executed
 * @return the CompiledMethod object that is the result of compilation
 */
public static CompiledMethod compile(CompilationPlan cp) {
    NormalMethod method = cp.method;
    OptOptions options = cp.options;
    checkSupported(method, options);
    try {
        printMethodMessage(method, options);
        IR ir = cp.execute();
        // if doing analysis only, don't try to return an object
        if (cp.analyzeOnly || cp.irGeneration) {
            return null;
        }
        // now that we're done compiling, give the specialization
        // system a chance to eagerly compile any specialized version
        // that are pending.  TODO: use lazy compilation with specialization.
        SpecializationDatabase.doDeferredSpecializations();
        ir.compiledMethod.compileComplete(ir.MIRInfo.machinecode);
        return ir.compiledMethod;
    } catch (OptimizingCompilerException e) {
        throw e;
    } catch (Throwable e) {
        fail(e, method);
        return null;
    }
}
Also used : NormalMethod(org.jikesrvm.classloader.NormalMethod) IR(org.jikesrvm.compilers.opt.ir.IR) OptOptions(org.jikesrvm.compilers.opt.OptOptions) OptimizingCompilerException(org.jikesrvm.compilers.opt.OptimizingCompilerException)

Aggregations

OptimizingCompilerException (org.jikesrvm.compilers.opt.OptimizingCompilerException)47 RegisterOperand (org.jikesrvm.compilers.opt.ir.operand.RegisterOperand)25 Operand (org.jikesrvm.compilers.opt.ir.operand.Operand)18 Instruction (org.jikesrvm.compilers.opt.ir.Instruction)17 Register (org.jikesrvm.compilers.opt.ir.Register)16 IntConstantOperand (org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand)14 ConditionOperand (org.jikesrvm.compilers.opt.ir.operand.ConditionOperand)11 LongConstantOperand (org.jikesrvm.compilers.opt.ir.operand.LongConstantOperand)11 MethodOperand (org.jikesrvm.compilers.opt.ir.operand.MethodOperand)11 TrapCodeOperand (org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand)10 TrueGuardOperand (org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand)10 BranchProfileOperand (org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand)9 ConstantOperand (org.jikesrvm.compilers.opt.ir.operand.ConstantOperand)9 LocationOperand (org.jikesrvm.compilers.opt.ir.operand.LocationOperand)9 TypeReference (org.jikesrvm.classloader.TypeReference)8 AddressConstantOperand (org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand)8 BranchOperand (org.jikesrvm.compilers.opt.ir.operand.BranchOperand)8 DoubleConstantOperand (org.jikesrvm.compilers.opt.ir.operand.DoubleConstantOperand)6 FloatConstantOperand (org.jikesrvm.compilers.opt.ir.operand.FloatConstantOperand)6 Offset (org.vmmagic.unboxed.Offset)6