1 /*
2 * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
3 * Copyright 2007, 2008 Red Hat, Inc.
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 */
25
26 // Platform specific for C++ based Interpreter
27
28 #if defined(PPC) || defined(SPARC) || defined(IA64)
29 #define LOTS_OF_REGS // Use plenty of registers
30 #else
31 #undef LOTS_OF_REGS // Loser platforms
32 #endif
33
34 private:
35 interpreterState _self_link;
36
37 public:
38 inline void set_locals(intptr_t* new_locals) {
39 _locals = new_locals;
40 }
41 inline void set_method(methodOop new_method) {
42 _method = new_method;
43 }
44 inline interpreterState self_link() {
45 return _self_link;
129 #define LOCALS_ADDR(offset) ((address)locals[-(offset)])
130 #define LOCALS_INT(offset) (*((jint*)&locals[-(offset)]))
131 #define LOCALS_FLOAT(offset) (*((jfloat*)&locals[-(offset)]))
132 #define LOCALS_OBJECT(offset) ((oop)locals[-(offset)])
133 #define LOCALS_DOUBLE(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->d)
134 #define LOCALS_LONG(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->l)
135 #define LOCALS_LONG_AT(offset) (((address)&locals[-((offset) + 1)]))
136 #define LOCALS_DOUBLE_AT(offset) (((address)&locals[-((offset) + 1)]))
137
138 #define SET_LOCALS_SLOT(value, offset) (*(intptr_t*)&locals[-(offset)] = *(intptr_t *)(value))
139 #define SET_LOCALS_ADDR(value, offset) (*((address *)&locals[-(offset)]) = (value))
140 #define SET_LOCALS_INT(value, offset) (*((jint *)&locals[-(offset)]) = (value))
141 #define SET_LOCALS_FLOAT(value, offset) (*((jfloat *)&locals[-(offset)]) = (value))
142 #define SET_LOCALS_OBJECT(value, offset) (*((oop *)&locals[-(offset)]) = (value))
143 #define SET_LOCALS_DOUBLE(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = (value))
144 #define SET_LOCALS_LONG(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = (value))
145 #define SET_LOCALS_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = \
146 ((VMJavaVal64*)(addr))->d)
147 #define SET_LOCALS_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = \
148 ((VMJavaVal64*)(addr))->l)
|
1 /*
2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
3 * Copyright 2007, 2008 Red Hat, Inc.
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 */
25
26 #ifndef CPU_ZERO_VM_BYTECODEINTERPRETER_ZERO_HPP
27 #define CPU_ZERO_VM_BYTECODEINTERPRETER_ZERO_HPP
28
29 // Platform specific for C++ based Interpreter
30
31 #if defined(PPC) || defined(SPARC) || defined(IA64)
32 #define LOTS_OF_REGS // Use plenty of registers
33 #else
34 #undef LOTS_OF_REGS // Loser platforms
35 #endif
36
37 private:
38 interpreterState _self_link;
39
40 public:
41 inline void set_locals(intptr_t* new_locals) {
42 _locals = new_locals;
43 }
44 inline void set_method(methodOop new_method) {
45 _method = new_method;
46 }
47 inline interpreterState self_link() {
48 return _self_link;
132 #define LOCALS_ADDR(offset) ((address)locals[-(offset)])
133 #define LOCALS_INT(offset) (*((jint*)&locals[-(offset)]))
134 #define LOCALS_FLOAT(offset) (*((jfloat*)&locals[-(offset)]))
135 #define LOCALS_OBJECT(offset) ((oop)locals[-(offset)])
136 #define LOCALS_DOUBLE(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->d)
137 #define LOCALS_LONG(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->l)
138 #define LOCALS_LONG_AT(offset) (((address)&locals[-((offset) + 1)]))
139 #define LOCALS_DOUBLE_AT(offset) (((address)&locals[-((offset) + 1)]))
140
141 #define SET_LOCALS_SLOT(value, offset) (*(intptr_t*)&locals[-(offset)] = *(intptr_t *)(value))
142 #define SET_LOCALS_ADDR(value, offset) (*((address *)&locals[-(offset)]) = (value))
143 #define SET_LOCALS_INT(value, offset) (*((jint *)&locals[-(offset)]) = (value))
144 #define SET_LOCALS_FLOAT(value, offset) (*((jfloat *)&locals[-(offset)]) = (value))
145 #define SET_LOCALS_OBJECT(value, offset) (*((oop *)&locals[-(offset)]) = (value))
146 #define SET_LOCALS_DOUBLE(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = (value))
147 #define SET_LOCALS_LONG(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = (value))
148 #define SET_LOCALS_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = \
149 ((VMJavaVal64*)(addr))->d)
150 #define SET_LOCALS_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = \
151 ((VMJavaVal64*)(addr))->l)
152
153 #endif // CPU_ZERO_VM_BYTECODEINTERPRETER_ZERO_HPP
|