src/share/vm/ci/ciField.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File cik Sdiff src/share/vm/ci

src/share/vm/ci/ciField.hpp

Print this page




  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_CI_CIFIELD_HPP
  26 #define SHARE_VM_CI_CIFIELD_HPP
  27 
  28 #include "ci/ciClassList.hpp"
  29 #include "ci/ciConstant.hpp"
  30 #include "ci/ciFlags.hpp"
  31 #include "ci/ciInstance.hpp"
  32 
  33 // ciField
  34 //
  35 // This class represents the result of a field lookup in the VM.
  36 // The lookup may not succeed, in which case the information in
  37 // the ciField will be incomplete.
  38 class ciField : public ResourceObj {
  39   CI_PACKAGE_ACCESS
  40   friend class ciEnv;
  41   friend class ciInstanceKlass;
  42   friend class NonStaticFieldFiller;
  43 
  44 private:
  45   ciFlags          _flags;
  46   ciInstanceKlass* _holder;
  47   ciSymbol*        _name;
  48   ciSymbol*        _signature;
  49   ciType*          _type;
  50   int              _offset;
  51   bool             _is_constant;
  52   ciInstanceKlass* _known_to_link_with;
  53   ciConstant       _constant_value;
  54 
  55   // Used for will_link
  56   int              _cp_index;
  57 
  58   ciType* compute_type();
  59   ciType* compute_type_impl();
  60 
  61   ciField(ciInstanceKlass* klass, int index);
  62   ciField(fieldDescriptor* fd);


 106   // Of what type is this field?
 107   ciType* type() { return (_type == NULL) ? compute_type() : _type; }
 108 
 109   // How is this field actually stored in memory?
 110   BasicType layout_type() { return type2field[(_type == NULL) ? T_OBJECT : _type->basic_type()]; }
 111 
 112   // How big is this field in memory?
 113   int size_in_bytes() { return type2aelembytes(layout_type()); }
 114 
 115   // What is the offset of this field?
 116   int offset() {
 117     assert(_offset >= 1, "illegal call to offset()");
 118     return _offset;
 119   }
 120 
 121   // Same question, explicit units.  (Fields are aligned to the byte level.)
 122   int offset_in_bytes() {
 123     return offset();
 124   }
 125 
 126   // Is this field shared?
 127   bool is_shared() {
 128     // non-static fields of shared holders are cached
 129     return _holder->is_shared() && !is_static();
 130   }
 131 
 132   // Is this field a constant?
 133   //
 134   // Clarification: A field is considered constant if:
 135   //   1. The field is both static and final
 136   //   2. The canonical holder of the field has undergone
 137   //      static initialization.
 138   //   3. If the field is an object or array, then the oop
 139   //      in question is allocated in perm space.
 140   //   4. The field is not one of the special static/final
 141   //      non-constant fields.  These are java.lang.System.in
 142   //      and java.lang.System.out.  Abomination.
 143   //
 144   // Note: the check for case 4 is not yet implemented.
 145   bool is_constant() { return _is_constant; }
 146 
 147   // Get the constant value of this field.
 148   ciConstant constant_value() {
 149     assert(is_static() && is_constant(), "illegal call to constant_value()");
 150     return _constant_value;




  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_CI_CIFIELD_HPP
  26 #define SHARE_VM_CI_CIFIELD_HPP
  27 
  28 #include "ci/ciClassList.hpp"
  29 #include "ci/ciConstant.hpp"
  30 #include "ci/ciFlags.hpp"
  31 #include "ci/ciInstance.hpp"
  32 
  33 // ciField
  34 //
  35 // This class represents the result of a field lookup in the VM.
  36 // The lookup may not succeed, in which case the information in
  37 // the ciField will be incomplete.
  38 class ciField : public ResourceObj {
  39   CI_PACKAGE_ACCESS
  40   friend class ciEnv;
  41   friend class ciInstanceKlass;

  42 
  43 private:
  44   ciFlags          _flags;
  45   ciInstanceKlass* _holder;
  46   ciSymbol*        _name;
  47   ciSymbol*        _signature;
  48   ciType*          _type;
  49   int              _offset;
  50   bool             _is_constant;
  51   ciInstanceKlass* _known_to_link_with;
  52   ciConstant       _constant_value;
  53 
  54   // Used for will_link
  55   int              _cp_index;
  56 
  57   ciType* compute_type();
  58   ciType* compute_type_impl();
  59 
  60   ciField(ciInstanceKlass* klass, int index);
  61   ciField(fieldDescriptor* fd);


 105   // Of what type is this field?
 106   ciType* type() { return (_type == NULL) ? compute_type() : _type; }
 107 
 108   // How is this field actually stored in memory?
 109   BasicType layout_type() { return type2field[(_type == NULL) ? T_OBJECT : _type->basic_type()]; }
 110 
 111   // How big is this field in memory?
 112   int size_in_bytes() { return type2aelembytes(layout_type()); }
 113 
 114   // What is the offset of this field?
 115   int offset() {
 116     assert(_offset >= 1, "illegal call to offset()");
 117     return _offset;
 118   }
 119 
 120   // Same question, explicit units.  (Fields are aligned to the byte level.)
 121   int offset_in_bytes() {
 122     return offset();
 123   }
 124 
 125   // // Is this field shared?
 126   // bool is_shared() {
 127   //   // non-static fields of shared holders are cached
 128   //   return _holder->is_shared() && !is_static();
 129   // }
 130 
 131   // Is this field a constant?
 132   //
 133   // Clarification: A field is considered constant if:
 134   //   1. The field is both static and final
 135   //   2. The canonical holder of the field has undergone
 136   //      static initialization.
 137   //   3. If the field is an object or array, then the oop
 138   //      in question is allocated in perm space.
 139   //   4. The field is not one of the special static/final
 140   //      non-constant fields.  These are java.lang.System.in
 141   //      and java.lang.System.out.  Abomination.
 142   //
 143   // Note: the check for case 4 is not yet implemented.
 144   bool is_constant() { return _is_constant; }
 145 
 146   // Get the constant value of this field.
 147   ciConstant constant_value() {
 148     assert(is_static() && is_constant(), "illegal call to constant_value()");
 149     return _constant_value;


src/share/vm/ci/ciField.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File