diff 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
line wrap: on
line diff
--- a/src/share/vm/oops/instanceKlass.hpp	Thu Nov 01 13:05:47 2012 +0100
+++ b/src/share/vm/oops/instanceKlass.hpp	Thu Oct 11 12:25:42 2012 -0400
@@ -245,6 +245,10 @@
   unsigned char * _cached_class_file_bytes;       // JVMTI: cached class file, before retransformable agent modified it in CFLH
   jint            _cached_class_file_len;         // JVMTI: length of above
   JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map;  // JVMTI: used during heap iteration
+
+  // true if class, superclass, or implemented interfaces have default methods
+  bool            _has_default_methods;
+
   volatile u2     _idnum_allocated_count;         // JNI/JVMTI: increments with the addition of methods, old ids don't change
   // Method array.
   Array<Method*>* _methods;
@@ -492,6 +496,13 @@
   // (returns NULL if not found)
   Method* lookup_method_in_all_interfaces(Symbol* name, Symbol* signature) const;
 
+  // Find method indices by name.  If a method with the specified name is
+  // found the index to the first method is returned, and 'end' is filled in
+  // with the index of first non-name-matching method.  If no method is found
+  // -1 is returned.
+  int find_method_by_name(Symbol* name, int* end);
+  static int find_method_by_name(Array<Method*>* methods, Symbol* name, int* end);
+
   // constant pool
   ConstantPool* constants() const        { return _constants; }
   void set_constants(ConstantPool* c)    { _constants = c; }
@@ -592,6 +603,9 @@
     return _jvmti_cached_class_field_map;
   }
 
+  bool has_default_methods() const { return _has_default_methods; }
+  void set_has_default_methods(bool b) { _has_default_methods = b; }
+
   // for adding methods, ConstMethod::UNSET_IDNUM means no more ids available
   inline u2 next_method_idnum();
   void set_initial_method_idnum(u2 value)             { _idnum_allocated_count = value; }
@@ -728,7 +742,6 @@
   GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots);
   bool compute_is_subtype_of(Klass* k);
   bool can_be_primary_super_slow() const;
-  Klass* java_super() const              { return super(); }
   int oop_size(oop obj)  const             { return size_helper(); }
   bool oop_is_instance_slow() const        { return true; }
 
@@ -750,6 +763,10 @@
     return (InstanceKlass*) k;
   }
 
+  InstanceKlass* java_super() const {
+    return (super() == NULL) ? NULL : cast(super());
+  }
+
   // Sizing (in words)
   static int header_size()            { return align_object_offset(sizeof(InstanceKlass)/HeapWordSize); }
   static int size(int vtable_length, int itable_length,