95 |
95 |
96 oop fieldDescriptor::string_initial_value(TRAPS) const { |
96 oop fieldDescriptor::string_initial_value(TRAPS) const { |
97 return constants()->uncached_string_at(initial_value_index(), CHECK_0); |
97 return constants()->uncached_string_at(initial_value_index(), CHECK_0); |
98 } |
98 } |
99 |
99 |
100 void fieldDescriptor::initialize(InstanceKlass* ik, int index) { |
100 void fieldDescriptor::reinitialize(InstanceKlass* ik, int index) { |
101 _cp = ik->constants(); |
101 if (_cp.is_null() || field_holder() != ik) { |
|
102 _cp = constantPoolHandle(Thread::current(), ik->constants()); |
|
103 // _cp should now reference ik's constant pool; i.e., ik is now field_holder. |
|
104 assert(field_holder() == ik, "must be already initialized to this class"); |
|
105 } |
102 FieldInfo* f = ik->field(index); |
106 FieldInfo* f = ik->field(index); |
103 assert(!f->is_internal(), "regular Java fields only"); |
107 assert(!f->is_internal(), "regular Java fields only"); |
104 |
108 |
105 _access_flags = accessFlags_from(f->access_flags()); |
109 _access_flags = accessFlags_from(f->access_flags()); |
106 guarantee(f->name_index() != 0 && f->signature_index() != 0, "bad constant pool index for fieldDescriptor"); |
110 guarantee(f->name_index() != 0 && f->signature_index() != 0, "bad constant pool index for fieldDescriptor"); |
107 _index = index; |
111 _index = index; |
|
112 verify(); |
108 } |
113 } |
109 |
114 |
110 #ifndef PRODUCT |
115 #ifndef PRODUCT |
|
116 |
|
117 void fieldDescriptor::verify() const { |
|
118 if (_cp.is_null()) { |
|
119 assert(_index == badInt, "constructor must be called"); // see constructor |
|
120 } else { |
|
121 assert(_index >= 0, "good index"); |
|
122 assert(_index < field_holder()->java_fields_count(), "oob"); |
|
123 } |
|
124 } |
111 |
125 |
112 void fieldDescriptor::print_on(outputStream* st) const { |
126 void fieldDescriptor::print_on(outputStream* st) const { |
113 access_flags().print_on(st); |
127 access_flags().print_on(st); |
114 name()->print_value_on(st); |
128 name()->print_value_on(st); |
115 st->print(" "); |
129 st->print(" "); |