Mercurial > hg > truffle
annotate src/share/vm/interpreter/templateInterpreter.hpp @ 17458:ddcb2ac2900d
Merge
author | drchase |
---|---|
date | Thu, 12 Dec 2013 20:55:36 -0500 |
parents | bd3237e0e18d |
children | de6a9e811145 |
rev | line source |
---|---|
0 | 1 /* |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1059
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1059
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1059
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_INTERPRETER_TEMPLATEINTERPRETER_HPP |
26 #define SHARE_VM_INTERPRETER_TEMPLATEINTERPRETER_HPP | |
27 | |
28 #include "interpreter/abstractInterpreter.hpp" | |
29 #include "interpreter/templateTable.hpp" | |
30 | |
605 | 31 // This file contains the platform-independent parts |
0 | 32 // of the template interpreter and the template interpreter generator. |
33 | |
34 #ifndef CC_INTERP | |
35 | |
36 //------------------------------------------------------------------------------------------------------------------------ | |
37 // A little wrapper class to group tosca-specific entry points into a unit. | |
38 // (tosca = Top-Of-Stack CAche) | |
39 | |
40 class EntryPoint VALUE_OBJ_CLASS_SPEC { | |
41 private: | |
42 address _entry[number_of_states]; | |
43 | |
44 public: | |
45 // Construction | |
46 EntryPoint(); | |
47 EntryPoint(address bentry, address centry, address sentry, address aentry, address ientry, address lentry, address fentry, address dentry, address ventry); | |
48 | |
49 // Attributes | |
50 address entry(TosState state) const; // return target address for a given tosca state | |
51 void set_entry(TosState state, address entry); // set target address for a given tosca state | |
52 void print(); | |
53 | |
54 // Comparison | |
55 bool operator == (const EntryPoint& y); // for debugging only | |
56 }; | |
57 | |
58 | |
59 //------------------------------------------------------------------------------------------------------------------------ | |
60 // A little wrapper class to group tosca-specific dispatch tables into a unit. | |
61 | |
62 class DispatchTable VALUE_OBJ_CLASS_SPEC { | |
63 public: | |
64 enum { length = 1 << BitsPerByte }; // an entry point for each byte value (also for undefined bytecodes) | |
65 | |
66 private: | |
67 address _table[number_of_states][length]; // dispatch tables, indexed by tosca and bytecode | |
68 | |
69 public: | |
70 // Attributes | |
71 EntryPoint entry(int i) const; // return entry point for a given bytecode i | |
72 void set_entry(int i, EntryPoint& entry); // set entry point for a given bytecode i | |
73 address* table_for(TosState state) { return _table[state]; } | |
74 address* table_for() { return table_for((TosState)0); } | |
75 int distance_from(address *table) { return table - table_for(); } | |
76 int distance_from(TosState state) { return distance_from(table_for(state)); } | |
77 | |
78 // Comparison | |
79 bool operator == (DispatchTable& y); // for debugging only | |
80 }; | |
81 | |
82 class TemplateInterpreter: public AbstractInterpreter { | |
83 friend class VMStructs; | |
84 friend class InterpreterMacroAssembler; | |
85 friend class TemplateInterpreterGenerator; | |
710 | 86 friend class InterpreterGenerator; |
0 | 87 friend class TemplateTable; |
88 // friend class Interpreter; | |
89 public: | |
90 | |
91 enum MoreConstants { | |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
92 number_of_return_entries = number_of_states, // number of return entry points |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
93 number_of_deopt_entries = number_of_states, // number of deoptimization entry points |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
94 number_of_return_addrs = number_of_states // number of return addresses |
0 | 95 }; |
96 | |
97 protected: | |
98 | |
99 static address _throw_ArrayIndexOutOfBoundsException_entry; | |
100 static address _throw_ArrayStoreException_entry; | |
101 static address _throw_ArithmeticException_entry; | |
102 static address _throw_ClassCastException_entry; | |
710 | 103 static address _throw_WrongMethodType_entry; |
0 | 104 static address _throw_NullPointerException_entry; |
105 static address _throw_exception_entry; | |
106 | |
107 static address _throw_StackOverflowError_entry; | |
108 | |
109 static address _remove_activation_entry; // continuation address if an exception is not handled by current frame | |
110 #ifdef HOTSWAP | |
111 static address _remove_activation_preserving_args_entry; // continuation address when current frame is being popped | |
112 #endif // HOTSWAP | |
113 | |
114 #ifndef PRODUCT | |
115 static EntryPoint _trace_code; | |
116 #endif // !PRODUCT | |
117 static EntryPoint _return_entry[number_of_return_entries]; // entry points to return to from a call | |
118 static EntryPoint _earlyret_entry; // entry point to return early from a call | |
119 static EntryPoint _deopt_entry[number_of_deopt_entries]; // entry points to return to from a deoptimization | |
120 static EntryPoint _continuation_entry; | |
121 static EntryPoint _safept_entry; | |
122 | |
13010
bd3237e0e18d
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
6725
diff
changeset
|
123 static address _invoke_return_entry[number_of_return_addrs]; // for invokestatic, invokespecial, invokevirtual return entries |
bd3237e0e18d
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
6725
diff
changeset
|
124 static address _invokeinterface_return_entry[number_of_return_addrs]; // for invokeinterface return entries |
bd3237e0e18d
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
6725
diff
changeset
|
125 static address _invokedynamic_return_entry[number_of_return_addrs]; // for invokedynamic return entries |
0 | 126 |
127 static DispatchTable _active_table; // the active dispatch table (used by the interpreter for dispatch) | |
128 static DispatchTable _normal_table; // the normal dispatch table (used to set the active table in normal mode) | |
129 static DispatchTable _safept_table; // the safepoint dispatch table (used to set the active table for safepoints) | |
130 static address _wentry_point[DispatchTable::length]; // wide instructions only (vtos tosca always) | |
131 | |
132 | |
133 public: | |
134 // Initialization/debugging | |
135 static void initialize(); | |
136 // this only returns whether a pc is within generated code for the interpreter. | |
137 static bool contains(address pc) { return _code != NULL && _code->contains(pc); } | |
138 | |
139 public: | |
140 | |
141 static address remove_activation_early_entry(TosState state) { return _earlyret_entry.entry(state); } | |
142 #ifdef HOTSWAP | |
143 static address remove_activation_preserving_args_entry() { return _remove_activation_preserving_args_entry; } | |
144 #endif // HOTSWAP | |
145 | |
146 static address remove_activation_entry() { return _remove_activation_entry; } | |
147 static address throw_exception_entry() { return _throw_exception_entry; } | |
148 static address throw_ArithmeticException_entry() { return _throw_ArithmeticException_entry; } | |
710 | 149 static address throw_WrongMethodType_entry() { return _throw_WrongMethodType_entry; } |
0 | 150 static address throw_NullPointerException_entry() { return _throw_NullPointerException_entry; } |
151 static address throw_StackOverflowError_entry() { return _throw_StackOverflowError_entry; } | |
152 | |
153 // Code generation | |
154 #ifndef PRODUCT | |
155 static address trace_code (TosState state) { return _trace_code.entry(state); } | |
156 #endif // !PRODUCT | |
157 static address continuation (TosState state) { return _continuation_entry.entry(state); } | |
158 static address* dispatch_table(TosState state) { return _active_table.table_for(state); } | |
159 static address* dispatch_table() { return _active_table.table_for(); } | |
160 static int distance_from_dispatch_table(TosState state){ return _active_table.distance_from(state); } | |
161 static address* normal_table(TosState state) { return _normal_table.table_for(state); } | |
162 static address* normal_table() { return _normal_table.table_for(); } | |
163 | |
164 // Support for invokes | |
13010
bd3237e0e18d
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
6725
diff
changeset
|
165 static address* invoke_return_entry_table() { return _invoke_return_entry; } |
bd3237e0e18d
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
6725
diff
changeset
|
166 static address* invokeinterface_return_entry_table() { return _invokeinterface_return_entry; } |
bd3237e0e18d
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
6725
diff
changeset
|
167 static address* invokedynamic_return_entry_table() { return _invokedynamic_return_entry; } |
bd3237e0e18d
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
6725
diff
changeset
|
168 static int TosState_as_index(TosState state); |
0 | 169 |
13010
bd3237e0e18d
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
6725
diff
changeset
|
170 static address* invoke_return_entry_table_for(Bytecodes::Code code); |
bd3237e0e18d
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
6725
diff
changeset
|
171 |
bd3237e0e18d
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
6725
diff
changeset
|
172 static address deopt_entry(TosState state, int length); |
bd3237e0e18d
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
6725
diff
changeset
|
173 static address return_entry(TosState state, int length, Bytecodes::Code code); |
0 | 174 |
175 // Safepoint support | |
176 static void notice_safepoints(); // stops the thread when reaching a safepoint | |
177 static void ignore_safepoints(); // ignores safepoints | |
178 | |
179 // Deoptimization support | |
900
9987d9d5eb0e
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
726
diff
changeset
|
180 // Compute the entry address for continuation after |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
181 static address deopt_continue_after_entry(Method* method, |
900
9987d9d5eb0e
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
726
diff
changeset
|
182 address bcp, |
9987d9d5eb0e
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
726
diff
changeset
|
183 int callee_parameters, |
9987d9d5eb0e
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
726
diff
changeset
|
184 bool is_top_frame); |
9987d9d5eb0e
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
726
diff
changeset
|
185 // Deoptimization should reexecute this bytecode |
9987d9d5eb0e
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
726
diff
changeset
|
186 static bool bytecode_should_reexecute(Bytecodes::Code code); |
9987d9d5eb0e
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
726
diff
changeset
|
187 // Compute the address for reexecution |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
188 static address deopt_reexecute_entry(Method* method, address bcp); |
0 | 189 |
1972 | 190 #ifdef TARGET_ARCH_x86 |
191 # include "templateInterpreter_x86.hpp" | |
192 #endif | |
193 #ifdef TARGET_ARCH_sparc | |
194 # include "templateInterpreter_sparc.hpp" | |
195 #endif | |
196 #ifdef TARGET_ARCH_zero | |
197 # include "templateInterpreter_zero.hpp" | |
198 #endif | |
2192
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
199 #ifdef TARGET_ARCH_arm |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
200 # include "templateInterpreter_arm.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
201 #endif |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
202 #ifdef TARGET_ARCH_ppc |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
203 # include "templateInterpreter_ppc.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
204 #endif |
1972 | 205 |
0 | 206 |
207 }; | |
208 | |
209 #endif // !CC_INTERP | |
1972 | 210 |
211 #endif // SHARE_VM_INTERPRETER_TEMPLATEINTERPRETER_HPP |