< prev index next >

src/hotspot/share/ci/ciStreams.cpp

Print this page

155 // ------------------------------------------------------------------
156 // Constant pool access
157 // ------------------------------------------------------------------
158 
159 // ------------------------------------------------------------------
160 // ciBytecodeStream::get_klass_index
161 //
162 // If this bytecodes references a klass, return the index of the
163 // referenced klass.
164 int ciBytecodeStream::get_klass_index() const {
165   switch(cur_bc()) {
166   case Bytecodes::_ldc:
167     return get_index_u1();
168   case Bytecodes::_ldc_w:
169   case Bytecodes::_ldc2_w:
170   case Bytecodes::_checkcast:
171   case Bytecodes::_instanceof:
172   case Bytecodes::_anewarray:
173   case Bytecodes::_multianewarray:
174   case Bytecodes::_new:

175   case Bytecodes::_newarray:
176     return get_index_u2();
177   default:
178     ShouldNotReachHere();
179     return 0;
180   }
181 }
182 
183 // ------------------------------------------------------------------
184 // ciBytecodeStream::get_klass
185 //
186 // If this bytecode is a new, newarray, multianewarray, instanceof,
187 // or checkcast, get the referenced klass.
188 ciKlass* ciBytecodeStream::get_klass(bool& will_link) {
189   VM_ENTRY_MARK;
190   constantPoolHandle cpool(THREAD, _method->get_Method()->constants());
191   return CURRENT_ENV->get_klass_by_index(cpool, get_klass_index(), will_link, _holder);
192 }
193 










194 // ------------------------------------------------------------------
195 // ciBytecodeStream::get_constant_raw_index
196 //
197 // If this bytecode is one of the ldc variants, get the index of the
198 // referenced constant.
199 int ciBytecodeStream::get_constant_raw_index() const {
200   // work-alike for Bytecode_loadconstant::raw_index()
201   switch (cur_bc()) {
202   case Bytecodes::_ldc:
203     return get_index_u1();
204   case Bytecodes::_ldc_w:
205   case Bytecodes::_ldc2_w:
206     return get_index_u2();
207   default:
208     ShouldNotReachHere();
209     return 0;
210   }
211 }
212 
213 // ------------------------------------------------------------------

264   return _method->get_Method()->constants()->tag_at(index);
265 }
266 
267 // ------------------------------------------------------------------
268 // ciBytecodeStream::get_basic_type_for_constant_at
269 //
270 BasicType ciBytecodeStream::get_basic_type_for_constant_at(int index) const {
271   VM_ENTRY_MARK;
272   return _method->get_Method()->constants()->basic_type_for_constant_at(index);
273 }
274 
275 // ------------------------------------------------------------------
276 // ciBytecodeStream::get_field_index
277 //
278 // If this is a field access bytecode, get the constant pool
279 // index of the referenced field.
280 int ciBytecodeStream::get_field_index() {
281   assert(cur_bc() == Bytecodes::_getfield ||
282          cur_bc() == Bytecodes::_putfield ||
283          cur_bc() == Bytecodes::_getstatic ||
284          cur_bc() == Bytecodes::_putstatic, "wrong bc");

285   return get_index_u2_cpcache();
286 }
287 
288 
289 // ------------------------------------------------------------------
290 // ciBytecodeStream::get_field
291 //
292 // If this bytecode is one of get_field, get_static, put_field,
293 // or put_static, get the referenced field.
294 ciField* ciBytecodeStream::get_field(bool& will_link) {
295   ciField* f = CURRENT_ENV->get_field_by_index(_holder, get_field_index());
296   will_link = f->will_link(_method, _bc);
297   return f;
298 }
299 
300 
301 // ------------------------------------------------------------------
302 // ciBytecodeStream::get_declared_field_holder
303 //
304 // Get the declared holder of the currently referenced field.

155 // ------------------------------------------------------------------
156 // Constant pool access
157 // ------------------------------------------------------------------
158 
159 // ------------------------------------------------------------------
160 // ciBytecodeStream::get_klass_index
161 //
162 // If this bytecodes references a klass, return the index of the
163 // referenced klass.
164 int ciBytecodeStream::get_klass_index() const {
165   switch(cur_bc()) {
166   case Bytecodes::_ldc:
167     return get_index_u1();
168   case Bytecodes::_ldc_w:
169   case Bytecodes::_ldc2_w:
170   case Bytecodes::_checkcast:
171   case Bytecodes::_instanceof:
172   case Bytecodes::_anewarray:
173   case Bytecodes::_multianewarray:
174   case Bytecodes::_new:
175   case Bytecodes::_aconst_init:
176   case Bytecodes::_newarray:
177     return get_index_u2();
178   default:
179     ShouldNotReachHere();
180     return 0;
181   }
182 }
183 
184 // ------------------------------------------------------------------
185 // ciBytecodeStream::get_klass
186 //
187 // If this bytecode is a new, newarray, multianewarray, instanceof,
188 // or checkcast, get the referenced klass.
189 ciKlass* ciBytecodeStream::get_klass(bool& will_link) {
190   VM_ENTRY_MARK;
191   constantPoolHandle cpool(THREAD, _method->get_Method()->constants());
192   return CURRENT_ENV->get_klass_by_index(cpool, get_klass_index(), will_link, _holder);
193 }
194 
195 // ------------------------------------------------------------------
196 // ciBytecodeStream::is_inline_klass
197 //
198 // Check if the klass is an inline klass.
199 bool ciBytecodeStream::has_Q_signature() const {
200   VM_ENTRY_MARK;
201   constantPoolHandle cpool(THREAD, _method->get_Method()->constants());
202   return CURRENT_ENV->has_Q_signature(cpool, get_klass_index());
203 }
204 
205 // ------------------------------------------------------------------
206 // ciBytecodeStream::get_constant_raw_index
207 //
208 // If this bytecode is one of the ldc variants, get the index of the
209 // referenced constant.
210 int ciBytecodeStream::get_constant_raw_index() const {
211   // work-alike for Bytecode_loadconstant::raw_index()
212   switch (cur_bc()) {
213   case Bytecodes::_ldc:
214     return get_index_u1();
215   case Bytecodes::_ldc_w:
216   case Bytecodes::_ldc2_w:
217     return get_index_u2();
218   default:
219     ShouldNotReachHere();
220     return 0;
221   }
222 }
223 
224 // ------------------------------------------------------------------

275   return _method->get_Method()->constants()->tag_at(index);
276 }
277 
278 // ------------------------------------------------------------------
279 // ciBytecodeStream::get_basic_type_for_constant_at
280 //
281 BasicType ciBytecodeStream::get_basic_type_for_constant_at(int index) const {
282   VM_ENTRY_MARK;
283   return _method->get_Method()->constants()->basic_type_for_constant_at(index);
284 }
285 
286 // ------------------------------------------------------------------
287 // ciBytecodeStream::get_field_index
288 //
289 // If this is a field access bytecode, get the constant pool
290 // index of the referenced field.
291 int ciBytecodeStream::get_field_index() {
292   assert(cur_bc() == Bytecodes::_getfield ||
293          cur_bc() == Bytecodes::_putfield ||
294          cur_bc() == Bytecodes::_getstatic ||
295          cur_bc() == Bytecodes::_putstatic ||
296          cur_bc() == Bytecodes::_withfield, "wrong bc");
297   return get_index_u2_cpcache();
298 }
299 
300 
301 // ------------------------------------------------------------------
302 // ciBytecodeStream::get_field
303 //
304 // If this bytecode is one of get_field, get_static, put_field,
305 // or put_static, get the referenced field.
306 ciField* ciBytecodeStream::get_field(bool& will_link) {
307   ciField* f = CURRENT_ENV->get_field_by_index(_holder, get_field_index());
308   will_link = f->will_link(_method, _bc);
309   return f;
310 }
311 
312 
313 // ------------------------------------------------------------------
314 // ciBytecodeStream::get_declared_field_holder
315 //
316 // Get the declared holder of the currently referenced field.
< prev index next >