duke@435: /* duke@435: * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * duke@435: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, duke@435: * CA 95054 USA or visit www.sun.com if you need additional information or duke@435: * have any questions. duke@435: * duke@435: */ duke@435: duke@435: public: duke@435: duke@435: // Sentinel placed in the code for interpreter returns so duke@435: // that i2c adapters and osr code can recognize an interpreter duke@435: // return address and convert the return to a specialized duke@435: // block of code to handle compiedl return values and cleaning duke@435: // the fpu stack. duke@435: static const int return_sentinel; duke@435: duke@435: duke@435: static Address::ScaleFactor stackElementScale() { duke@435: return TaggedStackInterpreter? Address::times_8 : Address::times_4; duke@435: } duke@435: duke@435: // Offset from rsp (which points to the last stack element) duke@435: static int expr_offset_in_bytes(int i) { return stackElementSize()*i ; } duke@435: static int expr_tag_offset_in_bytes(int i) { duke@435: assert(TaggedStackInterpreter, "should not call this"); duke@435: return expr_offset_in_bytes(i) + wordSize; duke@435: } duke@435: duke@435: // Support for Tagged Stacks duke@435: duke@435: // Stack index relative to tos (which points at value) duke@435: static int expr_index_at(int i) { duke@435: return stackElementWords() * i; duke@435: } duke@435: duke@435: static int expr_tag_index_at(int i) { duke@435: assert(TaggedStackInterpreter, "should not call this"); duke@435: // tag is one word above java stack element duke@435: return stackElementWords() * i + 1; duke@435: } duke@435: duke@435: // Already negated by c++ interpreter duke@435: static int local_index_at(int i) { duke@435: assert(i<=0, "local direction already negated"); duke@435: return stackElementWords() * i + (value_offset_in_bytes()/wordSize); duke@435: } duke@435: duke@435: static int local_tag_index_at(int i) { duke@435: assert(i<=0, "local direction already negated"); duke@435: assert(TaggedStackInterpreter, "should not call this"); duke@435: return stackElementWords() * i + (tag_offset_in_bytes()/wordSize); duke@435: }