< prev index next >

src/hotspot/share/ci/ciStreams.cpp

Print this page




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

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


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

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




 154 // ------------------------------------------------------------------
 155 // Constant pool access
 156 // ------------------------------------------------------------------
 157 
 158 // ------------------------------------------------------------------
 159 // ciBytecodeStream::get_klass_index
 160 //
 161 // If this bytecodes references a klass, return the index of the
 162 // referenced klass.
 163 int ciBytecodeStream::get_klass_index() const {
 164   switch(cur_bc()) {
 165   case Bytecodes::_ldc:
 166     return get_index_u1();
 167   case Bytecodes::_ldc_w:
 168   case Bytecodes::_ldc2_w:
 169   case Bytecodes::_checkcast:
 170   case Bytecodes::_instanceof:
 171   case Bytecodes::_anewarray:
 172   case Bytecodes::_multianewarray:
 173   case Bytecodes::_new:
 174   case Bytecodes::_defaultvalue:
 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(_method->get_Method()->constants());
 191   return CURRENT_ENV->get_klass_by_index(cpool, get_klass_index(), will_link, _holder);
 192 }
 193 
 194 // ------------------------------------------------------------------
 195 // ciBytecodeStream::is_klass_never_null
 196 //
 197 // Get information about nullability from the constant pool.
 198 bool ciBytecodeStream::is_klass_never_null() const {
 199   VM_ENTRY_MARK;
 200   constantPoolHandle cpool(_method->get_Method()->constants());
 201   return CURRENT_ENV->is_klass_never_null(cpool, get_klass_index());
 202 }
 203 
 204 // ------------------------------------------------------------------
 205 // ciBytecodeStream::get_constant_raw_index
 206 //
 207 // If this bytecode is one of the ldc variants, get the index of the
 208 // referenced constant.
 209 int ciBytecodeStream::get_constant_raw_index() const {
 210   // work-alike for Bytecode_loadconstant::raw_index()
 211   switch (cur_bc()) {
 212   case Bytecodes::_ldc:
 213     return get_index_u1();
 214   case Bytecodes::_ldc_w:
 215   case Bytecodes::_ldc2_w:
 216     return get_index_u2();
 217   default:
 218     ShouldNotReachHere();
 219     return 0;
 220   }
 221 }
 222 
 223 // ------------------------------------------------------------------
 224 // ciBytecodeStream::get_constant_pool_index


 253 
 254 // ------------------------------------------------------------------
 255 // ciBytecodeStream::get_constant_pool_tag
 256 //
 257 // If this bytecode is one of the ldc variants, get the referenced
 258 // constant.
 259 constantTag ciBytecodeStream::get_constant_pool_tag(int index) const {
 260   VM_ENTRY_MARK;
 261   return _method->get_Method()->constants()->constant_tag_at(index);
 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::_withfield, "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.


< prev index next >