annotate src/share/vm/ci/ciStreams.cpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents 7f813940ac35
children f6b0eb4e44cf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1138
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1138
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: 1138
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1602
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1602
diff changeset
26 #include "ci/ciCallSite.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1602
diff changeset
27 #include "ci/ciConstant.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1602
diff changeset
28 #include "ci/ciField.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1602
diff changeset
29 #include "ci/ciStreams.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1602
diff changeset
30 #include "ci/ciUtilities.hpp"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
31
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // ciExceptionHandlerStream
a61af66fc99e Initial load
duke
parents:
diff changeset
33 //
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // Walk over some selected set of a methods exception handlers.
a61af66fc99e Initial load
duke
parents:
diff changeset
35
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // ciExceptionHandlerStream::count
a61af66fc99e Initial load
duke
parents:
diff changeset
38 //
a61af66fc99e Initial load
duke
parents:
diff changeset
39 // How many exception handlers are there in this stream?
a61af66fc99e Initial load
duke
parents:
diff changeset
40 //
a61af66fc99e Initial load
duke
parents:
diff changeset
41 // Implementation note: Compiler2 needs this functionality, so I had
a61af66fc99e Initial load
duke
parents:
diff changeset
42 int ciExceptionHandlerStream::count() {
a61af66fc99e Initial load
duke
parents:
diff changeset
43 int save_pos = _pos;
a61af66fc99e Initial load
duke
parents:
diff changeset
44 int save_end = _end;
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 int count = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48 _pos = -1;
a61af66fc99e Initial load
duke
parents:
diff changeset
49 _end = _method->_handler_count;
a61af66fc99e Initial load
duke
parents:
diff changeset
50
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 next();
a61af66fc99e Initial load
duke
parents:
diff changeset
53 while (!is_done()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
54 count++;
a61af66fc99e Initial load
duke
parents:
diff changeset
55 next();
a61af66fc99e Initial load
duke
parents:
diff changeset
56 }
a61af66fc99e Initial load
duke
parents:
diff changeset
57
a61af66fc99e Initial load
duke
parents:
diff changeset
58 _pos = save_pos;
a61af66fc99e Initial load
duke
parents:
diff changeset
59 _end = save_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61 return count;
a61af66fc99e Initial load
duke
parents:
diff changeset
62 }
a61af66fc99e Initial load
duke
parents:
diff changeset
63
a61af66fc99e Initial load
duke
parents:
diff changeset
64 int ciExceptionHandlerStream::count_remaining() {
a61af66fc99e Initial load
duke
parents:
diff changeset
65 int save_pos = _pos;
a61af66fc99e Initial load
duke
parents:
diff changeset
66 int save_end = _end;
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 int count = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 while (!is_done()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
71 count++;
a61af66fc99e Initial load
duke
parents:
diff changeset
72 next();
a61af66fc99e Initial load
duke
parents:
diff changeset
73 }
a61af66fc99e Initial load
duke
parents:
diff changeset
74
a61af66fc99e Initial load
duke
parents:
diff changeset
75 _pos = save_pos;
a61af66fc99e Initial load
duke
parents:
diff changeset
76 _end = save_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
77
a61af66fc99e Initial load
duke
parents:
diff changeset
78 return count;
a61af66fc99e Initial load
duke
parents:
diff changeset
79 }
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 // ciBytecodeStream
a61af66fc99e Initial load
duke
parents:
diff changeset
82 //
a61af66fc99e Initial load
duke
parents:
diff changeset
83 // The class is used to iterate over the bytecodes of a method.
a61af66fc99e Initial load
duke
parents:
diff changeset
84 // It hides the details of constant pool structure/access by
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // providing accessors for constant pool items.
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87 // ------------------------------------------------------------------
1565
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
88 // ciBytecodeStream::next_wide_or_table
0
a61af66fc99e Initial load
duke
parents:
diff changeset
89 //
a61af66fc99e Initial load
duke
parents:
diff changeset
90 // Special handling for switch ops
1565
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
91 Bytecodes::Code ciBytecodeStream::next_wide_or_table(Bytecodes::Code bc) {
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
92 switch (bc) { // Check for special bytecode handling
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
93 case Bytecodes::_wide:
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
94 // Special handling for the wide bytcode
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
95 // Get following bytecode; do not return wide
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
96 assert(Bytecodes::Code(_pc[0]) == Bytecodes::_wide, "");
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
97 bc = Bytecodes::java_code(_raw_bc = (Bytecodes::Code)_pc[1]);
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
98 assert(Bytecodes::wide_length_for(bc) > 2, "must make progress");
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
99 _pc += Bytecodes::wide_length_for(bc);
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
100 _was_wide = _pc; // Flag last wide bytecode found
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
101 assert(is_wide(), "accessor works right");
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
102 break;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 case Bytecodes::_lookupswitch:
a61af66fc99e Initial load
duke
parents:
diff changeset
105 _pc++; // Skip wide bytecode
a61af66fc99e Initial load
duke
parents:
diff changeset
106 _pc += (_start-_pc)&3; // Word align
a61af66fc99e Initial load
duke
parents:
diff changeset
107 _table_base = (jint*)_pc; // Capture for later usage
a61af66fc99e Initial load
duke
parents:
diff changeset
108 // table_base[0] is default far_dest
a61af66fc99e Initial load
duke
parents:
diff changeset
109 // Table has 2 lead elements (default, length), then pairs of u4 values.
a61af66fc99e Initial load
duke
parents:
diff changeset
110 // So load table length, and compute address at end of table
a61af66fc99e Initial load
duke
parents:
diff changeset
111 _pc = (address)&_table_base[2+ 2*Bytes::get_Java_u4((address)&_table_base[1])];
a61af66fc99e Initial load
duke
parents:
diff changeset
112 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 case Bytecodes::_tableswitch: {
a61af66fc99e Initial load
duke
parents:
diff changeset
115 _pc++; // Skip wide bytecode
a61af66fc99e Initial load
duke
parents:
diff changeset
116 _pc += (_start-_pc)&3; // Word align
a61af66fc99e Initial load
duke
parents:
diff changeset
117 _table_base = (jint*)_pc; // Capture for later usage
a61af66fc99e Initial load
duke
parents:
diff changeset
118 // table_base[0] is default far_dest
a61af66fc99e Initial load
duke
parents:
diff changeset
119 int lo = Bytes::get_Java_u4((address)&_table_base[1]);// Low bound
a61af66fc99e Initial load
duke
parents:
diff changeset
120 int hi = Bytes::get_Java_u4((address)&_table_base[2]);// High bound
a61af66fc99e Initial load
duke
parents:
diff changeset
121 int len = hi - lo + 1; // Dense table size
a61af66fc99e Initial load
duke
parents:
diff changeset
122 _pc = (address)&_table_base[3+len]; // Skip past table
a61af66fc99e Initial load
duke
parents:
diff changeset
123 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
124 }
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
127 fatal("unhandled bytecode");
a61af66fc99e Initial load
duke
parents:
diff changeset
128 }
a61af66fc99e Initial load
duke
parents:
diff changeset
129 return bc;
a61af66fc99e Initial load
duke
parents:
diff changeset
130 }
a61af66fc99e Initial load
duke
parents:
diff changeset
131
a61af66fc99e Initial load
duke
parents:
diff changeset
132 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
133 // ciBytecodeStream::reset_to_bci
a61af66fc99e Initial load
duke
parents:
diff changeset
134 void ciBytecodeStream::reset_to_bci( int bci ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
135 _bc_start=_was_wide=0;
a61af66fc99e Initial load
duke
parents:
diff changeset
136 _pc = _start+bci;
a61af66fc99e Initial load
duke
parents:
diff changeset
137 }
a61af66fc99e Initial load
duke
parents:
diff changeset
138
a61af66fc99e Initial load
duke
parents:
diff changeset
139 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
140 // ciBytecodeStream::force_bci
a61af66fc99e Initial load
duke
parents:
diff changeset
141 void ciBytecodeStream::force_bci(int bci) {
a61af66fc99e Initial load
duke
parents:
diff changeset
142 if (bci < 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
143 reset_to_bci(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
144 _bc_start = _start + bci;
a61af66fc99e Initial load
duke
parents:
diff changeset
145 _bc = EOBC();
a61af66fc99e Initial load
duke
parents:
diff changeset
146 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
147 reset_to_bci(bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
148 next();
a61af66fc99e Initial load
duke
parents:
diff changeset
149 }
a61af66fc99e Initial load
duke
parents:
diff changeset
150 }
a61af66fc99e Initial load
duke
parents:
diff changeset
151
a61af66fc99e Initial load
duke
parents:
diff changeset
152
a61af66fc99e Initial load
duke
parents:
diff changeset
153 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
154 // Constant pool access
a61af66fc99e Initial load
duke
parents:
diff changeset
155 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
156
a61af66fc99e Initial load
duke
parents:
diff changeset
157 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
158 // ciBytecodeStream::get_klass_index
a61af66fc99e Initial load
duke
parents:
diff changeset
159 //
a61af66fc99e Initial load
duke
parents:
diff changeset
160 // If this bytecodes references a klass, return the index of the
a61af66fc99e Initial load
duke
parents:
diff changeset
161 // referenced klass.
a61af66fc99e Initial load
duke
parents:
diff changeset
162 int ciBytecodeStream::get_klass_index() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
163 switch(cur_bc()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
164 case Bytecodes::_ldc:
1565
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
165 return get_index_u1();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
166 case Bytecodes::_ldc_w:
a61af66fc99e Initial load
duke
parents:
diff changeset
167 case Bytecodes::_ldc2_w:
a61af66fc99e Initial load
duke
parents:
diff changeset
168 case Bytecodes::_checkcast:
a61af66fc99e Initial load
duke
parents:
diff changeset
169 case Bytecodes::_instanceof:
a61af66fc99e Initial load
duke
parents:
diff changeset
170 case Bytecodes::_anewarray:
a61af66fc99e Initial load
duke
parents:
diff changeset
171 case Bytecodes::_multianewarray:
a61af66fc99e Initial load
duke
parents:
diff changeset
172 case Bytecodes::_new:
a61af66fc99e Initial load
duke
parents:
diff changeset
173 case Bytecodes::_newarray:
1565
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
174 return get_index_u2();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
175 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
176 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
177 return 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
178 }
a61af66fc99e Initial load
duke
parents:
diff changeset
179 }
a61af66fc99e Initial load
duke
parents:
diff changeset
180
a61af66fc99e Initial load
duke
parents:
diff changeset
181 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
182 // ciBytecodeStream::get_klass
a61af66fc99e Initial load
duke
parents:
diff changeset
183 //
a61af66fc99e Initial load
duke
parents:
diff changeset
184 // If this bytecode is a new, newarray, multianewarray, instanceof,
a61af66fc99e Initial load
duke
parents:
diff changeset
185 // or checkcast, get the referenced klass.
a61af66fc99e Initial load
duke
parents:
diff changeset
186 ciKlass* ciBytecodeStream::get_klass(bool& will_link) {
1138
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 1137
diff changeset
187 VM_ENTRY_MARK;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
188 constantPoolHandle cpool(_method->get_Method()->constants());
1138
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 1137
diff changeset
189 return CURRENT_ENV->get_klass_by_index(cpool, get_klass_index(), will_link, _holder);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
190 }
a61af66fc99e Initial load
duke
parents:
diff changeset
191
a61af66fc99e Initial load
duke
parents:
diff changeset
192 // ------------------------------------------------------------------
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
193 // ciBytecodeStream::get_constant_raw_index
0
a61af66fc99e Initial load
duke
parents:
diff changeset
194 //
a61af66fc99e Initial load
duke
parents:
diff changeset
195 // If this bytecode is one of the ldc variants, get the index of the
a61af66fc99e Initial load
duke
parents:
diff changeset
196 // referenced constant.
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
197 int ciBytecodeStream::get_constant_raw_index() const {
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
198 // work-alike for Bytecode_loadconstant::raw_index()
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
199 switch (cur_bc()) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
200 case Bytecodes::_ldc:
1565
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
201 return get_index_u1();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
202 case Bytecodes::_ldc_w:
a61af66fc99e Initial load
duke
parents:
diff changeset
203 case Bytecodes::_ldc2_w:
1565
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
204 return get_index_u2();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
205 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
206 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
207 return 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
208 }
a61af66fc99e Initial load
duke
parents:
diff changeset
209 }
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
210
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
211 // ------------------------------------------------------------------
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
212 // ciBytecodeStream::get_constant_pool_index
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
213 // Decode any reference index into a regular pool index.
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
214 int ciBytecodeStream::get_constant_pool_index() const {
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
215 // work-alike for Bytecode_loadconstant::pool_index()
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
216 int index = get_constant_raw_index();
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
217 if (has_cache_index()) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
218 VM_ENTRY_MARK;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
219 constantPoolHandle cpool(_method->get_Method()->constants());
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
220 return cpool->object_to_cp_index(index);
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
221 }
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
222 return index;
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
223 }
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
224
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
225 // ------------------------------------------------------------------
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
226 // ciBytecodeStream::get_constant_cache_index
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
227 // Return the CP cache index, or -1 if there isn't any.
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
228 int ciBytecodeStream::get_constant_cache_index() const {
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
229 // work-alike for Bytecode_loadconstant::cache_index()
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
230 return has_cache_index() ? get_constant_raw_index() : -1;
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
231 }
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
232
0
a61af66fc99e Initial load
duke
parents:
diff changeset
233 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
234 // ciBytecodeStream::get_constant
a61af66fc99e Initial load
duke
parents:
diff changeset
235 //
a61af66fc99e Initial load
duke
parents:
diff changeset
236 // If this bytecode is one of the ldc variants, get the referenced
a61af66fc99e Initial load
duke
parents:
diff changeset
237 // constant.
a61af66fc99e Initial load
duke
parents:
diff changeset
238 ciConstant ciBytecodeStream::get_constant() {
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
239 int pool_index = get_constant_raw_index();
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
240 int cache_index = -1;
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
241 if (has_cache_index()) {
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
242 cache_index = pool_index;
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
243 pool_index = -1;
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
244 }
1138
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 1137
diff changeset
245 VM_ENTRY_MARK;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
246 constantPoolHandle cpool(_method->get_Method()->constants());
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
247 return CURRENT_ENV->get_constant_by_index(cpool, pool_index, cache_index, _holder);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
248 }
a61af66fc99e Initial load
duke
parents:
diff changeset
249
a61af66fc99e Initial load
duke
parents:
diff changeset
250 // ------------------------------------------------------------------
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
251 // ciBytecodeStream::get_constant_pool_tag
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
252 //
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
253 // If this bytecode is one of the ldc variants, get the referenced
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
254 // constant.
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
255 constantTag ciBytecodeStream::get_constant_pool_tag(int index) const {
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
256 VM_ENTRY_MARK;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
257 return _method->get_Method()->constants()->tag_at(index);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
258 }
a61af66fc99e Initial load
duke
parents:
diff changeset
259
a61af66fc99e Initial load
duke
parents:
diff changeset
260 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
261 // ciBytecodeStream::get_field_index
a61af66fc99e Initial load
duke
parents:
diff changeset
262 //
a61af66fc99e Initial load
duke
parents:
diff changeset
263 // If this is a field access bytecode, get the constant pool
a61af66fc99e Initial load
duke
parents:
diff changeset
264 // index of the referenced field.
a61af66fc99e Initial load
duke
parents:
diff changeset
265 int ciBytecodeStream::get_field_index() {
a61af66fc99e Initial load
duke
parents:
diff changeset
266 assert(cur_bc() == Bytecodes::_getfield ||
a61af66fc99e Initial load
duke
parents:
diff changeset
267 cur_bc() == Bytecodes::_putfield ||
a61af66fc99e Initial load
duke
parents:
diff changeset
268 cur_bc() == Bytecodes::_getstatic ||
a61af66fc99e Initial load
duke
parents:
diff changeset
269 cur_bc() == Bytecodes::_putstatic, "wrong bc");
1565
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
270 return get_index_u2_cpcache();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
271 }
a61af66fc99e Initial load
duke
parents:
diff changeset
272
a61af66fc99e Initial load
duke
parents:
diff changeset
273
a61af66fc99e Initial load
duke
parents:
diff changeset
274 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
275 // ciBytecodeStream::get_field
a61af66fc99e Initial load
duke
parents:
diff changeset
276 //
a61af66fc99e Initial load
duke
parents:
diff changeset
277 // If this bytecode is one of get_field, get_static, put_field,
a61af66fc99e Initial load
duke
parents:
diff changeset
278 // or put_static, get the referenced field.
a61af66fc99e Initial load
duke
parents:
diff changeset
279 ciField* ciBytecodeStream::get_field(bool& will_link) {
a61af66fc99e Initial load
duke
parents:
diff changeset
280 ciField* f = CURRENT_ENV->get_field_by_index(_holder, get_field_index());
a61af66fc99e Initial load
duke
parents:
diff changeset
281 will_link = f->will_link(_holder, _bc);
a61af66fc99e Initial load
duke
parents:
diff changeset
282 return f;
a61af66fc99e Initial load
duke
parents:
diff changeset
283 }
a61af66fc99e Initial load
duke
parents:
diff changeset
284
a61af66fc99e Initial load
duke
parents:
diff changeset
285
a61af66fc99e Initial load
duke
parents:
diff changeset
286 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
287 // ciBytecodeStream::get_declared_field_holder
a61af66fc99e Initial load
duke
parents:
diff changeset
288 //
a61af66fc99e Initial load
duke
parents:
diff changeset
289 // Get the declared holder of the currently referenced field.
a61af66fc99e Initial load
duke
parents:
diff changeset
290 //
a61af66fc99e Initial load
duke
parents:
diff changeset
291 // Usage note: the holder() of a ciField class returns the canonical
a61af66fc99e Initial load
duke
parents:
diff changeset
292 // holder of the field, rather than the holder declared in the
a61af66fc99e Initial load
duke
parents:
diff changeset
293 // bytecodes.
a61af66fc99e Initial load
duke
parents:
diff changeset
294 //
a61af66fc99e Initial load
duke
parents:
diff changeset
295 // There is no "will_link" result passed back. The user is responsible
a61af66fc99e Initial load
duke
parents:
diff changeset
296 // for checking linkability when retrieving the associated field.
a61af66fc99e Initial load
duke
parents:
diff changeset
297 ciInstanceKlass* ciBytecodeStream::get_declared_field_holder() {
1138
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 1137
diff changeset
298 VM_ENTRY_MARK;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
299 constantPoolHandle cpool(_method->get_Method()->constants());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
300 int holder_index = get_field_holder_index();
a61af66fc99e Initial load
duke
parents:
diff changeset
301 bool ignore;
1138
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 1137
diff changeset
302 return CURRENT_ENV->get_klass_by_index(cpool, holder_index, ignore, _holder)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
303 ->as_instance_klass();
a61af66fc99e Initial load
duke
parents:
diff changeset
304 }
a61af66fc99e Initial load
duke
parents:
diff changeset
305
a61af66fc99e Initial load
duke
parents:
diff changeset
306 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
307 // ciBytecodeStream::get_field_holder_index
a61af66fc99e Initial load
duke
parents:
diff changeset
308 //
a61af66fc99e Initial load
duke
parents:
diff changeset
309 // Get the constant pool index of the declared holder of the field
a61af66fc99e Initial load
duke
parents:
diff changeset
310 // referenced by the current bytecode. Used for generating
a61af66fc99e Initial load
duke
parents:
diff changeset
311 // deoptimization information.
a61af66fc99e Initial load
duke
parents:
diff changeset
312 int ciBytecodeStream::get_field_holder_index() {
1138
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 1137
diff changeset
313 GUARDED_VM_ENTRY(
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
314 ConstantPool* cpool = _holder->get_instanceKlass()->constants();
1138
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 1137
diff changeset
315 return cpool->klass_ref_index_at(get_field_index());
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 1137
diff changeset
316 )
0
a61af66fc99e Initial load
duke
parents:
diff changeset
317 }
a61af66fc99e Initial load
duke
parents:
diff changeset
318
a61af66fc99e Initial load
duke
parents:
diff changeset
319 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
320 // ciBytecodeStream::get_field_signature_index
a61af66fc99e Initial load
duke
parents:
diff changeset
321 //
a61af66fc99e Initial load
duke
parents:
diff changeset
322 // Get the constant pool index of the signature of the field
a61af66fc99e Initial load
duke
parents:
diff changeset
323 // referenced by the current bytecode. Used for generating
a61af66fc99e Initial load
duke
parents:
diff changeset
324 // deoptimization information.
a61af66fc99e Initial load
duke
parents:
diff changeset
325 int ciBytecodeStream::get_field_signature_index() {
a61af66fc99e Initial load
duke
parents:
diff changeset
326 VM_ENTRY_MARK;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
327 ConstantPool* cpool = _holder->get_instanceKlass()->constants();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
328 int nt_index = cpool->name_and_type_ref_index_at(get_field_index());
a61af66fc99e Initial load
duke
parents:
diff changeset
329 return cpool->signature_ref_index_at(nt_index);
a61af66fc99e Initial load
duke
parents:
diff changeset
330 }
a61af66fc99e Initial load
duke
parents:
diff changeset
331
a61af66fc99e Initial load
duke
parents:
diff changeset
332 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
333 // ciBytecodeStream::get_method_index
a61af66fc99e Initial load
duke
parents:
diff changeset
334 //
a61af66fc99e Initial load
duke
parents:
diff changeset
335 // If this is a method invocation bytecode, get the constant pool
a61af66fc99e Initial load
duke
parents:
diff changeset
336 // index of the invoked method.
a61af66fc99e Initial load
duke
parents:
diff changeset
337 int ciBytecodeStream::get_method_index() {
726
be93aad57795 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 0
diff changeset
338 #ifdef ASSERT
0
a61af66fc99e Initial load
duke
parents:
diff changeset
339 switch (cur_bc()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
340 case Bytecodes::_invokeinterface:
a61af66fc99e Initial load
duke
parents:
diff changeset
341 case Bytecodes::_invokevirtual:
a61af66fc99e Initial load
duke
parents:
diff changeset
342 case Bytecodes::_invokespecial:
a61af66fc99e Initial load
duke
parents:
diff changeset
343 case Bytecodes::_invokestatic:
726
be93aad57795 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 0
diff changeset
344 case Bytecodes::_invokedynamic:
be93aad57795 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 0
diff changeset
345 break;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
346 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
347 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
348 }
726
be93aad57795 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 0
diff changeset
349 #endif
1565
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
350 if (has_index_u4())
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
351 return get_index_u4(); // invokedynamic
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 1138
diff changeset
352 return get_index_u2_cpcache();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
353 }
a61af66fc99e Initial load
duke
parents:
diff changeset
354
a61af66fc99e Initial load
duke
parents:
diff changeset
355 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
356 // ciBytecodeStream::get_method
a61af66fc99e Initial load
duke
parents:
diff changeset
357 //
a61af66fc99e Initial load
duke
parents:
diff changeset
358 // If this is a method invocation bytecode, get the invoked method.
6634
7f813940ac35 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 6266
diff changeset
359 // Additionally return the declared signature to get more concrete
7f813940ac35 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 6266
diff changeset
360 // type information if required (Cf. invokedynamic and invokehandle).
7f813940ac35 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 6266
diff changeset
361 ciMethod* ciBytecodeStream::get_method(bool& will_link, ciSignature* *declared_signature_result) {
1138
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 1137
diff changeset
362 VM_ENTRY_MARK;
6634
7f813940ac35 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 6266
diff changeset
363 ciEnv* env = CURRENT_ENV;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
364 constantPoolHandle cpool(_method->get_Method()->constants());
6634
7f813940ac35 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 6266
diff changeset
365 ciMethod* m = env->get_method_by_index(cpool, get_method_index(), cur_bc(), _holder);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
366 will_link = m->is_loaded();
6634
7f813940ac35 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 6266
diff changeset
367 // Get declared method signature and return it.
7f813940ac35 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 6266
diff changeset
368 if (has_optional_appendix()) {
7f813940ac35 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 6266
diff changeset
369 const int sig_index = get_method_signature_index();
7f813940ac35 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 6266
diff changeset
370 Symbol* sig_sym = cpool->symbol_at(sig_index);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
371 ciKlass* pool_holder = env->get_klass(cpool->pool_holder());
6634
7f813940ac35 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 6266
diff changeset
372 (*declared_signature_result) = new (env->arena()) ciSignature(pool_holder, cpool, env->get_symbol(sig_sym));
7f813940ac35 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 6266
diff changeset
373 } else {
7f813940ac35 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 6266
diff changeset
374 (*declared_signature_result) = m->signature();
7f813940ac35 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 6266
diff changeset
375 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
376 return m;
a61af66fc99e Initial load
duke
parents:
diff changeset
377 }
a61af66fc99e Initial load
duke
parents:
diff changeset
378
a61af66fc99e Initial load
duke
parents:
diff changeset
379 // ------------------------------------------------------------------
6266
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
380 // ciBytecodeStream::has_appendix
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
381 //
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
382 // Returns true if there is an appendix argument stored in the
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
383 // constant pool cache at the current bci.
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
384 bool ciBytecodeStream::has_appendix() {
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
385 VM_ENTRY_MARK;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
386 constantPoolHandle cpool(_method->get_Method()->constants());
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
387 return ConstantPool::has_appendix_at_if_loaded(cpool, get_method_index());
6266
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
388 }
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
389
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
390 // ------------------------------------------------------------------
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
391 // ciBytecodeStream::get_appendix
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
392 //
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
393 // Return the appendix argument stored in the constant pool cache at
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
394 // the current bci.
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
395 ciObject* ciBytecodeStream::get_appendix() {
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
396 VM_ENTRY_MARK;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
397 constantPoolHandle cpool(_method->get_Method()->constants());
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
398 oop appendix_oop = ConstantPool::appendix_at_if_loaded(cpool, get_method_index());
6266
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
399 return CURRENT_ENV->get_object(appendix_oop);
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
400 }
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
401
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
402 // ------------------------------------------------------------------
0
a61af66fc99e Initial load
duke
parents:
diff changeset
403 // ciBytecodeStream::get_declared_method_holder
a61af66fc99e Initial load
duke
parents:
diff changeset
404 //
a61af66fc99e Initial load
duke
parents:
diff changeset
405 // Get the declared holder of the currently referenced method.
a61af66fc99e Initial load
duke
parents:
diff changeset
406 //
a61af66fc99e Initial load
duke
parents:
diff changeset
407 // Usage note: the holder() of a ciMethod class returns the canonical
a61af66fc99e Initial load
duke
parents:
diff changeset
408 // holder of the method, rather than the holder declared in the
a61af66fc99e Initial load
duke
parents:
diff changeset
409 // bytecodes.
a61af66fc99e Initial load
duke
parents:
diff changeset
410 //
a61af66fc99e Initial load
duke
parents:
diff changeset
411 // There is no "will_link" result passed back. The user is responsible
a61af66fc99e Initial load
duke
parents:
diff changeset
412 // for checking linkability when retrieving the associated method.
a61af66fc99e Initial load
duke
parents:
diff changeset
413 ciKlass* ciBytecodeStream::get_declared_method_holder() {
1138
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 1137
diff changeset
414 VM_ENTRY_MARK;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
415 constantPoolHandle cpool(_method->get_Method()->constants());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
416 bool ignore;
6266
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
417 // report as MethodHandle for invokedynamic, which is syntactically classless
726
be93aad57795 6655646: dynamic languages need dynamically linked call sites
jrose
parents: 0
diff changeset
418 if (cur_bc() == Bytecodes::_invokedynamic)
6266
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2357
diff changeset
419 return CURRENT_ENV->get_klass_by_name(_holder, ciSymbol::java_lang_invoke_MethodHandle(), false);
1138
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 1137
diff changeset
420 return CURRENT_ENV->get_klass_by_index(cpool, get_method_holder_index(), ignore, _holder);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
421 }
a61af66fc99e Initial load
duke
parents:
diff changeset
422
a61af66fc99e Initial load
duke
parents:
diff changeset
423 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
424 // ciBytecodeStream::get_method_holder_index
a61af66fc99e Initial load
duke
parents:
diff changeset
425 //
a61af66fc99e Initial load
duke
parents:
diff changeset
426 // Get the constant pool index of the declared holder of the method
a61af66fc99e Initial load
duke
parents:
diff changeset
427 // referenced by the current bytecode. Used for generating
a61af66fc99e Initial load
duke
parents:
diff changeset
428 // deoptimization information.
a61af66fc99e Initial load
duke
parents:
diff changeset
429 int ciBytecodeStream::get_method_holder_index() {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
430 ConstantPool* cpool = _method->get_Method()->constants();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
431 return cpool->klass_ref_index_at(get_method_index());
a61af66fc99e Initial load
duke
parents:
diff changeset
432 }
a61af66fc99e Initial load
duke
parents:
diff changeset
433
a61af66fc99e Initial load
duke
parents:
diff changeset
434 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
435 // ciBytecodeStream::get_method_signature_index
a61af66fc99e Initial load
duke
parents:
diff changeset
436 //
a61af66fc99e Initial load
duke
parents:
diff changeset
437 // Get the constant pool index of the signature of the method
a61af66fc99e Initial load
duke
parents:
diff changeset
438 // referenced by the current bytecode. Used for generating
a61af66fc99e Initial load
duke
parents:
diff changeset
439 // deoptimization information.
a61af66fc99e Initial load
duke
parents:
diff changeset
440 int ciBytecodeStream::get_method_signature_index() {
6634
7f813940ac35 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 6266
diff changeset
441 GUARDED_VM_ENTRY(
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
442 ConstantPool* cpool = _holder->get_instanceKlass()->constants();
6634
7f813940ac35 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 6266
diff changeset
443 const int method_index = get_method_index();
7f813940ac35 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 6266
diff changeset
444 const int name_and_type_index = cpool->name_and_type_ref_index_at(method_index);
7f813940ac35 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 6266
diff changeset
445 return cpool->signature_ref_index_at(name_and_type_index);
7f813940ac35 7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents: 6266
diff changeset
446 )
0
a61af66fc99e Initial load
duke
parents:
diff changeset
447 }
1137
97125851f396 6829187: compiler optimizations required for JSR 292
twisti
parents: 1135
diff changeset
448
97125851f396 6829187: compiler optimizations required for JSR 292
twisti
parents: 1135
diff changeset
449 // ------------------------------------------------------------------
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
450 // ciBytecodeStream::get_resolved_references
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
451 ciObjArray* ciBytecodeStream::get_resolved_references() {
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
452 VM_ENTRY_MARK;
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1579
diff changeset
453 // Get the constant pool.
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
454 ConstantPool* cpool = _holder->get_instanceKlass()->constants();
1138
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 1137
diff changeset
455
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
456 // Create a resolved references array and return it.
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
457 return CURRENT_ENV->get_object(cpool->resolved_references())->as_obj_array();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6634
diff changeset
458 }