// ciField // // This class represents the result of a field lookup in the VM. // The lookup may not succeed, in which case the information in // the ciField will be incomplete. class ciField : public ArenaObj {
CI_PACKAGE_ACCESS
friend class ciEnv;
friend class ciInstanceKlass;
// Of which klass is this field a member? // // Usage note: the declared holder of a field is the class // referenced by name in the bytecodes. The canonical holder // is the most general class which holds the field. This // method returns the canonical holder. The declared holder // can be accessed via a method in ciBytecodeStream. // // Ex. // class A { // public int f = 7; // } // class B extends A { // public void test() { // System.out.println(f); // } // } // // A java compiler is permitted to compile the access to // field f as: // // getfield B.f // // In that case the declared holder of f would be B and // the canonical holder of f would be A.
ciInstanceKlass* holder() const { return _holder; }
// Name of this field?
ciSymbol* name() const { return _name; }
// Signature of this field?
ciSymbol* signature() const { return _signature; }
// Of what type is this field?
ciType* type() { return (_type == NULL) ? compute_type() : _type; }
// How is this field actually stored in memory?
BasicType layout_type() { return type2field[(_type == NULL) ? T_OBJECT : _type->basic_type()]; }
// How big is this field in memory?
int size_in_bytes() { return type2aelembytes(layout_type()); }
// What is the offset of this field?
int offset() const {
assert(_offset >= 1, "illegal call to offset()"); return _offset;
}
// Same question, explicit units. (Fields are aligned to the byte level.)
int offset_in_bytes() const { return offset();
}
// Is this field shared? bool is_shared() { // non-static fields of shared holders are cached return _holder->is_shared() && !is_static();
}
// Is this field a constant? // // Clarification: A field is considered constant if: // 1. The field is both static and final // 2. The field is not one of the special static/final // non-constant fields. These are java.lang.System.in // and java.lang.System.out. Abomination. // // A field is also considered constant if // - it is marked @Stable and is non-null (or non-zero, if a primitive) or // - it is trusted or // - it is the target field of a CallSite object. // // See ciField::initialize_from() for more details. // // A user should also check the field value (constant_value().is_valid()), since // constant fields of non-initialized classes don't have values yet. bool is_constant() const { return _is_constant; }
// Get the constant value of the static field.
ciConstant constant_value();
// Get the constant value of non-static final field in the given // object.
ciConstant constant_value_of(ciObject* object);
// Check for link time errors. Accessing a field from a // certain method via a certain bytecode may or may not be legal. // This call checks to see if an exception may be raised by // an access of this field. // // Usage note: if the same field is accessed multiple times // in the same compilation, will_link will need to be checked // at each point of access. bool will_link(ciMethod* accessing_method,
Bytecodes::Code bc);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.