< prev index next >

src/share/vm/ci/ciInstance.cpp

Print this page




  69     case T_FLOAT:   return ciConstant(obj->float_field(offset));
  70     case T_DOUBLE:  return ciConstant(obj->double_field(offset));
  71     case T_LONG:    return ciConstant(obj->long_field(offset));
  72     case T_OBJECT:  // fall through
  73     case T_ARRAY: {
  74       oop o = obj->obj_field(offset);
  75 
  76       // A field will be "constant" if it is known always to be
  77       // a non-null reference to an instance of a particular class,
  78       // or to a particular array.  This can happen even if the instance
  79       // or array is not perm.  In such a case, an "unloaded" ciArray
  80       // or ciInstance is created.  The compiler may be able to use
  81       // information about the object's class (which is exact) or length.
  82 
  83       if (o == NULL) {
  84         return ciConstant(field_btype, ciNullObject::make());
  85       } else {
  86         return ciConstant(field_btype, CURRENT_ENV->get_object(o));
  87       }
  88     }
  89   }
  90   fatal("no field value: %s", type2name(field_btype));
  91   return ciConstant();

  92 }
  93 
  94 // ------------------------------------------------------------------
  95 // ciInstance::field_value
  96 //
  97 // Constant value of a field.
  98 ciConstant ciInstance::field_value(ciField* field) {
  99   assert(is_loaded(), "invalid access - must be loaded");
 100   assert(field->holder()->is_loaded(), "invalid access - holder must be loaded");
 101   assert(field->is_static() || klass()->is_subclass_of(field->holder()), "invalid access - must be subclass");
 102 
 103   GUARDED_VM_ENTRY(return field_value_impl(field->type()->basic_type(), field->offset());)
 104 }
 105 
 106 // ------------------------------------------------------------------
 107 // ciInstance::field_value_by_offset
 108 //
 109 // Constant value of a field at the specified offset.
 110 ciConstant ciInstance::field_value_by_offset(int field_offset) {
 111   ciInstanceKlass* ik = klass()->as_instance_klass();


  69     case T_FLOAT:   return ciConstant(obj->float_field(offset));
  70     case T_DOUBLE:  return ciConstant(obj->double_field(offset));
  71     case T_LONG:    return ciConstant(obj->long_field(offset));
  72     case T_OBJECT:  // fall through
  73     case T_ARRAY: {
  74       oop o = obj->obj_field(offset);
  75 
  76       // A field will be "constant" if it is known always to be
  77       // a non-null reference to an instance of a particular class,
  78       // or to a particular array.  This can happen even if the instance
  79       // or array is not perm.  In such a case, an "unloaded" ciArray
  80       // or ciInstance is created.  The compiler may be able to use
  81       // information about the object's class (which is exact) or length.
  82 
  83       if (o == NULL) {
  84         return ciConstant(field_btype, ciNullObject::make());
  85       } else {
  86         return ciConstant(field_btype, CURRENT_ENV->get_object(o));
  87       }
  88     }
  89     default:
  90       fatal("no field value: %s", type2name(field_btype));
  91       return ciConstant();
  92   }
  93 }
  94 
  95 // ------------------------------------------------------------------
  96 // ciInstance::field_value
  97 //
  98 // Constant value of a field.
  99 ciConstant ciInstance::field_value(ciField* field) {
 100   assert(is_loaded(), "invalid access - must be loaded");
 101   assert(field->holder()->is_loaded(), "invalid access - holder must be loaded");
 102   assert(field->is_static() || klass()->is_subclass_of(field->holder()), "invalid access - must be subclass");
 103 
 104   GUARDED_VM_ENTRY(return field_value_impl(field->type()->basic_type(), field->offset());)
 105 }
 106 
 107 // ------------------------------------------------------------------
 108 // ciInstance::field_value_by_offset
 109 //
 110 // Constant value of a field at the specified offset.
 111 ciConstant ciInstance::field_value_by_offset(int field_offset) {
 112   ciInstanceKlass* ik = klass()->as_instance_klass();
< prev index next >