comparison src/share/vm/oops/instanceKlass.hpp @ 4137:04b9a2566eec

Merge with hsx23/hotspot.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sat, 17 Dec 2011 21:40:27 +0100
parents f198b24093f3 f6f3bb0ee072
children 33df1aeaebbf
comparison
equal deleted inserted replaced
3737:9dc19b7d89a3 4137:04b9a2566eec
25 #ifndef SHARE_VM_OOPS_INSTANCEKLASS_HPP 25 #ifndef SHARE_VM_OOPS_INSTANCEKLASS_HPP
26 #define SHARE_VM_OOPS_INSTANCEKLASS_HPP 26 #define SHARE_VM_OOPS_INSTANCEKLASS_HPP
27 27
28 #include "oops/constMethodOop.hpp" 28 #include "oops/constMethodOop.hpp"
29 #include "oops/constantPoolOop.hpp" 29 #include "oops/constantPoolOop.hpp"
30 #include "oops/fieldInfo.hpp"
30 #include "oops/instanceOop.hpp" 31 #include "oops/instanceOop.hpp"
31 #include "oops/klassOop.hpp" 32 #include "oops/klassOop.hpp"
32 #include "oops/klassVtable.hpp" 33 #include "oops/klassVtable.hpp"
33 #include "oops/objArrayOop.hpp" 34 #include "oops/objArrayOop.hpp"
34 #include "runtime/handles.hpp" 35 #include "runtime/handles.hpp"
226 // (including inherited fields but after header_size()). 227 // (including inherited fields but after header_size()).
227 int _nonstatic_field_size; 228 int _nonstatic_field_size;
228 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass 229 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass
229 int _static_oop_field_count;// number of static oop fields in this klass 230 int _static_oop_field_count;// number of static oop fields in this klass
230 int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks 231 int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks
232 int _java_fields_count; // The number of declared Java fields
231 bool _is_marked_dependent; // used for marking during flushing and deoptimization 233 bool _is_marked_dependent; // used for marking during flushing and deoptimization
232 bool _rewritten; // methods rewritten. 234 bool _rewritten; // methods rewritten.
233 bool _has_nonstatic_fields; // for sizing with UseCompressedOops 235 bool _has_nonstatic_fields; // for sizing with UseCompressedOops
234 bool _should_verify_class; // allow caching of preverification 236 bool _should_verify_class; // allow caching of preverification
235 u2 _minor_version; // minor version number of class file 237 u2 _minor_version; // minor version number of class file
305 objArrayOop local_interfaces() const { return _local_interfaces; } 307 objArrayOop local_interfaces() const { return _local_interfaces; }
306 void set_local_interfaces(objArrayOop a) { oop_store_without_check((oop*) &_local_interfaces, (oop) a); } 308 void set_local_interfaces(objArrayOop a) { oop_store_without_check((oop*) &_local_interfaces, (oop) a); }
307 objArrayOop transitive_interfaces() const { return _transitive_interfaces; } 309 objArrayOop transitive_interfaces() const { return _transitive_interfaces; }
308 void set_transitive_interfaces(objArrayOop a) { oop_store_without_check((oop*) &_transitive_interfaces, (oop) a); } 310 void set_transitive_interfaces(objArrayOop a) { oop_store_without_check((oop*) &_transitive_interfaces, (oop) a); }
309 311
310 // fields 312 private:
311 // Field info extracted from the class file and stored 313 friend class fieldDescriptor;
312 // as an array of 7 shorts 314 FieldInfo* field(int index) const { return FieldInfo::from_field_array(_fields, index); }
313 enum FieldOffset { 315
314 access_flags_offset = 0, 316 public:
315 name_index_offset = 1, 317 int field_offset (int index) const { return field(index)->offset(); }
316 signature_index_offset = 2, 318 int field_access_flags(int index) const { return field(index)->access_flags(); }
317 initval_index_offset = 3, 319 Symbol* field_name (int index) const { return field(index)->name(constants()); }
318 low_offset = 4, 320 Symbol* field_signature (int index) const { return field(index)->signature(constants()); }
319 high_offset = 5, 321
320 generic_signature_offset = 6, 322 // Number of Java declared fields
321 next_offset = 7 323 int java_fields_count() const { return _java_fields_count; }
322 }; 324
325 // Number of fields including any injected fields
326 int all_fields_count() const { return _fields->length() / sizeof(FieldInfo::field_slots); }
323 327
324 typeArrayOop fields() const { return _fields; } 328 typeArrayOop fields() const { return _fields; }
325 int offset_from_fields( int index ) const { 329
326 return build_int_from_shorts( fields()->ushort_at(index + low_offset), 330 void set_fields(typeArrayOop f, int java_fields_count) {
327 fields()->ushort_at(index + high_offset) ); 331 oop_store_without_check((oop*) &_fields, (oop) f);
328 } 332 _java_fields_count = java_fields_count;
329 333 }
330 void set_fields(typeArrayOop f) { oop_store_without_check((oop*) &_fields, (oop) f); }
331 334
332 // inner classes 335 // inner classes
333 typeArrayOop inner_classes() const { return _inner_classes; } 336 typeArrayOop inner_classes() const { return _inner_classes; }
334 void set_inner_classes(typeArrayOop f) { oop_store_without_check((oop*) &_inner_classes, (oop) f); } 337 void set_inner_classes(typeArrayOop f) { oop_store_without_check((oop*) &_inner_classes, (oop) f); }
335 338
839 bool is_dependent_nmethod(nmethod* nm); 842 bool is_dependent_nmethod(nmethod* nm);
840 843
841 // Verification 844 // Verification
842 const char* internal_name() const; 845 const char* internal_name() const;
843 void oop_verify_on(oop obj, outputStream* st); 846 void oop_verify_on(oop obj, outputStream* st);
844
845 #ifndef PRODUCT
846 static void verify_class_klass_nonstatic_oop_maps(klassOop k) PRODUCT_RETURN;
847 #endif
848 }; 847 };
849 848
850 inline methodOop instanceKlass::method_at_vtable(int index) { 849 inline methodOop instanceKlass::method_at_vtable(int index) {
851 #ifndef PRODUCT 850 #ifndef PRODUCT
852 assert(index >= 0, "valid vtable index"); 851 assert(index >= 0, "valid vtable index");
1010 // Return the interesting information for the next previous version 1009 // Return the interesting information for the next previous version
1011 // of the klass. Returns NULL if there are no more previous versions. 1010 // of the klass. Returns NULL if there are no more previous versions.
1012 PreviousVersionInfo* next_previous_version(); 1011 PreviousVersionInfo* next_previous_version();
1013 }; 1012 };
1014 1013
1014
1015 //
1016 // nmethodBucket is used to record dependent nmethods for
1017 // deoptimization. nmethod dependencies are actually <klass, method>
1018 // pairs but we really only care about the klass part for purposes of
1019 // finding nmethods which might need to be deoptimized. Instead of
1020 // recording the method, a count of how many times a particular nmethod
1021 // was recorded is kept. This ensures that any recording errors are
1022 // noticed since an nmethod should be removed as many times are it's
1023 // added.
1024 //
1025 class nmethodBucket: public CHeapObj {
1026 friend class VMStructs;
1027 private:
1028 nmethod* _nmethod;
1029 int _count;
1030 nmethodBucket* _next;
1031
1032 public:
1033 nmethodBucket(nmethod* nmethod, nmethodBucket* next) {
1034 _nmethod = nmethod;
1035 _next = next;
1036 _count = 1;
1037 }
1038 int count() { return _count; }
1039 int increment() { _count += 1; return _count; }
1040 int decrement() { _count -= 1; assert(_count >= 0, "don't underflow"); return _count; }
1041 nmethodBucket* next() { return _next; }
1042 void set_next(nmethodBucket* b) { _next = b; }
1043 nmethod* get_nmethod() { return _nmethod; }
1044 };
1045
1015 #endif // SHARE_VM_OOPS_INSTANCEKLASS_HPP 1046 #endif // SHARE_VM_OOPS_INSTANCEKLASS_HPP