package org.graalvm.compiler.hotspot.sparc;
import static jdk.vm.ci.sparc.SPARC.g0;
import static jdk.vm.ci.sparc.SPARC.i0;
import static jdk.vm.ci.sparc.SPARC.l7;
import org.graalvm.compiler.asm.sparc.SPARCAddress;
import org.graalvm.compiler.asm.sparc.SPARCMacroAssembler;
import org.graalvm.compiler.hotspot.HotSpotBackend;
import org.graalvm.compiler.lir.LIRInstructionClass;
import org.graalvm.compiler.lir.Opcode;
import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
import org.graalvm.compiler.lir.sparc.SPARCLIRInstruction;
import org.graalvm.compiler.lir.sparc.SPARCSaveRegistersOp;
import jdk.vm.ci.code.Register;
@Opcode("LEAVE_UNPACK_FRAMES_STACK_FRAME")
final class SPARCHotSpotLeaveUnpackFramesStackFrameOp extends SPARCLIRInstruction {
public static final LIRInstructionClass<SPARCHotSpotLeaveUnpackFramesStackFrameOp> TYPE = LIRInstructionClass.create(SPARCHotSpotLeaveUnpackFramesStackFrameOp.class);
private final Register thread;
private final int threadLastJavaSpOffset;
private final int threadLastJavaPcOffset;
private final int threadJavaFrameAnchorFlagsOffset;
SPARCHotSpotLeaveUnpackFramesStackFrameOp(Register thread, int threadLastJavaSpOffset, int threadLastJavaPcOffset, int threadJavaFrameAnchorFlagsOffset) {
super(TYPE);
this.thread = thread;
this.threadLastJavaSpOffset = threadLastJavaSpOffset;
this.threadLastJavaPcOffset = threadLastJavaPcOffset;
this.threadJavaFrameAnchorFlagsOffset = threadJavaFrameAnchorFlagsOffset;
}
@Override
public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) {
masm.mov(l7, thread);
SPARCAddress lastJavaPc = new SPARCAddress(thread, threadLastJavaPcOffset);
masm.stdf(SPARCSaveRegistersOp.RETURN_REGISTER_STORAGE, lastJavaPc);
masm.ldx(lastJavaPc, i0);
masm.stx(g0, lastJavaPc);
masm.stx(g0, new SPARCAddress(thread, threadLastJavaSpOffset));
masm.stw(g0, new SPARCAddress(thread, threadJavaFrameAnchorFlagsOffset));
}
}