153 // ------------------------------------------------------------------
154 // Constant pool access
155 // ------------------------------------------------------------------
156
157 // ------------------------------------------------------------------
158 // ciBytecodeStream::get_klass_index
159 //
160 // If this bytecodes references a klass, return the index of the
161 // referenced klass.
162 int ciBytecodeStream::get_klass_index() const {
163 switch(cur_bc()) {
164 case Bytecodes::_ldc:
165 return get_index_u1();
166 case Bytecodes::_ldc_w:
167 case Bytecodes::_ldc2_w:
168 case Bytecodes::_checkcast:
169 case Bytecodes::_instanceof:
170 case Bytecodes::_anewarray:
171 case Bytecodes::_multianewarray:
172 case Bytecodes::_new:
173 case Bytecodes::_vdefault:
174 case Bytecodes::_newarray:
175 case Bytecodes::_vunbox:
176 case Bytecodes::_vbox:
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, vbox,
188 // vunbox, or checkcast, get the referenced klass.
189 ciKlass* ciBytecodeStream::get_klass(bool& will_link) {
190 VM_ENTRY_MARK;
191 constantPoolHandle cpool(_method->get_Method()->constants());
192 return CURRENT_ENV->get_klass_by_index(cpool, get_klass_index(), will_link, _holder);
193 }
194
195 // ------------------------------------------------------------------
196 // ciBytecodeStream::get_constant_raw_index
254 // ciBytecodeStream::get_constant_pool_tag
255 //
256 // If this bytecode is one of the ldc variants, get the referenced
257 // constant.
258 constantTag ciBytecodeStream::get_constant_pool_tag(int index) const {
259 VM_ENTRY_MARK;
260 BasicType bt = _method->get_Method()->constants()->basic_type_for_constant_at(index);
261 return constantTag::ofBasicType(bt);
262 }
263
264 // ------------------------------------------------------------------
265 // ciBytecodeStream::get_field_index
266 //
267 // If this is a field access bytecode, get the constant pool
268 // index of the referenced field.
269 int ciBytecodeStream::get_field_index() {
270 assert(cur_bc() == Bytecodes::_getfield ||
271 cur_bc() == Bytecodes::_putfield ||
272 cur_bc() == Bytecodes::_getstatic ||
273 cur_bc() == Bytecodes::_putstatic ||
274 cur_bc() == Bytecodes::_vwithfield, "wrong bc");
275 return get_index_u2_cpcache();
276 }
277
278
279 // ------------------------------------------------------------------
280 // ciBytecodeStream::get_field
281 //
282 // If this bytecode is one of get_field, get_static, put_field,
283 // or put_static, get the referenced field.
284 ciField* ciBytecodeStream::get_field(bool& will_link) {
285 ciField* f = CURRENT_ENV->get_field_by_index(_holder, get_field_index());
286 will_link = f->will_link(_method, _bc);
287 return f;
288 }
289
290
291 // ------------------------------------------------------------------
292 // ciBytecodeStream::get_declared_field_holder
293 //
294 // Get the declared holder of the currently referenced field.
|
153 // ------------------------------------------------------------------
154 // Constant pool access
155 // ------------------------------------------------------------------
156
157 // ------------------------------------------------------------------
158 // ciBytecodeStream::get_klass_index
159 //
160 // If this bytecodes references a klass, return the index of the
161 // referenced klass.
162 int ciBytecodeStream::get_klass_index() const {
163 switch(cur_bc()) {
164 case Bytecodes::_ldc:
165 return get_index_u1();
166 case Bytecodes::_ldc_w:
167 case Bytecodes::_ldc2_w:
168 case Bytecodes::_checkcast:
169 case Bytecodes::_instanceof:
170 case Bytecodes::_anewarray:
171 case Bytecodes::_multianewarray:
172 case Bytecodes::_new:
173 case Bytecodes::_defaultvalue:
174 case Bytecodes::_newarray:
175 return get_index_u2();
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, vbox,
186 // vunbox, or checkcast, get the referenced klass.
187 ciKlass* ciBytecodeStream::get_klass(bool& will_link) {
188 VM_ENTRY_MARK;
189 constantPoolHandle cpool(_method->get_Method()->constants());
190 return CURRENT_ENV->get_klass_by_index(cpool, get_klass_index(), will_link, _holder);
191 }
192
193 // ------------------------------------------------------------------
194 // ciBytecodeStream::get_constant_raw_index
252 // ciBytecodeStream::get_constant_pool_tag
253 //
254 // If this bytecode is one of the ldc variants, get the referenced
255 // constant.
256 constantTag ciBytecodeStream::get_constant_pool_tag(int index) const {
257 VM_ENTRY_MARK;
258 BasicType bt = _method->get_Method()->constants()->basic_type_for_constant_at(index);
259 return constantTag::ofBasicType(bt);
260 }
261
262 // ------------------------------------------------------------------
263 // ciBytecodeStream::get_field_index
264 //
265 // If this is a field access bytecode, get the constant pool
266 // index of the referenced field.
267 int ciBytecodeStream::get_field_index() {
268 assert(cur_bc() == Bytecodes::_getfield ||
269 cur_bc() == Bytecodes::_putfield ||
270 cur_bc() == Bytecodes::_getstatic ||
271 cur_bc() == Bytecodes::_putstatic ||
272 cur_bc() == Bytecodes::_withfield, "wrong bc");
273 return get_index_u2_cpcache();
274 }
275
276
277 // ------------------------------------------------------------------
278 // ciBytecodeStream::get_field
279 //
280 // If this bytecode is one of get_field, get_static, put_field,
281 // or put_static, get the referenced field.
282 ciField* ciBytecodeStream::get_field(bool& will_link) {
283 ciField* f = CURRENT_ENV->get_field_by_index(_holder, get_field_index());
284 will_link = f->will_link(_method, _bc);
285 return f;
286 }
287
288
289 // ------------------------------------------------------------------
290 // ciBytecodeStream::get_declared_field_holder
291 //
292 // Get the declared holder of the currently referenced field.
|