Search in sources :

Example 6 with CompilationResultBuilder

use of org.graalvm.compiler.lir.asm.CompilationResultBuilder in project graal by oracle.

the class AArch64HotSpotBackend method newCompilationResultBuilder.

@Override
public CompilationResultBuilder newCompilationResultBuilder(LIRGenerationResult lirGenRen, FrameMap frameMap, CompilationResult compilationResult, CompilationResultBuilderFactory factory) {
    HotSpotLIRGenerationResult gen = (HotSpotLIRGenerationResult) lirGenRen;
    LIR lir = gen.getLIR();
    assert gen.getDeoptimizationRescueSlot() == null || frameMap.frameNeedsAllocating() : "method that can deoptimize must have a frame";
    Stub stub = gen.getStub();
    Assembler masm = createAssembler(frameMap);
    HotSpotFrameContext frameContext = new HotSpotFrameContext(stub != null);
    DataBuilder dataBuilder = new HotSpotDataBuilder(getCodeCache().getTarget());
    CompilationResultBuilder crb = factory.createBuilder(getCodeCache(), getForeignCalls(), frameMap, masm, dataBuilder, frameContext, lir.getOptions(), lir.getDebug(), compilationResult);
    crb.setTotalFrameSize(frameMap.totalFrameSize());
    crb.setMaxInterpreterFrameSize(gen.getMaxInterpreterFrameSize());
    StackSlot deoptimizationRescueSlot = gen.getDeoptimizationRescueSlot();
    if (deoptimizationRescueSlot != null && stub == null) {
        crb.compilationResult.setCustomStackAreaOffset(deoptimizationRescueSlot);
    }
    if (stub != null) {
        EconomicSet<Register> destroyedCallerRegisters = gatherDestroyedCallerRegisters(lir);
        updateStub(stub, destroyedCallerRegisters, gen.getCalleeSaveInfo(), frameMap);
    }
    return crb;
}
Also used : CompilationResultBuilder(org.graalvm.compiler.lir.asm.CompilationResultBuilder) LIR(org.graalvm.compiler.lir.LIR) HotSpotDataBuilder(org.graalvm.compiler.hotspot.HotSpotDataBuilder) DataBuilder(org.graalvm.compiler.lir.asm.DataBuilder) Register(jdk.vm.ci.code.Register) ValueUtil.asRegister(jdk.vm.ci.code.ValueUtil.asRegister) ScratchRegister(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister) HotSpotLIRGenerationResult(org.graalvm.compiler.hotspot.HotSpotLIRGenerationResult) HotSpotDataBuilder(org.graalvm.compiler.hotspot.HotSpotDataBuilder) Stub(org.graalvm.compiler.hotspot.stubs.Stub) StackSlot(jdk.vm.ci.code.StackSlot) AArch64Assembler(org.graalvm.compiler.asm.aarch64.AArch64Assembler) AArch64MacroAssembler(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler) Assembler(org.graalvm.compiler.asm.Assembler)

Example 7 with CompilationResultBuilder

use of org.graalvm.compiler.lir.asm.CompilationResultBuilder in project graal by oracle.

the class TruffleCompilationResultBuilderFactory method createBuilder.

@Override
public CompilationResultBuilder createBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, DataBuilder dataBuilder, FrameContext frameContext, OptionValues options, DebugContext debug, CompilationResult compilationResult) {
    return new CompilationResultBuilder(codeCache, foreignCalls, frameMap, asm, dataBuilder, frameContext, options, debug, compilationResult) {

        @Override
        protected void closeCompilationResult() {
            CompilationResult result = this.compilationResult;
            result.setMethods(graph.method(), graph.getMethods());
            result.setBytecodeSize(graph.getBytecodeSize());
            Set<Assumption> newAssumptions = new HashSet<>();
            for (Assumption assumption : graph.getAssumptions()) {
                TruffleCompilationResultBuilderFactory.processAssumption(newAssumptions, assumption, validAssumptions);
            }
            if (result.getAssumptions() != null) {
                for (Assumption assumption : result.getAssumptions()) {
                    TruffleCompilationResultBuilderFactory.processAssumption(newAssumptions, assumption, validAssumptions);
                }
            }
            result.setAssumptions(newAssumptions.toArray(new Assumption[newAssumptions.size()]));
            super.closeCompilationResult();
        }
    };
}
Also used : CompilationResultBuilder(org.graalvm.compiler.lir.asm.CompilationResultBuilder) CompilationResult(org.graalvm.compiler.code.CompilationResult) TruffleAssumption(org.graalvm.compiler.truffle.compiler.nodes.TruffleAssumption) Assumption(jdk.vm.ci.meta.Assumptions.Assumption) HashSet(java.util.HashSet)

Aggregations

CompilationResultBuilder (org.graalvm.compiler.lir.asm.CompilationResultBuilder)7 Register (jdk.vm.ci.code.Register)4 ValueUtil.asRegister (jdk.vm.ci.code.ValueUtil.asRegister)4 Assembler (org.graalvm.compiler.asm.Assembler)4 DebugContext (org.graalvm.compiler.debug.DebugContext)4 LIR (org.graalvm.compiler.lir.LIR)4 DataBuilder (org.graalvm.compiler.lir.asm.DataBuilder)4 StackSlot (jdk.vm.ci.code.StackSlot)3 AMD64MacroAssembler (org.graalvm.compiler.asm.amd64.AMD64MacroAssembler)3 HotSpotDataBuilder (org.graalvm.compiler.hotspot.HotSpotDataBuilder)3 HotSpotLIRGenerationResult (org.graalvm.compiler.hotspot.HotSpotLIRGenerationResult)3 Stub (org.graalvm.compiler.hotspot.stubs.Stub)3 OptionValues (org.graalvm.compiler.options.OptionValues)3 ValueUtil.isRegister (jdk.vm.ci.code.ValueUtil.isRegister)2 Deoptimizer (com.oracle.svm.core.deopt.Deoptimizer)1 SubstrateDataBuilder (com.oracle.svm.core.graal.code.SubstrateDataBuilder)1 SharedMethod (com.oracle.svm.core.meta.SharedMethod)1 HashSet (java.util.HashSet)1 AMD64.rax (jdk.vm.ci.amd64.AMD64.rax)1 AMD64.rbx (jdk.vm.ci.amd64.AMD64.rbx)1