author | vlivanov |
Fri, 29 May 2015 17:04:21 +0300 | |
changeset 31046 | d01ad7a0ecb0 |
parent 31038 | 2fd2fdc6a70a |
child 38309 | 9b8e9c373740 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
2 |
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4567
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4567
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4567
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "ci/ciCallSite.hpp" |
|
27 |
#include "ci/ciConstant.hpp" |
|
28 |
#include "ci/ciField.hpp" |
|
29 |
#include "ci/ciStreams.hpp" |
|
30 |
#include "ci/ciUtilities.hpp" |
|
1 | 31 |
|
32 |
// ciExceptionHandlerStream |
|
33 |
// |
|
34 |
// Walk over some selected set of a methods exception handlers. |
|
35 |
||
36 |
// ------------------------------------------------------------------ |
|
37 |
// ciExceptionHandlerStream::count |
|
38 |
// |
|
39 |
// How many exception handlers are there in this stream? |
|
40 |
// |
|
41 |
// Implementation note: Compiler2 needs this functionality, so I had |
|
42 |
int ciExceptionHandlerStream::count() { |
|
43 |
int save_pos = _pos; |
|
44 |
int save_end = _end; |
|
45 |
||
46 |
int count = 0; |
|
47 |
||
48 |
_pos = -1; |
|
49 |
_end = _method->_handler_count; |
|
50 |
||
51 |
||
52 |
next(); |
|
53 |
while (!is_done()) { |
|
54 |
count++; |
|
55 |
next(); |
|
56 |
} |
|
57 |
||
58 |
_pos = save_pos; |
|
59 |
_end = save_end; |
|
60 |
||
61 |
return count; |
|
62 |
} |
|
63 |
||
64 |
int ciExceptionHandlerStream::count_remaining() { |
|
65 |
int save_pos = _pos; |
|
66 |
int save_end = _end; |
|
67 |
||
68 |
int count = 0; |
|
69 |
||
70 |
while (!is_done()) { |
|
71 |
count++; |
|
72 |
next(); |
|
73 |
} |
|
74 |
||
75 |
_pos = save_pos; |
|
76 |
_end = save_end; |
|
77 |
||
78 |
return count; |
|
79 |
} |
|
80 |
||
81 |
// ciBytecodeStream |
|
82 |
// |
|
83 |
// The class is used to iterate over the bytecodes of a method. |
|
84 |
// It hides the details of constant pool structure/access by |
|
85 |
// providing accessors for constant pool items. |
|
86 |
||
87 |
// ------------------------------------------------------------------ |
|
5688 | 88 |
// ciBytecodeStream::next_wide_or_table |
1 | 89 |
// |
90 |
// Special handling for switch ops |
|
5688 | 91 |
Bytecodes::Code ciBytecodeStream::next_wide_or_table(Bytecodes::Code bc) { |
92 |
switch (bc) { // Check for special bytecode handling |
|
93 |
case Bytecodes::_wide: |
|
94 |
// Special handling for the wide bytcode |
|
95 |
// Get following bytecode; do not return wide |
|
96 |
assert(Bytecodes::Code(_pc[0]) == Bytecodes::_wide, ""); |
|
97 |
bc = Bytecodes::java_code(_raw_bc = (Bytecodes::Code)_pc[1]); |
|
98 |
assert(Bytecodes::wide_length_for(bc) > 2, "must make progress"); |
|
99 |
_pc += Bytecodes::wide_length_for(bc); |
|
100 |
_was_wide = _pc; // Flag last wide bytecode found |
|
101 |
assert(is_wide(), "accessor works right"); |
|
102 |
break; |
|
1 | 103 |
|
104 |
case Bytecodes::_lookupswitch: |
|
105 |
_pc++; // Skip wide bytecode |
|
106 |
_pc += (_start-_pc)&3; // Word align |
|
107 |
_table_base = (jint*)_pc; // Capture for later usage |
|
108 |
// table_base[0] is default far_dest |
|
109 |
// Table has 2 lead elements (default, length), then pairs of u4 values. |
|
110 |
// So load table length, and compute address at end of table |
|
111 |
_pc = (address)&_table_base[2+ 2*Bytes::get_Java_u4((address)&_table_base[1])]; |
|
112 |
break; |
|
113 |
||
114 |
case Bytecodes::_tableswitch: { |
|
115 |
_pc++; // Skip wide bytecode |
|
116 |
_pc += (_start-_pc)&3; // Word align |
|
117 |
_table_base = (jint*)_pc; // Capture for later usage |
|
118 |
// table_base[0] is default far_dest |
|
119 |
int lo = Bytes::get_Java_u4((address)&_table_base[1]);// Low bound |
|
120 |
int hi = Bytes::get_Java_u4((address)&_table_base[2]);// High bound |
|
121 |
int len = hi - lo + 1; // Dense table size |
|
122 |
_pc = (address)&_table_base[3+len]; // Skip past table |
|
123 |
break; |
|
124 |
} |
|
125 |
||
126 |
default: |
|
127 |
fatal("unhandled bytecode"); |
|
128 |
} |
|
129 |
return bc; |
|
130 |
} |
|
131 |
||
132 |
// ------------------------------------------------------------------ |
|
133 |
// ciBytecodeStream::reset_to_bci |
|
134 |
void ciBytecodeStream::reset_to_bci( int bci ) { |
|
135 |
_bc_start=_was_wide=0; |
|
136 |
_pc = _start+bci; |
|
137 |
} |
|
138 |
||
139 |
// ------------------------------------------------------------------ |
|
140 |
// ciBytecodeStream::force_bci |
|
141 |
void ciBytecodeStream::force_bci(int bci) { |
|
142 |
if (bci < 0) { |
|
143 |
reset_to_bci(0); |
|
144 |
_bc_start = _start + bci; |
|
145 |
_bc = EOBC(); |
|
146 |
} else { |
|
147 |
reset_to_bci(bci); |
|
148 |
next(); |
|
149 |
} |
|
150 |
} |
|
151 |
||
152 |
||
153 |
// ------------------------------------------------------------------ |
|
154 |
// Constant pool access |
|
155 |
// ------------------------------------------------------------------ |
|
156 |
||
157 |
// ------------------------------------------------------------------ |
|
158 |
// ciBytecodeStream::get_klass_index |
|
159 |
// |
|
160 |
// If this bytecodes references a klass, return the index of the |
|
161 |
// referenced klass. |
|
162 |
int ciBytecodeStream::get_klass_index() const { |
|
163 |
switch(cur_bc()) { |
|
164 |
case Bytecodes::_ldc: |
|
5688 | 165 |
return get_index_u1(); |
1 | 166 |
case Bytecodes::_ldc_w: |
167 |
case Bytecodes::_ldc2_w: |
|
168 |
case Bytecodes::_checkcast: |
|
169 |
case Bytecodes::_instanceof: |
|
170 |
case Bytecodes::_anewarray: |
|
171 |
case Bytecodes::_multianewarray: |
|
172 |
case Bytecodes::_new: |
|
173 |
case Bytecodes::_newarray: |
|
5688 | 174 |
return get_index_u2(); |
1 | 175 |
default: |
176 |
ShouldNotReachHere(); |
|
177 |
return 0; |
|
178 |
} |
|
179 |
} |
|
180 |
||
181 |
// ------------------------------------------------------------------ |
|
182 |
// ciBytecodeStream::get_klass |
|
183 |
// |
|
184 |
// If this bytecode is a new, newarray, multianewarray, instanceof, |
|
185 |
// or checkcast, get the referenced klass. |
|
186 |
ciKlass* ciBytecodeStream::get_klass(bool& will_link) { |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
187 |
VM_ENTRY_MARK; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
188 |
constantPoolHandle cpool(_method->get_Method()->constants()); |
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
189 |
return CURRENT_ENV->get_klass_by_index(cpool, get_klass_index(), will_link, _holder); |
1 | 190 |
} |
191 |
||
192 |
// ------------------------------------------------------------------ |
|
5882 | 193 |
// ciBytecodeStream::get_constant_raw_index |
1 | 194 |
// |
195 |
// If this bytecode is one of the ldc variants, get the index of the |
|
196 |
// referenced constant. |
|
5882 | 197 |
int ciBytecodeStream::get_constant_raw_index() const { |
198 |
// work-alike for Bytecode_loadconstant::raw_index() |
|
199 |
switch (cur_bc()) { |
|
1 | 200 |
case Bytecodes::_ldc: |
5688 | 201 |
return get_index_u1(); |
1 | 202 |
case Bytecodes::_ldc_w: |
203 |
case Bytecodes::_ldc2_w: |
|
5688 | 204 |
return get_index_u2(); |
1 | 205 |
default: |
206 |
ShouldNotReachHere(); |
|
207 |
return 0; |
|
208 |
} |
|
209 |
} |
|
5882 | 210 |
|
211 |
// ------------------------------------------------------------------ |
|
212 |
// ciBytecodeStream::get_constant_pool_index |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
213 |
// Decode any reference index into a regular pool index. |
5882 | 214 |
int ciBytecodeStream::get_constant_pool_index() const { |
215 |
// work-alike for Bytecode_loadconstant::pool_index() |
|
216 |
int index = get_constant_raw_index(); |
|
217 |
if (has_cache_index()) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
218 |
VM_ENTRY_MARK; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
219 |
constantPoolHandle cpool(_method->get_Method()->constants()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
220 |
return cpool->object_to_cp_index(index); |
5882 | 221 |
} |
222 |
return index; |
|
223 |
} |
|
224 |
||
225 |
// ------------------------------------------------------------------ |
|
226 |
// ciBytecodeStream::get_constant_cache_index |
|
227 |
// Return the CP cache index, or -1 if there isn't any. |
|
228 |
int ciBytecodeStream::get_constant_cache_index() const { |
|
229 |
// work-alike for Bytecode_loadconstant::cache_index() |
|
230 |
return has_cache_index() ? get_constant_raw_index() : -1; |
|
231 |
} |
|
232 |
||
1 | 233 |
// ------------------------------------------------------------------ |
234 |
// ciBytecodeStream::get_constant |
|
235 |
// |
|
236 |
// If this bytecode is one of the ldc variants, get the referenced |
|
237 |
// constant. |
|
238 |
ciConstant ciBytecodeStream::get_constant() { |
|
5882 | 239 |
int pool_index = get_constant_raw_index(); |
240 |
int cache_index = -1; |
|
241 |
if (has_cache_index()) { |
|
242 |
cache_index = pool_index; |
|
243 |
pool_index = -1; |
|
244 |
} |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
245 |
VM_ENTRY_MARK; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
246 |
constantPoolHandle cpool(_method->get_Method()->constants()); |
5882 | 247 |
return CURRENT_ENV->get_constant_by_index(cpool, pool_index, cache_index, _holder); |
1 | 248 |
} |
249 |
||
250 |
// ------------------------------------------------------------------ |
|
5882 | 251 |
// ciBytecodeStream::get_constant_pool_tag |
252 |
// |
|
253 |
// If this bytecode is one of the ldc variants, get the referenced |
|
254 |
// constant. |
|
255 |
constantTag ciBytecodeStream::get_constant_pool_tag(int index) const { |
|
256 |
VM_ENTRY_MARK; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
257 |
return _method->get_Method()->constants()->tag_at(index); |
1 | 258 |
} |
259 |
||
260 |
// ------------------------------------------------------------------ |
|
261 |
// ciBytecodeStream::get_field_index |
|
262 |
// |
|
263 |
// If this is a field access bytecode, get the constant pool |
|
264 |
// index of the referenced field. |
|
265 |
int ciBytecodeStream::get_field_index() { |
|
266 |
assert(cur_bc() == Bytecodes::_getfield || |
|
267 |
cur_bc() == Bytecodes::_putfield || |
|
268 |
cur_bc() == Bytecodes::_getstatic || |
|
269 |
cur_bc() == Bytecodes::_putstatic, "wrong bc"); |
|
5688 | 270 |
return get_index_u2_cpcache(); |
1 | 271 |
} |
272 |
||
273 |
||
274 |
// ------------------------------------------------------------------ |
|
275 |
// ciBytecodeStream::get_field |
|
276 |
// |
|
277 |
// If this bytecode is one of get_field, get_static, put_field, |
|
278 |
// or put_static, get the referenced field. |
|
279 |
ciField* ciBytecodeStream::get_field(bool& will_link) { |
|
280 |
ciField* f = CURRENT_ENV->get_field_by_index(_holder, get_field_index()); |
|
281 |
will_link = f->will_link(_holder, _bc); |
|
282 |
return f; |
|
283 |
} |
|
284 |
||
285 |
||
286 |
// ------------------------------------------------------------------ |
|
287 |
// ciBytecodeStream::get_declared_field_holder |
|
288 |
// |
|
289 |
// Get the declared holder of the currently referenced field. |
|
290 |
// |
|
291 |
// Usage note: the holder() of a ciField class returns the canonical |
|
292 |
// holder of the field, rather than the holder declared in the |
|
293 |
// bytecodes. |
|
294 |
// |
|
295 |
// There is no "will_link" result passed back. The user is responsible |
|
296 |
// for checking linkability when retrieving the associated field. |
|
297 |
ciInstanceKlass* ciBytecodeStream::get_declared_field_holder() { |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
298 |
VM_ENTRY_MARK; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
299 |
constantPoolHandle cpool(_method->get_Method()->constants()); |
1 | 300 |
int holder_index = get_field_holder_index(); |
301 |
bool ignore; |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
302 |
return CURRENT_ENV->get_klass_by_index(cpool, holder_index, ignore, _holder) |
1 | 303 |
->as_instance_klass(); |
304 |
} |
|
305 |
||
306 |
// ------------------------------------------------------------------ |
|
307 |
// ciBytecodeStream::get_field_holder_index |
|
308 |
// |
|
309 |
// Get the constant pool index of the declared holder of the field |
|
310 |
// referenced by the current bytecode. Used for generating |
|
311 |
// deoptimization information. |
|
312 |
int ciBytecodeStream::get_field_holder_index() { |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
313 |
GUARDED_VM_ENTRY( |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
314 |
ConstantPool* cpool = _holder->get_instanceKlass()->constants(); |
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
315 |
return cpool->klass_ref_index_at(get_field_index()); |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
316 |
) |
1 | 317 |
} |
318 |
||
319 |
// ------------------------------------------------------------------ |
|
320 |
// ciBytecodeStream::get_field_signature_index |
|
321 |
// |
|
322 |
// Get the constant pool index of the signature of the field |
|
323 |
// referenced by the current bytecode. Used for generating |
|
324 |
// deoptimization information. |
|
325 |
int ciBytecodeStream::get_field_signature_index() { |
|
326 |
VM_ENTRY_MARK; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
327 |
ConstantPool* cpool = _holder->get_instanceKlass()->constants(); |
1 | 328 |
int nt_index = cpool->name_and_type_ref_index_at(get_field_index()); |
329 |
return cpool->signature_ref_index_at(nt_index); |
|
330 |
} |
|
331 |
||
332 |
// ------------------------------------------------------------------ |
|
333 |
// ciBytecodeStream::get_method_index |
|
334 |
// |
|
335 |
// If this is a method invocation bytecode, get the constant pool |
|
336 |
// index of the invoked method. |
|
337 |
int ciBytecodeStream::get_method_index() { |
|
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
338 |
#ifdef ASSERT |
1 | 339 |
switch (cur_bc()) { |
340 |
case Bytecodes::_invokeinterface: |
|
341 |
case Bytecodes::_invokevirtual: |
|
342 |
case Bytecodes::_invokespecial: |
|
343 |
case Bytecodes::_invokestatic: |
|
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
344 |
case Bytecodes::_invokedynamic: |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
345 |
break; |
1 | 346 |
default: |
347 |
ShouldNotReachHere(); |
|
348 |
} |
|
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
349 |
#endif |
5688 | 350 |
if (has_index_u4()) |
351 |
return get_index_u4(); // invokedynamic |
|
352 |
return get_index_u2_cpcache(); |
|
1 | 353 |
} |
354 |
||
355 |
// ------------------------------------------------------------------ |
|
356 |
// ciBytecodeStream::get_method |
|
357 |
// |
|
358 |
// If this is a method invocation bytecode, get the invoked method. |
|
13522
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13391
diff
changeset
|
359 |
// Additionally return the declared signature to get more concrete |
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13391
diff
changeset
|
360 |
// type information if required (Cf. invokedynamic and invokehandle). |
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13391
diff
changeset
|
361 |
ciMethod* ciBytecodeStream::get_method(bool& will_link, ciSignature* *declared_signature_result) { |
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
362 |
VM_ENTRY_MARK; |
13522
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13391
diff
changeset
|
363 |
ciEnv* env = CURRENT_ENV; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
364 |
constantPoolHandle cpool(_method->get_Method()->constants()); |
13522
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13391
diff
changeset
|
365 |
ciMethod* m = env->get_method_by_index(cpool, get_method_index(), cur_bc(), _holder); |
1 | 366 |
will_link = m->is_loaded(); |
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
367 |
|
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
368 |
// Use the MethodType stored in the CP cache to create a signature |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
369 |
// with correct types (in respect to class loaders). |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
370 |
if (has_method_type()) { |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
371 |
ciSymbol* sig_sym = env->get_symbol(cpool->symbol_at(get_method_signature_index())); |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
372 |
ciKlass* pool_holder = env->get_klass(cpool->pool_holder()); |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
373 |
ciMethodType* method_type = get_method_type(); |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
374 |
ciSignature* declared_signature = new (env->arena()) ciSignature(pool_holder, sig_sym, method_type); |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
375 |
(*declared_signature_result) = declared_signature; |
13522
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13391
diff
changeset
|
376 |
} else { |
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13391
diff
changeset
|
377 |
(*declared_signature_result) = m->signature(); |
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13391
diff
changeset
|
378 |
} |
1 | 379 |
return m; |
380 |
} |
|
381 |
||
382 |
// ------------------------------------------------------------------ |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
383 |
// ciBytecodeStream::has_appendix |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
384 |
// |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
385 |
// Returns true if there is an appendix argument stored in the |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
386 |
// constant pool cache at the current bci. |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
387 |
bool ciBytecodeStream::has_appendix() { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
388 |
VM_ENTRY_MARK; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
389 |
constantPoolHandle cpool(_method->get_Method()->constants()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
390 |
return ConstantPool::has_appendix_at_if_loaded(cpool, get_method_index()); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
391 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
392 |
|
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
393 |
// ------------------------------------------------------------------ |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
394 |
// ciBytecodeStream::get_appendix |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
395 |
// |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
396 |
// Return the appendix argument stored in the constant pool cache at |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
397 |
// the current bci. |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
398 |
ciObject* ciBytecodeStream::get_appendix() { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
399 |
VM_ENTRY_MARK; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
400 |
constantPoolHandle cpool(_method->get_Method()->constants()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
401 |
oop appendix_oop = ConstantPool::appendix_at_if_loaded(cpool, get_method_index()); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
402 |
return CURRENT_ENV->get_object(appendix_oop); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
403 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
404 |
|
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
405 |
// ------------------------------------------------------------------ |
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
406 |
// ciBytecodeStream::has_method_type |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
407 |
// |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
408 |
// Returns true if there is a MethodType argument stored in the |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
409 |
// constant pool cache at the current bci. |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
410 |
bool ciBytecodeStream::has_method_type() { |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
411 |
GUARDED_VM_ENTRY( |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
412 |
constantPoolHandle cpool(_method->get_Method()->constants()); |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
413 |
return ConstantPool::has_method_type_at_if_loaded(cpool, get_method_index()); |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
414 |
) |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
415 |
} |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
416 |
|
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
417 |
// ------------------------------------------------------------------ |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
418 |
// ciBytecodeStream::get_method_type |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
419 |
// |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
420 |
// Return the MethodType stored in the constant pool cache at |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
421 |
// the current bci. |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
422 |
ciMethodType* ciBytecodeStream::get_method_type() { |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
423 |
GUARDED_VM_ENTRY( |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
424 |
constantPoolHandle cpool(_method->get_Method()->constants()); |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
425 |
oop method_type_oop = ConstantPool::method_type_at_if_loaded(cpool, get_method_index()); |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
426 |
return CURRENT_ENV->get_object(method_type_oop)->as_method_type(); |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
427 |
) |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
428 |
} |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
429 |
|
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13728
diff
changeset
|
430 |
// ------------------------------------------------------------------ |
1 | 431 |
// ciBytecodeStream::get_declared_method_holder |
432 |
// |
|
433 |
// Get the declared holder of the currently referenced method. |
|
434 |
// |
|
435 |
// Usage note: the holder() of a ciMethod class returns the canonical |
|
436 |
// holder of the method, rather than the holder declared in the |
|
437 |
// bytecodes. |
|
438 |
// |
|
439 |
// There is no "will_link" result passed back. The user is responsible |
|
440 |
// for checking linkability when retrieving the associated method. |
|
441 |
ciKlass* ciBytecodeStream::get_declared_method_holder() { |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
442 |
VM_ENTRY_MARK; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
443 |
constantPoolHandle cpool(_method->get_Method()->constants()); |
1 | 444 |
bool ignore; |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
445 |
// report as MethodHandle for invokedynamic, which is syntactically classless |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
446 |
if (cur_bc() == Bytecodes::_invokedynamic) |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8676
diff
changeset
|
447 |
return CURRENT_ENV->get_klass_by_name(_holder, ciSymbol::java_lang_invoke_MethodHandle(), false); |
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
448 |
return CURRENT_ENV->get_klass_by_index(cpool, get_method_holder_index(), ignore, _holder); |
1 | 449 |
} |
450 |
||
451 |
// ------------------------------------------------------------------ |
|
452 |
// ciBytecodeStream::get_method_holder_index |
|
453 |
// |
|
454 |
// Get the constant pool index of the declared holder of the method |
|
455 |
// referenced by the current bytecode. Used for generating |
|
456 |
// deoptimization information. |
|
457 |
int ciBytecodeStream::get_method_holder_index() { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
458 |
ConstantPool* cpool = _method->get_Method()->constants(); |
1 | 459 |
return cpool->klass_ref_index_at(get_method_index()); |
460 |
} |
|
461 |
||
462 |
// ------------------------------------------------------------------ |
|
463 |
// ciBytecodeStream::get_method_signature_index |
|
464 |
// |
|
465 |
// Get the constant pool index of the signature of the method |
|
466 |
// referenced by the current bytecode. Used for generating |
|
467 |
// deoptimization information. |
|
468 |
int ciBytecodeStream::get_method_signature_index() { |
|
13522
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13391
diff
changeset
|
469 |
GUARDED_VM_ENTRY( |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
470 |
ConstantPool* cpool = _holder->get_instanceKlass()->constants(); |
13522
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13391
diff
changeset
|
471 |
const int method_index = get_method_index(); |
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13391
diff
changeset
|
472 |
const int name_and_type_index = cpool->name_and_type_ref_index_at(method_index); |
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13391
diff
changeset
|
473 |
return cpool->signature_ref_index_at(name_and_type_index); |
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13391
diff
changeset
|
474 |
) |
1 | 475 |
} |
4566
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
4564
diff
changeset
|
476 |
|
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
4564
diff
changeset
|
477 |
// ------------------------------------------------------------------ |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
478 |
// ciBytecodeStream::get_resolved_references |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
479 |
ciObjArray* ciBytecodeStream::get_resolved_references() { |
31046
d01ad7a0ecb0
8081320: Backout JDK-8059340: ConstantPool::_resolved_references is missing in heap dump
vlivanov
parents:
31038
diff
changeset
|
480 |
VM_ENTRY_MARK; |
d01ad7a0ecb0
8081320: Backout JDK-8059340: ConstantPool::_resolved_references is missing in heap dump
vlivanov
parents:
31038
diff
changeset
|
481 |
// Get the constant pool. |
d01ad7a0ecb0
8081320: Backout JDK-8059340: ConstantPool::_resolved_references is missing in heap dump
vlivanov
parents:
31038
diff
changeset
|
482 |
ConstantPool* cpool = _holder->get_instanceKlass()->constants(); |
d01ad7a0ecb0
8081320: Backout JDK-8059340: ConstantPool::_resolved_references is missing in heap dump
vlivanov
parents:
31038
diff
changeset
|
483 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
484 |
// Create a resolved references array and return it. |
31046
d01ad7a0ecb0
8081320: Backout JDK-8059340: ConstantPool::_resolved_references is missing in heap dump
vlivanov
parents:
31038
diff
changeset
|
485 |
return CURRENT_ENV->get_object(cpool->resolved_references())->as_obj_array(); |
d01ad7a0ecb0
8081320: Backout JDK-8059340: ConstantPool::_resolved_references is missing in heap dump
vlivanov
parents:
31038
diff
changeset
|
486 |
} |