Search in sources :

Example 6 with SPARCAddress

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

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

the class SPARCHotSpotCRuntimeCallEpilogueOp method emitCode.

@Override
public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) {
    // Restore the thread register when coming back from the runtime.
    SPARCMove.move(crb, masm, thread.asValue(LIRKind.value(XWORD)), threadTemp, SPARCDelayedControlTransfer.DUMMY);
    // Reset last Java frame, last Java PC and flags.
    masm.stx(g0, new SPARCAddress(thread, threadLastJavaSpOffset));
    masm.stx(g0, new SPARCAddress(thread, threadLastJavaPcOffset));
    masm.stw(g0, new SPARCAddress(thread, threadJavaFrameAnchorFlagsOffset));
}
Also used : SPARCAddress(org.graalvm.compiler.asm.sparc.SPARCAddress)

Example 8 with SPARCAddress

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

the class SPARCHotSpotCRuntimeCallPrologueOp method emitCode.

@Override
public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) {
    // Save last Java frame.
    Register scratchRegister = asRegister(spScratch);
    masm.add(stackPointer, STACK_BIAS, scratchRegister);
    masm.stx(scratchRegister, new SPARCAddress(thread, threadLastJavaSpOffset));
    // Save the thread register when calling out to the runtime.
    SPARCMove.move(crb, masm, threadTemp, thread.asValue(LIRKind.value(XWORD)), getDelayedControlTransfer());
}
Also used : Register(jdk.vm.ci.code.Register) ValueUtil.asRegister(jdk.vm.ci.code.ValueUtil.asRegister) SPARCAddress(org.graalvm.compiler.asm.sparc.SPARCAddress)

Example 9 with SPARCAddress

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

Example 10 with SPARCAddress

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

the class SPARCHotSpotJumpToExceptionHandlerInCallerOp method emitCode.

@Override
public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) {
    // Restore SP from L7 if the exception PC is a method handle call site.
    SPARCAddress dst = new SPARCAddress(thread, isMethodHandleReturnOffset);
    try (ScratchRegister scratch = masm.getScratchRegister()) {
        Register scratchReg = scratch.getRegister();
        masm.lduw(dst, scratchReg);
        masm.cmp(scratchReg, scratchReg);
        masm.movcc(ConditionFlag.NotZero, CC.Icc, l7, sp);
    }
    masm.jmpl(asRegister(handlerInCallerPc), 0, g0);
    // Delay slot
    leaveFrame(crb);
}
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) 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