Merge
authorhseigel
Wed, 13 May 2015 21:06:30 +0200
changeset 30623 852476aed2a9
parent 30614 e45861098f5a (current diff)
parent 30622 648d51c142bd (diff)
child 30633 eaf7c74a3fb9
Merge
--- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java	Mon May 11 16:30:26 2015 +0200
+++ b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java	Wed May 13 21:06:30 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -81,6 +81,7 @@
             startTag(cfg, "PropertyGroup", "Label", "Configuration");
             tagData("ConfigurationType", "DynamicLibrary");
             tagData("UseOfMfc", "false");
+            tagData("PlatformToolset", "v120");
             endTag();
         }
 
--- a/hotspot/src/share/vm/classfile/verificationType.cpp	Mon May 11 16:30:26 2015 +0200
+++ b/hotspot/src/share/vm/classfile/verificationType.cpp	Wed May 13 21:06:30 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -61,6 +61,10 @@
     Klass* obj = SystemDictionary::resolve_or_fail(
         name(), Handle(THREAD, klass->class_loader()),
         Handle(THREAD, klass->protection_domain()), true, CHECK_false);
+    if (TraceClassResolution) {
+      Verifier::trace_class_resolution(obj, klass());
+    }
+
     KlassHandle this_class(THREAD, obj);
 
     if (this_class->is_interface() && (!from_field_is_protected ||
@@ -73,6 +77,9 @@
       Klass* from_class = SystemDictionary::resolve_or_fail(
           from.name(), Handle(THREAD, klass->class_loader()),
           Handle(THREAD, klass->protection_domain()), true, CHECK_false);
+      if (TraceClassResolution) {
+        Verifier::trace_class_resolution(from_class, klass());
+      }
       return InstanceKlass::cast(from_class)->is_subclass_of(this_class());
     }
   } else if (is_array() && from.is_array()) {
--- a/hotspot/src/share/vm/classfile/verifier.cpp	Mon May 11 16:30:26 2015 +0200
+++ b/hotspot/src/share/vm/classfile/verifier.cpp	Wed May 13 21:06:30 2015 +0200
@@ -94,6 +94,21 @@
   return !need_verify;
 }
 
+void Verifier::trace_class_resolution(Klass* resolve_class, InstanceKlass* verify_class) {
+  assert(verify_class != NULL, "Unexpected null verify_class");
+  ResourceMark rm;
+  Symbol* s = verify_class->source_file_name();
+  const char* source_file = (s != NULL ? s->as_C_string() : NULL);
+  const char* verify = verify_class->external_name();
+  const char* resolve = resolve_class->external_name();
+  // print in a single call to reduce interleaving between threads
+  if (source_file != NULL) {
+    tty->print("RESOLVE %s %s %s (verification)\n", verify, resolve, source_file);
+  } else {
+    tty->print("RESOLVE %s %s (verification)\n", verify, resolve);
+  }
+}
+
 bool Verifier::verify(instanceKlassHandle klass, Verifier::Mode mode, bool should_verify_class, TRAPS) {
   HandleMark hm;
   ResourceMark rm(THREAD);
@@ -172,6 +187,10 @@
     ResourceMark rm(THREAD);
     instanceKlassHandle kls =
       SystemDictionary::resolve_or_fail(exception_name, true, CHECK_false);
+    if (TraceClassResolution) {
+      Verifier::trace_class_resolution(kls(), klass());
+    }
+
     while (!kls.is_null()) {
       if (kls == klass) {
         // If the class being verified is the exception we're creating
@@ -1947,9 +1966,15 @@
   oop loader = current_class()->class_loader();
   oop protection_domain = current_class()->protection_domain();
 
-  return SystemDictionary::resolve_or_fail(
+  Klass* kls = SystemDictionary::resolve_or_fail(
     name, Handle(THREAD, loader), Handle(THREAD, protection_domain),
     true, THREAD);
+
+  if (TraceClassResolution) {
+    instanceKlassHandle cur_class = current_class();
+    Verifier::trace_class_resolution(kls, cur_class());
+  }
+  return kls;
 }
 
 bool ClassVerifier::is_protected_access(instanceKlassHandle this_class,
--- a/hotspot/src/share/vm/classfile/verifier.hpp	Mon May 11 16:30:26 2015 +0200
+++ b/hotspot/src/share/vm/classfile/verifier.hpp	Wed May 13 21:06:30 2015 +0200
@@ -60,6 +60,9 @@
   // Relax certain verifier checks to enable some broken 1.1 apps to run on 1.2.
   static bool relax_verify_for(oop class_loader);
 
+  // Print output for -XX:+TraceClassResolution
+  static void trace_class_resolution(Klass* resolve_class, InstanceKlass* verify_class);
+
  private:
   static bool is_eligible_for_verification(instanceKlassHandle klass, bool should_verify_class);
   static Symbol* inference_verify(
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp	Mon May 11 16:30:26 2015 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp	Wed May 13 21:06:30 2015 +0200
@@ -310,11 +310,11 @@
     // Compute hash
     hash = hash_code(value);
     stat.inc_hashed();
-  }
 
-  if (use_java_hash() && hash != 0) {
-    // Store hash code in cache
-    java_lang_String::set_hash(java_string, hash);
+    if (use_java_hash() && hash != 0) {
+      // Store hash code in cache
+      java_lang_String::set_hash(java_string, hash);
+    }
   }
 
   typeArrayOop existing_value = lookup_or_add(value, hash);
--- a/hotspot/src/share/vm/oops/klassVtable.cpp	Mon May 11 16:30:26 2015 +0200
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp	Wed May 13 21:06:30 2015 +0200
@@ -1054,7 +1054,7 @@
 
 int klassItable::assign_itable_indices_for_interface(Klass* klass) {
   // an interface does not have an itable, but its methods need to be numbered
-  if (TraceItables) tty->print_cr("%3d: Initializing itable for interface %s", ++initialize_count,
+  if (TraceItables) tty->print_cr("%3d: Initializing itable indices for interface %s", ++initialize_count,
                                   klass->name()->as_C_string());
   Array<Method*>* methods = InstanceKlass::cast(klass)->methods();
   int nof_methods = methods->length();
@@ -1068,7 +1068,7 @@
         ResourceMark rm;
         const char* sig = (m != NULL) ? m->name_and_sig_as_C_string() : "<NULL>";
         if (m->has_vtable_index()) {
-          tty->print("itable index %d for method: %s, flags: ", m->vtable_index(), sig);
+          tty->print("vtable index %d for method: %s, flags: ", m->vtable_index(), sig);
         } else {
           tty->print("itable index %d for method: %s, flags: ", ime_num, sig);
         }
@@ -1100,22 +1100,25 @@
   assert(interf->is_interface(), "must be");
   Array<Method*>* methods = InstanceKlass::cast(interf)->methods();
   int nof_methods = methods->length();
+  int length = 0;
   while (nof_methods > 0) {
     Method* m = methods->at(nof_methods-1);
     if (m->has_itable_index()) {
-      int length = m->itable_index() + 1;
-#ifdef ASSERT
-      while (nof_methods = 0) {
-        m = methods->at(--nof_methods);
-        assert(!m->has_itable_index() || m->itable_index() < length, "");
-      }
-#endif //ASSERT
-      return length;  // return the rightmost itable index, plus one
+      length = m->itable_index() + 1;
+      break;
     }
     nof_methods -= 1;
   }
-  // no methods have itable indices
-  return 0;
+#ifdef ASSERT
+  int nof_methods_copy = nof_methods;
+  while (nof_methods_copy > 0) {
+    Method* mm = methods->at(--nof_methods_copy);
+    assert(!mm->has_itable_index() || mm->itable_index() < length, "");
+  }
+#endif //ASSERT
+  // return the rightmost itable index, plus one; or 0 if no methods have
+  // itable indices
+  return length;
 }
 
 
--- a/hotspot/src/share/vm/prims/methodHandles.cpp	Mon May 11 16:30:26 2015 +0200
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp	Wed May 13 21:06:30 2015 +0200
@@ -186,7 +186,9 @@
 oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info) {
   assert(info.resolved_appendix().is_null(), "only normal methods here");
   methodHandle m = info.resolved_method();
+  assert(m.not_null(), "null method handle");
   KlassHandle m_klass = m->method_holder();
+  assert(m.not_null(), "null holder for method handle");
   int flags = (jushort)( m->access_flags().as_short() & JVM_RECOGNIZED_METHOD_MODIFIERS );
   int vmindex = Method::invalid_vtable_index;
 
--- a/hotspot/src/share/vm/utilities/vmError.cpp	Mon May 11 16:30:26 2015 +0200
+++ b/hotspot/src/share/vm/utilities/vmError.cpp	Wed May 13 21:06:30 2015 +0200
@@ -520,7 +520,7 @@
     st->print("# ");
     if (CreateCoredumpOnCrash) {
       if (coredump_status) {
-        st->print("Core dump will be written. %s", coredump_message);
+        st->print("Core dump will be written. Default location: %s", coredump_message);
       } else {
         st->print("No core dump will be written. %s", coredump_message);
       }
--- a/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedCPU.java	Mon May 11 16:30:26 2015 +0200
+++ b/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedCPU.java	Wed May 13 21:06:30 2015 +0200
@@ -28,7 +28,7 @@
 
 import java.util.function.BooleanSupplier;
 
-import com.oracle.java.testlibrary.Platform;
+import jdk.test.lib.Platform;
 
 public class SupportedCPU implements BooleanSupplier {
     @Override
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java	Wed May 13 21:06:30 2015 +0200
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2015, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
+ * @build jdk.test.lib.*
+ * @run driver CreateCoredumpOnCrash
+ */
+
+import jdk.test.lib.*;
+import sun.misc.Unsafe;
+
+public class CreateCoredumpOnCrash {
+    private static class Crasher {
+        public static void main(String[] args) {
+            Utils.getUnsafe().getInt(0);
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        runTest("-XX:-CreateCoredumpOnCrash").shouldContain("CreateCoredumpOnCrash turned off, no core file dumped");
+
+        if (Platform.isWindows()) {
+            runTest("-XX:+CreateCoredumpOnCrash").shouldContain("Core dump will be written. Default location");
+
+            // The old CreateMinidumpOnCrash option should still work
+            runTest("-XX:+CreateMinidumpOnCrash").shouldContain("Core dump will be written. Default location");
+            runTest("-XX:-CreateMinidumpOnCrash").shouldContain("CreateCoredumpOnCrash turned off, no core file dumped");
+
+            if (Platform.isDebugBuild()) {
+                // Make sure we create dumps on Windows debug builds by default
+                runTest("-Ddummyopt=false").shouldContain("Core dump will be written. Default location");
+            }
+        } else {
+            runTest("-XX:+CreateCoredumpOnCrash").shouldNotContain("CreateCoredumpOnCrash turned off, no core file dumped");
+        }
+
+    }
+    public static OutputAnalyzer runTest(String option) throws Exception {
+        return new OutputAnalyzer(
+            ProcessTools.createJavaProcessBuilder(
+            "-Xmx64m", "-XX:-TransmitErrorReport", option, Crasher.class.getName())
+            .start());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/verifier/TraceClassRes.java	Wed May 13 21:06:30 2015 +0200
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8076318
+ * @summary split verifier needs to add TraceClassResolution
+ * @library /testlibrary
+ */
+
+import jdk.test.lib.*;
+
+// Test that the verifier outputs the classes it loads if -XX:+TraceClassResolution is specified"
+public class TraceClassRes {
+  public static void main(String[] args) throws Exception {
+
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+        "-XX:+TraceClassResolution", "-verify", "-Xshare:off", "-version");
+
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+    output.shouldContain("RESOLVE java.lang.ClassLoader java.lang.Throwable ClassLoader.java (verification)");
+    output.shouldHaveExitValue(0);
+  }
+}