annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1 /*
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
3 * Copyright 2012, 2013 SAP AG. All rights reserved.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
5 *
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
6 * This code is free software; you can redistribute it and/or modify it
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
7 * under the terms of the GNU General Public License version 2 only, as
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
8 * published by the Free Software Foundation.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
9 *
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
10 * This code is distributed in the hope that it will be useful, but WITHOUT
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
13 * version 2 for more details (a copy is included in the LICENSE file that
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
14 * accompanied this code).
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
15 *
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License version
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
17 * 2 along with this work; if not, write to the Free Software Foundation,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
19 *
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
21 * or visit www.oracle.com if you need additional information or have any
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
22 * questions.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
23 *
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
24 */
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
25
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
26 #ifndef CPU_PPC_VM_BYTECODEINTERPRETER_PPC_HPP
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
27 #define CPU_PPC_VM_BYTECODEINTERPRETER_PPC_HPP
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
28
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
29 // Platform specific for C++ based Interpreter
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
30 #define LOTS_OF_REGS /* Lets interpreter use plenty of registers */
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
31
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
32 private:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
33
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
34 // Save the bottom of the stack after frame manager setup. For ease of restoration after return
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
35 // from recursive interpreter call.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
36 intptr_t* _frame_bottom; // Saved bottom of frame manager frame.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
37 address _last_Java_pc; // Pc to return to in frame manager.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
38 intptr_t* _last_Java_fp; // frame pointer
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
39 intptr_t* _last_Java_sp; // stack pointer
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
40 interpreterState _self_link; // Previous interpreter state // sometimes points to self???
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
41 double _native_fresult; // Save result of native calls that might return floats.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
42 intptr_t _native_lresult; // Save result of native calls that might return handle/longs.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
43
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
44 public:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
45 address last_Java_pc(void) { return _last_Java_pc; }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
46 intptr_t* last_Java_fp(void) { return _last_Java_fp; }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
47
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
48 static ByteSize native_lresult_offset() {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
49 return byte_offset_of(BytecodeInterpreter, _native_lresult);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
50 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
51
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
52 static ByteSize native_fresult_offset() {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
53 return byte_offset_of(BytecodeInterpreter, _native_fresult);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
54 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
55
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
56 static void pd_layout_interpreterState(interpreterState istate, address last_Java_pc, intptr_t* last_Java_fp);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
57
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
58 #define SET_LAST_JAVA_FRAME() THREAD->frame_anchor()->set(istate->_last_Java_sp, istate->_last_Java_pc);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
59 #define RESET_LAST_JAVA_FRAME() THREAD->frame_anchor()->clear();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
60
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
61
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
62 // Macros for accessing the stack.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
63 #undef STACK_INT
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
64 #undef STACK_FLOAT
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
65 #undef STACK_ADDR
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
66 #undef STACK_OBJECT
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
67 #undef STACK_DOUBLE
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
68 #undef STACK_LONG
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
69
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
70 // JavaStack Implementation
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
71 #define STACK_SLOT(offset) ((address) &topOfStack[-(offset)])
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
72 #define STACK_INT(offset) (*((jint*) &topOfStack[-(offset)]))
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
73 #define STACK_FLOAT(offset) (*((jfloat *) &topOfStack[-(offset)]))
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
74 #define STACK_OBJECT(offset) (*((oop *) &topOfStack [-(offset)]))
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
75 #define STACK_DOUBLE(offset) (((VMJavaVal64*) &topOfStack[-(offset)])->d)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
76 #define STACK_LONG(offset) (((VMJavaVal64 *) &topOfStack[-(offset)])->l)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
77
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
78 #define SET_STACK_SLOT(value, offset) (*(intptr_t*)&topOfStack[-(offset)] = *(intptr_t*)(value))
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
79 #define SET_STACK_ADDR(value, offset) (*((address *)&topOfStack[-(offset)]) = (value))
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
80 #define SET_STACK_INT(value, offset) (*((jint *)&topOfStack[-(offset)]) = (value))
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
81 #define SET_STACK_FLOAT(value, offset) (*((jfloat *)&topOfStack[-(offset)]) = (value))
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
82 #define SET_STACK_OBJECT(value, offset) (*((oop *)&topOfStack[-(offset)]) = (value))
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
83 #define SET_STACK_DOUBLE(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = (value))
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
84 #define SET_STACK_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = \
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
85 ((VMJavaVal64*)(addr))->d)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
86 #define SET_STACK_LONG(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = (value))
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
87 #define SET_STACK_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = \
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
88 ((VMJavaVal64*)(addr))->l)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
89 // JavaLocals implementation
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
90
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
91 #define LOCALS_SLOT(offset) ((intptr_t*)&locals[-(offset)])
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
92 #define LOCALS_ADDR(offset) ((address)locals[-(offset)])
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
93 #define LOCALS_INT(offset) (*(jint*)&(locals[-(offset)]))
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
94 #define LOCALS_OBJECT(offset) ((oop)locals[-(offset)])
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
95 #define LOCALS_LONG_AT(offset) (((address)&locals[-((offset) + 1)]))
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
96 #define LOCALS_DOUBLE_AT(offset) (((address)&locals[-((offset) + 1)]))
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
97
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
98 #define SET_LOCALS_SLOT(value, offset) (*(intptr_t*)&locals[-(offset)] = *(intptr_t *)(value))
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
99 #define SET_LOCALS_INT(value, offset) (*((jint *)&locals[-(offset)]) = (value))
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
100 #define SET_LOCALS_DOUBLE(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = (value))
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
101 #define SET_LOCALS_LONG(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = (value))
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
102 #define SET_LOCALS_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = \
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
103
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
104
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
105 #endif // CPU_PPC_VM_BYTECODEINTERPRETER_PPC_PP