< 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 // ------------------------------------------------------------------

243 
244 // ------------------------------------------------------------------
245 // ciBytecodeStream::get_constant_pool_tag
246 //
247 // If this bytecode is one of the ldc variants, get the referenced
248 // constant.
249 constantTag ciBytecodeStream::get_constant_pool_tag(int index) const {
250   VM_ENTRY_MARK;
251   return _method->get_Method()->constants()->constant_tag_at(index);
252 }
253 
254 // ------------------------------------------------------------------
255 // ciBytecodeStream::get_field_index
256 //
257 // If this is a field access bytecode, get the constant pool
258 // index of the referenced field.
259 int ciBytecodeStream::get_field_index() {
260   assert(cur_bc() == Bytecodes::_getfield ||
261          cur_bc() == Bytecodes::_putfield ||
262          cur_bc() == Bytecodes::_getstatic ||
263          cur_bc() == Bytecodes::_putstatic, "wrong bc");

264   return get_index_u2_cpcache();
265 }
266 
267 
268 // ------------------------------------------------------------------
269 // ciBytecodeStream::get_field
270 //
271 // If this bytecode is one of get_field, get_static, put_field,
272 // or put_static, get the referenced field.
273 ciField* ciBytecodeStream::get_field(bool& will_link) {
274   ciField* f = CURRENT_ENV->get_field_by_index(_holder, get_field_index());
275   will_link = f->will_link(_method, _bc);
276   return f;
277 }
278 
279 
280 // ------------------------------------------------------------------
281 // ciBytecodeStream::get_declared_field_holder
282 //
283 // 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::_defaultvalue:
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 // ------------------------------------------------------------------

254 
255 // ------------------------------------------------------------------
256 // ciBytecodeStream::get_constant_pool_tag
257 //
258 // If this bytecode is one of the ldc variants, get the referenced
259 // constant.
260 constantTag ciBytecodeStream::get_constant_pool_tag(int index) const {
261   VM_ENTRY_MARK;
262   return _method->get_Method()->constants()->constant_tag_at(index);
263 }
264 
265 // ------------------------------------------------------------------
266 // ciBytecodeStream::get_field_index
267 //
268 // If this is a field access bytecode, get the constant pool
269 // index of the referenced field.
270 int ciBytecodeStream::get_field_index() {
271   assert(cur_bc() == Bytecodes::_getfield ||
272          cur_bc() == Bytecodes::_putfield ||
273          cur_bc() == Bytecodes::_getstatic ||
274          cur_bc() == Bytecodes::_putstatic ||
275          cur_bc() == Bytecodes::_withfield, "wrong bc");
276   return get_index_u2_cpcache();
277 }
278 
279 
280 // ------------------------------------------------------------------
281 // ciBytecodeStream::get_field
282 //
283 // If this bytecode is one of get_field, get_static, put_field,
284 // or put_static, get the referenced field.
285 ciField* ciBytecodeStream::get_field(bool& will_link) {
286   ciField* f = CURRENT_ENV->get_field_by_index(_holder, get_field_index());
287   will_link = f->will_link(_method, _bc);
288   return f;
289 }
290 
291 
292 // ------------------------------------------------------------------
293 // ciBytecodeStream::get_declared_field_holder
294 //
295 // Get the declared holder of the currently referenced field.
< prev index next >