Search in sources :

Example 1 with SPARCAddress

use of org.graalvm.compiler.asm.sparc.SPARCAddress in project graal by oracle.

the class SPARCTruffleCallBoundaryInstumentationFactory 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) {
            SPARCMacroAssembler masm = (SPARCMacroAssembler) this.asm;
            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.ld(new SPARCAddress(thisRegister, installedCodeOffset), spillRegister, 4, false);
                    Register baseReg = encoding.hasBase() ? registers.getHeapBaseRegister() : null;
                    SPARCHotSpotMove.UncompressPointer.emitUncompressCode(masm, spillRegister, spillRegister, baseReg, encoding.getShift(), true);
                } else {
                    masm.ldx(new SPARCAddress(thisRegister, installedCodeOffset), spillRegister);
                }
                masm.ldx(new SPARCAddress(spillRegister, entryPointOffset), spillRegister);
                masm.compareBranch(spillRegister, 0, Equal, Xcc, doProlog, PREDICT_NOT_TAKEN, null);
                masm.jmp(spillRegister);
                masm.nop();
                masm.bind(doProlog);
            }
        }
    };
}
Also used : TruffleCallBoundaryInstrumentation(org.graalvm.compiler.truffle.compiler.hotspot.TruffleCallBoundaryInstrumentation) ScratchRegister(org.graalvm.compiler.asm.sparc.SPARCMacroAssembler.ScratchRegister) Register(jdk.vm.ci.code.Register) ScratchRegister(org.graalvm.compiler.asm.sparc.SPARCMacroAssembler.ScratchRegister) Label(org.graalvm.compiler.asm.Label) CompressEncoding(org.graalvm.compiler.core.common.CompressEncoding) SPARCMacroAssembler(org.graalvm.compiler.asm.sparc.SPARCMacroAssembler) SPARCAddress(org.graalvm.compiler.asm.sparc.SPARCAddress)

Example 2 with SPARCAddress

use of org.graalvm.compiler.asm.sparc.SPARCAddress in project graal by oracle.

the class SPARCCall method indirectJmp.

public static void indirectJmp(CompilationResultBuilder crb, SPARCMacroAssembler masm, Register dst, InvokeTarget target) {
    int before = masm.position();
    masm.sethix(0L, dst, true);
    masm.jmp(new SPARCAddress(dst, 0));
    // delay slot
    masm.nop();
    int after = masm.position();
    crb.recordIndirectCall(before, after, target, null);
    masm.ensureUniquePC();
}
Also used : SPARCAddress(org.graalvm.compiler.asm.sparc.SPARCAddress)

Example 3 with SPARCAddress

use of org.graalvm.compiler.asm.sparc.SPARCAddress in project graal by oracle.

the class SPARCMove method stack2stack.

public static void stack2stack(CompilationResultBuilder crb, SPARCMacroAssembler masm, PlatformKind resultKind, PlatformKind inputKind, Value result, Value input, SPARCDelayedControlTransfer delaySlotLir) {
    try (ScratchRegister sc = masm.getScratchRegister()) {
        SPARCAddress inputAddress = (SPARCAddress) crb.asAddress(input);
        Value scratchRegisterValue = sc.getRegister().asValue(LIRKind.combine(input));
        emitLoad(crb, masm, inputAddress, scratchRegisterValue, false, inputKind, SPARCDelayedControlTransfer.DUMMY, null);
        SPARCAddress resultAddress = (SPARCAddress) crb.asAddress(result);
        emitStore(scratchRegisterValue, resultAddress, resultKind, delaySlotLir, null, crb, masm);
    }
}
Also used : ScratchRegister(org.graalvm.compiler.asm.sparc.SPARCMacroAssembler.ScratchRegister) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) SPARCAddress(org.graalvm.compiler.asm.sparc.SPARCAddress)

Example 4 with SPARCAddress

use of org.graalvm.compiler.asm.sparc.SPARCAddress in project graal by oracle.

the class SPARCMove method reg2stack.

public static void reg2stack(CompilationResultBuilder crb, SPARCMacroAssembler masm, Value result, Value input, SPARCDelayedControlTransfer delaySlotLir) {
    SPARCAddress resultAddress = (SPARCAddress) crb.asAddress(result);
    emitStore(input, resultAddress, result.getPlatformKind(), delaySlotLir, null, crb, masm);
}
Also used : SPARCAddress(org.graalvm.compiler.asm.sparc.SPARCAddress)

Example 5 with SPARCAddress

use of org.graalvm.compiler.asm.sparc.SPARCAddress in project graal by oracle.

the class SPARCSaveRegistersOp method emitCode.

@Override
public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) {
    // Can be used with VIS3
    // new Movxtod(SPARC.i0, RETURN_REGISTER_STORAGE).emit(masm);
    // We abuse the first stackslot for transferring i0 to return_register_storage
    // assert slots.length >= 1;
    SPARCAddress slot0Address = (SPARCAddress) crb.asAddress(slots[0]);
    masm.stx(SPARC.i0, slot0Address);
    masm.lddf(slot0Address, RETURN_REGISTER_STORAGE);
    // Now save the registers
    for (int i = 0; i < savedRegisters.length; i++) {
        if (savedRegisters[i] != null) {
            assert isStackSlot(slots[i]) : "not a StackSlot: " + slots[i];
            Register savedRegister = savedRegisters[i];
            StackSlot slot = asStackSlot(slots[i]);
            SPARCAddress slotAddress = (SPARCAddress) crb.asAddress(slot);
            RegisterValue input = savedRegister.asValue(slot.getValueKind());
            SPARCMove.emitStore(input, slotAddress, slot.getPlatformKind(), DUMMY, null, crb, masm);
        }
    }
}
Also used : RegisterValue(jdk.vm.ci.code.RegisterValue) Register(jdk.vm.ci.code.Register) ValueUtil.isStackSlot(jdk.vm.ci.code.ValueUtil.isStackSlot) ValueUtil.asStackSlot(jdk.vm.ci.code.ValueUtil.asStackSlot) StackSlot(jdk.vm.ci.code.StackSlot) SPARCAddress(org.graalvm.compiler.asm.sparc.SPARCAddress)

Aggregations

SPARCAddress (org.graalvm.compiler.asm.sparc.SPARCAddress)20 Register (jdk.vm.ci.code.Register)14 ValueUtil.asRegister (jdk.vm.ci.code.ValueUtil.asRegister)12 ScratchRegister (org.graalvm.compiler.asm.sparc.SPARCMacroAssembler.ScratchRegister)11 ValueUtil.isRegister (jdk.vm.ci.code.ValueUtil.isRegister)5 Label (org.graalvm.compiler.asm.Label)4 SPARCMacroAssembler (org.graalvm.compiler.asm.sparc.SPARCMacroAssembler)4 SPARCAssembler.isCPURegister (org.graalvm.compiler.asm.sparc.SPARCAssembler.isCPURegister)3 SPARCAssembler.isDoubleFloatRegister (org.graalvm.compiler.asm.sparc.SPARCAssembler.isDoubleFloatRegister)3 SPARCAssembler.isSingleFloatRegister (org.graalvm.compiler.asm.sparc.SPARCAssembler.isSingleFloatRegister)3 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)2 Value (jdk.vm.ci.meta.Value)2 SPARCAssembler.isGlobalRegister (org.graalvm.compiler.asm.sparc.SPARCAssembler.isGlobalRegister)2 CallingConvention (jdk.vm.ci.code.CallingConvention)1 RegisterConfig (jdk.vm.ci.code.RegisterConfig)1 RegisterValue (jdk.vm.ci.code.RegisterValue)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