Search in sources :

Example 1 with AArch64MacroAssembler

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

the class AArch64HotSpotBackend method emitCode.

@Override
public void emitCode(CompilationResultBuilder crb, LIR lir, ResolvedJavaMethod installedCodeOwner) {
    AArch64MacroAssembler masm = (AArch64MacroAssembler) crb.asm;
    FrameMap frameMap = crb.frameMap;
    RegisterConfig regConfig = frameMap.getRegisterConfig();
    Label verifiedStub = new Label();
    emitCodePrefix(crb, installedCodeOwner, masm, regConfig, verifiedStub);
    emitCodeBody(crb, lir, masm);
    emitCodeSuffix(crb, masm, frameMap);
}
Also used : AArch64MacroAssembler(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler) AArch64HotSpotRegisterConfig(jdk.vm.ci.hotspot.aarch64.AArch64HotSpotRegisterConfig) RegisterConfig(jdk.vm.ci.code.RegisterConfig) AArch64FrameMap(org.graalvm.compiler.lir.aarch64.AArch64FrameMap) FrameMap(org.graalvm.compiler.lir.framemap.FrameMap) Label(org.graalvm.compiler.asm.Label)

Example 2 with AArch64MacroAssembler

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

the class AArch64HotSpotBackend method emitCodePrefix.

private void emitCodePrefix(CompilationResultBuilder crb, ResolvedJavaMethod installedCodeOwner, AArch64MacroAssembler masm, RegisterConfig regConfig, Label verifiedStub) {
    HotSpotProviders providers = getProviders();
    if (installedCodeOwner != null && !isStatic(installedCodeOwner.getModifiers())) {
        crb.recordMark(config.MARKID_UNVERIFIED_ENTRY);
        CallingConvention cc = regConfig.getCallingConvention(HotSpotCallingConventionType.JavaCallee, null, new JavaType[] { providers.getMetaAccess().lookupJavaType(Object.class) }, this);
        // See definition of IC_Klass in c1_LIRAssembler_aarch64.cpp
        // equal to scratch(1) careful!
        Register inlineCacheKlass = AArch64HotSpotRegisterConfig.inlineCacheRegister;
        Register receiver = asRegister(cc.getArgument(0));
        int transferSize = config.useCompressedClassPointers ? 4 : 8;
        AArch64Address klassAddress = masm.makeAddress(receiver, config.hubOffset, transferSize);
        // Are r10 and r11 available scratch registers here? One would hope so.
        Register klass = r10;
        if (config.useCompressedClassPointers) {
            masm.ldr(32, klass, klassAddress);
            AArch64HotSpotMove.decodeKlassPointer(masm, klass, klass, providers.getRegisters().getHeapBaseRegister(), config.getKlassEncoding());
        } else {
            masm.ldr(64, klass, klassAddress);
        }
        masm.cmp(64, inlineCacheKlass, klass);
        /*
             * Conditional jumps have a much lower range than unconditional ones, which can be a
             * problem because the miss handler could be out of range.
             */
        masm.branchConditionally(AArch64Assembler.ConditionFlag.EQ, verifiedStub);
        AArch64Call.directJmp(crb, masm, getForeignCalls().lookupForeignCall(IC_MISS_HANDLER));
    }
    masm.align(config.codeEntryAlignment);
    crb.recordMark(config.MARKID_OSR_ENTRY);
    masm.bind(verifiedStub);
    crb.recordMark(config.MARKID_VERIFIED_ENTRY);
}
Also used : CallingConvention(jdk.vm.ci.code.CallingConvention) 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) AArch64Address(org.graalvm.compiler.asm.aarch64.AArch64Address)

Example 3 with AArch64MacroAssembler

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

the class AArch64HotSpotEpilogueOp method leaveFrame.

protected void leaveFrame(CompilationResultBuilder crb, AArch64MacroAssembler masm, boolean emitSafepoint) {
    assert crb.frameContext != null : "We never elide frames in aarch64";
    crb.frameContext.leave(crb);
    if (emitSafepoint) {
        try (ScratchRegister sc = masm.getScratchRegister()) {
            Register scratch = sc.getRegister();
            AArch64HotSpotSafepointOp.emitCode(crb, masm, config, true, thread, scratch, null);
        }
    }
}
Also used : ScratchRegister(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister) ScratchRegister(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister) Register(jdk.vm.ci.code.Register)

Example 4 with AArch64MacroAssembler

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

the class AArch64Move method reg2reg.

private static void reg2reg(@SuppressWarnings("unused") CompilationResultBuilder crb, AArch64MacroAssembler masm, AllocatableValue result, AllocatableValue input) {
    Register dst = asRegister(result);
    Register src = asRegister(input);
    if (src.equals(dst)) {
        return;
    }
    AArch64Kind kind = (AArch64Kind) input.getPlatformKind();
    int size = kind.getSizeInBytes() * Byte.SIZE;
    if (kind.isInteger()) {
        masm.mov(size, dst, src);
    } else {
        masm.fmov(size, dst, src);
    }
}
Also used : 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.aarch64.AArch64MacroAssembler.ScratchRegister) AArch64Kind(jdk.vm.ci.aarch64.AArch64Kind)

Example 5 with AArch64MacroAssembler

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

the class AArch64Move method emitStackMove.

private static void emitStackMove(CompilationResultBuilder crb, AArch64MacroAssembler masm, AllocatableValue result, Value input) {
    try (ScratchRegister r1 = masm.getScratchRegister()) {
        try (ScratchRegister r2 = masm.getScratchRegister()) {
            Register rscratch1 = r1.getRegister();
            Register rscratch2 = r2.getRegister();
            // use the slot kind to define the operand size
            PlatformKind kind = input.getPlatformKind();
            final int size = kind.getSizeInBytes() * Byte.SIZE;
            // Always perform stack -> stack copies through integer registers
            crb.blockComment("[stack -> stack copy]");
            AArch64Address src = loadStackSlotAddress(crb, masm, asStackSlot(input), rscratch2);
            masm.ldr(size, rscratch1, src);
            AArch64Address dst = loadStackSlotAddress(crb, masm, asStackSlot(result), rscratch2);
            masm.str(size, rscratch1, dst);
        }
    }
}
Also used : ScratchRegister(org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister) 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.aarch64.AArch64MacroAssembler.ScratchRegister) PlatformKind(jdk.vm.ci.meta.PlatformKind) AArch64Address(org.graalvm.compiler.asm.aarch64.AArch64Address)

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