Merge
authordcubed
Fri, 29 Mar 2013 08:38:00 -0700
changeset 16598 220e5e5b3947
parent 16587 d51641194e3a (current diff)
parent 16597 e6fde43d473e (diff)
child 16599 09e39436637f
Merge
hotspot/src/share/vm/runtime/arguments.cpp
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Thu Mar 28 19:13:22 2013 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Fri Mar 29 08:38:00 2013 -0700
@@ -2185,10 +2185,9 @@
 // Make sure all class components (including arrays) in the given
 // signature will be resolved to the same class in both loaders.
 // Returns the name of the type that failed a loader constraint check, or
-// NULL if no constraint failed. The returned C string needs cleaning up
-// with a ResourceMark in the caller.  No exception except OOME is thrown.
+// NULL if no constraint failed.  No exception except OOME is thrown.
 // Arrays are not added to the loader constraint table, their elements are.
-char* SystemDictionary::check_signature_loaders(Symbol* signature,
+Symbol* SystemDictionary::check_signature_loaders(Symbol* signature,
                                                Handle loader1, Handle loader2,
                                                bool is_method, TRAPS)  {
   // Nothing to do if loaders are the same.
@@ -2196,14 +2195,12 @@
     return NULL;
   }
 
-  ResourceMark rm(THREAD);
   SignatureStream sig_strm(signature, is_method);
   while (!sig_strm.is_done()) {
     if (sig_strm.is_object()) {
-      Symbol* s = sig_strm.as_symbol(CHECK_NULL);
-      Symbol*  sig  = s;
+      Symbol* sig = sig_strm.as_symbol(CHECK_NULL);
       if (!add_loader_constraint(sig, loader1, loader2, THREAD)) {
-        return sig->as_C_string();
+        return sig;
       }
     }
     sig_strm.next();
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp	Thu Mar 28 19:13:22 2013 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp	Fri Mar 29 08:38:00 2013 -0700
@@ -483,8 +483,8 @@
   // Check class loader constraints
   static bool add_loader_constraint(Symbol* name, Handle loader1,
                                     Handle loader2, TRAPS);
-  static char* check_signature_loaders(Symbol* signature, Handle loader1,
-                                       Handle loader2, bool is_method, TRAPS);
+  static Symbol* check_signature_loaders(Symbol* signature, Handle loader1,
+                                         Handle loader2, bool is_method, TRAPS);
 
   // JSR 292
   // find a java.lang.invoke.MethodHandle.invoke* method for a given signature
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp	Thu Mar 28 19:13:22 2013 -0700
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp	Fri Mar 29 08:38:00 2013 -0700
@@ -458,25 +458,27 @@
     Handle class_loader (THREAD, resolved_method->method_holder()->class_loader());
     {
       ResourceMark rm(THREAD);
-      char* failed_type_name =
+      Symbol* failed_type_symbol =
         SystemDictionary::check_signature_loaders(method_signature, loader,
                                                   class_loader, true, CHECK);
-      if (failed_type_name != NULL) {
+      if (failed_type_symbol != NULL) {
         const char* msg = "loader constraint violation: when resolving method"
           " \"%s\" the class loader (instance of %s) of the current class, %s,"
-          " and the class loader (instance of %s) for resolved class, %s, have"
+          " and the class loader (instance of %s) for the method's defining class, %s, have"
           " different Class objects for the type %s used in the signature";
         char* sig = Method::name_and_sig_as_C_string(resolved_klass(),method_name,method_signature);
         const char* loader1 = SystemDictionary::loader_name(loader());
         char* current = InstanceKlass::cast(current_klass())->name()->as_C_string();
         const char* loader2 = SystemDictionary::loader_name(class_loader());
-        char* resolved = InstanceKlass::cast(resolved_klass())->name()->as_C_string();
+        char* target = InstanceKlass::cast(resolved_method->method_holder())
+                       ->name()->as_C_string();
+        char* failed_type_name = failed_type_symbol->as_C_string();
         size_t buflen = strlen(msg) + strlen(sig) + strlen(loader1) +
-          strlen(current) + strlen(loader2) + strlen(resolved) +
-          strlen(failed_type_name);
+          strlen(current) + strlen(loader2) + strlen(target) +
+          strlen(failed_type_name) + 1;
         char* buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, buflen);
         jio_snprintf(buf, buflen, msg, sig, loader1, current, loader2,
-                     resolved, failed_type_name);
+                     target, failed_type_name);
         THROW_MSG(vmSymbols::java_lang_LinkageError(), buf);
       }
     }
@@ -520,26 +522,28 @@
     Handle class_loader (THREAD, resolved_method->method_holder()->class_loader());
     {
       ResourceMark rm(THREAD);
-      char* failed_type_name =
+      Symbol* failed_type_symbol =
         SystemDictionary::check_signature_loaders(method_signature, loader,
                                                   class_loader, true, CHECK);
-      if (failed_type_name != NULL) {
+      if (failed_type_symbol != NULL) {
         const char* msg = "loader constraint violation: when resolving "
           "interface method \"%s\" the class loader (instance of %s) of the "
           "current class, %s, and the class loader (instance of %s) for "
-          "resolved class, %s, have different Class objects for the type %s "
+          "the method's defining class, %s, have different Class objects for the type %s "
           "used in the signature";
         char* sig = Method::name_and_sig_as_C_string(resolved_klass(),method_name,method_signature);
         const char* loader1 = SystemDictionary::loader_name(loader());
         char* current = InstanceKlass::cast(current_klass())->name()->as_C_string();
         const char* loader2 = SystemDictionary::loader_name(class_loader());
-        char* resolved = InstanceKlass::cast(resolved_klass())->name()->as_C_string();
+        char* target = InstanceKlass::cast(resolved_method->method_holder())
+                       ->name()->as_C_string();
+        char* failed_type_name = failed_type_symbol->as_C_string();
         size_t buflen = strlen(msg) + strlen(sig) + strlen(loader1) +
-          strlen(current) + strlen(loader2) + strlen(resolved) +
-          strlen(failed_type_name);
+          strlen(current) + strlen(loader2) + strlen(target) +
+          strlen(failed_type_name) + 1;
         char* buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, buflen);
         jio_snprintf(buf, buflen, msg, sig, loader1, current, loader2,
-                     resolved, failed_type_name);
+                     target, failed_type_name);
         THROW_MSG(vmSymbols::java_lang_LinkageError(), buf);
       }
     }
@@ -642,12 +646,12 @@
     Symbol*  signature_ref  = pool->signature_ref_at(index);
     {
       ResourceMark rm(THREAD);
-      char* failed_type_name =
+      Symbol* failed_type_symbol =
         SystemDictionary::check_signature_loaders(signature_ref,
                                                   ref_loader, sel_loader,
                                                   false,
                                                   CHECK);
-      if (failed_type_name != NULL) {
+      if (failed_type_symbol != NULL) {
         const char* msg = "loader constraint violation: when resolving field"
           " \"%s\" the class loader (instance of %s) of the referring class, "
           "%s, and the class loader (instance of %s) for the field's resolved "
@@ -656,8 +660,9 @@
         const char* loader1 = SystemDictionary::loader_name(ref_loader());
         char* sel = InstanceKlass::cast(sel_klass())->name()->as_C_string();
         const char* loader2 = SystemDictionary::loader_name(sel_loader());
+        char* failed_type_name = failed_type_symbol->as_C_string();
         size_t buflen = strlen(msg) + strlen(field_name) + strlen(loader1) +
-          strlen(sel) + strlen(loader2) + strlen(failed_type_name);
+          strlen(sel) + strlen(loader2) + strlen(failed_type_name) + 1;
         char* buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, buflen);
         jio_snprintf(buf, buflen, msg, field_name, loader1, sel, loader2,
                      failed_type_name);
--- a/hotspot/src/share/vm/oops/constMethod.cpp	Thu Mar 28 19:13:22 2013 -0700
+++ b/hotspot/src/share/vm/oops/constMethod.cpp	Fri Mar 29 08:38:00 2013 -0700
@@ -363,6 +363,26 @@
   return (AnnotationArray**)constMethod_end() - offset;
 }
 
+// copy annotations from 'cm' to 'this'
+void ConstMethod::copy_annotations_from(ConstMethod* cm) {
+  if (cm->has_method_annotations()) {
+    assert(has_method_annotations(), "should be allocated already");
+    set_method_annotations(cm->method_annotations());
+  }
+  if (cm->has_parameter_annotations()) {
+    assert(has_parameter_annotations(), "should be allocated already");
+    set_parameter_annotations(cm->parameter_annotations());
+  }
+  if (cm->has_type_annotations()) {
+    assert(has_type_annotations(), "should be allocated already");
+    set_type_annotations(cm->type_annotations());
+  }
+  if (cm->has_default_annotations()) {
+    assert(has_default_annotations(), "should be allocated already");
+    set_default_annotations(cm->default_annotations());
+  }
+}
+
 // Printing
 
 void ConstMethod::print_on(outputStream* st) const {
--- a/hotspot/src/share/vm/oops/constMethod.hpp	Thu Mar 28 19:13:22 2013 -0700
+++ b/hotspot/src/share/vm/oops/constMethod.hpp	Fri Mar 29 08:38:00 2013 -0700
@@ -441,6 +441,9 @@
     return has_default_annotations() ? default_annotations()->length() : 0;
   }
 
+  // Copy annotations from other ConstMethod
+  void copy_annotations_from(ConstMethod* cm);
+
   // byte codes
   void    set_code(address code) {
     if (code_size() > 0) {
--- a/hotspot/src/share/vm/oops/klassVtable.cpp	Thu Mar 28 19:13:22 2013 -0700
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp	Fri Mar 29 08:38:00 2013 -0700
@@ -327,11 +327,11 @@
 
           if (target_loader() != super_loader()) {
             ResourceMark rm(THREAD);
-            char* failed_type_name =
+            Symbol* failed_type_symbol =
               SystemDictionary::check_signature_loaders(signature, target_loader,
                                                         super_loader, true,
                                                         CHECK_(false));
-            if (failed_type_name != NULL) {
+            if (failed_type_symbol != NULL) {
               const char* msg = "loader constraint violation: when resolving "
                 "overridden method \"%s\" the class loader (instance"
                 " of %s) of the current class, %s, and its superclass loader "
@@ -341,6 +341,7 @@
               const char* loader1 = SystemDictionary::loader_name(target_loader());
               char* current = _klass->name()->as_C_string();
               const char* loader2 = SystemDictionary::loader_name(super_loader());
+              char* failed_type_name = failed_type_symbol->as_C_string();
               size_t buflen = strlen(msg) + strlen(sig) + strlen(loader1) +
                 strlen(current) + strlen(loader2) + strlen(failed_type_name);
               char* buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, buflen);
@@ -787,12 +788,12 @@
         Handle method_holder_loader (THREAD, target->method_holder()->class_loader());
         if (method_holder_loader() != interface_loader()) {
           ResourceMark rm(THREAD);
-          char* failed_type_name =
+          Symbol* failed_type_symbol =
             SystemDictionary::check_signature_loaders(method_signature,
                                                       method_holder_loader,
                                                       interface_loader,
                                                       true, CHECK);
-          if (failed_type_name != NULL) {
+          if (failed_type_symbol != NULL) {
             const char* msg = "loader constraint violation in interface "
               "itable initialization: when resolving method \"%s\" the class"
               " loader (instance of %s) of the current class, %s, "
@@ -804,6 +805,7 @@
             char* current = klass->name()->as_C_string();
             const char* loader2 = SystemDictionary::loader_name(interface_loader());
             char* iface = InstanceKlass::cast(interf_h())->name()->as_C_string();
+            char* failed_type_name = failed_type_symbol->as_C_string();
             size_t buflen = strlen(msg) + strlen(sig) + strlen(loader1) +
               strlen(current) + strlen(loader2) + strlen(iface) +
               strlen(failed_type_name);
--- a/hotspot/src/share/vm/oops/method.cpp	Thu Mar 28 19:13:22 2013 -0700
+++ b/hotspot/src/share/vm/oops/method.cpp	Fri Mar 29 08:38:00 2013 -0700
@@ -1170,6 +1170,8 @@
     newm->set_stackmap_data(stackmap_data);
   }
 
+  // copy annotations over to new method
+  newcm->copy_annotations_from(cm);
   return newm;
 }
 
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Thu Mar 28 19:13:22 2013 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Fri Mar 29 08:38:00 2013 -0700
@@ -3320,6 +3320,13 @@
   }
   check_deprecated_gcs();
   check_deprecated_gc_flags();
+  if (AssumeMP && !UseSerialGC) {
+    if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
+      warning("If the number of processors is expected to increase from one, then"
+              " you should configure the number of parallel GC threads appropriately"
+              " using -XX:ParallelGCThreads=N");
+    }
+  }
 #else // INCLUDE_ALL_GCS
   assert(verify_serial_gc_flags(), "SerialGC unset");
 #endif // INCLUDE_ALL_GCS
--- a/hotspot/src/share/vm/runtime/globals.hpp	Thu Mar 28 19:13:22 2013 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Fri Mar 29 08:38:00 2013 -0700
@@ -457,6 +457,9 @@
   lp64_product(intx, ObjectAlignmentInBytes, 8,                             \
           "Default object alignment in bytes, 8 is minimum")                \
                                                                             \
+  product(bool, AssumeMP, false,                                            \
+          "Instruct the VM to assume multiple processors are available")    \
+                                                                            \
   /* UseMembar is theoretically a temp flag used for memory barrier         \
    * removal testing.  It was supposed to be removed before FCS but has     \
    * been re-added (see 6401008) */                                         \
--- a/hotspot/src/share/vm/runtime/os.hpp	Thu Mar 28 19:13:22 2013 -0700
+++ b/hotspot/src/share/vm/runtime/os.hpp	Fri Mar 29 08:38:00 2013 -0700
@@ -180,7 +180,7 @@
   // Interface for detecting multiprocessor system
   static inline bool is_MP() {
     assert(_processor_count > 0, "invalid processor count");
-    return _processor_count > 1;
+    return _processor_count > 1 || AssumeMP;
   }
   static julong available_memory();
   static julong physical_memory();
--- a/hotspot/src/share/vm/services/memTracker.hpp	Thu Mar 28 19:13:22 2013 -0700
+++ b/hotspot/src/share/vm/services/memTracker.hpp	Fri Mar 29 08:38:00 2013 -0700
@@ -86,13 +86,13 @@
 
    static inline void set_autoShutdown(bool value) { }
    static void shutdown(ShutdownReason reason) { }
-   static inline bool shutdown_in_progress() {  }
+   static inline bool shutdown_in_progress() { return false; }
    static bool print_memory_usage(BaselineOutputer& out, size_t unit,
-            bool summary_only = true) { }
+            bool summary_only = true) { return false; }
    static bool compare_memory_usage(BaselineOutputer& out, size_t unit,
-            bool summary_only = true) { }
+            bool summary_only = true) { return false; }
 
-   static bool wbtest_wait_for_data_merge() { }
+   static bool wbtest_wait_for_data_merge() { return false; }
 
    static inline void sync() { }
    static inline void thread_exiting(JavaThread* thread) { }
--- a/hotspot/test/runtime/7116786/Test7116786.java	Thu Mar 28 19:13:22 2013 -0700
+++ b/hotspot/test/runtime/7116786/Test7116786.java	Fri Mar 29 08:38:00 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -338,9 +338,12 @@
                  "invalid constant pool index in ldc",
                  "Invalid index in ldc"),
 
-        new Case("case58", "verifier.cpp", true, "verify_switch",
+        /* No longer a valid test case for bytecode version >= 51. Nonzero
+         * padding bytes are permitted with lookupswitch and tableswitch
+         * bytecodes as of JVMS 3d edition */
+        new Case("case58", "verifier.cpp", false, "verify_switch",
                  "bad switch padding",
-                 "Nonzero padding byte in lookswitch or tableswitch"),
+                 "Nonzero padding byte in lookupswitch or tableswitch"),
 
         new Case("case59", "verifier.cpp", true, "verify_switch",
                  "tableswitch low is greater than high",