Search in sources :

Example 1 with HotSpotDataBuilder

use of org.graalvm.compiler.hotspot.HotSpotDataBuilder in project graal by oracle.

the class SPARCHotSpotBackend method newCompilationResultBuilder.

@Override
public CompilationResultBuilder newCompilationResultBuilder(LIRGenerationResult lirGenRes, FrameMap frameMap, CompilationResult compilationResult, CompilationResultBuilderFactory factory) {
    HotSpotLIRGenerationResult gen = (HotSpotLIRGenerationResult) lirGenRes;
    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);
    // On SPARC we always use stack frames.
    HotSpotFrameContext frameContext = new HotSpotFrameContext(stub != null);
    DataBuilder dataBuilder = new HotSpotDataBuilder(getCodeCache().getTarget());
    OptionValues options = lir.getOptions();
    DebugContext debug = lir.getDebug();
    CompilationResultBuilder crb = factory.createBuilder(getProviders().getCodeCache(), getProviders().getForeignCalls(), frameMap, masm, dataBuilder, frameContext, options, debug, 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) {
        // Even on sparc we need to save floating point registers
        EconomicSet<Register> destroyedCallerRegisters = gatherDestroyedCallerRegisters(lir);
        EconomicMap<LIRFrameState, SaveRegistersOp> calleeSaveInfo = gen.getCalleeSaveInfo();
        updateStub(stub, destroyedCallerRegisters, calleeSaveInfo, frameMap);
    }
    assert registerSizePredictionValidator(crb, debug);
    return crb;
}
Also used : LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) OptionValues(org.graalvm.compiler.options.OptionValues) 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) DebugContext(org.graalvm.compiler.debug.DebugContext) 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.isRegister(jdk.vm.ci.code.ValueUtil.isRegister) ValueUtil.asRegister(jdk.vm.ci.code.ValueUtil.asRegister) ScratchRegister(org.graalvm.compiler.asm.sparc.SPARCMacroAssembler.ScratchRegister) SPARCAssembler.isGlobalRegister(org.graalvm.compiler.asm.sparc.SPARCAssembler.isGlobalRegister) SPARCAssembler(org.graalvm.compiler.asm.sparc.SPARCAssembler) SPARCMacroAssembler(org.graalvm.compiler.asm.sparc.SPARCMacroAssembler) Assembler(org.graalvm.compiler.asm.Assembler) SaveRegistersOp(org.graalvm.compiler.lir.StandardOp.SaveRegistersOp)

Example 2 with HotSpotDataBuilder

use of org.graalvm.compiler.hotspot.HotSpotDataBuilder in project graal by oracle.

the class AMD64HotSpotBackend method newCompilationResultBuilder.

@Override
public CompilationResultBuilder newCompilationResultBuilder(LIRGenerationResult lirGenRen, FrameMap frameMap, CompilationResult compilationResult, CompilationResultBuilderFactory factory) {
    // Omit the frame if the method:
    // - has no spill slots or other slots allocated during register allocation
    // - has no callee-saved registers
    // - has no incoming arguments passed on the stack
    // - has no deoptimization points
    // - makes no foreign calls (which require an aligned stack)
    HotSpotLIRGenerationResult gen = (HotSpotLIRGenerationResult) lirGenRen;
    LIR lir = gen.getLIR();
    assert gen.getDeoptimizationRescueSlot() == null || frameMap.frameNeedsAllocating() : "method that can deoptimize must have a frame";
    OptionValues options = lir.getOptions();
    DebugContext debug = lir.getDebug();
    boolean omitFrame = CanOmitFrame.getValue(options) && !frameMap.frameNeedsAllocating() && !lir.hasArgInCallerFrame() && !gen.hasForeignCall();
    Stub stub = gen.getStub();
    Assembler masm = createAssembler(frameMap);
    HotSpotFrameContext frameContext = new HotSpotFrameContext(stub != null, omitFrame);
    DataBuilder dataBuilder = new HotSpotDataBuilder(getCodeCache().getTarget());
    CompilationResultBuilder crb = factory.createBuilder(getCodeCache(), getForeignCalls(), frameMap, masm, dataBuilder, frameContext, options, debug, 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 : OptionValues(org.graalvm.compiler.options.OptionValues) 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) DebugContext(org.graalvm.compiler.debug.DebugContext) 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) Assembler(org.graalvm.compiler.asm.Assembler) AMD64MacroAssembler(org.graalvm.compiler.asm.amd64.AMD64MacroAssembler)

Example 3 with HotSpotDataBuilder

use of org.graalvm.compiler.hotspot.HotSpotDataBuilder 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)

Aggregations

Register (jdk.vm.ci.code.Register)3 StackSlot (jdk.vm.ci.code.StackSlot)3 ValueUtil.asRegister (jdk.vm.ci.code.ValueUtil.asRegister)3 Assembler (org.graalvm.compiler.asm.Assembler)3 HotSpotDataBuilder (org.graalvm.compiler.hotspot.HotSpotDataBuilder)3 HotSpotLIRGenerationResult (org.graalvm.compiler.hotspot.HotSpotLIRGenerationResult)3 Stub (org.graalvm.compiler.hotspot.stubs.Stub)3 LIR (org.graalvm.compiler.lir.LIR)3 CompilationResultBuilder (org.graalvm.compiler.lir.asm.CompilationResultBuilder)3 DataBuilder (org.graalvm.compiler.lir.asm.DataBuilder)3 DebugContext (org.graalvm.compiler.debug.DebugContext)2 OptionValues (org.graalvm.compiler.options.OptionValues)2 ValueUtil.isRegister (jdk.vm.ci.code.ValueUtil.isRegister)1 AArch64Assembler (org.graalvm.compiler.asm.aarch64.AArch64Assembler)1 AArch64MacroAssembler (org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler)1 ScratchRegister (org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister)1 AMD64MacroAssembler (org.graalvm.compiler.asm.amd64.AMD64MacroAssembler)1 SPARCAssembler (org.graalvm.compiler.asm.sparc.SPARCAssembler)1 SPARCAssembler.isGlobalRegister (org.graalvm.compiler.asm.sparc.SPARCAssembler.isGlobalRegister)1 SPARCMacroAssembler (org.graalvm.compiler.asm.sparc.SPARCMacroAssembler)1