Tue, 26 Jul 2016 17:06:17 +0800
Add multiply word to GPR instruction (mul) in MIPS assembler.
1 /*
2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2015, 2016, Loongson Technology. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
26 #ifndef CPU_MIPS_VM_BYTECODEINTERPRETER_MIPS_HPP
27 #define CPU_MIPS_VM_BYTECODEINTERPRETER_MIPS_HPP
29 // Platform specific for C++ based Interpreter
30 #define LOTS_OF_REGS /* Lets interpreter use plenty of registers */
32 private:
34 // save the bottom of the stack after frame manager setup. For ease of restoration after return
35 // from recursive interpreter call
36 intptr_t* _frame_bottom; /* saved bottom of frame manager frame */
37 intptr_t* _last_Java_pc; /* pc to return to in frame manager */
38 intptr_t* _sender_sp; /* sender's sp before stack (locals) extension */
39 interpreterState _self_link; /* Previous interpreter state */ /* sometimes points to self??? */
40 double _native_fresult; /* save result of native calls that might return floats */
41 intptr_t _native_lresult; /* save result of native calls that might return handle/longs */
42 public:
44 static void pd_layout_interpreterState(interpreterState istate, address last_Java_pc, intptr_t* last_Java_fp);
45 inline intptr_t* sender_sp() {
46 return _sender_sp;
47 }
50 #define SET_LAST_JAVA_FRAME()
52 #define RESET_LAST_JAVA_FRAME() THREAD->frame_anchor()->set_flags(0);
54 /*
55 * Macros for accessing the stack.
56 */
57 #undef STACK_INT
58 #undef STACK_FLOAT
59 #undef STACK_ADDR
60 #undef STACK_OBJECT
61 #undef STACK_DOUBLE
62 #undef STACK_LONG
63 // JavaStack Implementation
66 #define GET_STACK_SLOT(offset) (*((intptr_t*) &topOfStack[-(offset)]))
67 #define STACK_SLOT(offset) ((address) &topOfStack[-(offset)])
68 #define STACK_ADDR(offset) (*((address *) &topOfStack[-(offset)]))
69 #define STACK_INT(offset) (*((jint*) &topOfStack[-(offset)]))
70 #define STACK_FLOAT(offset) (*((jfloat *) &topOfStack[-(offset)]))
71 #define STACK_OBJECT(offset) (*((oop *) &topOfStack [-(offset)]))
72 #define STACK_DOUBLE(offset) (((VMJavaVal64*) &topOfStack[-(offset)])->d)
73 #define STACK_LONG(offset) (((VMJavaVal64 *) &topOfStack[-(offset)])->l)
75 #define SET_STACK_SLOT(value, offset) (*(intptr_t*)&topOfStack[-(offset)] = *(intptr_t*)(value))
76 #define SET_STACK_ADDR(value, offset) (*((address *)&topOfStack[-(offset)]) = (value))
77 #define SET_STACK_INT(value, offset) (*((jint *)&topOfStack[-(offset)]) = (value))
78 #define SET_STACK_FLOAT(value, offset) (*((jfloat *)&topOfStack[-(offset)]) = (value))
79 #define SET_STACK_OBJECT(value, offset) (*((oop *)&topOfStack[-(offset)]) = (value))
80 #define SET_STACK_DOUBLE(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = (value))
81 #define SET_STACK_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = \
82 ((VMJavaVal64*)(addr))->d)
83 #define SET_STACK_LONG(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = (value))
84 #define SET_STACK_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = \
85 ((VMJavaVal64*)(addr))->l)
87 #define LOCALS_SLOT(offset) ((intptr_t*)&locals[-(offset)])
88 #define LOCALS_ADDR(offset) ((address)locals[-(offset)])
89 #define LOCALS_INT(offset) (*((jint*)&locals[-(offset)]))
90 #define LOCALS_FLOAT(offset) (*((jfloat*)&locals[-(offset)]))
91 #define LOCALS_OBJECT(offset) ((oop)locals[-(offset)])
92 #define LOCALS_DOUBLE(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->d)
93 #define LOCALS_LONG(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->l)
94 #define LOCALS_LONG_AT(offset) (((address)&locals[-((offset) + 1)]))
95 #define LOCALS_DOUBLE_AT(offset) (((address)&locals[-((offset) + 1)]))
97 #define SET_LOCALS_SLOT(value, offset) (*(intptr_t*)&locals[-(offset)] = *(intptr_t *)(value))
98 #define SET_LOCALS_ADDR(value, offset) (*((address *)&locals[-(offset)]) = (value))
99 #define SET_LOCALS_INT(value, offset) (*((jint *)&locals[-(offset)]) = (value))
100 #define SET_LOCALS_FLOAT(value, offset) (*((jfloat *)&locals[-(offset)]) = (value))
101 #define SET_LOCALS_OBJECT(value, offset) (*((oop *)&locals[-(offset)]) = (value))
102 #define SET_LOCALS_DOUBLE(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = (value))
103 #define SET_LOCALS_LONG(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = (value))
104 #define SET_LOCALS_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = \
105 ((VMJavaVal64*)(addr))->d)
106 #define SET_LOCALS_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = \
107 ((VMJavaVal64*)(addr))->l)
109 #endif // CPU_MIPS_VM_BYTECODEINTERPRETER_MIPS_HPP