178 |
178 |
179 // |
179 // |
180 // End of the oop block. |
180 // End of the oop block. |
181 // |
181 // |
182 |
182 |
183 int _nonstatic_field_size; // number of non-static fields in this klass (including inherited fields) |
183 // number of words used by non-static fields in this klass (including |
184 int _static_field_size; // number of static fields (oop and non-oop) in this klass |
184 // inherited fields but after header_size()). If fields are compressed into |
|
185 // header, this can be zero so it's not the same as number of static fields. |
|
186 int _nonstatic_field_size; |
|
187 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass |
185 int _static_oop_field_size;// number of static oop fields in this klass |
188 int _static_oop_field_size;// number of static oop fields in this klass |
186 int _nonstatic_oop_map_size;// number of nonstatic oop-map blocks allocated at end of this klass |
189 int _nonstatic_oop_map_size;// number of nonstatic oop-map blocks allocated at end of this klass |
187 bool _is_marked_dependent; // used for marking during flushing and deoptimization |
190 bool _is_marked_dependent; // used for marking during flushing and deoptimization |
188 bool _rewritten; // methods rewritten. |
191 bool _rewritten; // methods rewritten. |
|
192 bool _has_nonstatic_fields; // for sizing with UseCompressedOops |
189 u2 _minor_version; // minor version number of class file |
193 u2 _minor_version; // minor version number of class file |
190 u2 _major_version; // major version number of class file |
194 u2 _major_version; // major version number of class file |
191 ClassState _init_state; // state of class |
195 ClassState _init_state; // state of class |
192 Thread* _init_thread; // Pointer to current thread doing initialization (to handle recusive initialization) |
196 Thread* _init_thread; // Pointer to current thread doing initialization (to handle recusive initialization) |
193 int _vtable_len; // length of Java vtable (in words) |
197 int _vtable_len; // length of Java vtable (in words) |
219 |
223 |
220 friend class instanceKlassKlass; |
224 friend class instanceKlassKlass; |
221 friend class SystemDictionary; |
225 friend class SystemDictionary; |
222 |
226 |
223 public: |
227 public: |
|
228 bool has_nonstatic_fields() const { return _has_nonstatic_fields; } |
|
229 void set_has_nonstatic_fields(bool b) { _has_nonstatic_fields = b; } |
|
230 |
224 // field sizes |
231 // field sizes |
225 int nonstatic_field_size() const { return _nonstatic_field_size; } |
232 int nonstatic_field_size() const { return _nonstatic_field_size; } |
226 void set_nonstatic_field_size(int size) { _nonstatic_field_size = size; } |
233 void set_nonstatic_field_size(int size) { _nonstatic_field_size = size; } |
227 |
234 |
228 int static_field_size() const { return _static_field_size; } |
235 int static_field_size() const { return _static_field_size; } |
338 // find instance or static fields according to JVM spec 5.4.3.2, returns the klass in which the field is defined |
345 // find instance or static fields according to JVM spec 5.4.3.2, returns the klass in which the field is defined |
339 klassOop find_field(symbolOop name, symbolOop sig, bool is_static, fieldDescriptor* fd) const; |
346 klassOop find_field(symbolOop name, symbolOop sig, bool is_static, fieldDescriptor* fd) const; |
340 |
347 |
341 // find a non-static or static field given its offset within the class. |
348 // find a non-static or static field given its offset within the class. |
342 bool contains_field_offset(int offset) { |
349 bool contains_field_offset(int offset) { |
343 return ((offset/wordSize) >= instanceOopDesc::header_size() && |
350 return instanceOopDesc::contains_field_offset(offset, nonstatic_field_size()); |
344 (offset/wordSize)-instanceOopDesc::header_size() < nonstatic_field_size()); |
|
345 } |
351 } |
346 |
352 |
347 bool find_local_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const; |
353 bool find_local_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const; |
348 bool find_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const; |
354 bool find_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const; |
349 |
355 |
568 |
574 |
569 intptr_t* start_of_vtable() const { return ((intptr_t*)as_klassOop()) + vtable_start_offset(); } |
575 intptr_t* start_of_vtable() const { return ((intptr_t*)as_klassOop()) + vtable_start_offset(); } |
570 intptr_t* start_of_itable() const { return start_of_vtable() + align_object_offset(vtable_length()); } |
576 intptr_t* start_of_itable() const { return start_of_vtable() + align_object_offset(vtable_length()); } |
571 int itable_offset_in_words() const { return start_of_itable() - (intptr_t*)as_klassOop(); } |
577 int itable_offset_in_words() const { return start_of_itable() - (intptr_t*)as_klassOop(); } |
572 |
578 |
573 oop* start_of_static_fields() const { return (oop*)(start_of_itable() + align_object_offset(itable_length())); } |
579 // Static field offset is an offset into the Heap, should be converted by |
|
580 // based on UseCompressedOop for traversal |
|
581 HeapWord* start_of_static_fields() const { |
|
582 return (HeapWord*)(start_of_itable() + align_object_offset(itable_length())); |
|
583 } |
|
584 |
574 intptr_t* end_of_itable() const { return start_of_itable() + itable_length(); } |
585 intptr_t* end_of_itable() const { return start_of_itable() + itable_length(); } |
575 oop* end_of_static_fields() const { return start_of_static_fields() + static_field_size(); } |
586 |
576 int offset_of_static_fields() const { return (intptr_t)start_of_static_fields() - (intptr_t)as_klassOop(); } |
587 int offset_of_static_fields() const { |
577 |
588 return (intptr_t)start_of_static_fields() - (intptr_t)as_klassOop(); |
578 OopMapBlock* start_of_nonstatic_oop_maps() const { return (OopMapBlock*) (start_of_static_fields() + static_field_size()); } |
589 } |
|
590 |
|
591 OopMapBlock* start_of_nonstatic_oop_maps() const { |
|
592 return (OopMapBlock*) (start_of_static_fields() + static_field_size()); |
|
593 } |
579 |
594 |
580 // Allocation profiling support |
595 // Allocation profiling support |
581 juint alloc_size() const { return _alloc_count * size_helper(); } |
596 juint alloc_size() const { return _alloc_count * size_helper(); } |
582 void set_alloc_size(juint n) {} |
597 void set_alloc_size(juint n) {} |
583 |
598 |