changeset 5202:74fb15aa1c09

Merge
author asaha
date Wed, 02 Jul 2014 21:04:56 -0700
parents c1b245e7e701 1d8226b3e989
children a79149401826
files .hgtags make/hotspot_version src/os/bsd/vm/os_bsd.cpp src/os/linux/vm/os_linux.cpp
diffstat 15 files changed, 199 insertions(+), 91 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Jun 26 14:23:30 2014 -0700
+++ b/.hgtags	Wed Jul 02 21:04:56 2014 -0700
@@ -616,6 +616,7 @@
 408028d410e316a99495c42df0031018890c22fe jdk7u55-b02
 50fb91504dd8cdf410eb956075442daf3aacf1db jdk7u55-b03
 3be3b8a032a5508646c1c5620cee18d3e69fc708 jdk7u55-b04
+b86119fa2748bd91ae4984ff2264da92b6626f8c jdk7u65-b00
 b86119fa2748bd91ae4984ff2264da92b6626f8c jdk7u55-b05
 260d919d52e500a0b20f911fade2a7710474067a jdk7u55-b06
 8cf6e0a3a0651c4132ae034c2b68ddf4eb5c4d88 jdk7u55-b07
@@ -628,7 +629,10 @@
 b021fd817a0177b31d1e3d65127a27458e85801e jdk7u55-b13
 d27b468d5f3be3329ff1ff342f3347e6b2e0303b jdk7u55-b30
 dff9147a781672f20bb0577a94233264ea4a95d1 jdk7u55-b14
+4e73c6403b44f86d579b1ba03ea636c52c4b559b jdk7u55-b15
 8175599864880938d68d0a515fa561043d7d5fd0 jdk7u55-b31
+ba9270b8fb1f4852ff1d9dab15571eb9e0714495 jdk7u55-b32
+0901a8cf66a0494b55bf104c9666d4e3c6ff93f0 jdk7u55-b33
 ae4adc1492d1c90a70bd2d139a939fc0c8329be9 jdk7u60-b00
 af1fc2868a2b919727bfbb0858449bd991bbee4a jdk7u40-b60
 cc83359f5e5eb46dd9176b0a272390b1a0a51fdc hs24.60-b01
@@ -655,9 +659,28 @@
 b226be2040f971855626f5b88cb41a7d5299fea0 jdk7u60-b14
 2871f345b7e5585e20dc7aa91035967fe774cfba jdk7u60-b15
 ec76bacbb5b90efc7988dee5345c656126b97561 jdk7u60-b16
+617a6338e0c4f7699eed5061d7e8f576c3ace029 jdk7u60-b17
 617a6338e0c4f7699eed5061d7e8f576c3ace029 jdk7u60-b18
-617a6338e0c4f7699eed5061d7e8f576c3ace029 jdk7u60-b17
+4a9635c98a917cfcef506ca5d034c733a33c53f3 jdk7u65-b01
 361493c7cdb5f75b28efc63389d6cebaaaa43a2c jdk7u60-b19
+eb797fab50d3b440b17b3e7c5d83f42bfa73655e jdk7u65-b02
+bb00df28ecdbd0da89ab4ed81f6f2b732fa512da jdk7u65-b03
+848481af9003067546c7f34c166bb8d745b95d5f jdk7u65-b04
+98a884fa64a9ef1753a28691106efe10942b9d70 jdk7u65-b05
+6f1dddf9c632bfb14121c9521d17b64bd0be0cd2 jdk7u65-b06
+a053d3d805355ffcd85c17e653182e17d4456bd5 jdk7u65-b07
+6f03dfb50363d26599fcf726586ea3f6d0e0347d jdk7u65-b08
+b4930eb1ea7630b4d8609e2efe6f000d3dc83235 jdk7u65-b09
+4736382ac9d999044b05eb26932ab6fc59dbb159 jdk7u65-b10
+7345c7bf20fd8c91492240a95082af9a201b3a96 jdk7u65-b11
+28b81694b89f88541e28bbc767d78e77ec66cce6 jdk7u65-b12
+f4ed018b4c51dae699da835617b19e8a49c124a4 jdk7u65-b13
+7ec585caae47f7202fb5357607f9ad058b03870e jdk7u65-b14
+7058f0d30de6826b6866ce2d146c63e943be33af jdk7u65-b15
+f1b2970a2564c3360db420431cfbba215da6ae43 jdk7u65-b16
+4c6df9a369cb9d54fe2d898452883a22b8ec6640 jdk7u65-b17
+aca05127f95b5704ee3a34104a8f86e36326f0c0 jdk7u65-b30
+d006213be74730453cf5c3ce31f1d1d505334419 jdk7u65-b18
 b92f390febd01615af4a736b4f830f6052aa1d09 hs24.80-b00
 1448ebfef4f1aae0174eca983ad05507730ca6fd hs24.80-b01
 b1d29549dca7e36a4d050af5a54f8f56963a5c7d hs24.80-b02
--- a/src/os/bsd/vm/os_bsd.cpp	Thu Jun 26 14:23:30 2014 -0700
+++ b/src/os/bsd/vm/os_bsd.cpp	Wed Jul 02 21:04:56 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1830,9 +1830,6 @@
   ::abort();
 }
 
-// unused on bsd for now.
-void os::set_error_file(const char *logfile) {}
-
 
 // This method is a copy of JDK's sysGetLastErrorString
 // from src/solaris/hpi/src/system_md.c
@@ -2596,6 +2593,7 @@
         // determine if this is a legacy image or modules image
         // modules image doesn't have "jre" subdirectory
         len = strlen(buf);
+        assert(len < buflen, "Ran out of buffer space");
         jrelib_p = buf + len;
 
         // Add the appropriate library subdir
@@ -2631,7 +2629,7 @@
     }
   }
 
-  strcpy(saved_jvm_path, buf);
+  strncpy(saved_jvm_path, buf, MAXPATHLEN);
 }
 
 void os::print_jni_name_prefix_on(outputStream* st, int args_size) {
--- a/src/os/linux/vm/os_linux.cpp	Thu Jun 26 14:23:30 2014 -0700
+++ b/src/os/linux/vm/os_linux.cpp	Wed Jul 02 21:04:56 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1625,9 +1625,6 @@
   ::abort();
 }
 
-// unused on linux for now.
-void os::set_error_file(const char *logfile) {}
-
 
 // This method is a copy of JDK's sysGetLastErrorString
 // from src/solaris/hpi/src/system_md.c
@@ -2424,6 +2421,7 @@
         // determine if this is a legacy image or modules image
         // modules image doesn't have "jre" subdirectory
         len = strlen(buf);
+        assert(len < buflen, "Ran out of buffer room");
         jrelib_p = buf + len;
         snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch);
         if (0 != access(buf, F_OK)) {
@@ -2446,7 +2444,7 @@
     }
   }
 
-  strcpy(saved_jvm_path, buf);
+  strncpy(saved_jvm_path, buf, MAXPATHLEN);
 }
 
 void os::print_jni_name_prefix_on(outputStream* st, int args_size) {
--- a/src/os/solaris/vm/os_solaris.cpp	Thu Jun 26 14:23:30 2014 -0700
+++ b/src/os/solaris/vm/os_solaris.cpp	Wed Jul 02 21:04:56 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1877,9 +1877,6 @@
   ::abort(); // dump core (for debugging)
 }
 
-// unused
-void os::set_error_file(const char *logfile) {}
-
 // DLL functions
 
 const char* os::dll_file_extension() { return ".so"; }
@@ -2561,6 +2558,7 @@
         // determine if this is a legacy image or modules image
         // modules image doesn't have "jre" subdirectory
         len = strlen(buf);
+        assert(len < buflen, "Ran out of buffer space");
         jrelib_p = buf + len;
         snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch);
         if (0 != access(buf, F_OK)) {
@@ -2581,7 +2579,7 @@
     }
   }
 
-  strcpy(saved_jvm_path, buf);
+  strncpy(saved_jvm_path, buf, MAXPATHLEN);
 }
 
 
--- a/src/os/windows/vm/os_windows.cpp	Thu Jun 26 14:23:30 2014 -0700
+++ b/src/os/windows/vm/os_windows.cpp	Wed Jul 02 21:04:56 2014 -0700
@@ -1773,27 +1773,28 @@
      // libjvm.so is installed there (append a fake suffix
      // hotspot/libjvm.so).
      char* java_home_var = ::getenv("JAVA_HOME");
-     if (java_home_var != NULL && java_home_var[0] != 0) {
-
-        strncpy(buf, java_home_var, buflen);
-
-        // determine if this is a legacy image or modules image
-        // modules image doesn't have "jre" subdirectory
-        size_t len = strlen(buf);
-        char* jrebin_p = buf + len;
-        jio_snprintf(jrebin_p, buflen-len, "\\jre\\bin\\");
-        if (0 != _access(buf, 0)) {
-          jio_snprintf(jrebin_p, buflen-len, "\\bin\\");
-        }
-        len = strlen(buf);
-        jio_snprintf(buf + len, buflen-len, "hotspot\\jvm.dll");
+     if (java_home_var != NULL && java_home_var[0] != 0 &&
+         strlen(java_home_var) < (size_t)buflen) {
+
+       strncpy(buf, java_home_var, buflen);
+
+       // determine if this is a legacy image or modules image
+       // modules image doesn't have "jre" subdirectory
+       size_t len = strlen(buf);
+       char* jrebin_p = buf + len;
+       jio_snprintf(jrebin_p, buflen-len, "\\jre\\bin\\");
+       if (0 != _access(buf, 0)) {
+         jio_snprintf(jrebin_p, buflen-len, "\\bin\\");
+       }
+       len = strlen(buf);
+       jio_snprintf(buf + len, buflen-len, "hotspot\\jvm.dll");
      }
   }
 
   if(buf[0] == '\0') {
-  GetModuleFileName(vm_lib_handle, buf, buflen);
-  }
-  strcpy(saved_jvm_path, buf);
+    GetModuleFileName(vm_lib_handle, buf, buflen);
+  }
+  strncpy(saved_jvm_path, buf, MAX_PATH);
 }
 
 
@@ -2218,17 +2219,6 @@
 #endif //_WIN64
 
 
-// Fatal error reporting is single threaded so we can make this a
-// static and preallocated.  If it's more than MAX_PATH silently ignore
-// it.
-static char saved_error_file[MAX_PATH] = {0};
-
-void os::set_error_file(const char *logfile) {
-  if (strlen(logfile) <= MAX_PATH) {
-    strncpy(saved_error_file, logfile, MAX_PATH);
-  }
-}
-
 static inline void report_error(Thread* t, DWORD exception_code,
                                 address addr, void* siginfo, void* context) {
   VMError err(t, exception_code, addr, siginfo, context);
--- a/src/share/vm/classfile/classFileParser.cpp	Thu Jun 26 14:23:30 2014 -0700
+++ b/src/share/vm/classfile/classFileParser.cpp	Wed Jul 02 21:04:56 2014 -0700
@@ -961,7 +961,7 @@
             "Wrong size %u for field's Signature attribute in class file %s",
             attribute_length, CHECK);
         }
-        generic_signature_index = cfs->get_u2(CHECK);
+        generic_signature_index = parse_generic_signature_attribute(cp, CHECK);
       } else if (attribute_name == vmSymbols::tag_runtime_visible_annotations()) {
         runtime_visible_annotations_length = attribute_length;
         runtime_visible_annotations = cfs->get_u1_buffer();
@@ -1698,7 +1698,8 @@
 }
 
 // Sift through annotations, looking for those significant to the VM:
-void ClassFileParser::parse_annotations(u1* buffer, int limit,
+void ClassFileParser::parse_annotations(Handle class_loader,
+                                        u1* buffer, int limit,
                                         constantPoolHandle cp,
                                         ClassFileParser::AnnotationCollector* coll,
                                         TRAPS) {
@@ -1736,7 +1737,7 @@
     }
 
     // Here is where parsing particular annotations will take place.
-    AnnotationCollector::ID id = coll->annotation_index(aname);
+    AnnotationCollector::ID id = coll->annotation_index(class_loader, is_anonymous(), aname);
     if (id == AnnotationCollector::_unknown)  continue;
     coll->set_annotation(id);
     // If there are no values, just set the bit and move on:
@@ -1765,20 +1766,30 @@
   }
 }
 
-ClassFileParser::AnnotationCollector::ID ClassFileParser::AnnotationCollector::annotation_index(Symbol* name) {
+ClassFileParser::AnnotationCollector::ID ClassFileParser::AnnotationCollector::annotation_index(Handle class_loader,
+                                                                                                bool is_anonymous,
+                                                                                                Symbol* name) {
   vmSymbols::SID sid = vmSymbols::find_sid(name);
+  // Privileged code can use all annotations.  Other code silently drops some.
+  const bool privileged = class_loader.is_null() || is_anonymous ||
+                          class_loader()->klass()->klass_part()->name() ==
+                            vmSymbols::sun_misc_Launcher_ExtClassLoader();
   switch (sid) {
   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_ForceInline_signature):
     if (_location != _in_method)  break;  // only allow for methods
+    if (!privileged)              break;  // only allow in privileged code
     return _method_ForceInline;
   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_DontInline_signature):
     if (_location != _in_method)  break;  // only allow for methods
+    if (!privileged)              break;  // only allow in privileged code
     return _method_DontInline;
   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Compiled_signature):
     if (_location != _in_method)  break;  // only allow for methods
+    if (!privileged)              break;  // only allow in privileged code
     return _method_LambdaForm_Compiled;
   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Hidden_signature):
     if (_location != _in_method)  break;  // only allow for methods
+    if (!privileged)              break;  // only allow in privileged code
     return _method_LambdaForm_Hidden;
   default: break;
   }
@@ -1818,8 +1829,8 @@
 // from the method back up to the containing klass. These flag values
 // are added to klass's access_flags.
 
-methodHandle ClassFileParser::parse_method(constantPoolHandle cp, bool is_interface,
-                                           AccessFlags *promoted_flags,
+methodHandle ClassFileParser::parse_method(Handle class_loader, constantPoolHandle cp,
+                                           bool is_interface, AccessFlags *promoted_flags,
                                            typeArrayHandle* method_annotations,
                                            typeArrayHandle* method_parameter_annotations,
                                            typeArrayHandle* method_default_annotations,
@@ -2122,13 +2133,12 @@
             "Invalid Signature attribute length %u in class file %s",
             method_attribute_length, CHECK_(nullHandle));
         }
-        cfs->guarantee_more(2, CHECK_(nullHandle));  // generic_signature_index
-        generic_signature_index = cfs->get_u2_fast();
+        generic_signature_index = parse_generic_signature_attribute(cp, CHECK_(nullHandle));
       } else if (method_attribute_name == vmSymbols::tag_runtime_visible_annotations()) {
         runtime_visible_annotations_length = method_attribute_length;
         runtime_visible_annotations = cfs->get_u1_buffer();
         assert(runtime_visible_annotations != NULL, "null visible annotations");
-        parse_annotations(runtime_visible_annotations, runtime_visible_annotations_length, cp, &parsed_annotations, CHECK_(nullHandle));
+        parse_annotations(class_loader, runtime_visible_annotations, runtime_visible_annotations_length, cp, &parsed_annotations, CHECK_(nullHandle));
         cfs->skip_u1(runtime_visible_annotations_length, CHECK_(nullHandle));
       } else if (PreserveAllAnnotations && method_attribute_name == vmSymbols::tag_runtime_invisible_annotations()) {
         runtime_invisible_annotations_length = method_attribute_length;
@@ -2357,8 +2367,8 @@
 // from the methods back up to the containing klass. These flag values
 // are added to klass's access_flags.
 
-objArrayHandle ClassFileParser::parse_methods(constantPoolHandle cp, bool is_interface,
-                                              AccessFlags* promoted_flags,
+objArrayHandle ClassFileParser::parse_methods(Handle class_loader, constantPoolHandle cp,
+                                              bool is_interface, AccessFlags* promoted_flags,
                                               bool* has_final_method,
                                               objArrayOop* methods_annotations_oop,
                                               objArrayOop* methods_parameter_annotations_oop,
@@ -2381,7 +2391,8 @@
     objArrayHandle methods_parameter_annotations;
     objArrayHandle methods_default_annotations;
     for (int index = 0; index < length; index++) {
-      methodHandle method = parse_method(cp, is_interface,
+      methodHandle method = parse_method(class_loader, cp,
+                                         is_interface,
                                          promoted_flags,
                                          &method_annotations,
                                          &method_parameter_annotations,
@@ -2490,6 +2501,17 @@
   }
 }
 
+// Parse generic_signature attribute for methods and fields
+u2 ClassFileParser::parse_generic_signature_attribute(constantPoolHandle cp, TRAPS) {
+  ClassFileStream* cfs = stream();
+  cfs->guarantee_more(2, CHECK_0);  // generic_signature_index
+  u2 generic_signature_index = cfs->get_u2_fast();
+  check_property(
+    valid_symbol_at(cp, generic_signature_index),
+    "Invalid Signature attribute at constant pool index %u in class file %s",
+    generic_signature_index, CHECK_0);
+  return generic_signature_index;
+}
 
 void ClassFileParser::parse_classfile_sourcefile_attribute(constantPoolHandle cp, TRAPS) {
   ClassFileStream* cfs = stream();
@@ -2654,18 +2676,19 @@
   ClassFileStream* cfs = stream();
   u1* current_start = cfs->current();
 
-  cfs->guarantee_more(2, CHECK);  // length
-  int attribute_array_length = cfs->get_u2_fast();
-
-  guarantee_property(_max_bootstrap_specifier_index < attribute_array_length,
-                     "Short length on BootstrapMethods in class file %s",
-                     CHECK);
-
   guarantee_property(attribute_byte_length > sizeof(u2),
                      "Invalid BootstrapMethods attribute length %u in class file %s",
                      attribute_byte_length,
                      CHECK);
 
+  cfs->guarantee_more(attribute_byte_length, CHECK);
+
+  int attribute_array_length = cfs->get_u2_fast();
+
+  guarantee_property(_max_bootstrap_specifier_index < attribute_array_length,
+                     "Short length on BootstrapMethods in class file %s",
+                     CHECK);
+
   // The attribute contains a counted array of counted tuples of shorts,
   // represending bootstrap specifiers:
   //    length*{bootstrap_method_index, argument_count*{argument_index}}
@@ -2726,7 +2749,8 @@
 }
 
 
-void ClassFileParser::parse_classfile_attributes(constantPoolHandle cp,
+void ClassFileParser::parse_classfile_attributes(Handle class_loader,
+                                                 constantPoolHandle cp,
                                                  ClassFileParser::ClassAnnotationCollector* parsed_annotations,
                                                  TRAPS) {
   ClassFileStream* cfs = stream();
@@ -2809,7 +2833,8 @@
         runtime_visible_annotations_length = attribute_length;
         runtime_visible_annotations = cfs->get_u1_buffer();
         assert(runtime_visible_annotations != NULL, "null visible annotations");
-        parse_annotations(runtime_visible_annotations,
+        parse_annotations(class_loader,
+                          runtime_visible_annotations,
                           runtime_visible_annotations_length,
                           cp,
                           parsed_annotations,
@@ -3172,7 +3197,8 @@
     objArrayOop methods_annotations_oop = NULL;
     objArrayOop methods_parameter_annotations_oop = NULL;
     objArrayOop methods_default_annotations_oop = NULL;
-    objArrayHandle methods = parse_methods(cp, access_flags.is_interface(),
+    objArrayHandle methods = parse_methods(class_loader, cp,
+                                           access_flags.is_interface(),
                                            &promoted_flags,
                                            &has_final_method,
                                            &methods_annotations_oop,
@@ -3186,7 +3212,7 @@
 
     // Additional attributes
     ClassAnnotationCollector parsed_annotations;
-    parse_classfile_attributes(cp, &parsed_annotations, CHECK_(nullHandle));
+    parse_classfile_attributes(class_loader, cp, &parsed_annotations, CHECK_(nullHandle));
 
     // Make sure this is the end of class file stream
     guarantee_property(cfs->at_eos(), "Extra bytes at the end of class file %s", CHECK_(nullHandle));
--- a/src/share/vm/classfile/classFileParser.hpp	Thu Jun 26 14:23:30 2014 -0700
+++ b/src/share/vm/classfile/classFileParser.hpp	Wed Jul 02 21:04:56 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -102,7 +102,7 @@
       assert((int)_annotation_LIMIT <= (int)sizeof(_annotations_present) * BitsPerByte, "");
     }
     // If this annotation name has an ID, report it (or _none).
-    ID annotation_index(Symbol* name);
+    ID annotation_index(Handle class_loader, bool is_anonymous, Symbol* name);
     // Set the annotation name:
     void set_annotation(ID id) {
       assert((int)id >= 0 && (int)id < (int)_annotation_LIMIT, "oob");
@@ -169,14 +169,14 @@
                                u2* java_fields_count_ptr, TRAPS);
 
   // Method parsing
-  methodHandle parse_method(constantPoolHandle cp, bool is_interface,
-                            AccessFlags* promoted_flags,
+  methodHandle parse_method(Handle class_loader, constantPoolHandle cp,
+                            bool is_interface, AccessFlags* promoted_flags,
                             typeArrayHandle* method_annotations,
                             typeArrayHandle* method_parameter_annotations,
                             typeArrayHandle* method_default_annotations,
                             TRAPS);
-  objArrayHandle parse_methods (constantPoolHandle cp, bool is_interface,
-                                AccessFlags* promoted_flags,
+  objArrayHandle parse_methods (Handle class_loader, constantPoolHandle cp,
+                                bool is_interface, AccessFlags* promoted_flags,
                                 bool* has_final_method,
                                 objArrayOop* methods_annotations_oop,
                                 objArrayOop* methods_parameter_annotations_oop,
@@ -202,6 +202,7 @@
   typeArrayOop parse_stackmap_table(u4 code_attribute_length, TRAPS);
 
   // Classfile attribute parsing
+  u2 parse_generic_signature_attribute(constantPoolHandle cp, TRAPS);
   void parse_classfile_sourcefile_attribute(constantPoolHandle cp, TRAPS);
   void parse_classfile_source_debug_extension_attribute(constantPoolHandle cp, int length, TRAPS);
   u2   parse_classfile_inner_classes_attribute(u1* inner_classes_attribute_start,
@@ -210,7 +211,8 @@
                                                u2 enclosing_method_method_index,
                                                constantPoolHandle cp,
                                                TRAPS);
-  void parse_classfile_attributes(constantPoolHandle cp,
+  void parse_classfile_attributes(Handle class_loader,
+                                  constantPoolHandle cp,
                                   ClassAnnotationCollector* parsed_annotations,
                                   TRAPS);
   void parse_classfile_synthetic_attribute(constantPoolHandle cp, TRAPS);
@@ -224,7 +226,7 @@
                                        int runtime_invisible_annotations_length, TRAPS);
   int skip_annotation(u1* buffer, int limit, int index);
   int skip_annotation_value(u1* buffer, int limit, int index);
-  void parse_annotations(u1* buffer, int limit, constantPoolHandle cp,
+  void parse_annotations(Handle class_loader, u1* buffer, int limit, constantPoolHandle cp,
                          /* Results (currently, only one result is supported): */
                          AnnotationCollector* result,
                          TRAPS);
@@ -335,6 +337,12 @@
             : cp->tag_at(index).is_klass_reference());
   }
 
+  // Checks that the cpool index is in range and is a utf8
+  bool valid_symbol_at(constantPoolHandle cp, int cpool_index) {
+    return (cp->is_within_bounds(cpool_index) &&
+            cp->tag_at(cpool_index).is_utf8());
+  }
+
  public:
   // Constructor
   ClassFileParser(ClassFileStream* st) { set_stream(st); }
--- a/src/share/vm/classfile/stackMapTable.cpp	Thu Jun 26 14:23:30 2014 -0700
+++ b/src/share/vm/classfile/stackMapTable.cpp	Wed Jul 02 21:04:56 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -134,6 +134,7 @@
   }
   // check if uninitialized objects exist on backward branches
   check_new_object(frame, target, CHECK_VERIFY(frame->verifier()));
+  frame->verifier()->update_furthest_jump(target);
 }
 
 void StackMapTable::check_new_object(
--- a/src/share/vm/classfile/verifier.cpp	Thu Jun 26 14:23:30 2014 -0700
+++ b/src/share/vm/classfile/verifier.cpp	Wed Jul 02 21:04:56 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -629,6 +629,9 @@
   bool no_control_flow = false; // Set to true when there is no direct control
                                 // flow from current instruction to the next
                                 // instruction in sequence
+
+  set_furthest_jump(0);
+
   Bytecodes::Code opcode;
   while (!bcs.is_last_bytecode()) {
     // Check for recursive re-verification before each bytecode.
@@ -2239,6 +2242,29 @@
           "Bad <init> method call");
       return;
     }
+
+    // Make sure that this call is not jumped over.
+    if (bci < furthest_jump()) {
+      verify_error(ErrorContext::bad_code(bci),
+                   "Bad <init> method call from inside of a branch");
+      return;
+    }
+
+    // Make sure that this call is not done from within a TRY block because
+    // that can result in returning an incomplete object.  Simply checking
+    // (bci >= start_pc) also ensures that this call is not done after a TRY
+    // block.  That is also illegal because this call must be the first Java
+    // statement in the constructor.
+    ExceptionTable exhandlers(_method());
+    int exlength = exhandlers.length();
+    for(int i = 0; i < exlength; i++) {
+      if (bci >= exhandlers.start_pc(i)) {
+        verify_error(ErrorContext::bad_code(bci),
+                     "Bad <init> method call from after the start of a try block");
+        return;
+      }
+    }
+
     current_frame->initialize_object(type, current_type());
     *this_uninit = true;
   } else if (type.is_uninitialized()) {
@@ -2275,6 +2301,11 @@
       methodOop m = instanceKlass::cast(ref_klass)->uncached_lookup_method(
         vmSymbols::object_initializer_name(),
         cp->signature_ref_at(bcs->get_index_u2()));
+      if (m == NULL) {
+        verify_error(ErrorContext::bad_code(bci),
+            "Call to missing <init> method");
+        return;
+      }
       instanceKlassHandle mh(THREAD, m->method_holder());
       if (m->is_protected() && !mh->is_same_class_package(_klass())) {
         bool assignable = current_type().is_assignable_from(
--- a/src/share/vm/classfile/verifier.hpp	Thu Jun 26 14:23:30 2014 -0700
+++ b/src/share/vm/classfile/verifier.hpp	Wed Jul 02 21:04:56 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -256,6 +256,9 @@
 
   ErrorContext _error_context;  // contains information about an error
 
+  // Used to detect illegal jumps over calls to super() and this() in ctors.
+  int32_t _furthest_jump;
+
   void verify_method(methodHandle method, TRAPS);
   char* generate_code_data(methodHandle m, u4 code_length, TRAPS);
   void verify_exception_handler_table(u4 code_length, char* code_data,
@@ -398,6 +401,20 @@
   Symbol* create_temporary_symbol(const char *s, int length, TRAPS);
 
   TypeOrigin ref_ctx(const char* str, TRAPS);
+
+  // Keep track of the furthest branch done in a method to make sure that
+  // there are no branches over calls to super() or this() from inside of
+  // a constructor.
+  int32_t furthest_jump() { return _furthest_jump; }
+
+  void set_furthest_jump(int32_t target) {
+    _furthest_jump = target;
+  }
+
+  void update_furthest_jump(int32_t target) {
+    if (target > _furthest_jump) _furthest_jump = target;
+  }
+
 };
 
 inline int ClassVerifier::change_sig_to_verificationType(
--- a/src/share/vm/compiler/compileBroker.cpp	Thu Jun 26 14:23:30 2014 -0700
+++ b/src/share/vm/compiler/compileBroker.cpp	Wed Jul 02 21:04:56 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1921,6 +1921,7 @@
   ResourceMark rm;
   char* method_name = method->name()->as_C_string();
   strncpy(_last_method_compiled, method_name, CompileBroker::name_buffer_length);
+  _last_method_compiled[CompileBroker::name_buffer_length - 1] = '\0'; // ensure null terminated
   char current_method[CompilerCounters::cmname_buffer_length];
   size_t maxLen = CompilerCounters::cmname_buffer_length;
 
--- a/src/share/vm/oops/klassVtable.cpp	Thu Jun 26 14:23:30 2014 -0700
+++ b/src/share/vm/oops/klassVtable.cpp	Wed Jul 02 21:04:56 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -209,6 +209,17 @@
 // For bytecodes not produced by javac together it is possible that a method does not override
 // the superclass's method, but might indirectly override a super-super class's vtable entry
 // If none found, return a null superk, else return the superk of the method this does override
+// For public and protected methods: if they override a superclass, they will
+// also be overridden themselves appropriately.
+// Private methods do not override and are not overridden.
+// Package Private methods are trickier:
+// e.g. P1.A, pub m
+// P2.B extends A, package private m
+// P1.C extends B, public m
+// P1.C.m needs to override P1.A.m and can not override P2.B.m
+// Therefore: all package private methods need their own vtable entries for
+// them to be the root of an inheritance overriding decision
+// Package private methods may also override other vtable entries
 instanceKlass* klassVtable::find_transitive_override(instanceKlass* initialsuper, methodHandle target_method,
                             int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) {
   instanceKlass* superk = initialsuper;
@@ -310,8 +321,12 @@
       ((klass->major_version() >= VTABLE_TRANSITIVE_OVERRIDE_VERSION)
         && ((super_klass = find_transitive_override(super_klass, target_method, i, target_loader,
              target_classname, THREAD)) != (instanceKlass*)NULL))) {
-        // overriding, so no new entry
-        allocate_new = false;
+
+        // Package private methods always need a new entry to root their own
+        // overriding. They may also override other methods.
+        if (!target_method()->is_package_private()) {
+          allocate_new = false;
+        }
 
         if (checkconstraints) {
         // Override vtable entry if passes loader constraint check
@@ -433,6 +448,12 @@
     return true;
   }
 
+  // Package private methods always need a new entry to root their own
+  // overriding. This allows transitive overriding to work.
+  if (target_method()->is_package_private()) {
+    return true;
+  }
+
   // search through the super class hierarchy to see if we need
   // a new entry
   ResourceMark rm;
--- a/src/share/vm/runtime/os.hpp	Thu Jun 26 14:23:30 2014 -0700
+++ b/src/share/vm/runtime/os.hpp	Wed Jul 02 21:04:56 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -460,9 +460,6 @@
   // run cmd in a separate process and return its exit code; or -1 on failures
   static int fork_and_exec(char *cmd);
 
-  // Set file to send error reports.
-  static void set_error_file(const char *logfile);
-
   // os::exit() is merged with vm_exit()
   // static void exit(int num);
 
--- a/src/share/vm/utilities/events.cpp	Thu Jun 26 14:23:30 2014 -0700
+++ b/src/share/vm/utilities/events.cpp	Wed Jul 02 21:04:56 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -93,7 +93,7 @@
     va_start(ap, format);
     // Save a copy of begin message and log it.
     _buffer.printv(format, ap);
-    Events::log(NULL, _buffer);
+    Events::log(NULL, "%s", (const char*)_buffer);
     va_end(ap);
   }
 }
@@ -102,6 +102,6 @@
   if (LogEvents) {
     // Append " done" to the begin message and log it
     _buffer.append(" done");
-    Events::log(NULL, _buffer);
+    Events::log(NULL, "%s", (const char*)_buffer);
   }
 }
--- a/src/share/vm/utilities/vmError.cpp	Thu Jun 26 14:23:30 2014 -0700
+++ b/src/share/vm/utilities/vmError.cpp	Wed Jul 02 21:04:56 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -951,7 +951,6 @@
       if (fd != -1) {
         out.print_raw("# An error report file with more information is saved as:\n# ");
         out.print_raw_cr(buffer);
-        os::set_error_file(buffer);
 
         log.set_fd(fd);
       } else {