Search in sources :

Example 1 with SPARCMacroAssembler

use of org.graalvm.compiler.asm.sparc.SPARCMacroAssembler 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 SPARCMacroAssembler

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

the class SPARCJumpOp method emitCode.

@Override
public void emitCode(CompilationResultBuilder crb) {
    if (!crb.isSuccessorEdge(destination())) {
        if (!emitDone) {
            SPARCMacroAssembler masm = (SPARCMacroAssembler) crb.asm;
            masm.jmp(destination().label());
        } else {
            int disp = crb.asm.position() - delaySlotPosition;
            assert disp == 4 : disp;
        }
    }
}
Also used : SPARCMacroAssembler(org.graalvm.compiler.asm.sparc.SPARCMacroAssembler)

Example 3 with SPARCMacroAssembler

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

the class SPARCAssemblerTest method setup.

@Before
public void setup() {
    TargetDescription target = createTarget();
    masm = new SPARCMacroAssembler(target);
}
Also used : TargetDescription(jdk.vm.ci.code.TargetDescription) SPARCMacroAssembler(org.graalvm.compiler.asm.sparc.SPARCMacroAssembler) Before(org.junit.Before)

Example 4 with SPARCMacroAssembler

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

the class SPARCHotSpotBackend method bangStackWithOffset.

@Override
protected void bangStackWithOffset(CompilationResultBuilder crb, int bangOffset) {
    // Use SPARCAddress to get the final displacement including the stack bias.
    SPARCMacroAssembler masm = (SPARCMacroAssembler) crb.asm;
    SPARCAddress address = new SPARCAddress(sp, -bangOffset);
    if (SPARCAssembler.isSimm13(address.getDisplacement())) {
        masm.stx(g0, address);
    } else {
        try (ScratchRegister sc = masm.getScratchRegister()) {
            Register scratch = sc.getRegister();
            assert isGlobalRegister(scratch) : "Only global (g1-g7) registers are allowed if the frame was not initialized here. Got register " + scratch;
            masm.setx(address.getDisplacement(), scratch, false);
            masm.stx(g0, new SPARCAddress(sp, scratch));
        }
    }
}
Also used : ScratchRegister(org.graalvm.compiler.asm.sparc.SPARCMacroAssembler.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.sparc.SPARCMacroAssembler.ScratchRegister) SPARCAssembler.isGlobalRegister(org.graalvm.compiler.asm.sparc.SPARCAssembler.isGlobalRegister) SPARCMacroAssembler(org.graalvm.compiler.asm.sparc.SPARCMacroAssembler) SPARCAddress(org.graalvm.compiler.asm.sparc.SPARCAddress)

Example 5 with SPARCMacroAssembler

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

the class SPARCHotSpotCounterOp method emitCode.

@Override
public void emitCode(CompilationResultBuilder crb) {
    SPARCMacroAssembler masm = (SPARCMacroAssembler) crb.asm;
    TargetDescription target = crb.target;
    // address for counters array
    SPARCAddress countersArrayAddr = new SPARCAddress(thread, config.jvmciCountersThreadOffset);
    try (ScratchRegister scratch = masm.getScratchRegister()) {
        Register countersArrayReg = scratch.getRegister();
        // load counters array
        masm.ldx(countersArrayAddr, countersArrayReg);
        IncrementEmitter emitter = new IncrementEmitter(countersArrayReg, masm);
        forEachCounter(emitter, target);
    }
}
Also used : ScratchRegister(org.graalvm.compiler.asm.sparc.SPARCMacroAssembler.ScratchRegister) Register(jdk.vm.ci.code.Register) ValueUtil.asRegister(jdk.vm.ci.code.ValueUtil.asRegister) ScratchRegister(org.graalvm.compiler.asm.sparc.SPARCMacroAssembler.ScratchRegister) TargetDescription(jdk.vm.ci.code.TargetDescription) SPARCMacroAssembler(org.graalvm.compiler.asm.sparc.SPARCMacroAssembler) SPARCAddress(org.graalvm.compiler.asm.sparc.SPARCAddress)

Aggregations

SPARCMacroAssembler (org.graalvm.compiler.asm.sparc.SPARCMacroAssembler)6 Register (jdk.vm.ci.code.Register)4 SPARCAddress (org.graalvm.compiler.asm.sparc.SPARCAddress)4 ScratchRegister (org.graalvm.compiler.asm.sparc.SPARCMacroAssembler.ScratchRegister)4 ValueUtil.asRegister (jdk.vm.ci.code.ValueUtil.asRegister)3 TargetDescription (jdk.vm.ci.code.TargetDescription)2 ValueUtil.isRegister (jdk.vm.ci.code.ValueUtil.isRegister)2 Label (org.graalvm.compiler.asm.Label)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 CompressEncoding (org.graalvm.compiler.core.common.CompressEncoding)1 HotSpotForeignCallsProvider (org.graalvm.compiler.hotspot.meta.HotSpotForeignCallsProvider)1 FrameMap (org.graalvm.compiler.lir.framemap.FrameMap)1 SPARCFrameMap (org.graalvm.compiler.lir.sparc.SPARCFrameMap)1 TruffleCallBoundaryInstrumentation (org.graalvm.compiler.truffle.compiler.hotspot.TruffleCallBoundaryInstrumentation)1 Before (org.junit.Before)1