1.1 --- a/src/share/vm/runtime/fieldDescriptor.hpp Sat Sep 10 00:11:04 2011 -0700 1.2 +++ b/src/share/vm/runtime/fieldDescriptor.hpp Sat Sep 10 17:29:02 2011 -0700 1.3 @@ -40,29 +40,40 @@ 1.4 class fieldDescriptor VALUE_OBJ_CLASS_SPEC { 1.5 private: 1.6 AccessFlags _access_flags; 1.7 - int _name_index; 1.8 - int _signature_index; 1.9 - int _initial_value_index; 1.10 - int _offset; 1.11 - int _generic_signature_index; 1.12 - int _index; // index into fields() array 1.13 + int _index; // the field index 1.14 constantPoolHandle _cp; 1.15 1.16 + // update the access_flags for the field in the klass 1.17 + void update_klass_field_access_flag() { 1.18 + instanceKlass* ik = instanceKlass::cast(field_holder()); 1.19 + ik->field(index())->set_access_flags(_access_flags.as_short()); 1.20 + } 1.21 + 1.22 + FieldInfo* field() const { 1.23 + instanceKlass* ik = instanceKlass::cast(field_holder()); 1.24 + return ik->field(_index); 1.25 + } 1.26 + 1.27 public: 1.28 - Symbol* name() const { return _cp->symbol_at(_name_index); } 1.29 - Symbol* signature() const { return _cp->symbol_at(_signature_index); } 1.30 + Symbol* name() const { 1.31 + return field()->name(_cp); 1.32 + } 1.33 + Symbol* signature() const { 1.34 + return field()->signature(_cp); 1.35 + } 1.36 klassOop field_holder() const { return _cp->pool_holder(); } 1.37 constantPoolOop constants() const { return _cp(); } 1.38 AccessFlags access_flags() const { return _access_flags; } 1.39 oop loader() const; 1.40 // Offset (in words) of field from start of instanceOop / klassOop 1.41 - int offset() const { return _offset; } 1.42 - Symbol* generic_signature() const { return (_generic_signature_index > 0 ? _cp->symbol_at(_generic_signature_index) : (Symbol*)NULL); } 1.43 + int offset() const { return field()->offset(); } 1.44 + Symbol* generic_signature() const { return field()->generic_signature(_cp); } 1.45 int index() const { return _index; } 1.46 typeArrayOop annotations() const; 1.47 1.48 // Initial field value 1.49 - bool has_initial_value() const { return _initial_value_index != 0; } 1.50 + bool has_initial_value() const { return field()->initval_index() != 0; } 1.51 + int initial_value_index() const { return field()->initval_index(); } 1.52 constantTag initial_value_tag() const; // The tag will return true on one of is_int(), is_long(), is_single(), is_double() 1.53 jint int_initial_value() const; 1.54 jlong long_initial_value() const; 1.55 @@ -74,25 +85,31 @@ 1.56 BasicType field_type() const { return FieldType::basic_type(signature()); } 1.57 1.58 // Access flags 1.59 - bool is_public() const { return _access_flags.is_public(); } 1.60 - bool is_private() const { return _access_flags.is_private(); } 1.61 - bool is_protected() const { return _access_flags.is_protected(); } 1.62 + bool is_public() const { return access_flags().is_public(); } 1.63 + bool is_private() const { return access_flags().is_private(); } 1.64 + bool is_protected() const { return access_flags().is_protected(); } 1.65 bool is_package_private() const { return !is_public() && !is_private() && !is_protected(); } 1.66 1.67 - bool is_static() const { return _access_flags.is_static(); } 1.68 - bool is_final() const { return _access_flags.is_final(); } 1.69 - bool is_volatile() const { return _access_flags.is_volatile(); } 1.70 - bool is_transient() const { return _access_flags.is_transient(); } 1.71 + bool is_static() const { return access_flags().is_static(); } 1.72 + bool is_final() const { return access_flags().is_final(); } 1.73 + bool is_volatile() const { return access_flags().is_volatile(); } 1.74 + bool is_transient() const { return access_flags().is_transient(); } 1.75 1.76 - bool is_synthetic() const { return _access_flags.is_synthetic(); } 1.77 + bool is_synthetic() const { return access_flags().is_synthetic(); } 1.78 1.79 - bool is_field_access_watched() const { return _access_flags.is_field_access_watched(); } 1.80 + bool is_field_access_watched() const { return access_flags().is_field_access_watched(); } 1.81 bool is_field_modification_watched() const 1.82 - { return _access_flags.is_field_modification_watched(); } 1.83 - void set_is_field_access_watched(const bool value) 1.84 - { _access_flags.set_is_field_access_watched(value); } 1.85 - void set_is_field_modification_watched(const bool value) 1.86 - { _access_flags.set_is_field_modification_watched(value); } 1.87 + { return access_flags().is_field_modification_watched(); } 1.88 + 1.89 + void set_is_field_access_watched(const bool value) { 1.90 + _access_flags.set_is_field_access_watched(value); 1.91 + update_klass_field_access_flag(); 1.92 + } 1.93 + 1.94 + void set_is_field_modification_watched(const bool value) { 1.95 + _access_flags.set_is_field_modification_watched(value); 1.96 + update_klass_field_access_flag(); 1.97 + } 1.98 1.99 // Initialization 1.100 void initialize(klassOop k, int index);