comparison src/share/vm/oops/instanceKlass.hpp @ 4970:33df1aeaebbf

Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 27 Feb 2012 13:10:13 +0100
parents 04b9a2566eec b7b8b6d2f97d
children 957c266d8bc5
comparison
equal deleted inserted replaced
4703:2cfb7fb2dce7 4970:33df1aeaebbf
225 225
226 // Number of heapOopSize words used by non-static fields in this klass 226 // Number of heapOopSize words used by non-static fields in this klass
227 // (including inherited fields but after header_size()). 227 // (including inherited fields but after header_size()).
228 int _nonstatic_field_size; 228 int _nonstatic_field_size;
229 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
230 int _static_oop_field_count;// number of static oop fields in this klass 230 u2 _static_oop_field_count;// number of static oop fields in this klass
231 u2 _java_fields_count; // The number of declared Java fields
231 int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks 232 int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks
232 int _java_fields_count; // The number of declared Java fields 233
233 bool _is_marked_dependent; // used for marking during flushing and deoptimization 234 bool _is_marked_dependent; // used for marking during flushing and deoptimization
234 bool _rewritten; // methods rewritten. 235 bool _rewritten; // methods rewritten.
235 bool _has_nonstatic_fields; // for sizing with UseCompressedOops 236 bool _has_nonstatic_fields; // for sizing with UseCompressedOops
236 bool _should_verify_class; // allow caching of preverification 237 bool _should_verify_class; // allow caching of preverification
237 u2 _minor_version; // minor version number of class file 238 u2 _minor_version; // minor version number of class file
238 u2 _major_version; // major version number of class file 239 u2 _major_version; // major version number of class file
239 ClassState _init_state; // state of class
240 Thread* _init_thread; // Pointer to current thread doing initialization (to handle recusive initialization) 240 Thread* _init_thread; // Pointer to current thread doing initialization (to handle recusive initialization)
241 int _vtable_len; // length of Java vtable (in words) 241 int _vtable_len; // length of Java vtable (in words)
242 int _itable_len; // length of Java itable (in words) 242 int _itable_len; // length of Java itable (in words)
243 ReferenceType _reference_type; // reference type
244 OopMapCache* volatile _oop_map_cache; // OopMapCache for all methods in the klass (allocated lazily) 243 OopMapCache* volatile _oop_map_cache; // OopMapCache for all methods in the klass (allocated lazily)
245 JNIid* _jni_ids; // First JNI identifier for static fields in this class 244 JNIid* _jni_ids; // First JNI identifier for static fields in this class
246 jmethodID* _methods_jmethod_ids; // jmethodIDs corresponding to method_idnum, or NULL if none 245 jmethodID* _methods_jmethod_ids; // jmethodIDs corresponding to method_idnum, or NULL if none
247 int* _methods_cached_itable_indices; // itable_index cache for JNI invoke corresponding to methods idnum, or NULL 246 int* _methods_cached_itable_indices; // itable_index cache for JNI invoke corresponding to methods idnum, or NULL
248 nmethodBucket* _dependencies; // list of dependent nmethods 247 nmethodBucket* _dependencies; // list of dependent nmethods
258 unsigned char * _cached_class_file_bytes; // JVMTI: cached class file, before retransformable agent modified it in CFLH 257 unsigned char * _cached_class_file_bytes; // JVMTI: cached class file, before retransformable agent modified it in CFLH
259 jint _cached_class_file_len; // JVMTI: length of above 258 jint _cached_class_file_len; // JVMTI: length of above
260 JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map; // JVMTI: used during heap iteration 259 JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map; // JVMTI: used during heap iteration
261 volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change 260 volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change
262 261
262 // Class states are defined as ClassState (see above).
263 // Place the _init_state here to utilize the unused 2-byte after
264 // _idnum_allocated_count.
265 u1 _init_state; // state of class
266
267 u1 _reference_type; // reference type
268
263 // embedded Java vtable follows here 269 // embedded Java vtable follows here
264 // embedded Java itables follows here 270 // embedded Java itables follows here
265 // embedded static fields follows here 271 // embedded static fields follows here
266 // embedded nonstatic oop-map blocks follows here 272 // embedded nonstatic oop-map blocks follows here
267 273
277 void set_nonstatic_field_size(int size) { _nonstatic_field_size = size; } 283 void set_nonstatic_field_size(int size) { _nonstatic_field_size = size; }
278 284
279 int static_field_size() const { return _static_field_size; } 285 int static_field_size() const { return _static_field_size; }
280 void set_static_field_size(int size) { _static_field_size = size; } 286 void set_static_field_size(int size) { _static_field_size = size; }
281 287
282 int static_oop_field_count() const { return _static_oop_field_count; } 288 int static_oop_field_count() const { return (int)_static_oop_field_count; }
283 void set_static_oop_field_count(int size) { _static_oop_field_count = size; } 289 void set_static_oop_field_count(u2 size) { _static_oop_field_count = size; }
284 290
285 // Java vtable 291 // Java vtable
286 int vtable_length() const { return _vtable_len; } 292 int vtable_length() const { return _vtable_len; }
287 void set_vtable_length(int len) { _vtable_len = len; } 293 void set_vtable_length(int len) { _vtable_len = len; }
288 294
318 int field_access_flags(int index) const { return field(index)->access_flags(); } 324 int field_access_flags(int index) const { return field(index)->access_flags(); }
319 Symbol* field_name (int index) const { return field(index)->name(constants()); } 325 Symbol* field_name (int index) const { return field(index)->name(constants()); }
320 Symbol* field_signature (int index) const { return field(index)->signature(constants()); } 326 Symbol* field_signature (int index) const { return field(index)->signature(constants()); }
321 327
322 // Number of Java declared fields 328 // Number of Java declared fields
323 int java_fields_count() const { return _java_fields_count; } 329 int java_fields_count() const { return (int)_java_fields_count; }
324 330
325 // Number of fields including any injected fields 331 // Number of fields including any injected fields
326 int all_fields_count() const { return _fields->length() / sizeof(FieldInfo::field_slots); } 332 int all_fields_count() const { return _fields->length() / sizeof(FieldInfo::field_slots); }
327 333
328 typeArrayOop fields() const { return _fields; } 334 typeArrayOop fields() const { return _fields; }
329 335
330 void set_fields(typeArrayOop f, int java_fields_count) { 336 void set_fields(typeArrayOop f, u2 java_fields_count) {
331 oop_store_without_check((oop*) &_fields, (oop) f); 337 oop_store_without_check((oop*) &_fields, (oop) f);
332 _java_fields_count = java_fields_count; 338 _java_fields_count = java_fields_count;
333 } 339 }
334 340
335 // inner classes 341 // inner classes
375 bool is_initialized() const { return _init_state == fully_initialized; } 381 bool is_initialized() const { return _init_state == fully_initialized; }
376 bool is_not_initialized() const { return _init_state < being_initialized; } 382 bool is_not_initialized() const { return _init_state < being_initialized; }
377 bool is_being_initialized() const { return _init_state == being_initialized; } 383 bool is_being_initialized() const { return _init_state == being_initialized; }
378 bool is_in_error_state() const { return _init_state == initialization_error; } 384 bool is_in_error_state() const { return _init_state == initialization_error; }
379 bool is_reentrant_initialization(Thread *thread) { return thread == _init_thread; } 385 bool is_reentrant_initialization(Thread *thread) { return thread == _init_thread; }
380 int get_init_state() { return _init_state; } // Useful for debugging 386 ClassState init_state() { return (ClassState)_init_state; }
381 bool is_rewritten() const { return _rewritten; } 387 bool is_rewritten() const { return _rewritten; }
382 388
383 // defineClass specified verification 389 // defineClass specified verification
384 bool should_verify_class() const { return _should_verify_class; } 390 bool should_verify_class() const { return _should_verify_class; }
385 void set_should_verify_class(bool value) { _should_verify_class = value; } 391 void set_should_verify_class(bool value) { _should_verify_class = value; }
400 406
401 // set the class to initialized if no static initializer is present 407 // set the class to initialized if no static initializer is present
402 void eager_initialize(Thread *thread); 408 void eager_initialize(Thread *thread);
403 409
404 // reference type 410 // reference type
405 ReferenceType reference_type() const { return _reference_type; } 411 ReferenceType reference_type() const { return (ReferenceType)_reference_type; }
406 void set_reference_type(ReferenceType t) { _reference_type = t; } 412 void set_reference_type(ReferenceType t) {
407 413 assert(t == (u1)t, "overflow");
408 static int reference_type_offset_in_bytes() { return offset_of(instanceKlass, _reference_type); } 414 _reference_type = (u1)t;
415 }
416
417 static ByteSize reference_type_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(instanceKlass, _reference_type)); }
409 418
410 // find local field, returns true if found 419 // find local field, returns true if found
411 bool find_local_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const; 420 bool find_local_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
412 // find field in direct superinterfaces, returns the interface in which the field is defined 421 // find field in direct superinterfaces, returns the interface in which the field is defined
413 klassOop find_interface_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const; 422 klassOop find_interface_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
563 typeArrayOop get_method_default_annotations_of(int idnum) 572 typeArrayOop get_method_default_annotations_of(int idnum)
564 { return get_method_annotations_from(idnum, _methods_default_annotations); } 573 { return get_method_annotations_from(idnum, _methods_default_annotations); }
565 void set_method_annotations_of(int idnum, typeArrayOop anno) 574 void set_method_annotations_of(int idnum, typeArrayOop anno)
566 { set_methods_annotations_of(idnum, anno, &_methods_annotations); } 575 { set_methods_annotations_of(idnum, anno, &_methods_annotations); }
567 void set_method_parameter_annotations_of(int idnum, typeArrayOop anno) 576 void set_method_parameter_annotations_of(int idnum, typeArrayOop anno)
568 { set_methods_annotations_of(idnum, anno, &_methods_annotations); } 577 { set_methods_annotations_of(idnum, anno, &_methods_parameter_annotations); }
569 void set_method_default_annotations_of(int idnum, typeArrayOop anno) 578 void set_method_default_annotations_of(int idnum, typeArrayOop anno)
570 { set_methods_annotations_of(idnum, anno, &_methods_annotations); } 579 { set_methods_annotations_of(idnum, anno, &_methods_default_annotations); }
571 580
572 // allocation 581 // allocation
573 DEFINE_ALLOCATE_PERMANENT(instanceKlass); 582 DEFINE_ALLOCATE_PERMANENT(instanceKlass);
574 instanceOop allocate_instance(TRAPS); 583 instanceOop allocate_instance(TRAPS);
575 instanceOop allocate_permanent_instance(TRAPS); 584 instanceOop allocate_permanent_instance(TRAPS);
614 // Breakpoint support (see methods on methodOop for details) 623 // Breakpoint support (see methods on methodOop for details)
615 BreakpointInfo* breakpoints() const { return _breakpoints; }; 624 BreakpointInfo* breakpoints() const { return _breakpoints; };
616 void set_breakpoints(BreakpointInfo* bps) { _breakpoints = bps; }; 625 void set_breakpoints(BreakpointInfo* bps) { _breakpoints = bps; };
617 626
618 // support for stub routines 627 // support for stub routines
619 static int init_state_offset_in_bytes() { return offset_of(instanceKlass, _init_state); } 628 static ByteSize init_state_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(instanceKlass, _init_state)); }
620 static int init_thread_offset_in_bytes() { return offset_of(instanceKlass, _init_thread); } 629 static ByteSize init_thread_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(instanceKlass, _init_thread)); }
621 630
622 // subclass/subinterface checks 631 // subclass/subinterface checks
623 bool implements_interface(klassOop k) const; 632 bool implements_interface(klassOop k) const;
624 633
625 // Access to implementors of an interface. We only store the count 634 // Access to implementors of an interface. We only store the count
752 private: 761 private:
753 // initialization state 762 // initialization state
754 #ifdef ASSERT 763 #ifdef ASSERT
755 void set_init_state(ClassState state); 764 void set_init_state(ClassState state);
756 #else 765 #else
757 void set_init_state(ClassState state) { _init_state = state; } 766 void set_init_state(ClassState state) { _init_state = (u1)state; }
758 #endif 767 #endif
759 void set_rewritten() { _rewritten = true; } 768 void set_rewritten() { _rewritten = true; }
760 void set_init_thread(Thread *thread) { _init_thread = thread; } 769 void set_init_thread(Thread *thread) { _init_thread = thread; }
761 770
762 u2 idnum_allocated_count() const { return _idnum_allocated_count; } 771 u2 idnum_allocated_count() const { return _idnum_allocated_count; }