Mercurial > hg > truffle
annotate src/share/vm/interpreter/templateTable.hpp @ 9126:bc26f978b0ce
HotSpotResolvedObjectType: implement hasFinalizeSubclass() correctly
don't use the (wrong) cached value, but ask the runtime on each request.
Fixes regression on xml.* benchmarks @ specjvm2008. The problem was:
After the constructor of Object was deoptimized due to an assumption violation,
it was recompiled again after some time. However, on recompilation, the value
of hasFinalizeSubclass for the class was not updated and it was compiled again
with a, now wrong, assumption, which then triggers deoptimization again.
This was repeated until it hit the recompilation limit (defined by
PerMethodRecompilationCutoff), and therefore only executed by the interpreter
from now on, causing the performance regression.
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Mon, 15 Apr 2013 19:54:58 +0200 |
parents | da91efe96a93 |
children | 5ccbab1c69f3 d2907f74462e |
rev | line source |
---|---|
0 | 1 /* |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
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:
844
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
844
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:
844
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_INTERPRETER_TEMPLATETABLE_HPP |
26 #define SHARE_VM_INTERPRETER_TEMPLATETABLE_HPP | |
27 | |
28 #include "interpreter/bytecodes.hpp" | |
29 #include "memory/allocation.hpp" | |
30 #include "runtime/frame.hpp" | |
31 #ifdef TARGET_ARCH_MODEL_x86_32 | |
32 # include "interp_masm_x86_32.hpp" | |
33 #endif | |
34 #ifdef TARGET_ARCH_MODEL_x86_64 | |
35 # include "interp_masm_x86_64.hpp" | |
36 #endif | |
37 #ifdef TARGET_ARCH_MODEL_sparc | |
38 # include "interp_masm_sparc.hpp" | |
39 #endif | |
40 #ifdef TARGET_ARCH_MODEL_zero | |
41 # include "interp_masm_zero.hpp" | |
42 #endif | |
2192
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
43 #ifdef TARGET_ARCH_MODEL_arm |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
44 # include "interp_masm_arm.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
45 #endif |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
46 #ifdef TARGET_ARCH_MODEL_ppc |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
47 # include "interp_masm_ppc.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
48 #endif |
1972 | 49 |
0 | 50 #ifndef CC_INTERP |
51 // All the necessary definitions used for (bytecode) template generation. Instead of | |
52 // spreading the implementation functionality for each bytecode in the interpreter | |
53 // and the snippet generator, a template is assigned to each bytecode which can be | |
54 // used to generate the bytecode's implementation if needed. | |
55 | |
56 | |
57 // A Template describes the properties of a code template for a given bytecode | |
58 // and provides a generator to generate the code template. | |
59 | |
60 class Template VALUE_OBJ_CLASS_SPEC { | |
61 private: | |
62 enum Flags { | |
63 uses_bcp_bit, // set if template needs the bcp pointing to bytecode | |
64 does_dispatch_bit, // set if template dispatches on its own | |
65 calls_vm_bit, // set if template calls the vm | |
66 wide_bit // set if template belongs to a wide instruction | |
67 }; | |
68 | |
69 typedef void (*generator)(int arg); | |
70 | |
71 int _flags; // describes interpreter template properties (bcp unknown) | |
72 TosState _tos_in; // tos cache state before template execution | |
73 TosState _tos_out; // tos cache state after template execution | |
74 generator _gen; // template code generator | |
75 int _arg; // argument for template code generator | |
76 | |
77 void initialize(int flags, TosState tos_in, TosState tos_out, generator gen, int arg); | |
78 | |
79 friend class TemplateTable; | |
80 | |
81 public: | |
82 Bytecodes::Code bytecode() const; | |
83 bool is_valid() const { return _gen != NULL; } | |
84 bool uses_bcp() const { return (_flags & (1 << uses_bcp_bit )) != 0; } | |
85 bool does_dispatch() const { return (_flags & (1 << does_dispatch_bit)) != 0; } | |
86 bool calls_vm() const { return (_flags & (1 << calls_vm_bit )) != 0; } | |
87 bool is_wide() const { return (_flags & (1 << wide_bit )) != 0; } | |
88 TosState tos_in() const { return _tos_in; } | |
89 TosState tos_out() const { return _tos_out; } | |
90 void generate(InterpreterMacroAssembler* masm); | |
91 }; | |
92 | |
93 | |
94 // The TemplateTable defines all Templates and provides accessor functions | |
95 // to get the template for a given bytecode. | |
96 | |
97 class TemplateTable: AllStatic { | |
98 public: | |
99 enum Operation { add, sub, mul, div, rem, _and, _or, _xor, shl, shr, ushr }; | |
100 enum Condition { equal, not_equal, less, less_equal, greater, greater_equal }; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
101 enum CacheByte { f1_byte = 1, f2_byte = 2 }; // byte_no codes |
0 | 102 |
103 private: | |
104 static bool _is_initialized; // true if TemplateTable has been initialized | |
105 static Template _template_table [Bytecodes::number_of_codes]; | |
106 static Template _template_table_wide[Bytecodes::number_of_codes]; | |
107 | |
108 static Template* _desc; // the current template to be generated | |
109 static Bytecodes::Code bytecode() { return _desc->bytecode(); } | |
110 | |
342 | 111 static BarrierSet* _bs; // Cache the barrier set. |
0 | 112 public: |
113 //%note templates_1 | |
114 static InterpreterMacroAssembler* _masm; // the assembler used when generating templates | |
115 | |
116 private: | |
117 | |
118 // special registers | |
119 static inline Address at_bcp(int offset); | |
120 | |
121 // helpers | |
122 static void unimplemented_bc(); | |
3852
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
2426
diff
changeset
|
123 static void patch_bytecode(Bytecodes::Code bc, Register bc_reg, |
fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
2426
diff
changeset
|
124 Register temp_reg, bool load_bc_into_bc_reg = true, int byte_no = -1); |
0 | 125 |
126 // C calls | |
127 static void call_VM(Register oop_result, address entry_point); | |
128 static void call_VM(Register oop_result, address entry_point, Register arg_1); | |
129 static void call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2); | |
130 static void call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2, Register arg_3); | |
131 | |
132 // these overloadings are not presently used on SPARC: | |
133 static void call_VM(Register oop_result, Register last_java_sp, address entry_point); | |
134 static void call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1); | |
135 static void call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, Register arg_2); | |
136 static void call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, Register arg_2, Register arg_3); | |
137 | |
138 // bytecodes | |
139 static void nop(); | |
140 | |
141 static void aconst_null(); | |
142 static void iconst(int value); | |
143 static void lconst(int value); | |
144 static void fconst(int value); | |
145 static void dconst(int value); | |
146 | |
147 static void bipush(); | |
148 static void sipush(); | |
149 static void ldc(bool wide); | |
150 static void ldc2_w(); | |
1602 | 151 static void fast_aldc(bool wide); |
0 | 152 |
153 static void locals_index(Register reg, int offset = 1); | |
154 static void iload(); | |
155 static void fast_iload(); | |
156 static void fast_iload2(); | |
157 static void fast_icaload(); | |
158 static void lload(); | |
159 static void fload(); | |
160 static void dload(); | |
161 static void aload(); | |
162 | |
163 static void locals_index_wide(Register reg); | |
164 static void wide_iload(); | |
165 static void wide_lload(); | |
166 static void wide_fload(); | |
167 static void wide_dload(); | |
168 static void wide_aload(); | |
169 | |
170 static void iaload(); | |
171 static void laload(); | |
172 static void faload(); | |
173 static void daload(); | |
174 static void aaload(); | |
175 static void baload(); | |
176 static void caload(); | |
177 static void saload(); | |
178 | |
179 static void iload(int n); | |
180 static void lload(int n); | |
181 static void fload(int n); | |
182 static void dload(int n); | |
183 static void aload(int n); | |
184 static void aload_0(); | |
185 | |
186 static void istore(); | |
187 static void lstore(); | |
188 static void fstore(); | |
189 static void dstore(); | |
190 static void astore(); | |
191 | |
192 static void wide_istore(); | |
193 static void wide_lstore(); | |
194 static void wide_fstore(); | |
195 static void wide_dstore(); | |
196 static void wide_astore(); | |
197 | |
198 static void iastore(); | |
199 static void lastore(); | |
200 static void fastore(); | |
201 static void dastore(); | |
202 static void aastore(); | |
203 static void bastore(); | |
204 static void castore(); | |
205 static void sastore(); | |
206 | |
207 static void istore(int n); | |
208 static void lstore(int n); | |
209 static void fstore(int n); | |
210 static void dstore(int n); | |
211 static void astore(int n); | |
212 | |
213 static void pop(); | |
214 static void pop2(); | |
215 static void dup(); | |
216 static void dup_x1(); | |
217 static void dup_x2(); | |
218 static void dup2(); | |
219 static void dup2_x1(); | |
220 static void dup2_x2(); | |
221 static void swap(); | |
222 | |
223 static void iop2(Operation op); | |
224 static void lop2(Operation op); | |
225 static void fop2(Operation op); | |
226 static void dop2(Operation op); | |
227 | |
228 static void idiv(); | |
229 static void irem(); | |
230 | |
231 static void lmul(); | |
232 static void ldiv(); | |
233 static void lrem(); | |
234 static void lshl(); | |
235 static void lshr(); | |
236 static void lushr(); | |
237 | |
238 static void ineg(); | |
239 static void lneg(); | |
240 static void fneg(); | |
241 static void dneg(); | |
242 | |
243 static void iinc(); | |
244 static void wide_iinc(); | |
245 static void convert(); | |
246 static void lcmp(); | |
247 | |
248 static void float_cmp (bool is_float, int unordered_result); | |
249 static void float_cmp (int unordered_result); | |
250 static void double_cmp(int unordered_result); | |
251 | |
252 static void count_calls(Register method, Register temp); | |
253 static void branch(bool is_jsr, bool is_wide); | |
254 static void if_0cmp (Condition cc); | |
255 static void if_icmp (Condition cc); | |
256 static void if_nullcmp(Condition cc); | |
257 static void if_acmp (Condition cc); | |
258 | |
259 static void _goto(); | |
260 static void jsr(); | |
261 static void ret(); | |
262 static void wide_ret(); | |
263 | |
264 static void goto_w(); | |
265 static void jsr_w(); | |
266 | |
267 static void tableswitch(); | |
268 static void lookupswitch(); | |
269 static void fast_linearswitch(); | |
270 static void fast_binaryswitch(); | |
271 | |
272 static void _return(TosState state); | |
273 | |
1565 | 274 static void resolve_cache_and_index(int byte_no, // one of 1,2,11 |
275 Register cache, // output for CP cache | |
276 Register index, // output for CP index | |
277 size_t index_size); // one of 1,2,4 | |
0 | 278 static void load_invoke_cp_cache_entry(int byte_no, |
279 Register method, | |
280 Register itable_index, | |
281 Register flags, | |
1565 | 282 bool is_invokevirtual, |
283 bool is_virtual_final, | |
284 bool is_invokedynamic); | |
0 | 285 static void load_field_cp_cache_entry(Register obj, |
286 Register cache, | |
287 Register index, | |
288 Register offset, | |
289 Register flags, | |
290 bool is_static); | |
291 static void invokevirtual(int byte_no); | |
292 static void invokespecial(int byte_no); | |
293 static void invokestatic(int byte_no); | |
294 static void invokeinterface(int byte_no); | |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
342
diff
changeset
|
295 static void invokedynamic(int byte_no); |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
3852
diff
changeset
|
296 static void invokehandle(int byte_no); |
0 | 297 static void fast_invokevfinal(int byte_no); |
298 | |
299 static void getfield_or_static(int byte_no, bool is_static); | |
300 static void putfield_or_static(int byte_no, bool is_static); | |
301 static void getfield(int byte_no); | |
302 static void putfield(int byte_no); | |
303 static void getstatic(int byte_no); | |
304 static void putstatic(int byte_no); | |
305 static void pop_and_check_object(Register obj); | |
306 | |
307 static void _new(); | |
308 static void newarray(); | |
309 static void anewarray(); | |
310 static void arraylength(); | |
311 static void checkcast(); | |
312 static void instanceof(); | |
313 | |
314 static void athrow(); | |
315 | |
316 static void monitorenter(); | |
317 static void monitorexit(); | |
318 | |
319 static void wide(); | |
320 static void multianewarray(); | |
321 | |
322 static void fast_xaccess(TosState state); | |
323 static void fast_accessfield(TosState state); | |
324 static void fast_storefield(TosState state); | |
325 | |
326 static void _breakpoint(); | |
327 | |
328 static void shouldnotreachhere(); | |
329 | |
330 // jvmti support | |
331 static void jvmti_post_field_access(Register cache, Register index, bool is_static, bool has_tos); | |
332 static void jvmti_post_field_mod(Register cache, Register index, bool is_static); | |
333 static void jvmti_post_fast_field_mod(); | |
334 | |
335 // debugging of TemplateGenerator | |
336 static void transition(TosState tos_in, TosState tos_out);// checks if in/out states expected by template generator correspond to table entries | |
337 | |
338 // initialization helpers | |
339 static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)( ), char filler ); | |
340 static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(int arg ), int arg ); | |
341 static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(bool arg ), bool arg ); | |
342 static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(TosState tos), TosState tos); | |
343 static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(Operation op), Operation op); | |
344 static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(Condition cc), Condition cc); | |
345 | |
346 friend class Template; | |
347 | |
348 // InterpreterMacroAssembler::is_a(), etc., need TemplateTable::call_VM(). | |
349 friend class InterpreterMacroAssembler; | |
350 | |
351 public: | |
352 // Initialization | |
353 static void initialize(); | |
354 static void pd_initialize(); | |
355 | |
356 // Templates | |
357 static Template* template_for (Bytecodes::Code code) { Bytecodes::check (code); return &_template_table [code]; } | |
358 static Template* template_for_wide(Bytecodes::Code code) { Bytecodes::wide_check(code); return &_template_table_wide[code]; } | |
359 | |
360 // Platform specifics | |
1972 | 361 #ifdef TARGET_ARCH_MODEL_x86_32 |
362 # include "templateTable_x86_32.hpp" | |
363 #endif | |
364 #ifdef TARGET_ARCH_MODEL_x86_64 | |
365 # include "templateTable_x86_64.hpp" | |
366 #endif | |
367 #ifdef TARGET_ARCH_MODEL_sparc | |
368 # include "templateTable_sparc.hpp" | |
369 #endif | |
370 #ifdef TARGET_ARCH_MODEL_zero | |
371 # include "templateTable_zero.hpp" | |
372 #endif | |
2192
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
373 #ifdef TARGET_ARCH_MODEL_arm |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
374 # include "templateTable_arm.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
375 #endif |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
376 #ifdef TARGET_ARCH_MODEL_ppc |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
377 # include "templateTable_ppc.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
378 #endif |
1972 | 379 |
0 | 380 }; |
381 #endif /* !CC_INTERP */ | |
1972 | 382 |
383 #endif // SHARE_VM_INTERPRETER_TEMPLATETABLE_HPP |