changeset 5422:694438c84bfa

Merge
author henryjen
date Mon, 30 Sep 2013 12:17:17 -0700
parents c81dd5393a5e (current diff) 2d2d0499ef24 (diff)
children 4b68c8075fec
files .hgtags .jcheck/conf make/jprt.properties src/share/vm/classfile/classFileParser.cpp src/share/vm/classfile/defaultMethods.cpp src/share/vm/interpreter/linkResolver.cpp src/share/vm/oops/constantPool.cpp src/share/vm/oops/instanceKlass.cpp src/share/vm/oops/instanceKlass.hpp src/share/vm/oops/klassVtable.cpp src/share/vm/oops/klassVtable.hpp src/share/vm/oops/method.cpp src/share/vm/oops/method.hpp src/share/vm/prims/methodHandles.cpp src/share/vm/runtime/globals.hpp src/share/vm/runtime/reflection.cpp src/share/vm/utilities/ostream.cpp src/share/vm/utilities/ostream.hpp
diffstat 10 files changed, 134 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Sep 25 12:23:10 2013 -0700
+++ b/.hgtags	Mon Sep 30 12:17:17 2013 -0700
@@ -273,6 +273,7 @@
 54240c1b8e87758f28da2c6a569a926fd9e0910a jdk8-b53
 9e3ae661284dc04185b029d85440fe7811f1ed07 hs24-b21
 e8fb566b94667f88462164defa654203f0ab6820 jdk8-b54
+203d2c0ee7c4fe648464fe2c506bd91003b7a5b7 lambda-b56
 09ea7e0752b306b8ae74713aeb4eb6263e1c6836 hs24-b22
 af0c8a0808516317333dcf9af15567cdd52761ce jdk8-b55
 6124ff4218296c91e4a72f1a76c064892d39d61b jdk8-b56
--- a/.jcheck/conf	Wed Sep 25 12:23:10 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-project=jdk8
--- a/src/share/vm/classfile/classFileParser.cpp	Wed Sep 25 12:23:10 2013 -0700
+++ b/src/share/vm/classfile/classFileParser.cpp	Mon Sep 30 12:17:17 2013 -0700
@@ -2396,6 +2396,7 @@
       runtime_visible_type_annotations_length +
            runtime_invisible_type_annotations_length,
       annotation_default_length,
+      0,
       0);
 
   Method* m = Method::allocate(
--- a/src/share/vm/classfile/defaultMethods.hpp	Wed Sep 25 12:23:10 2013 -0700
+++ b/src/share/vm/classfile/defaultMethods.hpp	Mon Sep 30 12:17:17 2013 -0700
@@ -53,6 +53,7 @@
   static Method* find_super_default(
       Klass* this_klass, Klass* super_iface,
       Symbol* method_name, Symbol* method_sig, TRAPS);
+
 };
 
 #endif // SHARE_VM_CLASSFILE_DEFAULTMETHODS_HPP
--- a/src/share/vm/interpreter/linkResolver.cpp	Wed Sep 25 12:23:10 2013 -0700
+++ b/src/share/vm/interpreter/linkResolver.cpp	Mon Sep 30 12:17:17 2013 -0700
@@ -604,6 +604,20 @@
       }
     }
   }
+
+  if (TraceItables && Verbose) {
+    ResourceMark rm(THREAD);
+    tty->print("invokeinterface resolved method: caller-class:%s, compile-time-class:%s, method:%s, method_holder:%s, access_flags: ",
+                   (current_klass.is_null() ? "<NULL>" : current_klass->internal_name()),
+                   (resolved_klass.is_null() ? "<NULL>" : resolved_klass->internal_name()),
+                   Method::name_and_sig_as_C_string(resolved_klass(),
+                                                    resolved_method->name(),
+                                                    resolved_method->signature()),
+                   resolved_method->method_holder()->internal_name()
+                  );
+    resolved_method->access_flags().print_on(tty);
+    tty->cr();
+  }
 }
 
 //------------------------------------------------------------------------------------------------------------------------
@@ -811,6 +825,20 @@
         Method* method = DefaultMethods::find_super_default(current_klass(),
             resolved_klass(), method_name, method_signature, CHECK);
         resolved_method = methodHandle(THREAD, method);
+
+        if (TraceItables && Verbose) {
+          ResourceMark rm(THREAD);
+          tty->print("invokespecial resolved method: caller-class:%s, compile-time-class:%s, method:%s, method_holder:%s, access_flags: ",
+                      (current_klass.is_null() ? "<NULL>" : current_klass->internal_name()),
+                      (resolved_klass.is_null() ? "<NULL>" : resolved_klass->internal_name()),
+                      Method::name_and_sig_as_C_string(resolved_klass(),
+                                                       resolved_method->name(),
+                                                       resolved_method->signature()),
+                      resolved_method->method_holder()->internal_name()
+                     );
+          resolved_method->access_flags().print_on(tty);
+          tty->cr();
+        }
         return;
       }
     }
@@ -907,6 +935,19 @@
 
   // setup result
   result.set_static(resolved_klass, sel_method, CHECK);
+
+    if (TraceItables && Verbose) {
+      ResourceMark rm(THREAD);
+      tty->print("invokespecial selected method: resolved-class:%s, method:%s, method_holder:%s, access_flags: ",
+                   (resolved_klass.is_null() ? "<NULL>" : resolved_klass->internal_name()),
+                   Method::name_and_sig_as_C_string(resolved_klass(),
+                                                    sel_method->name(),
+                                                    sel_method->signature()),
+                   sel_method->method_holder()->internal_name()
+                  );
+      sel_method->access_flags().print_on(tty);
+      tty->cr();
+    }
 }
 
 void LinkResolver::resolve_virtual_call(CallInfo& result, Handle recv, KlassHandle receiver_klass, KlassHandle resolved_klass,
@@ -936,6 +977,20 @@
                                                                                                              resolved_method->signature()));
     THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
   }
+
+  if (PrintVtables && Verbose) {
+    ResourceMark rm(THREAD);
+    tty->print("invokevirtual resolved method: caller-class:%s, compile-time-class:%s, method:%s, method_holder:%s, access_flags: ",
+                   (current_klass.is_null() ? "<NULL>" : current_klass->internal_name()),
+                   (resolved_klass.is_null() ? "<NULL>" : resolved_klass->internal_name()),
+                   Method::name_and_sig_as_C_string(resolved_klass(),
+                                                    resolved_method->name(),
+                                                    resolved_method->signature()),
+                   resolved_method->method_holder()->internal_name()
+                  );
+    resolved_method->access_flags().print_on(tty);
+    tty->cr();
+  }
 }
 
 // throws runtime exceptions
@@ -1014,6 +1069,21 @@
 
   // setup result
   result.set_virtual(resolved_klass, recv_klass, resolved_method, selected_method, vtable_index, CHECK);
+
+  if (PrintVtables && Verbose) {
+    ResourceMark rm(THREAD);
+    tty->print("invokevirtual selected  method: receiver-class:%s, resolved-class:%s, method:%s, method_holder:%s, vtable_index:%d, access_flags: ",
+                   (recv_klass.is_null() ? "<NULL>" : recv_klass->internal_name()),
+                   (resolved_klass.is_null() ? "<NULL>" : resolved_klass->internal_name()),
+                   Method::name_and_sig_as_C_string(resolved_klass(),
+                                                    resolved_method->name(),
+                                                    resolved_method->signature()),
+                   selected_method->method_holder()->internal_name(),
+                   vtable_index
+                  );
+    selected_method->access_flags().print_on(tty);
+    tty->cr();
+  }
 }
 
 void LinkResolver::resolve_interface_call(CallInfo& result, Handle recv, KlassHandle recv_klass, KlassHandle resolved_klass,
@@ -1110,6 +1180,20 @@
   }
   int itable_index = resolved_method()->itable_index();
   result.set_interface(resolved_klass, recv_klass, resolved_method, sel_method, itable_index, CHECK);
+
+  if (TraceItables && Verbose) {
+    ResourceMark rm(THREAD);
+    tty->print("invokeinterface selected method: receiver-class:%s, resolved-class:%s, method:%s, method_holder:%s, access_flags: ",
+                   (recv_klass.is_null() ? "<NULL>" : recv_klass->internal_name()),
+                   (resolved_klass.is_null() ? "<NULL>" : resolved_klass->internal_name()),
+                   Method::name_and_sig_as_C_string(resolved_klass(),
+                                                    resolved_method->name(),
+                                                    resolved_method->signature()),
+                   sel_method->method_holder()->internal_name()
+                  );
+    sel_method->access_flags().print_on(tty);
+    tty->cr();
+  }
 }
 
 
--- a/src/share/vm/oops/constMethod.cpp	Wed Sep 25 12:23:10 2013 -0700
+++ b/src/share/vm/oops/constMethod.cpp	Mon Sep 30 12:17:17 2013 -0700
@@ -137,6 +137,9 @@
   if (sizes->default_annotations_length() > 0) {
     extra_bytes += sizeof(AnnotationArray*);
   }
+  if (sizes->target_method_length() > 0) {
+    extra_bytes += sizeof(Method*);
+  }
 
   int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord;
   assert(extra_words == extra_bytes/BytesPerWord, "should already be aligned");
@@ -163,6 +166,7 @@
   if (has_parameter_annotations()) offset++;
   if (has_type_annotations()) offset++;
   if (has_default_annotations()) offset++;
+  if (has_target_method()) offset++;
   return (u2*)((AnnotationArray**)constMethod_end() - offset) - 1;
 }
 
@@ -256,6 +260,8 @@
     _flags |= _has_type_annotations;
   if (sizes->default_annotations_length() > 0)
     _flags |= _has_default_annotations;
+  if (sizes->target_method_length() > 0)
+    _flags |= _has_target_method;
 
   // This code is extremely brittle and should possibly be revised.
   // The *_length_addr functions walk backwards through the
@@ -363,6 +369,16 @@
   return (AnnotationArray**)constMethod_end() - offset;
 }
 
+Method** ConstMethod::target_method_addr() const {
+  assert(has_target_method(), "should only be called if overpass target method is present");
+  int offset = 1;
+  if (has_method_annotations()) offset++;
+  if (has_parameter_annotations()) offset++;
+  if (has_type_annotations()) offset++;
+  if (has_default_annotations()) offset++;
+  return (Method**)constMethod_end() - offset;
+}
+
 // copy annotations from 'cm' to 'this'
 void ConstMethod::copy_annotations_from(ConstMethod* cm) {
   if (cm->has_method_annotations()) {
--- a/src/share/vm/oops/constMethod.hpp	Wed Sep 25 12:23:10 2013 -0700
+++ b/src/share/vm/oops/constMethod.hpp	Mon Sep 30 12:17:17 2013 -0700
@@ -86,6 +86,9 @@
 // | generic signature index (u2)                         |
 // |  (indexed from start of constMethodOop)              |
 // |------------------------------------------------------|
+// | word-aligned Method* target_method if overpass       |
+// |  (access flags bit tells if present)                 |
+// |------------------------------------------------------|
 // | annotations arrays - method, parameter, type, default|
 // | pointer to Array<u1> if annotation is present        |
 // |------------------------------------------------------|
@@ -141,7 +144,8 @@
   do_element(method_annotations_length)         \
   do_element(parameter_annotations_length)      \
   do_element(type_annotations_length)           \
-  do_element(default_annotations_length)
+  do_element(default_annotations_length)        \
+  do_element(target_method_length)
 
 #define INLINE_TABLE_DECLARE(sym)    int _##sym;
 #define INLINE_TABLE_PARAM(sym)      int sym,
@@ -193,7 +197,8 @@
     _has_method_annotations = 0x0080,
     _has_parameter_annotations = 0x0100,
     _has_type_annotations = 0x0200,
-    _has_default_annotations = 0x0400
+    _has_default_annotations = 0x0400,
+    _has_target_method = 0x0800
   };
 
   // Bit vector of signature
@@ -395,6 +400,8 @@
   bool has_default_annotations() const
     { return (_flags & _has_default_annotations) != 0; }
 
+  bool has_target_method() const
+    { return (_flags & _has_target_method) != 0; }
 
   AnnotationArray** method_annotations_addr() const;
   AnnotationArray* method_annotations() const  {
@@ -428,6 +435,15 @@
     *(default_annotations_addr()) = anno;
   }
 
+  Method** target_method_addr() const;
+  Method* target_method() const {
+    return has_target_method() ? *(target_method_addr()) : NULL;
+  }
+  void set_target_method(Method* target) {
+    assert(has_target_method(), "only set target method for OVERPASS");
+    *(target_method_addr()) = target;
+  }
+
   int method_annotations_length() const {
     return has_method_annotations() ? method_annotations()->length() : 0;
   }
@@ -440,6 +456,11 @@
   int default_annotations_length() const {
     return has_default_annotations() ? default_annotations()->length() : 0;
   }
+  // This is just used to determine existence, not to count length
+  // returning nonzero is sufficient
+  int target_method_length() const {
+    return has_target_method() ? sizeof(Method*) : 0;
+  }
 
   // Copy annotations from other ConstMethod
   void copy_annotations_from(ConstMethod* cm);
--- a/src/share/vm/oops/klassVtable.cpp	Wed Sep 25 12:23:10 2013 -0700
+++ b/src/share/vm/oops/klassVtable.cpp	Mon Sep 30 12:17:17 2013 -0700
@@ -535,7 +535,7 @@
 // in super unless it is private and therefore inaccessible to this class.
 // the caller must make sure that the method belongs to an interface implemented by the class
 bool klassVtable::is_miranda(Method* m, Array<Method*>* class_methods, Klass* super) {
-  if (m->is_static()) {
+  if (m->is_static() || m->is_private()) {
     return false;
   }
   Symbol* name = m->name();
--- a/src/share/vm/oops/method.cpp	Wed Sep 25 12:23:10 2013 -0700
+++ b/src/share/vm/oops/method.cpp	Mon Sep 30 12:17:17 2013 -0700
@@ -1147,6 +1147,7 @@
   int parameter_annotations_len = cm->parameter_annotations_length();
   int type_annotations_len = cm->type_annotations_length();
   int default_annotations_len = cm->default_annotations_length();
+  int target_method_len = cm->target_method_length();
 
   InlineTableSizes sizes(
       localvariable_len,
@@ -1159,6 +1160,7 @@
       parameter_annotations_len,
       type_annotations_len,
       default_annotations_len,
+      target_method_len,
       0);
 
   ClassLoaderData* loader_data = m->method_holder()->class_loader_data();
--- a/src/share/vm/oops/method.hpp	Wed Sep 25 12:23:10 2013 -0700
+++ b/src/share/vm/oops/method.hpp	Mon Sep 30 12:17:17 2013 -0700
@@ -198,7 +198,11 @@
   AnnotationArray* type_annotations() const      {
     return constMethod()->type_annotations();
   }
-
+  // overpass support
+  void set_target_method(Method* target)         {
+     constMethod()->set_target_method(target); 
+  }
+  Method* target_method() const                  { return constMethod()->target_method(); }
 #ifdef CC_INTERP
   void set_result_index(BasicType type);
   int  result_index()                            { return _result_index; }