duke@435: /* stefank@2314: * Copyright (c) 2002, 2010, Oracle and/or its affiliates. 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: * trims@1907: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: * or visit www.oracle.com if you need additional information or have any trims@1907: * questions. duke@435: * duke@435: */ duke@435: stefank@2314: #ifndef CPU_SPARC_VM_BYTECODEINTERPRETER_SPARC_HPP stefank@2314: #define CPU_SPARC_VM_BYTECODEINTERPRETER_SPARC_HPP stefank@2314: duke@435: // Platform specific for C++ based Interpreter duke@435: #define LOTS_OF_REGS /* Lets interpreter use plenty of registers */ duke@435: duke@435: private: duke@435: duke@435: // save the bottom of the stack after frame manager setup. For ease of restoration after return duke@435: // from recursive interpreter call duke@435: intptr_t* _frame_bottom; /* saved bottom of frame manager frame */ duke@435: intptr_t* _last_Java_pc; /* pc to return to in frame manager */ duke@435: interpreterState _self_link; /* Previous interpreter state */ /* sometimes points to self??? */ duke@435: double _native_fresult; /* save result of native calls that might return floats */ duke@435: intptr_t _native_lresult; /* save result of native calls that might return handle/longs */ duke@435: public: duke@435: duke@435: static void pd_layout_interpreterState(interpreterState istate, address last_Java_pc, intptr_t* last_Java_fp); duke@435: duke@435: duke@435: #define SET_LAST_JAVA_FRAME() duke@435: duke@435: #define RESET_LAST_JAVA_FRAME() THREAD->frame_anchor()->set_flags(0); duke@435: duke@435: /* duke@435: * Macros for accessing the stack. duke@435: */ duke@435: #undef STACK_INT duke@435: #undef STACK_FLOAT duke@435: #undef STACK_ADDR duke@435: #undef STACK_OBJECT duke@435: #undef STACK_DOUBLE duke@435: #undef STACK_LONG duke@435: // JavaStack Implementation duke@435: duke@435: duke@435: #define GET_STACK_SLOT(offset) (*((intptr_t*) &topOfStack[-(offset)])) duke@435: #define STACK_SLOT(offset) ((address) &topOfStack[-(offset)]) duke@435: #define STACK_ADDR(offset) (*((address *) &topOfStack[-(offset)])) duke@435: #define STACK_INT(offset) (*((jint*) &topOfStack[-(offset)])) duke@435: #define STACK_FLOAT(offset) (*((jfloat *) &topOfStack[-(offset)])) duke@435: #define STACK_OBJECT(offset) (*((oop *) &topOfStack [-(offset)])) duke@435: #define STACK_DOUBLE(offset) (((VMJavaVal64*) &topOfStack[-(offset)])->d) duke@435: #define STACK_LONG(offset) (((VMJavaVal64 *) &topOfStack[-(offset)])->l) duke@435: duke@435: #define SET_STACK_SLOT(value, offset) (*(intptr_t*)&topOfStack[-(offset)] = *(intptr_t*)(value)) duke@435: #define SET_STACK_ADDR(value, offset) (*((address *)&topOfStack[-(offset)]) = (value)) duke@435: #define SET_STACK_INT(value, offset) (*((jint *)&topOfStack[-(offset)]) = (value)) duke@435: #define SET_STACK_FLOAT(value, offset) (*((jfloat *)&topOfStack[-(offset)]) = (value)) duke@435: #define SET_STACK_OBJECT(value, offset) (*((oop *)&topOfStack[-(offset)]) = (value)) duke@435: #define SET_STACK_DOUBLE(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = (value)) duke@435: #define SET_STACK_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = \ duke@435: ((VMJavaVal64*)(addr))->d) duke@435: #define SET_STACK_LONG(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = (value)) duke@435: #define SET_STACK_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = \ duke@435: ((VMJavaVal64*)(addr))->l) duke@435: duke@435: #define LOCALS_SLOT(offset) ((intptr_t*)&locals[-(offset)]) duke@435: #define LOCALS_ADDR(offset) ((address)locals[-(offset)]) sgoldman@558: #define LOCALS_INT(offset) (*((jint*)&locals[-(offset)])) duke@435: #define LOCALS_FLOAT(offset) (*((jfloat*)&locals[-(offset)])) duke@435: #define LOCALS_OBJECT(offset) ((oop)locals[-(offset)]) duke@435: #define LOCALS_DOUBLE(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->d) duke@435: #define LOCALS_LONG(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->l) duke@435: #define LOCALS_LONG_AT(offset) (((address)&locals[-((offset) + 1)])) duke@435: #define LOCALS_DOUBLE_AT(offset) (((address)&locals[-((offset) + 1)])) duke@435: duke@435: #define SET_LOCALS_SLOT(value, offset) (*(intptr_t*)&locals[-(offset)] = *(intptr_t *)(value)) duke@435: #define SET_LOCALS_ADDR(value, offset) (*((address *)&locals[-(offset)]) = (value)) duke@435: #define SET_LOCALS_INT(value, offset) (*((jint *)&locals[-(offset)]) = (value)) duke@435: #define SET_LOCALS_FLOAT(value, offset) (*((jfloat *)&locals[-(offset)]) = (value)) duke@435: #define SET_LOCALS_OBJECT(value, offset) (*((oop *)&locals[-(offset)]) = (value)) duke@435: #define SET_LOCALS_DOUBLE(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = (value)) duke@435: #define SET_LOCALS_LONG(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = (value)) duke@435: #define SET_LOCALS_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = \ duke@435: ((VMJavaVal64*)(addr))->d) duke@435: #define SET_LOCALS_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = \ duke@435: ((VMJavaVal64*)(addr))->l) stefank@2314: stefank@2314: #endif // CPU_SPARC_VM_BYTECODEINTERPRETER_SPARC_HPP