Mercurial > hg > truffle
comparison src/share/vm/oops/instanceKlass.hpp @ 6934:4735d2c84362
7200776: Implement default methods in interfaces
Summary: Add generic type analysis and default method selection algorithms
Reviewed-by: coleenp, acorn
author | kamg |
---|---|
date | Thu, 11 Oct 2012 12:25:42 -0400 |
parents | da91efe96a93 |
children | e522a00b91aa bd7a7ce2e264 |
comparison
equal
deleted
inserted
replaced
6921:a1b8cf9cf970 | 6934:4735d2c84362 |
---|---|
243 GrowableArray<PreviousVersionNode *>* _previous_versions; | 243 GrowableArray<PreviousVersionNode *>* _previous_versions; |
244 // JVMTI fields can be moved to their own structure - see 6315920 | 244 // JVMTI fields can be moved to their own structure - see 6315920 |
245 unsigned char * _cached_class_file_bytes; // JVMTI: cached class file, before retransformable agent modified it in CFLH | 245 unsigned char * _cached_class_file_bytes; // JVMTI: cached class file, before retransformable agent modified it in CFLH |
246 jint _cached_class_file_len; // JVMTI: length of above | 246 jint _cached_class_file_len; // JVMTI: length of above |
247 JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map; // JVMTI: used during heap iteration | 247 JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map; // JVMTI: used during heap iteration |
248 | |
249 // true if class, superclass, or implemented interfaces have default methods | |
250 bool _has_default_methods; | |
251 | |
248 volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change | 252 volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change |
249 // Method array. | 253 // Method array. |
250 Array<Method*>* _methods; | 254 Array<Method*>* _methods; |
251 // Interface (Klass*s) this class declares locally to implement. | 255 // Interface (Klass*s) this class declares locally to implement. |
252 Array<Klass*>* _local_interfaces; | 256 Array<Klass*>* _local_interfaces; |
490 | 494 |
491 // lookup a method in all the interfaces that this class implements | 495 // lookup a method in all the interfaces that this class implements |
492 // (returns NULL if not found) | 496 // (returns NULL if not found) |
493 Method* lookup_method_in_all_interfaces(Symbol* name, Symbol* signature) const; | 497 Method* lookup_method_in_all_interfaces(Symbol* name, Symbol* signature) const; |
494 | 498 |
499 // Find method indices by name. If a method with the specified name is | |
500 // found the index to the first method is returned, and 'end' is filled in | |
501 // with the index of first non-name-matching method. If no method is found | |
502 // -1 is returned. | |
503 int find_method_by_name(Symbol* name, int* end); | |
504 static int find_method_by_name(Array<Method*>* methods, Symbol* name, int* end); | |
505 | |
495 // constant pool | 506 // constant pool |
496 ConstantPool* constants() const { return _constants; } | 507 ConstantPool* constants() const { return _constants; } |
497 void set_constants(ConstantPool* c) { _constants = c; } | 508 void set_constants(ConstantPool* c) { _constants = c; } |
498 | 509 |
499 // protection domain | 510 // protection domain |
590 } | 601 } |
591 JvmtiCachedClassFieldMap* jvmti_cached_class_field_map() const { | 602 JvmtiCachedClassFieldMap* jvmti_cached_class_field_map() const { |
592 return _jvmti_cached_class_field_map; | 603 return _jvmti_cached_class_field_map; |
593 } | 604 } |
594 | 605 |
606 bool has_default_methods() const { return _has_default_methods; } | |
607 void set_has_default_methods(bool b) { _has_default_methods = b; } | |
608 | |
595 // for adding methods, ConstMethod::UNSET_IDNUM means no more ids available | 609 // for adding methods, ConstMethod::UNSET_IDNUM means no more ids available |
596 inline u2 next_method_idnum(); | 610 inline u2 next_method_idnum(); |
597 void set_initial_method_idnum(u2 value) { _idnum_allocated_count = value; } | 611 void set_initial_method_idnum(u2 value) { _idnum_allocated_count = value; } |
598 | 612 |
599 // generics support | 613 // generics support |
726 // virtual operations from Klass | 740 // virtual operations from Klass |
727 bool is_leaf_class() const { return _subklass == NULL; } | 741 bool is_leaf_class() const { return _subklass == NULL; } |
728 GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots); | 742 GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots); |
729 bool compute_is_subtype_of(Klass* k); | 743 bool compute_is_subtype_of(Klass* k); |
730 bool can_be_primary_super_slow() const; | 744 bool can_be_primary_super_slow() const; |
731 Klass* java_super() const { return super(); } | |
732 int oop_size(oop obj) const { return size_helper(); } | 745 int oop_size(oop obj) const { return size_helper(); } |
733 bool oop_is_instance_slow() const { return true; } | 746 bool oop_is_instance_slow() const { return true; } |
734 | 747 |
735 // Iterators | 748 // Iterators |
736 void do_local_static_fields(FieldClosure* cl); | 749 void do_local_static_fields(FieldClosure* cl); |
746 // Casting from Klass* | 759 // Casting from Klass* |
747 static InstanceKlass* cast(Klass* k) { | 760 static InstanceKlass* cast(Klass* k) { |
748 assert(k->is_klass(), "must be"); | 761 assert(k->is_klass(), "must be"); |
749 assert(k->oop_is_instance(), "cast to InstanceKlass"); | 762 assert(k->oop_is_instance(), "cast to InstanceKlass"); |
750 return (InstanceKlass*) k; | 763 return (InstanceKlass*) k; |
764 } | |
765 | |
766 InstanceKlass* java_super() const { | |
767 return (super() == NULL) ? NULL : cast(super()); | |
751 } | 768 } |
752 | 769 |
753 // Sizing (in words) | 770 // Sizing (in words) |
754 static int header_size() { return align_object_offset(sizeof(InstanceKlass)/HeapWordSize); } | 771 static int header_size() { return align_object_offset(sizeof(InstanceKlass)/HeapWordSize); } |
755 static int size(int vtable_length, int itable_length, | 772 static int size(int vtable_length, int itable_length, |