1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/cpu/sparc/vm/bytecodeInterpreter_sparc.hpp Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,99 @@ 1.4 +/* 1.5 + * Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.24 + * have any questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +// Platform specific for C++ based Interpreter 1.29 +#define LOTS_OF_REGS /* Lets interpreter use plenty of registers */ 1.30 + 1.31 +private: 1.32 + 1.33 + // save the bottom of the stack after frame manager setup. For ease of restoration after return 1.34 + // from recursive interpreter call 1.35 + intptr_t* _frame_bottom; /* saved bottom of frame manager frame */ 1.36 + intptr_t* _last_Java_pc; /* pc to return to in frame manager */ 1.37 + interpreterState _self_link; /* Previous interpreter state */ /* sometimes points to self??? */ 1.38 + double _native_fresult; /* save result of native calls that might return floats */ 1.39 + intptr_t _native_lresult; /* save result of native calls that might return handle/longs */ 1.40 +public: 1.41 + 1.42 + static void pd_layout_interpreterState(interpreterState istate, address last_Java_pc, intptr_t* last_Java_fp); 1.43 + 1.44 + 1.45 +#define SET_LAST_JAVA_FRAME() 1.46 + 1.47 +#define RESET_LAST_JAVA_FRAME() THREAD->frame_anchor()->set_flags(0); 1.48 + 1.49 +/* 1.50 + * Macros for accessing the stack. 1.51 + */ 1.52 +#undef STACK_INT 1.53 +#undef STACK_FLOAT 1.54 +#undef STACK_ADDR 1.55 +#undef STACK_OBJECT 1.56 +#undef STACK_DOUBLE 1.57 +#undef STACK_LONG 1.58 +// JavaStack Implementation 1.59 + 1.60 + 1.61 +#define GET_STACK_SLOT(offset) (*((intptr_t*) &topOfStack[-(offset)])) 1.62 +#define STACK_SLOT(offset) ((address) &topOfStack[-(offset)]) 1.63 +#define STACK_ADDR(offset) (*((address *) &topOfStack[-(offset)])) 1.64 +#define STACK_INT(offset) (*((jint*) &topOfStack[-(offset)])) 1.65 +#define STACK_FLOAT(offset) (*((jfloat *) &topOfStack[-(offset)])) 1.66 +#define STACK_OBJECT(offset) (*((oop *) &topOfStack [-(offset)])) 1.67 +#define STACK_DOUBLE(offset) (((VMJavaVal64*) &topOfStack[-(offset)])->d) 1.68 +#define STACK_LONG(offset) (((VMJavaVal64 *) &topOfStack[-(offset)])->l) 1.69 + 1.70 +#define SET_STACK_SLOT(value, offset) (*(intptr_t*)&topOfStack[-(offset)] = *(intptr_t*)(value)) 1.71 +#define SET_STACK_ADDR(value, offset) (*((address *)&topOfStack[-(offset)]) = (value)) 1.72 +#define SET_STACK_INT(value, offset) (*((jint *)&topOfStack[-(offset)]) = (value)) 1.73 +#define SET_STACK_FLOAT(value, offset) (*((jfloat *)&topOfStack[-(offset)]) = (value)) 1.74 +#define SET_STACK_OBJECT(value, offset) (*((oop *)&topOfStack[-(offset)]) = (value)) 1.75 +#define SET_STACK_DOUBLE(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = (value)) 1.76 +#define SET_STACK_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = \ 1.77 + ((VMJavaVal64*)(addr))->d) 1.78 +#define SET_STACK_LONG(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = (value)) 1.79 +#define SET_STACK_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = \ 1.80 + ((VMJavaVal64*)(addr))->l) 1.81 + 1.82 +#define LOCALS_SLOT(offset) ((intptr_t*)&locals[-(offset)]) 1.83 +#define LOCALS_ADDR(offset) ((address)locals[-(offset)]) 1.84 +#define LOCALS_INT(offset) ((jint)(locals[-(offset)])) 1.85 +#define LOCALS_FLOAT(offset) (*((jfloat*)&locals[-(offset)])) 1.86 +#define LOCALS_OBJECT(offset) ((oop)locals[-(offset)]) 1.87 +#define LOCALS_DOUBLE(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->d) 1.88 +#define LOCALS_LONG(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->l) 1.89 +#define LOCALS_LONG_AT(offset) (((address)&locals[-((offset) + 1)])) 1.90 +#define LOCALS_DOUBLE_AT(offset) (((address)&locals[-((offset) + 1)])) 1.91 + 1.92 +#define SET_LOCALS_SLOT(value, offset) (*(intptr_t*)&locals[-(offset)] = *(intptr_t *)(value)) 1.93 +#define SET_LOCALS_ADDR(value, offset) (*((address *)&locals[-(offset)]) = (value)) 1.94 +#define SET_LOCALS_INT(value, offset) (*((jint *)&locals[-(offset)]) = (value)) 1.95 +#define SET_LOCALS_FLOAT(value, offset) (*((jfloat *)&locals[-(offset)]) = (value)) 1.96 +#define SET_LOCALS_OBJECT(value, offset) (*((oop *)&locals[-(offset)]) = (value)) 1.97 +#define SET_LOCALS_DOUBLE(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = (value)) 1.98 +#define SET_LOCALS_LONG(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = (value)) 1.99 +#define SET_LOCALS_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = \ 1.100 + ((VMJavaVal64*)(addr))->d) 1.101 +#define SET_LOCALS_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = \ 1.102 + ((VMJavaVal64*)(addr))->l)