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