author | jrose |
Fri, 11 Mar 2011 22:34:57 -0800 | |
changeset 8676 | 9098d4e927e1 |
parent 7397 | 5b173b4ca846 |
child 13391 | 30245956af37 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
8676
9098d4e927e1
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
7397
diff
changeset
|
2 |
* Copyright (c) 1999, 2011, 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/ciCPCache.hpp" |
|
27 |
#include "ci/ciCallSite.hpp" |
|
28 |
#include "ci/ciConstant.hpp" |
|
29 |
#include "ci/ciField.hpp" |
|
30 |
#include "ci/ciStreams.hpp" |
|
31 |
#include "ci/ciUtilities.hpp" |
|
1 | 32 |
|
33 |
// ciExceptionHandlerStream |
|
34 |
// |
|
35 |
// Walk over some selected set of a methods exception handlers. |
|
36 |
||
37 |
// ------------------------------------------------------------------ |
|
38 |
// ciExceptionHandlerStream::count |
|
39 |
// |
|
40 |
// How many exception handlers are there in this stream? |
|
41 |
// |
|
42 |
// Implementation note: Compiler2 needs this functionality, so I had |
|
43 |
int ciExceptionHandlerStream::count() { |
|
44 |
int save_pos = _pos; |
|
45 |
int save_end = _end; |
|
46 |
||
47 |
int count = 0; |
|
48 |
||
49 |
_pos = -1; |
|
50 |
_end = _method->_handler_count; |
|
51 |
||
52 |
||
53 |
next(); |
|
54 |
while (!is_done()) { |
|
55 |
count++; |
|
56 |
next(); |
|
57 |
} |
|
58 |
||
59 |
_pos = save_pos; |
|
60 |
_end = save_end; |
|
61 |
||
62 |
return count; |
|
63 |
} |
|
64 |
||
65 |
int ciExceptionHandlerStream::count_remaining() { |
|
66 |
int save_pos = _pos; |
|
67 |
int save_end = _end; |
|
68 |
||
69 |
int count = 0; |
|
70 |
||
71 |
while (!is_done()) { |
|
72 |
count++; |
|
73 |
next(); |
|
74 |
} |
|
75 |
||
76 |
_pos = save_pos; |
|
77 |
_end = save_end; |
|
78 |
||
79 |
return count; |
|
80 |
} |
|
81 |
||
82 |
// ciBytecodeStream |
|
83 |
// |
|
84 |
// The class is used to iterate over the bytecodes of a method. |
|
85 |
// It hides the details of constant pool structure/access by |
|
86 |
// providing accessors for constant pool items. |
|
87 |
||
88 |
// ------------------------------------------------------------------ |
|
5688 | 89 |
// ciBytecodeStream::next_wide_or_table |
1 | 90 |
// |
91 |
// Special handling for switch ops |
|
5688 | 92 |
Bytecodes::Code ciBytecodeStream::next_wide_or_table(Bytecodes::Code bc) { |
93 |
switch (bc) { // Check for special bytecode handling |
|
94 |
case Bytecodes::_wide: |
|
95 |
// Special handling for the wide bytcode |
|
96 |
// Get following bytecode; do not return wide |
|
97 |
assert(Bytecodes::Code(_pc[0]) == Bytecodes::_wide, ""); |
|
98 |
bc = Bytecodes::java_code(_raw_bc = (Bytecodes::Code)_pc[1]); |
|
99 |
assert(Bytecodes::wide_length_for(bc) > 2, "must make progress"); |
|
100 |
_pc += Bytecodes::wide_length_for(bc); |
|
101 |
_was_wide = _pc; // Flag last wide bytecode found |
|
102 |
assert(is_wide(), "accessor works right"); |
|
103 |
break; |
|
1 | 104 |
|
105 |
case Bytecodes::_lookupswitch: |
|
106 |
_pc++; // Skip wide bytecode |
|
107 |
_pc += (_start-_pc)&3; // Word align |
|
108 |
_table_base = (jint*)_pc; // Capture for later usage |
|
109 |
// table_base[0] is default far_dest |
|
110 |
// Table has 2 lead elements (default, length), then pairs of u4 values. |
|
111 |
// So load table length, and compute address at end of table |
|
112 |
_pc = (address)&_table_base[2+ 2*Bytes::get_Java_u4((address)&_table_base[1])]; |
|
113 |
break; |
|
114 |
||
115 |
case Bytecodes::_tableswitch: { |
|
116 |
_pc++; // Skip wide bytecode |
|
117 |
_pc += (_start-_pc)&3; // Word align |
|
118 |
_table_base = (jint*)_pc; // Capture for later usage |
|
119 |
// table_base[0] is default far_dest |
|
120 |
int lo = Bytes::get_Java_u4((address)&_table_base[1]);// Low bound |
|
121 |
int hi = Bytes::get_Java_u4((address)&_table_base[2]);// High bound |
|
122 |
int len = hi - lo + 1; // Dense table size |
|
123 |
_pc = (address)&_table_base[3+len]; // Skip past table |
|
124 |
break; |
|
125 |
} |
|
126 |
||
127 |
default: |
|
128 |
fatal("unhandled bytecode"); |
|
129 |
} |
|
130 |
return bc; |
|
131 |
} |
|
132 |
||
133 |
// ------------------------------------------------------------------ |
|
134 |
// ciBytecodeStream::reset_to_bci |
|
135 |
void ciBytecodeStream::reset_to_bci( int bci ) { |
|
136 |
_bc_start=_was_wide=0; |
|
137 |
_pc = _start+bci; |
|
138 |
} |
|
139 |
||
140 |
// ------------------------------------------------------------------ |
|
141 |
// ciBytecodeStream::force_bci |
|
142 |
void ciBytecodeStream::force_bci(int bci) { |
|
143 |
if (bci < 0) { |
|
144 |
reset_to_bci(0); |
|
145 |
_bc_start = _start + bci; |
|
146 |
_bc = EOBC(); |
|
147 |
} else { |
|
148 |
reset_to_bci(bci); |
|
149 |
next(); |
|
150 |
} |
|
151 |
} |
|
152 |
||
153 |
||
154 |
// ------------------------------------------------------------------ |
|
155 |
// Constant pool access |
|
156 |
// ------------------------------------------------------------------ |
|
157 |
||
158 |
// ------------------------------------------------------------------ |
|
159 |
// ciBytecodeStream::get_klass_index |
|
160 |
// |
|
161 |
// If this bytecodes references a klass, return the index of the |
|
162 |
// referenced klass. |
|
163 |
int ciBytecodeStream::get_klass_index() const { |
|
164 |
switch(cur_bc()) { |
|
165 |
case Bytecodes::_ldc: |
|
5688 | 166 |
return get_index_u1(); |
1 | 167 |
case Bytecodes::_ldc_w: |
168 |
case Bytecodes::_ldc2_w: |
|
169 |
case Bytecodes::_checkcast: |
|
170 |
case Bytecodes::_instanceof: |
|
171 |
case Bytecodes::_anewarray: |
|
172 |
case Bytecodes::_multianewarray: |
|
173 |
case Bytecodes::_new: |
|
174 |
case Bytecodes::_newarray: |
|
5688 | 175 |
return get_index_u2(); |
1 | 176 |
default: |
177 |
ShouldNotReachHere(); |
|
178 |
return 0; |
|
179 |
} |
|
180 |
} |
|
181 |
||
182 |
// ------------------------------------------------------------------ |
|
183 |
// ciBytecodeStream::get_klass |
|
184 |
// |
|
185 |
// If this bytecode is a new, newarray, multianewarray, instanceof, |
|
186 |
// or checkcast, get the referenced klass. |
|
187 |
ciKlass* ciBytecodeStream::get_klass(bool& will_link) { |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
188 |
VM_ENTRY_MARK; |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
189 |
constantPoolHandle cpool(_method->get_methodOop()->constants()); |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
190 |
return CURRENT_ENV->get_klass_by_index(cpool, get_klass_index(), will_link, _holder); |
1 | 191 |
} |
192 |
||
193 |
// ------------------------------------------------------------------ |
|
5882 | 194 |
// ciBytecodeStream::get_constant_raw_index |
1 | 195 |
// |
196 |
// If this bytecode is one of the ldc variants, get the index of the |
|
197 |
// referenced constant. |
|
5882 | 198 |
int ciBytecodeStream::get_constant_raw_index() const { |
199 |
// work-alike for Bytecode_loadconstant::raw_index() |
|
200 |
switch (cur_bc()) { |
|
1 | 201 |
case Bytecodes::_ldc: |
5688 | 202 |
return get_index_u1(); |
1 | 203 |
case Bytecodes::_ldc_w: |
204 |
case Bytecodes::_ldc2_w: |
|
5688 | 205 |
return get_index_u2(); |
1 | 206 |
default: |
207 |
ShouldNotReachHere(); |
|
208 |
return 0; |
|
209 |
} |
|
210 |
} |
|
5882 | 211 |
|
212 |
// ------------------------------------------------------------------ |
|
213 |
// ciBytecodeStream::get_constant_pool_index |
|
214 |
// Decode any CP cache index into a regular pool index. |
|
215 |
int ciBytecodeStream::get_constant_pool_index() const { |
|
216 |
// work-alike for Bytecode_loadconstant::pool_index() |
|
217 |
int index = get_constant_raw_index(); |
|
218 |
if (has_cache_index()) { |
|
219 |
return get_cpcache()->get_pool_index(index); |
|
220 |
} |
|
221 |
return index; |
|
222 |
} |
|
223 |
||
224 |
// ------------------------------------------------------------------ |
|
225 |
// ciBytecodeStream::get_constant_cache_index |
|
226 |
// Return the CP cache index, or -1 if there isn't any. |
|
227 |
int ciBytecodeStream::get_constant_cache_index() const { |
|
228 |
// work-alike for Bytecode_loadconstant::cache_index() |
|
229 |
return has_cache_index() ? get_constant_raw_index() : -1; |
|
230 |
} |
|
231 |
||
1 | 232 |
// ------------------------------------------------------------------ |
233 |
// ciBytecodeStream::get_constant |
|
234 |
// |
|
235 |
// If this bytecode is one of the ldc variants, get the referenced |
|
236 |
// constant. |
|
237 |
ciConstant ciBytecodeStream::get_constant() { |
|
5882 | 238 |
int pool_index = get_constant_raw_index(); |
239 |
int cache_index = -1; |
|
240 |
if (has_cache_index()) { |
|
241 |
cache_index = pool_index; |
|
242 |
pool_index = -1; |
|
243 |
} |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
244 |
VM_ENTRY_MARK; |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
245 |
constantPoolHandle cpool(_method->get_methodOop()->constants()); |
5882 | 246 |
return CURRENT_ENV->get_constant_by_index(cpool, pool_index, cache_index, _holder); |
1 | 247 |
} |
248 |
||
249 |
// ------------------------------------------------------------------ |
|
5882 | 250 |
// ciBytecodeStream::get_constant_pool_tag |
251 |
// |
|
252 |
// If this bytecode is one of the ldc variants, get the referenced |
|
253 |
// constant. |
|
254 |
constantTag ciBytecodeStream::get_constant_pool_tag(int index) const { |
|
255 |
VM_ENTRY_MARK; |
|
256 |
return _method->get_methodOop()->constants()->tag_at(index); |
|
1 | 257 |
} |
258 |
||
259 |
// ------------------------------------------------------------------ |
|
260 |
// ciBytecodeStream::get_field_index |
|
261 |
// |
|
262 |
// If this is a field access bytecode, get the constant pool |
|
263 |
// index of the referenced field. |
|
264 |
int ciBytecodeStream::get_field_index() { |
|
265 |
assert(cur_bc() == Bytecodes::_getfield || |
|
266 |
cur_bc() == Bytecodes::_putfield || |
|
267 |
cur_bc() == Bytecodes::_getstatic || |
|
268 |
cur_bc() == Bytecodes::_putstatic, "wrong bc"); |
|
5688 | 269 |
return get_index_u2_cpcache(); |
1 | 270 |
} |
271 |
||
272 |
||
273 |
// ------------------------------------------------------------------ |
|
274 |
// ciBytecodeStream::get_field |
|
275 |
// |
|
276 |
// If this bytecode is one of get_field, get_static, put_field, |
|
277 |
// or put_static, get the referenced field. |
|
278 |
ciField* ciBytecodeStream::get_field(bool& will_link) { |
|
279 |
ciField* f = CURRENT_ENV->get_field_by_index(_holder, get_field_index()); |
|
280 |
will_link = f->will_link(_holder, _bc); |
|
281 |
return f; |
|
282 |
} |
|
283 |
||
284 |
||
285 |
// ------------------------------------------------------------------ |
|
286 |
// ciBytecodeStream::get_declared_field_holder |
|
287 |
// |
|
288 |
// Get the declared holder of the currently referenced field. |
|
289 |
// |
|
290 |
// Usage note: the holder() of a ciField class returns the canonical |
|
291 |
// holder of the field, rather than the holder declared in the |
|
292 |
// bytecodes. |
|
293 |
// |
|
294 |
// There is no "will_link" result passed back. The user is responsible |
|
295 |
// for checking linkability when retrieving the associated field. |
|
296 |
ciInstanceKlass* ciBytecodeStream::get_declared_field_holder() { |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
297 |
VM_ENTRY_MARK; |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
298 |
constantPoolHandle cpool(_method->get_methodOop()->constants()); |
1 | 299 |
int holder_index = get_field_holder_index(); |
300 |
bool ignore; |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
301 |
return CURRENT_ENV->get_klass_by_index(cpool, holder_index, ignore, _holder) |
1 | 302 |
->as_instance_klass(); |
303 |
} |
|
304 |
||
305 |
// ------------------------------------------------------------------ |
|
306 |
// ciBytecodeStream::get_field_holder_index |
|
307 |
// |
|
308 |
// Get the constant pool index of the declared holder of the field |
|
309 |
// referenced by the current bytecode. Used for generating |
|
310 |
// deoptimization information. |
|
311 |
int ciBytecodeStream::get_field_holder_index() { |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
312 |
GUARDED_VM_ENTRY( |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
313 |
constantPoolOop cpool = _holder->get_instanceKlass()->constants(); |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
314 |
return cpool->klass_ref_index_at(get_field_index()); |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
315 |
) |
1 | 316 |
} |
317 |
||
318 |
// ------------------------------------------------------------------ |
|
319 |
// ciBytecodeStream::get_field_signature_index |
|
320 |
// |
|
321 |
// Get the constant pool index of the signature of the field |
|
322 |
// referenced by the current bytecode. Used for generating |
|
323 |
// deoptimization information. |
|
324 |
int ciBytecodeStream::get_field_signature_index() { |
|
325 |
VM_ENTRY_MARK; |
|
326 |
constantPoolOop cpool = _holder->get_instanceKlass()->constants(); |
|
327 |
int nt_index = cpool->name_and_type_ref_index_at(get_field_index()); |
|
328 |
return cpool->signature_ref_index_at(nt_index); |
|
329 |
} |
|
330 |
||
331 |
// ------------------------------------------------------------------ |
|
332 |
// ciBytecodeStream::get_method_index |
|
333 |
// |
|
334 |
// If this is a method invocation bytecode, get the constant pool |
|
335 |
// index of the invoked method. |
|
336 |
int ciBytecodeStream::get_method_index() { |
|
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
337 |
#ifdef ASSERT |
1 | 338 |
switch (cur_bc()) { |
339 |
case Bytecodes::_invokeinterface: |
|
340 |
case Bytecodes::_invokevirtual: |
|
341 |
case Bytecodes::_invokespecial: |
|
342 |
case Bytecodes::_invokestatic: |
|
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
343 |
case Bytecodes::_invokedynamic: |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
344 |
break; |
1 | 345 |
default: |
346 |
ShouldNotReachHere(); |
|
347 |
} |
|
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
348 |
#endif |
5688 | 349 |
if (has_index_u4()) |
350 |
return get_index_u4(); // invokedynamic |
|
351 |
return get_index_u2_cpcache(); |
|
1 | 352 |
} |
353 |
||
354 |
// ------------------------------------------------------------------ |
|
355 |
// ciBytecodeStream::get_method |
|
356 |
// |
|
357 |
// If this is a method invocation bytecode, get the invoked method. |
|
358 |
ciMethod* ciBytecodeStream::get_method(bool& will_link) { |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
359 |
VM_ENTRY_MARK; |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
360 |
constantPoolHandle cpool(_method->get_methodOop()->constants()); |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
361 |
ciMethod* m = CURRENT_ENV->get_method_by_index(cpool, get_method_index(), cur_bc(), _holder); |
1 | 362 |
will_link = m->is_loaded(); |
363 |
return m; |
|
364 |
} |
|
365 |
||
366 |
// ------------------------------------------------------------------ |
|
367 |
// ciBytecodeStream::get_declared_method_holder |
|
368 |
// |
|
369 |
// Get the declared holder of the currently referenced method. |
|
370 |
// |
|
371 |
// Usage note: the holder() of a ciMethod class returns the canonical |
|
372 |
// holder of the method, rather than the holder declared in the |
|
373 |
// bytecodes. |
|
374 |
// |
|
375 |
// There is no "will_link" result passed back. The user is responsible |
|
376 |
// for checking linkability when retrieving the associated method. |
|
377 |
ciKlass* ciBytecodeStream::get_declared_method_holder() { |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
378 |
VM_ENTRY_MARK; |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
379 |
constantPoolHandle cpool(_method->get_methodOop()->constants()); |
1 | 380 |
bool ignore; |
4564
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
3261
diff
changeset
|
381 |
// report as InvokeDynamic for invokedynamic, which is syntactically classless |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
382 |
if (cur_bc() == Bytecodes::_invokedynamic) |
8676
9098d4e927e1
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
7397
diff
changeset
|
383 |
return CURRENT_ENV->get_klass_by_name(_holder, ciSymbol::java_lang_invoke_InvokeDynamic(), false); |
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
384 |
return CURRENT_ENV->get_klass_by_index(cpool, get_method_holder_index(), ignore, _holder); |
1 | 385 |
} |
386 |
||
387 |
// ------------------------------------------------------------------ |
|
388 |
// ciBytecodeStream::get_method_holder_index |
|
389 |
// |
|
390 |
// Get the constant pool index of the declared holder of the method |
|
391 |
// referenced by the current bytecode. Used for generating |
|
392 |
// deoptimization information. |
|
393 |
int ciBytecodeStream::get_method_holder_index() { |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
394 |
constantPoolOop cpool = _method->get_methodOop()->constants(); |
1 | 395 |
return cpool->klass_ref_index_at(get_method_index()); |
396 |
} |
|
397 |
||
398 |
// ------------------------------------------------------------------ |
|
399 |
// ciBytecodeStream::get_method_signature_index |
|
400 |
// |
|
401 |
// Get the constant pool index of the signature of the method |
|
402 |
// referenced by the current bytecode. Used for generating |
|
403 |
// deoptimization information. |
|
404 |
int ciBytecodeStream::get_method_signature_index() { |
|
405 |
VM_ENTRY_MARK; |
|
406 |
constantPoolOop cpool = _holder->get_instanceKlass()->constants(); |
|
407 |
int method_index = get_method_index(); |
|
408 |
int name_and_type_index = cpool->name_and_type_ref_index_at(method_index); |
|
409 |
return cpool->signature_ref_index_at(name_and_type_index); |
|
410 |
} |
|
4566
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
4564
diff
changeset
|
411 |
|
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
4564
diff
changeset
|
412 |
// ------------------------------------------------------------------ |
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
4564
diff
changeset
|
413 |
// ciBytecodeStream::get_cpcache |
5882 | 414 |
ciCPCache* ciBytecodeStream::get_cpcache() const { |
415 |
if (_cpcache == NULL) { |
|
416 |
VM_ENTRY_MARK; |
|
417 |
// Get the constant pool. |
|
418 |
constantPoolOop cpool = _holder->get_instanceKlass()->constants(); |
|
419 |
constantPoolCacheOop cpcache = cpool->cache(); |
|
4566
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
4564
diff
changeset
|
420 |
|
5882 | 421 |
*(ciCPCache**)&_cpcache = CURRENT_ENV->get_object(cpcache)->as_cpcache(); |
422 |
} |
|
423 |
return _cpcache; |
|
4566
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
4564
diff
changeset
|
424 |
} |
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
425 |
|
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
426 |
// ------------------------------------------------------------------ |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
427 |
// ciBytecodeStream::get_call_site |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
428 |
ciCallSite* ciBytecodeStream::get_call_site() { |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
429 |
VM_ENTRY_MARK; |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
430 |
// Get the constant pool. |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
431 |
constantPoolOop cpool = _holder->get_instanceKlass()->constants(); |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
432 |
constantPoolCacheOop cpcache = cpool->cache(); |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
433 |
|
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
434 |
// Get the CallSite from the constant pool cache. |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
435 |
int method_index = get_method_index(); |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
436 |
ConstantPoolCacheEntry* cpcache_entry = cpcache->secondary_entry_at(method_index); |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
437 |
oop call_site_oop = cpcache_entry->f1(); |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
438 |
|
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
439 |
// Create a CallSite object and return it. |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
440 |
return CURRENT_ENV->get_object(call_site_oop)->as_call_site(); |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4566
diff
changeset
|
441 |
} |