Mercurial > hg > truffle
annotate src/share/vm/interpreter/bytecodes.cpp @ 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 |
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:
1527
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1527
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:
1527
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "interpreter/bytecodes.hpp" | |
27 #include "memory/resourceArea.hpp" | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
28 #include "oops/method.hpp" |
1972 | 29 #ifdef TARGET_ARCH_x86 |
30 # include "bytes_x86.hpp" | |
31 #endif | |
32 #ifdef TARGET_ARCH_sparc | |
33 # include "bytes_sparc.hpp" | |
34 #endif | |
35 #ifdef TARGET_ARCH_zero | |
36 # include "bytes_zero.hpp" | |
37 #endif | |
2192
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
2142
diff
changeset
|
38 #ifdef TARGET_ARCH_arm |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
2142
diff
changeset
|
39 # include "bytes_arm.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
2142
diff
changeset
|
40 #endif |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
2142
diff
changeset
|
41 #ifdef TARGET_ARCH_ppc |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
2142
diff
changeset
|
42 # include "bytes_ppc.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
2142
diff
changeset
|
43 #endif |
0 | 44 |
45 | |
1526
daf617c34be6
6953588: hotspot\src\share\vm\interpreter\bytecodes.cpp doesn't compile with VS2010 on AMD64
prr
parents:
1135
diff
changeset
|
46 #if defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER < 1600)) |
0 | 47 // Windows AMD64 Compiler Hangs compiling this file |
48 // unless optimization is off | |
49 #ifdef _M_AMD64 | |
50 #pragma optimize ("", off) | |
51 #endif | |
1526
daf617c34be6
6953588: hotspot\src\share\vm\interpreter\bytecodes.cpp doesn't compile with VS2010 on AMD64
prr
parents:
1135
diff
changeset
|
52 #endif |
0 | 53 |
54 | |
55 bool Bytecodes::_is_initialized = false; | |
56 const char* Bytecodes::_name [Bytecodes::number_of_codes]; | |
57 BasicType Bytecodes::_result_type [Bytecodes::number_of_codes]; | |
58 s_char Bytecodes::_depth [Bytecodes::number_of_codes]; | |
1565 | 59 u_char Bytecodes::_lengths [Bytecodes::number_of_codes]; |
0 | 60 Bytecodes::Code Bytecodes::_java_code [Bytecodes::number_of_codes]; |
1565 | 61 u_short Bytecodes::_flags [(1<<BitsPerByte)*2]; |
0 | 62 |
2142 | 63 #ifdef ASSERT |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
64 bool Bytecodes::check_method(const Method* method, address bcp) { |
2142 | 65 return method->contains(bcp); |
66 } | |
67 #endif | |
68 | |
69 bool Bytecodes::check_must_rewrite(Bytecodes::Code code) { | |
70 assert(can_rewrite(code), "post-check only"); | |
71 | |
72 // Some codes are conditionally rewriting. Look closely at them. | |
73 switch (code) { | |
74 case Bytecodes::_aload_0: | |
75 // Even if RewriteFrequentPairs is turned on, | |
76 // the _aload_0 code might delay its rewrite until | |
77 // a following _getfield rewrites itself. | |
78 return false; | |
79 | |
80 case Bytecodes::_lookupswitch: | |
81 return false; // the rewrite is not done by the interpreter | |
82 | |
83 case Bytecodes::_new: | |
84 // (Could actually look at the class here, but the profit would be small.) | |
85 return false; // the rewrite is not always done | |
86 } | |
87 | |
88 // No other special cases. | |
89 return true; | |
90 } | |
0 | 91 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
92 Bytecodes::Code Bytecodes::code_at(Method* method, int bci) { |
2142 | 93 return code_at(method, method->bcp_from(bci)); |
0 | 94 } |
95 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
96 Bytecodes::Code Bytecodes::non_breakpoint_code_at(const Method* method, address bcp) { |
2142 | 97 assert(method != NULL, "must have the method for breakpoint conversion"); |
98 assert(method->contains(bcp), "must be valid bcp in method"); | |
0 | 99 return method->orig_bytecode_at(method->bci_from(bcp)); |
100 } | |
101 | |
2142 | 102 int Bytecodes::special_length_at(Bytecodes::Code code, address bcp, address end) { |
0 | 103 switch (code) { |
104 case _wide: | |
413
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
105 if (end != NULL && bcp + 1 >= end) { |
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
106 return -1; // don't read past end of code buffer |
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
107 } |
0 | 108 return wide_length_for(cast(*(bcp + 1))); |
109 case _tableswitch: | |
110 { address aligned_bcp = (address)round_to((intptr_t)bcp + 1, jintSize); | |
413
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
111 if (end != NULL && aligned_bcp + 3*jintSize >= end) { |
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
112 return -1; // don't read past end of code buffer |
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
113 } |
0 | 114 jlong lo = (jint)Bytes::get_Java_u4(aligned_bcp + 1*jintSize); |
115 jlong hi = (jint)Bytes::get_Java_u4(aligned_bcp + 2*jintSize); | |
116 jlong len = (aligned_bcp - bcp) + (3 + hi - lo + 1)*jintSize; | |
117 // only return len if it can be represented as a positive int; | |
118 // return -1 otherwise | |
119 return (len > 0 && len == (int)len) ? len : -1; | |
120 } | |
121 | |
122 case _lookupswitch: // fall through | |
123 case _fast_binaryswitch: // fall through | |
124 case _fast_linearswitch: | |
125 { address aligned_bcp = (address)round_to((intptr_t)bcp + 1, jintSize); | |
413
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
126 if (end != NULL && aligned_bcp + 2*jintSize >= end) { |
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
127 return -1; // don't read past end of code buffer |
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
128 } |
0 | 129 jlong npairs = (jint)Bytes::get_Java_u4(aligned_bcp + jintSize); |
130 jlong len = (aligned_bcp - bcp) + (2 + 2*npairs)*jintSize; | |
131 // only return len if it can be represented as a positive int; | |
132 // return -1 otherwise | |
133 return (len > 0 && len == (int)len) ? len : -1; | |
134 } | |
135 } | |
1570 | 136 // Note: Length functions must return <=0 for invalid bytecodes. |
0 | 137 return 0; |
138 } | |
139 | |
140 // At a breakpoint instruction, this returns the breakpoint's length, | |
141 // otherwise, it's the same as special_length_at(). This is used by | |
142 // the RawByteCodeStream, which wants to see the actual bytecode | |
143 // values (including breakpoint). RawByteCodeStream is used by the | |
144 // verifier when reading in bytecode to verify. Other mechanisms that | |
145 // run at runtime (such as generateOopMaps) need to iterate over the code | |
146 // and don't expect to see breakpoints: they want to see the instruction | |
413
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
147 // which was replaced so that they can get the correct length and find |
0 | 148 // the next bytecode. |
413
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
149 // |
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
150 // 'end' indicates the end of the code buffer, which we should not try to read |
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
151 // past. |
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
152 int Bytecodes::raw_special_length_at(address bcp, address end) { |
0 | 153 Code code = code_or_bp_at(bcp); |
154 if (code == _breakpoint) { | |
155 return 1; | |
156 } else { | |
2142 | 157 return special_length_at(code, bcp, end); |
0 | 158 } |
159 } | |
160 | |
161 | |
162 | |
163 void Bytecodes::def(Code code, const char* name, const char* format, const char* wide_format, BasicType result_type, int depth, bool can_trap) { | |
164 def(code, name, format, wide_format, result_type, depth, can_trap, code); | |
165 } | |
166 | |
167 | |
168 void Bytecodes::def(Code code, const char* name, const char* format, const char* wide_format, BasicType result_type, int depth, bool can_trap, Code java_code) { | |
169 assert(wide_format == NULL || format != NULL, "short form must exist if there's a wide form"); | |
1565 | 170 int len = (format != NULL ? (int) strlen(format) : 0); |
171 int wlen = (wide_format != NULL ? (int) strlen(wide_format) : 0); | |
0 | 172 _name [code] = name; |
173 _result_type [code] = result_type; | |
174 _depth [code] = depth; | |
1565 | 175 _lengths [code] = (wlen << 4) | (len & 0xF); |
0 | 176 _java_code [code] = java_code; |
1565 | 177 int bc_flags = 0; |
178 if (can_trap) bc_flags |= _bc_can_trap; | |
179 if (java_code != code) bc_flags |= _bc_can_rewrite; | |
180 _flags[(u1)code+0*(1<<BitsPerByte)] = compute_flags(format, bc_flags); | |
181 _flags[(u1)code+1*(1<<BitsPerByte)] = compute_flags(wide_format, bc_flags); | |
182 assert(is_defined(code) == (format != NULL), ""); | |
183 assert(wide_is_defined(code) == (wide_format != NULL), ""); | |
184 assert(length_for(code) == len, ""); | |
185 assert(wide_length_for(code) == wlen, ""); | |
0 | 186 } |
187 | |
188 | |
189 // Format strings interpretation: | |
190 // | |
191 // b: bytecode | |
192 // c: signed constant, Java byte-ordering | |
1565 | 193 // i: unsigned local index, Java byte-ordering (I = native byte ordering) |
194 // j: unsigned CP cache index, Java byte-ordering (J = native byte ordering) | |
195 // k: unsigned CP index, Java byte-ordering | |
196 // o: branch offset, Java byte-ordering | |
0 | 197 // _: unused/ignored |
198 // w: wide bytecode | |
199 // | |
1565 | 200 // Note: The format strings are used for 2 purposes: |
0 | 201 // 1. to specify the length of the bytecode |
202 // (= number of characters in format string) | |
1565 | 203 // 2. to derive bytecode format flags (_fmt_has_k, etc.) |
0 | 204 // |
205 // Note: For bytecodes with variable length, the format string is the empty string. | |
206 | |
1565 | 207 int Bytecodes::compute_flags(const char* format, int more_flags) { |
208 if (format == NULL) return 0; // not even more_flags | |
209 int flags = more_flags; | |
210 const char* fp = format; | |
211 switch (*fp) { | |
212 case '\0': | |
213 flags |= _fmt_not_simple; // but variable | |
214 break; | |
215 case 'b': | |
216 flags |= _fmt_not_variable; // but simple | |
217 ++fp; // skip 'b' | |
218 break; | |
219 case 'w': | |
220 flags |= _fmt_not_variable | _fmt_not_simple; | |
221 ++fp; // skip 'w' | |
222 guarantee(*fp == 'b', "wide format must start with 'wb'"); | |
223 ++fp; // skip 'b' | |
224 break; | |
225 } | |
226 | |
227 int has_nbo = 0, has_jbo = 0, has_size = 0; | |
228 for (;;) { | |
229 int this_flag = 0; | |
230 char fc = *fp++; | |
231 switch (fc) { | |
232 case '\0': // end of string | |
233 assert(flags == (jchar)flags, "change _format_flags"); | |
234 return flags; | |
235 | |
236 case '_': continue; // ignore these | |
237 | |
238 case 'j': this_flag = _fmt_has_j; has_jbo = 1; break; | |
239 case 'k': this_flag = _fmt_has_k; has_jbo = 1; break; | |
240 case 'i': this_flag = _fmt_has_i; has_jbo = 1; break; | |
241 case 'c': this_flag = _fmt_has_c; has_jbo = 1; break; | |
242 case 'o': this_flag = _fmt_has_o; has_jbo = 1; break; | |
243 | |
244 // uppercase versions mark native byte order (from Rewriter) | |
245 // actually, only the 'J' case happens currently | |
246 case 'J': this_flag = _fmt_has_j; has_nbo = 1; break; | |
247 case 'K': this_flag = _fmt_has_k; has_nbo = 1; break; | |
248 case 'I': this_flag = _fmt_has_i; has_nbo = 1; break; | |
249 case 'C': this_flag = _fmt_has_c; has_nbo = 1; break; | |
250 case 'O': this_flag = _fmt_has_o; has_nbo = 1; break; | |
251 default: guarantee(false, "bad char in format"); | |
252 } | |
253 | |
254 flags |= this_flag; | |
255 | |
256 guarantee(!(has_jbo && has_nbo), "mixed byte orders in format"); | |
257 if (has_nbo) | |
258 flags |= _fmt_has_nbo; | |
259 | |
260 int this_size = 1; | |
261 if (*fp == fc) { | |
262 // advance beyond run of the same characters | |
263 this_size = 2; | |
264 while (*++fp == fc) this_size++; | |
265 switch (this_size) { | |
266 case 2: flags |= _fmt_has_u2; break; | |
267 case 4: flags |= _fmt_has_u4; break; | |
268 default: guarantee(false, "bad rep count in format"); | |
269 } | |
270 } | |
271 guarantee(has_size == 0 || // no field yet | |
272 this_size == has_size || // same size | |
273 this_size < has_size && *fp == '\0', // last field can be short | |
274 "mixed field sizes in format"); | |
275 has_size = this_size; | |
276 } | |
277 } | |
278 | |
0 | 279 void Bytecodes::initialize() { |
280 if (_is_initialized) return; | |
281 assert(number_of_codes <= 256, "too many bytecodes"); | |
282 | |
283 // initialize bytecode tables - didn't use static array initializers | |
284 // (such as {}) so we can do additional consistency checks and init- | |
285 // code is independent of actual bytecode numbering. | |
286 // | |
287 // Note 1: NULL for the format string means the bytecode doesn't exist | |
288 // in that form. | |
289 // | |
290 // Note 2: The result type is T_ILLEGAL for bytecodes where the top of stack | |
291 // type after execution is not only determined by the bytecode itself. | |
292 | |
293 // Java bytecodes | |
294 // bytecode bytecode name format wide f. result tp stk traps | |
295 def(_nop , "nop" , "b" , NULL , T_VOID , 0, false); | |
296 def(_aconst_null , "aconst_null" , "b" , NULL , T_OBJECT , 1, false); | |
297 def(_iconst_m1 , "iconst_m1" , "b" , NULL , T_INT , 1, false); | |
298 def(_iconst_0 , "iconst_0" , "b" , NULL , T_INT , 1, false); | |
299 def(_iconst_1 , "iconst_1" , "b" , NULL , T_INT , 1, false); | |
300 def(_iconst_2 , "iconst_2" , "b" , NULL , T_INT , 1, false); | |
301 def(_iconst_3 , "iconst_3" , "b" , NULL , T_INT , 1, false); | |
302 def(_iconst_4 , "iconst_4" , "b" , NULL , T_INT , 1, false); | |
303 def(_iconst_5 , "iconst_5" , "b" , NULL , T_INT , 1, false); | |
304 def(_lconst_0 , "lconst_0" , "b" , NULL , T_LONG , 2, false); | |
305 def(_lconst_1 , "lconst_1" , "b" , NULL , T_LONG , 2, false); | |
306 def(_fconst_0 , "fconst_0" , "b" , NULL , T_FLOAT , 1, false); | |
307 def(_fconst_1 , "fconst_1" , "b" , NULL , T_FLOAT , 1, false); | |
308 def(_fconst_2 , "fconst_2" , "b" , NULL , T_FLOAT , 1, false); | |
309 def(_dconst_0 , "dconst_0" , "b" , NULL , T_DOUBLE , 2, false); | |
310 def(_dconst_1 , "dconst_1" , "b" , NULL , T_DOUBLE , 2, false); | |
311 def(_bipush , "bipush" , "bc" , NULL , T_INT , 1, false); | |
312 def(_sipush , "sipush" , "bcc" , NULL , T_INT , 1, false); | |
1565 | 313 def(_ldc , "ldc" , "bk" , NULL , T_ILLEGAL, 1, true ); |
314 def(_ldc_w , "ldc_w" , "bkk" , NULL , T_ILLEGAL, 1, true ); | |
315 def(_ldc2_w , "ldc2_w" , "bkk" , NULL , T_ILLEGAL, 2, true ); | |
0 | 316 def(_iload , "iload" , "bi" , "wbii" , T_INT , 1, false); |
317 def(_lload , "lload" , "bi" , "wbii" , T_LONG , 2, false); | |
318 def(_fload , "fload" , "bi" , "wbii" , T_FLOAT , 1, false); | |
319 def(_dload , "dload" , "bi" , "wbii" , T_DOUBLE , 2, false); | |
320 def(_aload , "aload" , "bi" , "wbii" , T_OBJECT , 1, false); | |
321 def(_iload_0 , "iload_0" , "b" , NULL , T_INT , 1, false); | |
322 def(_iload_1 , "iload_1" , "b" , NULL , T_INT , 1, false); | |
323 def(_iload_2 , "iload_2" , "b" , NULL , T_INT , 1, false); | |
324 def(_iload_3 , "iload_3" , "b" , NULL , T_INT , 1, false); | |
325 def(_lload_0 , "lload_0" , "b" , NULL , T_LONG , 2, false); | |
326 def(_lload_1 , "lload_1" , "b" , NULL , T_LONG , 2, false); | |
327 def(_lload_2 , "lload_2" , "b" , NULL , T_LONG , 2, false); | |
328 def(_lload_3 , "lload_3" , "b" , NULL , T_LONG , 2, false); | |
329 def(_fload_0 , "fload_0" , "b" , NULL , T_FLOAT , 1, false); | |
330 def(_fload_1 , "fload_1" , "b" , NULL , T_FLOAT , 1, false); | |
331 def(_fload_2 , "fload_2" , "b" , NULL , T_FLOAT , 1, false); | |
332 def(_fload_3 , "fload_3" , "b" , NULL , T_FLOAT , 1, false); | |
333 def(_dload_0 , "dload_0" , "b" , NULL , T_DOUBLE , 2, false); | |
334 def(_dload_1 , "dload_1" , "b" , NULL , T_DOUBLE , 2, false); | |
335 def(_dload_2 , "dload_2" , "b" , NULL , T_DOUBLE , 2, false); | |
336 def(_dload_3 , "dload_3" , "b" , NULL , T_DOUBLE , 2, false); | |
337 def(_aload_0 , "aload_0" , "b" , NULL , T_OBJECT , 1, true ); // rewriting in interpreter | |
338 def(_aload_1 , "aload_1" , "b" , NULL , T_OBJECT , 1, false); | |
339 def(_aload_2 , "aload_2" , "b" , NULL , T_OBJECT , 1, false); | |
340 def(_aload_3 , "aload_3" , "b" , NULL , T_OBJECT , 1, false); | |
341 def(_iaload , "iaload" , "b" , NULL , T_INT , -1, true ); | |
342 def(_laload , "laload" , "b" , NULL , T_LONG , 0, true ); | |
343 def(_faload , "faload" , "b" , NULL , T_FLOAT , -1, true ); | |
344 def(_daload , "daload" , "b" , NULL , T_DOUBLE , 0, true ); | |
345 def(_aaload , "aaload" , "b" , NULL , T_OBJECT , -1, true ); | |
346 def(_baload , "baload" , "b" , NULL , T_INT , -1, true ); | |
347 def(_caload , "caload" , "b" , NULL , T_INT , -1, true ); | |
348 def(_saload , "saload" , "b" , NULL , T_INT , -1, true ); | |
349 def(_istore , "istore" , "bi" , "wbii" , T_VOID , -1, false); | |
350 def(_lstore , "lstore" , "bi" , "wbii" , T_VOID , -2, false); | |
351 def(_fstore , "fstore" , "bi" , "wbii" , T_VOID , -1, false); | |
352 def(_dstore , "dstore" , "bi" , "wbii" , T_VOID , -2, false); | |
353 def(_astore , "astore" , "bi" , "wbii" , T_VOID , -1, false); | |
354 def(_istore_0 , "istore_0" , "b" , NULL , T_VOID , -1, false); | |
355 def(_istore_1 , "istore_1" , "b" , NULL , T_VOID , -1, false); | |
356 def(_istore_2 , "istore_2" , "b" , NULL , T_VOID , -1, false); | |
357 def(_istore_3 , "istore_3" , "b" , NULL , T_VOID , -1, false); | |
358 def(_lstore_0 , "lstore_0" , "b" , NULL , T_VOID , -2, false); | |
359 def(_lstore_1 , "lstore_1" , "b" , NULL , T_VOID , -2, false); | |
360 def(_lstore_2 , "lstore_2" , "b" , NULL , T_VOID , -2, false); | |
361 def(_lstore_3 , "lstore_3" , "b" , NULL , T_VOID , -2, false); | |
362 def(_fstore_0 , "fstore_0" , "b" , NULL , T_VOID , -1, false); | |
363 def(_fstore_1 , "fstore_1" , "b" , NULL , T_VOID , -1, false); | |
364 def(_fstore_2 , "fstore_2" , "b" , NULL , T_VOID , -1, false); | |
365 def(_fstore_3 , "fstore_3" , "b" , NULL , T_VOID , -1, false); | |
366 def(_dstore_0 , "dstore_0" , "b" , NULL , T_VOID , -2, false); | |
367 def(_dstore_1 , "dstore_1" , "b" , NULL , T_VOID , -2, false); | |
368 def(_dstore_2 , "dstore_2" , "b" , NULL , T_VOID , -2, false); | |
369 def(_dstore_3 , "dstore_3" , "b" , NULL , T_VOID , -2, false); | |
370 def(_astore_0 , "astore_0" , "b" , NULL , T_VOID , -1, false); | |
371 def(_astore_1 , "astore_1" , "b" , NULL , T_VOID , -1, false); | |
372 def(_astore_2 , "astore_2" , "b" , NULL , T_VOID , -1, false); | |
373 def(_astore_3 , "astore_3" , "b" , NULL , T_VOID , -1, false); | |
374 def(_iastore , "iastore" , "b" , NULL , T_VOID , -3, true ); | |
375 def(_lastore , "lastore" , "b" , NULL , T_VOID , -4, true ); | |
376 def(_fastore , "fastore" , "b" , NULL , T_VOID , -3, true ); | |
377 def(_dastore , "dastore" , "b" , NULL , T_VOID , -4, true ); | |
378 def(_aastore , "aastore" , "b" , NULL , T_VOID , -3, true ); | |
379 def(_bastore , "bastore" , "b" , NULL , T_VOID , -3, true ); | |
380 def(_castore , "castore" , "b" , NULL , T_VOID , -3, true ); | |
381 def(_sastore , "sastore" , "b" , NULL , T_VOID , -3, true ); | |
382 def(_pop , "pop" , "b" , NULL , T_VOID , -1, false); | |
383 def(_pop2 , "pop2" , "b" , NULL , T_VOID , -2, false); | |
384 def(_dup , "dup" , "b" , NULL , T_VOID , 1, false); | |
385 def(_dup_x1 , "dup_x1" , "b" , NULL , T_VOID , 1, false); | |
386 def(_dup_x2 , "dup_x2" , "b" , NULL , T_VOID , 1, false); | |
387 def(_dup2 , "dup2" , "b" , NULL , T_VOID , 2, false); | |
388 def(_dup2_x1 , "dup2_x1" , "b" , NULL , T_VOID , 2, false); | |
389 def(_dup2_x2 , "dup2_x2" , "b" , NULL , T_VOID , 2, false); | |
390 def(_swap , "swap" , "b" , NULL , T_VOID , 0, false); | |
391 def(_iadd , "iadd" , "b" , NULL , T_INT , -1, false); | |
392 def(_ladd , "ladd" , "b" , NULL , T_LONG , -2, false); | |
393 def(_fadd , "fadd" , "b" , NULL , T_FLOAT , -1, false); | |
394 def(_dadd , "dadd" , "b" , NULL , T_DOUBLE , -2, false); | |
395 def(_isub , "isub" , "b" , NULL , T_INT , -1, false); | |
396 def(_lsub , "lsub" , "b" , NULL , T_LONG , -2, false); | |
397 def(_fsub , "fsub" , "b" , NULL , T_FLOAT , -1, false); | |
398 def(_dsub , "dsub" , "b" , NULL , T_DOUBLE , -2, false); | |
399 def(_imul , "imul" , "b" , NULL , T_INT , -1, false); | |
400 def(_lmul , "lmul" , "b" , NULL , T_LONG , -2, false); | |
401 def(_fmul , "fmul" , "b" , NULL , T_FLOAT , -1, false); | |
402 def(_dmul , "dmul" , "b" , NULL , T_DOUBLE , -2, false); | |
403 def(_idiv , "idiv" , "b" , NULL , T_INT , -1, true ); | |
404 def(_ldiv , "ldiv" , "b" , NULL , T_LONG , -2, true ); | |
405 def(_fdiv , "fdiv" , "b" , NULL , T_FLOAT , -1, false); | |
406 def(_ddiv , "ddiv" , "b" , NULL , T_DOUBLE , -2, false); | |
407 def(_irem , "irem" , "b" , NULL , T_INT , -1, true ); | |
408 def(_lrem , "lrem" , "b" , NULL , T_LONG , -2, true ); | |
409 def(_frem , "frem" , "b" , NULL , T_FLOAT , -1, false); | |
410 def(_drem , "drem" , "b" , NULL , T_DOUBLE , -2, false); | |
411 def(_ineg , "ineg" , "b" , NULL , T_INT , 0, false); | |
412 def(_lneg , "lneg" , "b" , NULL , T_LONG , 0, false); | |
413 def(_fneg , "fneg" , "b" , NULL , T_FLOAT , 0, false); | |
414 def(_dneg , "dneg" , "b" , NULL , T_DOUBLE , 0, false); | |
415 def(_ishl , "ishl" , "b" , NULL , T_INT , -1, false); | |
416 def(_lshl , "lshl" , "b" , NULL , T_LONG , -1, false); | |
417 def(_ishr , "ishr" , "b" , NULL , T_INT , -1, false); | |
418 def(_lshr , "lshr" , "b" , NULL , T_LONG , -1, false); | |
419 def(_iushr , "iushr" , "b" , NULL , T_INT , -1, false); | |
420 def(_lushr , "lushr" , "b" , NULL , T_LONG , -1, false); | |
421 def(_iand , "iand" , "b" , NULL , T_INT , -1, false); | |
422 def(_land , "land" , "b" , NULL , T_LONG , -2, false); | |
423 def(_ior , "ior" , "b" , NULL , T_INT , -1, false); | |
424 def(_lor , "lor" , "b" , NULL , T_LONG , -2, false); | |
425 def(_ixor , "ixor" , "b" , NULL , T_INT , -1, false); | |
426 def(_lxor , "lxor" , "b" , NULL , T_LONG , -2, false); | |
427 def(_iinc , "iinc" , "bic" , "wbiicc", T_VOID , 0, false); | |
428 def(_i2l , "i2l" , "b" , NULL , T_LONG , 1, false); | |
429 def(_i2f , "i2f" , "b" , NULL , T_FLOAT , 0, false); | |
430 def(_i2d , "i2d" , "b" , NULL , T_DOUBLE , 1, false); | |
431 def(_l2i , "l2i" , "b" , NULL , T_INT , -1, false); | |
432 def(_l2f , "l2f" , "b" , NULL , T_FLOAT , -1, false); | |
433 def(_l2d , "l2d" , "b" , NULL , T_DOUBLE , 0, false); | |
434 def(_f2i , "f2i" , "b" , NULL , T_INT , 0, false); | |
435 def(_f2l , "f2l" , "b" , NULL , T_LONG , 1, false); | |
436 def(_f2d , "f2d" , "b" , NULL , T_DOUBLE , 1, false); | |
437 def(_d2i , "d2i" , "b" , NULL , T_INT , -1, false); | |
438 def(_d2l , "d2l" , "b" , NULL , T_LONG , 0, false); | |
439 def(_d2f , "d2f" , "b" , NULL , T_FLOAT , -1, false); | |
440 def(_i2b , "i2b" , "b" , NULL , T_BYTE , 0, false); | |
441 def(_i2c , "i2c" , "b" , NULL , T_CHAR , 0, false); | |
442 def(_i2s , "i2s" , "b" , NULL , T_SHORT , 0, false); | |
443 def(_lcmp , "lcmp" , "b" , NULL , T_VOID , -3, false); | |
444 def(_fcmpl , "fcmpl" , "b" , NULL , T_VOID , -1, false); | |
445 def(_fcmpg , "fcmpg" , "b" , NULL , T_VOID , -1, false); | |
446 def(_dcmpl , "dcmpl" , "b" , NULL , T_VOID , -3, false); | |
447 def(_dcmpg , "dcmpg" , "b" , NULL , T_VOID , -3, false); | |
448 def(_ifeq , "ifeq" , "boo" , NULL , T_VOID , -1, false); | |
449 def(_ifne , "ifne" , "boo" , NULL , T_VOID , -1, false); | |
450 def(_iflt , "iflt" , "boo" , NULL , T_VOID , -1, false); | |
451 def(_ifge , "ifge" , "boo" , NULL , T_VOID , -1, false); | |
452 def(_ifgt , "ifgt" , "boo" , NULL , T_VOID , -1, false); | |
453 def(_ifle , "ifle" , "boo" , NULL , T_VOID , -1, false); | |
454 def(_if_icmpeq , "if_icmpeq" , "boo" , NULL , T_VOID , -2, false); | |
455 def(_if_icmpne , "if_icmpne" , "boo" , NULL , T_VOID , -2, false); | |
456 def(_if_icmplt , "if_icmplt" , "boo" , NULL , T_VOID , -2, false); | |
457 def(_if_icmpge , "if_icmpge" , "boo" , NULL , T_VOID , -2, false); | |
458 def(_if_icmpgt , "if_icmpgt" , "boo" , NULL , T_VOID , -2, false); | |
459 def(_if_icmple , "if_icmple" , "boo" , NULL , T_VOID , -2, false); | |
460 def(_if_acmpeq , "if_acmpeq" , "boo" , NULL , T_VOID , -2, false); | |
461 def(_if_acmpne , "if_acmpne" , "boo" , NULL , T_VOID , -2, false); | |
462 def(_goto , "goto" , "boo" , NULL , T_VOID , 0, false); | |
463 def(_jsr , "jsr" , "boo" , NULL , T_INT , 0, false); | |
464 def(_ret , "ret" , "bi" , "wbii" , T_VOID , 0, false); | |
465 def(_tableswitch , "tableswitch" , "" , NULL , T_VOID , -1, false); // may have backward branches | |
466 def(_lookupswitch , "lookupswitch" , "" , NULL , T_VOID , -1, false); // rewriting in interpreter | |
467 def(_ireturn , "ireturn" , "b" , NULL , T_INT , -1, true); | |
468 def(_lreturn , "lreturn" , "b" , NULL , T_LONG , -2, true); | |
469 def(_freturn , "freturn" , "b" , NULL , T_FLOAT , -1, true); | |
470 def(_dreturn , "dreturn" , "b" , NULL , T_DOUBLE , -2, true); | |
471 def(_areturn , "areturn" , "b" , NULL , T_OBJECT , -1, true); | |
472 def(_return , "return" , "b" , NULL , T_VOID , 0, true); | |
1565 | 473 def(_getstatic , "getstatic" , "bJJ" , NULL , T_ILLEGAL, 1, true ); |
474 def(_putstatic , "putstatic" , "bJJ" , NULL , T_ILLEGAL, -1, true ); | |
475 def(_getfield , "getfield" , "bJJ" , NULL , T_ILLEGAL, 0, true ); | |
476 def(_putfield , "putfield" , "bJJ" , NULL , T_ILLEGAL, -2, true ); | |
477 def(_invokevirtual , "invokevirtual" , "bJJ" , NULL , T_ILLEGAL, -1, true); | |
478 def(_invokespecial , "invokespecial" , "bJJ" , NULL , T_ILLEGAL, -1, true); | |
479 def(_invokestatic , "invokestatic" , "bJJ" , NULL , T_ILLEGAL, 0, true); | |
480 def(_invokeinterface , "invokeinterface" , "bJJ__", NULL , T_ILLEGAL, -1, true); | |
481 def(_invokedynamic , "invokedynamic" , "bJJJJ", NULL , T_ILLEGAL, 0, true ); | |
482 def(_new , "new" , "bkk" , NULL , T_OBJECT , 1, true ); | |
0 | 483 def(_newarray , "newarray" , "bc" , NULL , T_OBJECT , 0, true ); |
1565 | 484 def(_anewarray , "anewarray" , "bkk" , NULL , T_OBJECT , 0, true ); |
0 | 485 def(_arraylength , "arraylength" , "b" , NULL , T_VOID , 0, true ); |
486 def(_athrow , "athrow" , "b" , NULL , T_VOID , -1, true ); | |
1565 | 487 def(_checkcast , "checkcast" , "bkk" , NULL , T_OBJECT , 0, true ); |
488 def(_instanceof , "instanceof" , "bkk" , NULL , T_INT , 0, true ); | |
0 | 489 def(_monitorenter , "monitorenter" , "b" , NULL , T_VOID , -1, true ); |
490 def(_monitorexit , "monitorexit" , "b" , NULL , T_VOID , -1, true ); | |
491 def(_wide , "wide" , "" , NULL , T_VOID , 0, false); | |
1565 | 492 def(_multianewarray , "multianewarray" , "bkkc" , NULL , T_OBJECT , 1, true ); |
0 | 493 def(_ifnull , "ifnull" , "boo" , NULL , T_VOID , -1, false); |
494 def(_ifnonnull , "ifnonnull" , "boo" , NULL , T_VOID , -1, false); | |
495 def(_goto_w , "goto_w" , "boooo", NULL , T_VOID , 0, false); | |
496 def(_jsr_w , "jsr_w" , "boooo", NULL , T_INT , 0, false); | |
497 def(_breakpoint , "breakpoint" , "" , NULL , T_VOID , 0, true); | |
498 | |
499 // JVM bytecodes | |
500 // bytecode bytecode name format wide f. result tp stk traps std code | |
501 | |
1565 | 502 def(_fast_agetfield , "fast_agetfield" , "bJJ" , NULL , T_OBJECT , 0, true , _getfield ); |
503 def(_fast_bgetfield , "fast_bgetfield" , "bJJ" , NULL , T_INT , 0, true , _getfield ); | |
504 def(_fast_cgetfield , "fast_cgetfield" , "bJJ" , NULL , T_CHAR , 0, true , _getfield ); | |
505 def(_fast_dgetfield , "fast_dgetfield" , "bJJ" , NULL , T_DOUBLE , 0, true , _getfield ); | |
506 def(_fast_fgetfield , "fast_fgetfield" , "bJJ" , NULL , T_FLOAT , 0, true , _getfield ); | |
507 def(_fast_igetfield , "fast_igetfield" , "bJJ" , NULL , T_INT , 0, true , _getfield ); | |
508 def(_fast_lgetfield , "fast_lgetfield" , "bJJ" , NULL , T_LONG , 0, true , _getfield ); | |
509 def(_fast_sgetfield , "fast_sgetfield" , "bJJ" , NULL , T_SHORT , 0, true , _getfield ); | |
0 | 510 |
1565 | 511 def(_fast_aputfield , "fast_aputfield" , "bJJ" , NULL , T_OBJECT , 0, true , _putfield ); |
512 def(_fast_bputfield , "fast_bputfield" , "bJJ" , NULL , T_INT , 0, true , _putfield ); | |
513 def(_fast_cputfield , "fast_cputfield" , "bJJ" , NULL , T_CHAR , 0, true , _putfield ); | |
514 def(_fast_dputfield , "fast_dputfield" , "bJJ" , NULL , T_DOUBLE , 0, true , _putfield ); | |
515 def(_fast_fputfield , "fast_fputfield" , "bJJ" , NULL , T_FLOAT , 0, true , _putfield ); | |
516 def(_fast_iputfield , "fast_iputfield" , "bJJ" , NULL , T_INT , 0, true , _putfield ); | |
517 def(_fast_lputfield , "fast_lputfield" , "bJJ" , NULL , T_LONG , 0, true , _putfield ); | |
518 def(_fast_sputfield , "fast_sputfield" , "bJJ" , NULL , T_SHORT , 0, true , _putfield ); | |
0 | 519 |
520 def(_fast_aload_0 , "fast_aload_0" , "b" , NULL , T_OBJECT , 1, true , _aload_0 ); | |
1565 | 521 def(_fast_iaccess_0 , "fast_iaccess_0" , "b_JJ" , NULL , T_INT , 1, true , _aload_0 ); |
522 def(_fast_aaccess_0 , "fast_aaccess_0" , "b_JJ" , NULL , T_OBJECT , 1, true , _aload_0 ); | |
523 def(_fast_faccess_0 , "fast_faccess_0" , "b_JJ" , NULL , T_OBJECT , 1, true , _aload_0 ); | |
0 | 524 |
525 def(_fast_iload , "fast_iload" , "bi" , NULL , T_INT , 1, false, _iload); | |
526 def(_fast_iload2 , "fast_iload2" , "bi_i" , NULL , T_INT , 2, false, _iload); | |
527 def(_fast_icaload , "fast_icaload" , "bi_" , NULL , T_INT , 0, false, _iload); | |
528 | |
529 // Faster method invocation. | |
1565 | 530 def(_fast_invokevfinal , "fast_invokevfinal" , "bJJ" , NULL , T_ILLEGAL, -1, true, _invokevirtual ); |
0 | 531 |
532 def(_fast_linearswitch , "fast_linearswitch" , "" , NULL , T_VOID , -1, false, _lookupswitch ); | |
533 def(_fast_binaryswitch , "fast_binaryswitch" , "" , NULL , T_VOID , -1, false, _lookupswitch ); | |
534 | |
535 def(_return_register_finalizer , "return_register_finalizer" , "b" , NULL , T_VOID , 0, true, _return); | |
536 | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
2192
diff
changeset
|
537 def(_invokehandle , "invokehandle" , "bJJ" , NULL , T_ILLEGAL, -1, true, _invokevirtual ); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
2192
diff
changeset
|
538 |
1602 | 539 def(_fast_aldc , "fast_aldc" , "bj" , NULL , T_OBJECT, 1, true, _ldc ); |
540 def(_fast_aldc_w , "fast_aldc_w" , "bJJ" , NULL , T_OBJECT, 1, true, _ldc_w ); | |
541 | |
0 | 542 def(_shouldnotreachhere , "_shouldnotreachhere" , "b" , NULL , T_VOID , 0, false); |
543 | |
544 // platform specific JVM bytecodes | |
545 pd_initialize(); | |
546 | |
547 // compare can_trap information for each bytecode with the | |
548 // can_trap information for the corresponding base bytecode | |
549 // (if a rewritten bytecode can trap, so must the base bytecode) | |
550 #ifdef ASSERT | |
551 { for (int i = 0; i < number_of_codes; i++) { | |
552 if (is_defined(i)) { | |
553 Code code = cast(i); | |
554 Code java = java_code(code); | |
1490
f03d0a26bf83
6888954: argument formatting for assert() and friends
jcoomes
parents:
1135
diff
changeset
|
555 if (can_trap(code) && !can_trap(java)) |
f03d0a26bf83
6888954: argument formatting for assert() and friends
jcoomes
parents:
1135
diff
changeset
|
556 fatal(err_msg("%s can trap => %s can trap, too", name(code), |
f03d0a26bf83
6888954: argument formatting for assert() and friends
jcoomes
parents:
1135
diff
changeset
|
557 name(java))); |
0 | 558 } |
559 } | |
560 } | |
561 #endif | |
562 | |
563 // initialization successful | |
564 _is_initialized = true; | |
565 } | |
566 | |
567 | |
568 void bytecodes_init() { | |
569 Bytecodes::initialize(); | |
570 } | |
571 | |
572 // Restore optimization | |
573 #ifdef _M_AMD64 | |
574 #pragma optimize ("", on) | |
575 #endif |