Search in sources :

Example 11 with AArch64MacroAssembler

use of org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler in project graal by oracle.

the class AArch64HotSpotPatchReturnAddressOp method emitCode.

@Override
public void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) {
    final int frameSize = crb.frameMap.frameSize();
    // LR is saved in the {fp, lr} pair above the frame
    AArch64Address lrAddress = AArch64Address.createUnscaledImmediateAddress(sp, frameSize + crb.target.wordSize);
    masm.str(64, asRegister(address), lrAddress);
}
Also used : AArch64Address(org.graalvm.compiler.asm.aarch64.AArch64Address)

Example 12 with AArch64MacroAssembler

use of org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler in project graal by oracle.

the class AArch64HotSpotBackend method emitCodeSuffix.

private void emitCodeSuffix(CompilationResultBuilder crb, AArch64MacroAssembler masm, FrameMap frameMap) {
    HotSpotProviders providers = getProviders();
    HotSpotFrameContext frameContext = (HotSpotFrameContext) crb.frameContext;
    if (!frameContext.isStub) {
        HotSpotForeignCallsProvider foreignCalls = providers.getForeignCalls();
        try (ScratchRegister sc = masm.getScratchRegister()) {
            Register scratch = sc.getRegister();
            crb.recordMark(config.MARKID_EXCEPTION_HANDLER_ENTRY);
            ForeignCallLinkage linkage = foreignCalls.lookupForeignCall(EXCEPTION_HANDLER);
            Register helper = AArch64Call.isNearCall(linkage) ? null : scratch;
            AArch64Call.directCall(crb, masm, linkage, helper, null);
        }
        crb.recordMark(config.MARKID_DEOPT_HANDLER_ENTRY);
        ForeignCallLinkage linkage = foreignCalls.lookupForeignCall(DEOPTIMIZATION_HANDLER);
        // Warning: the argument is an offset from the instruction!
        masm.adr(lr, 0);
        AArch64Call.directJmp(crb, masm, linkage);
    } else {
        // it has no calls that can cause such "return" entries
        assert !frameMap.accessesCallerFrame();
    }
}
Also used : ScratchRegister(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister) Register(jdk.vm.ci.code.Register) ValueUtil.asRegister(jdk.vm.ci.code.ValueUtil.asRegister) ScratchRegister(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister) HotSpotProviders(org.graalvm.compiler.hotspot.meta.HotSpotProviders) ForeignCallLinkage(org.graalvm.compiler.core.common.spi.ForeignCallLinkage) HotSpotForeignCallsProvider(org.graalvm.compiler.hotspot.meta.HotSpotForeignCallsProvider)

Example 13 with AArch64MacroAssembler

use of org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler in project graal by oracle.

the class AArch64HotSpotBackend method bangStackWithOffset.

@Override
protected void bangStackWithOffset(CompilationResultBuilder crb, int bangOffset) {
    AArch64MacroAssembler masm = (AArch64MacroAssembler) crb.asm;
    try (ScratchRegister sc = masm.getScratchRegister()) {
        Register scratch = sc.getRegister();
        AArch64Address address = masm.makeAddress(sp, -bangOffset, scratch, 8, /* allowOverwrite */
        false);
        masm.str(64, zr, address);
    }
}
Also used : AArch64MacroAssembler(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler) ScratchRegister(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister) Register(jdk.vm.ci.code.Register) ValueUtil.asRegister(jdk.vm.ci.code.ValueUtil.asRegister) ScratchRegister(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister) AArch64Address(org.graalvm.compiler.asm.aarch64.AArch64Address)

Example 14 with AArch64MacroAssembler

use of org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler in project graal by oracle.

the class AArch64TruffleCallBoundaryInstumentationFactory 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 TruffleCallBoundaryInstrumentation(metaAccess, codeCache, foreignCalls, frameMap, asm, dataBuilder, frameContext, options, debug, compilationResult, config, registers) {

        @Override
        protected void injectTailCallCode(int installedCodeOffset, int entryPointOffset) {
            AArch64MacroAssembler masm = (AArch64MacroAssembler) this.asm;
            AArch64HotSpotBackend.emitInvalidatePlaceholder(this, masm);
            try (ScratchRegister scratch = masm.getScratchRegister()) {
                Register thisRegister = codeCache.getRegisterConfig().getCallingConventionRegisters(JavaCall, Object).get(0);
                Register spillRegister = scratch.getRegister();
                Label doProlog = new Label();
                if (config.useCompressedOops) {
                    CompressEncoding encoding = config.getOopEncoding();
                    masm.ldr(32, spillRegister, AArch64Address.createPairUnscaledImmediateAddress(thisRegister, installedCodeOffset));
                    Register base = encoding.hasBase() ? registers.getHeapBaseRegister() : null;
                    AArch64HotSpotMove.UncompressPointer.emitUncompressCode(masm, spillRegister, spillRegister, base, encoding.getShift(), true);
                } else {
                    masm.ldr(64, spillRegister, AArch64Address.createPairUnscaledImmediateAddress(thisRegister, installedCodeOffset));
                }
                masm.ldr(64, spillRegister, AArch64Address.createPairUnscaledImmediateAddress(spillRegister, entryPointOffset));
                masm.cbz(64, spillRegister, doProlog);
                masm.jmp(spillRegister);
                masm.nop();
                masm.bind(doProlog);
            }
        }
    };
}
Also used : AArch64MacroAssembler(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler) TruffleCallBoundaryInstrumentation(org.graalvm.compiler.truffle.compiler.hotspot.TruffleCallBoundaryInstrumentation) ScratchRegister(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister) ScratchRegister(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister) Register(jdk.vm.ci.code.Register) Label(org.graalvm.compiler.asm.Label) CompressEncoding(org.graalvm.compiler.core.common.CompressEncoding)

Example 15 with AArch64MacroAssembler

use of org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler in project graal by oracle.

the class AArch64MacroAssemblerTest method setupEnvironment.

@Before
public void setupEnvironment() {
    TargetDescription target = createTarget();
    masm = new AArch64MacroAssembler(target);
    asm = new TestProtectedAssembler(target);
    base = AArch64.r10;
    index = AArch64.r13;
    scratch = AArch64.r15;
}
Also used : AArch64MacroAssembler(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler) TargetDescription(jdk.vm.ci.code.TargetDescription) Before(org.junit.Before)

Aggregations

ScratchRegister (org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister)15 Register (jdk.vm.ci.code.Register)13 ValueUtil.asRegister (jdk.vm.ci.code.ValueUtil.asRegister)11 AArch64Address (org.graalvm.compiler.asm.aarch64.AArch64Address)9 Label (org.graalvm.compiler.asm.Label)6 ValueUtil.isRegister (jdk.vm.ci.code.ValueUtil.isRegister)4 AArch64MacroAssembler (org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler)4 AArch64Kind (jdk.vm.ci.aarch64.AArch64Kind)3 ValueUtil.asAllocatableValue (jdk.vm.ci.code.ValueUtil.asAllocatableValue)2 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)2 HotSpotProviders (org.graalvm.compiler.hotspot.meta.HotSpotProviders)2 CallingConvention (jdk.vm.ci.code.CallingConvention)1 RegisterConfig (jdk.vm.ci.code.RegisterConfig)1 StackSlot (jdk.vm.ci.code.StackSlot)1 TargetDescription (jdk.vm.ci.code.TargetDescription)1 ValueUtil.asStackSlot (jdk.vm.ci.code.ValueUtil.asStackSlot)1 ValueUtil.isStackSlot (jdk.vm.ci.code.ValueUtil.isStackSlot)1 AArch64HotSpotRegisterConfig (jdk.vm.ci.hotspot.aarch64.AArch64HotSpotRegisterConfig)1 PlatformKind (jdk.vm.ci.meta.PlatformKind)1 Value (jdk.vm.ci.meta.Value)1