comparison src/cpu/ppc/vm/bytecodeInterpreter_ppc.hpp @ 14408:ec28f9c041ff

8019972: PPC64 (part 9): platform files for interpreter only VM. Summary: With this change the HotSpot core build works on Linux/PPC64. The VM succesfully executes simple test programs. Reviewed-by: kvn
author goetz
date Fri, 02 Aug 2013 16:46:45 +0200
parents
children 018b357638aa
comparison
equal deleted inserted replaced
14407:94c202aa2646 14408:ec28f9c041ff
1 /*
2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
3 * Copyright 2012, 2013 SAP AG. 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 */
25
26 #ifndef CPU_PPC_VM_BYTECODEINTERPRETER_PPC_HPP
27 #define CPU_PPC_VM_BYTECODEINTERPRETER_PPC_HPP
28
29 // Platform specific for C++ based Interpreter
30 #define LOTS_OF_REGS /* Lets interpreter use plenty of registers */
31
32 private:
33
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 address _last_Java_pc; // Pc to return to in frame manager.
38 intptr_t* _last_Java_fp; // frame pointer
39 intptr_t* _last_Java_sp; // stack pointer
40 interpreterState _self_link; // Previous interpreter state // sometimes points to self???
41 double _native_fresult; // Save result of native calls that might return floats.
42 intptr_t _native_lresult; // Save result of native calls that might return handle/longs.
43
44 public:
45 address last_Java_pc(void) { return _last_Java_pc; }
46 intptr_t* last_Java_fp(void) { return _last_Java_fp; }
47
48 static ByteSize native_lresult_offset() {
49 return byte_offset_of(BytecodeInterpreter, _native_lresult);
50 }
51
52 static ByteSize native_fresult_offset() {
53 return byte_offset_of(BytecodeInterpreter, _native_fresult);
54 }
55
56 static void pd_layout_interpreterState(interpreterState istate, address last_Java_pc, intptr_t* last_Java_fp);
57
58 #define SET_LAST_JAVA_FRAME() THREAD->frame_anchor()->set(istate->_last_Java_sp, istate->_last_Java_pc);
59 #define RESET_LAST_JAVA_FRAME() THREAD->frame_anchor()->clear();
60
61
62 // Macros for accessing the stack.
63 #undef STACK_INT
64 #undef STACK_FLOAT
65 #undef STACK_ADDR
66 #undef STACK_OBJECT
67 #undef STACK_DOUBLE
68 #undef STACK_LONG
69
70 // JavaStack Implementation
71 #define STACK_SLOT(offset) ((address) &topOfStack[-(offset)])
72 #define STACK_INT(offset) (*((jint*) &topOfStack[-(offset)]))
73 #define STACK_FLOAT(offset) (*((jfloat *) &topOfStack[-(offset)]))
74 #define STACK_OBJECT(offset) (*((oop *) &topOfStack [-(offset)]))
75 #define STACK_DOUBLE(offset) (((VMJavaVal64*) &topOfStack[-(offset)])->d)
76 #define STACK_LONG(offset) (((VMJavaVal64 *) &topOfStack[-(offset)])->l)
77
78 #define SET_STACK_SLOT(value, offset) (*(intptr_t*)&topOfStack[-(offset)] = *(intptr_t*)(value))
79 #define SET_STACK_ADDR(value, offset) (*((address *)&topOfStack[-(offset)]) = (value))
80 #define SET_STACK_INT(value, offset) (*((jint *)&topOfStack[-(offset)]) = (value))
81 #define SET_STACK_FLOAT(value, offset) (*((jfloat *)&topOfStack[-(offset)]) = (value))
82 #define SET_STACK_OBJECT(value, offset) (*((oop *)&topOfStack[-(offset)]) = (value))
83 #define SET_STACK_DOUBLE(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = (value))
84 #define SET_STACK_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = \
85 ((VMJavaVal64*)(addr))->d)
86 #define SET_STACK_LONG(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = (value))
87 #define SET_STACK_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = \
88 ((VMJavaVal64*)(addr))->l)
89 // JavaLocals implementation
90
91 #define LOCALS_SLOT(offset) ((intptr_t*)&locals[-(offset)])
92 #define LOCALS_ADDR(offset) ((address)locals[-(offset)])
93 #define LOCALS_INT(offset) (*(jint*)&(locals[-(offset)]))
94 #define LOCALS_OBJECT(offset) ((oop)locals[-(offset)])
95 #define LOCALS_LONG_AT(offset) (((address)&locals[-((offset) + 1)]))
96 #define LOCALS_DOUBLE_AT(offset) (((address)&locals[-((offset) + 1)]))
97
98 #define SET_LOCALS_SLOT(value, offset) (*(intptr_t*)&locals[-(offset)] = *(intptr_t *)(value))
99 #define SET_LOCALS_INT(value, offset) (*((jint *)&locals[-(offset)]) = (value))
100 #define SET_LOCALS_DOUBLE(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = (value))
101 #define SET_LOCALS_LONG(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = (value))
102 #define SET_LOCALS_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = \
103
104
105 #endif // CPU_PPC_VM_BYTECODEINTERPRETER_PPC_PP