Search in sources :

Example 1 with PatchConsumerFactory

use of com.oracle.svm.core.graal.code.PatchConsumerFactory in project graal by oracle.

the class SubstrateAArch64Backend method newCompilationResultBuilder.

@Override
public CompilationResultBuilder newCompilationResultBuilder(LIRGenerationResult lirGenResult, FrameMap frameMap, CompilationResult compilationResult, CompilationResultBuilderFactory factory) {
    Assembler masm = new AArch64MacroAssembler(getTarget());
    PatchConsumerFactory patchConsumerFactory;
    if (SubstrateUtil.HOSTED) {
        patchConsumerFactory = PatchConsumerFactory.HostedPatchConsumerFactory.factory();
    } else {
        patchConsumerFactory = PatchConsumerFactory.NativePatchConsumerFactory.factory();
    }
    masm.setCodePatchingAnnotationConsumer(patchConsumerFactory.newConsumer(compilationResult));
    SharedMethod method = ((SubstrateLIRGenerationResult) lirGenResult).getMethod();
    Deoptimizer.StubType stubType = method.getDeoptStubType();
    DataBuilder dataBuilder = new SubstrateDataBuilder();
    CallingConvention callingConvention = lirGenResult.getCallingConvention();
    final FrameContext frameContext;
    if (stubType == Deoptimizer.StubType.EntryStub) {
        frameContext = new DeoptEntryStubContext(method, callingConvention);
    } else if (stubType == Deoptimizer.StubType.ExitStub) {
        frameContext = new DeoptExitStubContext(method, callingConvention);
    } else {
        frameContext = createFrameContext(method);
    }
    LIR lir = lirGenResult.getLIR();
    OptionValues options = lir.getOptions();
    DebugContext debug = lir.getDebug();
    Register uncompressedNullRegister = useLinearPointerCompression() ? ReservedRegisters.singleton().getHeapBaseRegister() : Register.None;
    CompilationResultBuilder crb = factory.createBuilder(getProviders(), lirGenResult.getFrameMap(), masm, dataBuilder, frameContext, options, debug, compilationResult, uncompressedNullRegister);
    crb.setTotalFrameSize(lirGenResult.getFrameMap().totalFrameSize());
    return crb;
}
Also used : AArch64MacroAssembler(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler) SubstrateCallingConvention(com.oracle.svm.core.graal.code.SubstrateCallingConvention) CallingConvention(jdk.vm.ci.code.CallingConvention) OptionValues(org.graalvm.compiler.options.OptionValues) FrameContext(org.graalvm.compiler.lir.asm.FrameContext) DebugContext(org.graalvm.compiler.debug.DebugContext) Deoptimizer(com.oracle.svm.core.deopt.Deoptimizer) CompilationResultBuilder(org.graalvm.compiler.lir.asm.CompilationResultBuilder) LIR(org.graalvm.compiler.lir.LIR) SubstrateDataBuilder(com.oracle.svm.core.graal.code.SubstrateDataBuilder) 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) PatchConsumerFactory(com.oracle.svm.core.graal.code.PatchConsumerFactory) SharedMethod(com.oracle.svm.core.meta.SharedMethod) AArch64MacroAssembler(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler) Assembler(org.graalvm.compiler.asm.Assembler) SubstrateDataBuilder(com.oracle.svm.core.graal.code.SubstrateDataBuilder)

Example 2 with PatchConsumerFactory

use of com.oracle.svm.core.graal.code.PatchConsumerFactory in project graal by oracle.

the class SubstrateAMD64Backend method newCompilationResultBuilder.

@Override
public CompilationResultBuilder newCompilationResultBuilder(LIRGenerationResult lirGenResult, FrameMap frameMap, CompilationResult compilationResult, CompilationResultBuilderFactory factory) {
    LIR lir = lirGenResult.getLIR();
    OptionValues options = lir.getOptions();
    AMD64MacroAssembler masm = new AMD64MacroAssembler(getTarget(), options);
    PatchConsumerFactory patchConsumerFactory;
    if (SubstrateUtil.HOSTED) {
        patchConsumerFactory = PatchConsumerFactory.HostedPatchConsumerFactory.factory();
    } else {
        patchConsumerFactory = PatchConsumerFactory.NativePatchConsumerFactory.factory();
    }
    masm.setCodePatchingAnnotationConsumer(patchConsumerFactory.newConsumer(compilationResult));
    SharedMethod method = ((SubstrateLIRGenerationResult) lirGenResult).getMethod();
    Deoptimizer.StubType stubType = method.getDeoptStubType();
    DataBuilder dataBuilder = new SubstrateDataBuilder();
    CallingConvention callingConvention = lirGenResult.getCallingConvention();
    final FrameContext frameContext;
    if (stubType == Deoptimizer.StubType.EntryStub) {
        frameContext = new DeoptEntryStubContext(method, callingConvention);
    } else if (stubType == Deoptimizer.StubType.ExitStub) {
        frameContext = new DeoptExitStubContext(method, callingConvention);
    } else {
        frameContext = createFrameContext(method, callingConvention);
    }
    DebugContext debug = lir.getDebug();
    Register uncompressedNullRegister = useLinearPointerCompression() ? ReservedRegisters.singleton().getHeapBaseRegister() : Register.None;
    CompilationResultBuilder tasm = factory.createBuilder(getProviders(), lirGenResult.getFrameMap(), masm, dataBuilder, frameContext, options, debug, compilationResult, uncompressedNullRegister);
    tasm.setTotalFrameSize(lirGenResult.getFrameMap().totalFrameSize());
    return tasm;
}
Also used : SubstrateCallingConvention(com.oracle.svm.core.graal.code.SubstrateCallingConvention) CallingConvention(jdk.vm.ci.code.CallingConvention) OptionValues(org.graalvm.compiler.options.OptionValues) FrameContext(org.graalvm.compiler.lir.asm.FrameContext) DebugContext(org.graalvm.compiler.debug.DebugContext) Deoptimizer(com.oracle.svm.core.deopt.Deoptimizer) CompilationResultBuilder(org.graalvm.compiler.lir.asm.CompilationResultBuilder) LIR(org.graalvm.compiler.lir.LIR) SubstrateDataBuilder(com.oracle.svm.core.graal.code.SubstrateDataBuilder) 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) AMD64MacroAssembler(org.graalvm.compiler.asm.amd64.AMD64MacroAssembler) PatchConsumerFactory(com.oracle.svm.core.graal.code.PatchConsumerFactory) SharedMethod(com.oracle.svm.core.meta.SharedMethod) SubstrateDataBuilder(com.oracle.svm.core.graal.code.SubstrateDataBuilder)

Aggregations

Deoptimizer (com.oracle.svm.core.deopt.Deoptimizer)2 PatchConsumerFactory (com.oracle.svm.core.graal.code.PatchConsumerFactory)2 SubstrateCallingConvention (com.oracle.svm.core.graal.code.SubstrateCallingConvention)2 SubstrateDataBuilder (com.oracle.svm.core.graal.code.SubstrateDataBuilder)2 SharedMethod (com.oracle.svm.core.meta.SharedMethod)2 CallingConvention (jdk.vm.ci.code.CallingConvention)2 Register (jdk.vm.ci.code.Register)2 ValueUtil.asRegister (jdk.vm.ci.code.ValueUtil.asRegister)2 DebugContext (org.graalvm.compiler.debug.DebugContext)2 LIR (org.graalvm.compiler.lir.LIR)2 CompilationResultBuilder (org.graalvm.compiler.lir.asm.CompilationResultBuilder)2 DataBuilder (org.graalvm.compiler.lir.asm.DataBuilder)2 FrameContext (org.graalvm.compiler.lir.asm.FrameContext)2 OptionValues (org.graalvm.compiler.options.OptionValues)2 ValueUtil.isRegister (jdk.vm.ci.code.ValueUtil.isRegister)1 Assembler (org.graalvm.compiler.asm.Assembler)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