001/* 002 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. 003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 004 * 005 * This code is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU General Public License version 2 only, as 007 * published by the Free Software Foundation. 008 * 009 * This code is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 011 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 012 * version 2 for more details (a copy is included in the LICENSE file that 013 * accompanied this code). 014 * 015 * You should have received a copy of the GNU General Public License version 016 * 2 along with this work; if not, write to the Free Software Foundation, 017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 018 * 019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 020 * or visit www.oracle.com if you need additional information or have any 021 * questions. 022 */ 023package com.oracle.graal.hotspot.sparc; 024 025import jdk.internal.jvmci.code.*; 026import jdk.internal.jvmci.meta.*; 027import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; 028import static jdk.internal.jvmci.code.ValueUtil.*; 029import static jdk.internal.jvmci.sparc.SPARC.*; 030 031import com.oracle.graal.asm.sparc.*; 032import com.oracle.graal.lir.*; 033import com.oracle.graal.lir.asm.*; 034import com.oracle.graal.lir.sparc.*; 035 036/** 037 * Pushes an interpreter frame to the stack. 038 */ 039@Opcode("PUSH_INTERPRETER_FRAME") 040final class SPARCHotSpotPushInterpreterFrameOp extends SPARCLIRInstruction { 041 public static final LIRInstructionClass<SPARCHotSpotPushInterpreterFrameOp> TYPE = LIRInstructionClass.create(SPARCHotSpotPushInterpreterFrameOp.class); 042 043 @Alive(REG) AllocatableValue frameSize; 044 @Alive(REG) AllocatableValue framePc; 045 @Alive(REG) AllocatableValue senderSp; 046 @Alive(REG) AllocatableValue initialInfo; 047 048 SPARCHotSpotPushInterpreterFrameOp(AllocatableValue frameSize, AllocatableValue framePc, AllocatableValue senderSp, AllocatableValue initialInfo) { 049 super(TYPE); 050 this.frameSize = frameSize; 051 this.framePc = framePc; 052 this.senderSp = senderSp; 053 this.initialInfo = initialInfo; 054 } 055 056 @Override 057 public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { 058 final Register frameSizeRegister = asRegister(frameSize); 059 final Register framePcRegister = asRegister(framePc); 060 final Register senderSpRegister = asRegister(senderSp); 061 062 // Save sender SP to O5_savedSP. 063 masm.mov(senderSpRegister, o5); 064 065 masm.neg(frameSizeRegister); 066 masm.save(sp, frameSizeRegister, sp); 067 068 masm.mov(i0, o0); 069 masm.mov(i1, o1); 070 masm.mov(i2, o2); 071 masm.mov(i3, o3); 072 masm.mov(i4, o4); 073 074 // NOTE: Don't touch I5 as it contains valuable saved SP! 075 076 // Move frame's new PC into i7 077 masm.mov(framePcRegister, i7); 078 } 079 080 @Override 081 public boolean leavesRegisterWindow() { 082 return true; 083 } 084}