changeset 5782:aaa34700871c

Merge
author asaha
date Tue, 28 Oct 2014 10:52:17 -0700
parents 312b5f1dc31d 7df3393c9f20
children fddbf8bf7698
files .hgtags make/hotspot_version src/share/vm/classfile/verifier.cpp src/share/vm/classfile/verifier.hpp src/share/vm/classfile/vmSymbols.hpp src/share/vm/runtime/objectMonitor.cpp
diffstat 21 files changed, 319 insertions(+), 174 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Oct 15 10:09:04 2014 -0700
+++ b/.hgtags	Tue Oct 28 10:52:17 2014 -0700
@@ -690,11 +690,26 @@
 d006213be74730453cf5c3ce31f1d1d505334419 jdk7u65-b18
 1d8226b3e9896656451801393eb3ae394faeb638 jdk7u65-b19
 c43b0b843f897a4d8cf0a3566b017b87230dd3b4 jdk7u65-b32
+b92f390febd01615af4a736b4f830f6052aa1d09 hs24.80-b00
+1448ebfef4f1aae0174eca983ad05507730ca6fd hs24.80-b01
+b1d29549dca7e36a4d050af5a54f8f56963a5c7d hs24.80-b02
+ff18bcebe2943527cdbc094375c38c27ec7f2442 hs24.80-b03
+1b9722b5134a8e565d8b8fe851849e034beff057 hs24.80-b04
+04d6919c44db8c9d811ef0ac4775a579f854cdfc hs24.80-b05
+ee18e60e7e8da9f1912895af353564de0330a2b1 hs24.80-b06
+05fe7a87d14908eb3f21a0d29fc72cee2f996b7f jdk7u80-b00
+e2533d62ca887078e4b952a75a75680cfb7894b9 jdk7u80-b01
+bad107a5d096b070355c5a2d80aa50bc5576144b jdk7u80-b02
 d3c9265e12fa115052f18d1e3d379143b56bbf63 jdk7u65-b20
 39776d90970221dd260187acb4c37631e41a66a9 jdk7u67-b01
 1d8226b3e9896656451801393eb3ae394faeb638 jdk7u65-b40
 cf8b3a090e597e59177c5f67d44cdec12309777f jdk7u65-b31
 df855c3f4d31dd7db081d68e3054518380127893 jdk7u65-b33
+39776d90970221dd260187acb4c37631e41a66a9 jdk7u67-b01
+7152f5f6395c66c8d6389100d880882d5cfe9af3 jdk7u67-b31
+4fb7952ebba8ba45be16bdc64184259e8076ffcf jdk7u67-b32
+a20f1b6311e10b755d949a088e7aeca2ba088a59 jdk7u67-b33
+39c07d2fb4d3d97bf3bb53c1c1e199709c5c49fe jdk7u67-b34
 6b37a189944aaa09e81d97d394496464d16bee42 jdk7u66-b00
 121dc94194d9234e2b13c867d875e23e1bdd6abd jdk7u66-b01
 f28ea516eb0b9e99f1e342954ab4642456af4da1 jdk7u66-b09
@@ -736,6 +751,21 @@
 ac701f87d1ea46033c69f3e1cb84fc0a971da70c jdk7u72-b13
 d9b56c6bdddb6f9d8242230f5fdd58f9c7d30ea5 jdk7u72-b14
 a6ae698522bfab3c595a4f8c2c3ee7e8939eb1bb jdk7u72-b30
+492a2abed4ca015459e24f7348233531b7e929d2 jdk7u72-b31
+e6b6d91b3934c281086f8efacb0926e7451cc18b jdk7u75-b00
+9096ac248b379a0f3012f18c7289ec47cdef8459 jdk7u75-b01
+a6964b2822d906eab9c923cdd723cf3dd4facfcd jdk7u75-b02
+6c1a8b7ed616311a932715428620e262076bb68a jdk7u75-b03
+2480d9d778301a3f88b0ab8ee35a585df82528e5 jdk7u75-b04
+d81faf9016ce5c9f98264b1f724b3d6d85b12c07 jdk7u75-b05
+2ec4b796b1de3cfe58f051111dfd70ab367e553e jdk7u75-b06
+3c01618f40c059bf192c0b16176b144113965ea7 jdk7u76-b00
+7b5d132c3a70f3c0667fe9df4cae045b46673267 jdk7u76-b01
+10c2cb5743cac7d6fedc9307af8450283367e5e2 jdk7u76-b02
+99a8d8e3f1c6311853bfc0a86de503830cd3db1a jdk7u76-b03
+15079dd9fd20f252d4c6dc6972508d3375cf5af2 jdk7u76-b04
+0ac38b5b642738fb27b446b0c1bc6108f31f197c jdk7u76-b05
+8580db8e38a232978f69fe627f3373e12c467803 jdk7u76-b06
 b92f390febd01615af4a736b4f830f6052aa1d09 hs24.80-b00
 1448ebfef4f1aae0174eca983ad05507730ca6fd hs24.80-b01
 b1d29549dca7e36a4d050af5a54f8f56963a5c7d hs24.80-b02
--- a/make/hotspot_version	Wed Oct 15 10:09:04 2014 -0700
+++ b/make/hotspot_version	Tue Oct 28 10:52:17 2014 -0700
@@ -1,5 +1,5 @@
 # 
-# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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
@@ -31,7 +31,7 @@
 #
 
 # Don't put quotes (fail windows build).
-HOTSPOT_VM_COPYRIGHT=Copyright 2014
+HOTSPOT_VM_COPYRIGHT=Copyright 2015
 
 HS_MAJOR_VER=24
 HS_MINOR_VER=80
--- a/src/share/vm/ci/bcEscapeAnalyzer.cpp	Wed Oct 15 10:09:04 2014 -0700
+++ b/src/share/vm/ci/bcEscapeAnalyzer.cpp	Tue Oct 28 10:52:17 2014 -0700
@@ -89,8 +89,8 @@
 public:
   ArgumentMap *_vars;
   ArgumentMap *_stack;
-  short _stack_height;
-  short _max_stack;
+  int _stack_height;
+  int _max_stack;
   bool _initialized;
   ArgumentMap empty_map;
 
--- a/src/share/vm/classfile/systemDictionary.cpp	Wed Oct 15 10:09:04 2014 -0700
+++ b/src/share/vm/classfile/systemDictionary.cpp	Tue Oct 28 10:52:17 2014 -0700
@@ -1872,11 +1872,12 @@
   instanceKlass::cast(WK_KLASS(Reference_klass))->set_reference_type(REF_OTHER);
   instanceRefKlass::update_nonstatic_oop_maps(WK_KLASS(Reference_klass));
 
-  initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(PhantomReference_klass), scan, CHECK);
+  initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Cleaner_klass), scan, CHECK);
   instanceKlass::cast(WK_KLASS(SoftReference_klass))->set_reference_type(REF_SOFT);
   instanceKlass::cast(WK_KLASS(WeakReference_klass))->set_reference_type(REF_WEAK);
   instanceKlass::cast(WK_KLASS(FinalReference_klass))->set_reference_type(REF_FINAL);
   instanceKlass::cast(WK_KLASS(PhantomReference_klass))->set_reference_type(REF_PHANTOM);
+  instanceKlass::cast(WK_KLASS(Cleaner_klass))->set_reference_type(REF_CLEANER);
 
   // JSR 292 classes
   WKID jsr292_group_start = WK_KLASS_ENUM_NAME(MethodHandle_klass);
--- a/src/share/vm/classfile/systemDictionary.hpp	Wed Oct 15 10:09:04 2014 -0700
+++ b/src/share/vm/classfile/systemDictionary.hpp	Tue Oct 28 10:52:17 2014 -0700
@@ -126,6 +126,7 @@
   do_klass(WeakReference_klass,                         java_lang_ref_WeakReference,               Pre                 ) \
   do_klass(FinalReference_klass,                        java_lang_ref_FinalReference,              Pre                 ) \
   do_klass(PhantomReference_klass,                      java_lang_ref_PhantomReference,            Pre                 ) \
+  do_klass(Cleaner_klass,                               sun_misc_Cleaner,                          Pre                 ) \
   do_klass(Finalizer_klass,                             java_lang_ref_Finalizer,                   Pre                 ) \
                                                                                                                          \
   do_klass(Thread_klass,                                java_lang_Thread,                          Pre                 ) \
--- a/src/share/vm/classfile/verifier.cpp	Wed Oct 15 10:09:04 2014 -0700
+++ b/src/share/vm/classfile/verifier.cpp	Tue Oct 28 10:52:17 2014 -0700
@@ -1549,14 +1549,14 @@
         case Bytecodes::_invokespecial :
         case Bytecodes::_invokestatic :
           verify_invoke_instructions(
-            &bcs, code_length, &current_frame,
-            &this_uninit, return_type, cp, CHECK_VERIFY(this));
+            &bcs, code_length, &current_frame, (bci >= ex_min && bci < ex_max),
+            &this_uninit, return_type, cp, &stackmap_table, CHECK_VERIFY(this));
           no_control_flow = false; break;
         case Bytecodes::_invokeinterface :
         case Bytecodes::_invokedynamic :
           verify_invoke_instructions(
-            &bcs, code_length, &current_frame,
-            &this_uninit, return_type, cp, CHECK_VERIFY(this));
+            &bcs, code_length, &current_frame, (bci >= ex_min && bci < ex_max),
+            &this_uninit, return_type, cp, &stackmap_table, CHECK_VERIFY(this));
           no_control_flow = false; break;
         case Bytecodes::_new :
         {
@@ -2399,8 +2399,9 @@
 
 void ClassVerifier::verify_invoke_init(
     RawBytecodeStream* bcs, u2 ref_class_index, VerificationType ref_class_type,
-    StackMapFrame* current_frame, u4 code_length, bool *this_uninit,
-    constantPoolHandle cp, TRAPS) {
+    StackMapFrame* current_frame, u4 code_length, bool in_try_block,
+    bool *this_uninit, constantPoolHandle cp, StackMapTable* stackmap_table,
+    TRAPS) {
   u2 bci = bcs->bci();
   VerificationType type = current_frame->pop_stack(
     VerificationType::reference_check(), CHECK_VERIFY(this));
@@ -2416,28 +2417,38 @@
       return;
     }
 
-    // Check if this call is done from inside of a TRY block.  If so, make
-    // sure that all catch clause paths end in a throw.  Otherwise, this
-    // can result in returning an incomplete object.
-    ExceptionTable exhandlers(_method());
-    int exlength = exhandlers.length();
-    for(int i = 0; i < exlength; i++) {
-      u2 start_pc = exhandlers.start_pc(i);
-      u2 end_pc = exhandlers.end_pc(i);
+    // If this invokespecial call is done from inside of a TRY block then make
+    // sure that all catch clause paths end in a throw.  Otherwise, this can
+    // result in returning an incomplete object.
+    if (in_try_block) {
+      ExceptionTable exhandlers(_method());
+      int exlength = exhandlers.length();
+      for(int i = 0; i < exlength; i++) {
+        // Reacquire the table in case a GC happened
+        ExceptionTable exhandlers(_method());
+        u2 start_pc = exhandlers.start_pc(i);
+        u2 end_pc = exhandlers.end_pc(i);
 
-      if (bci >= start_pc && bci < end_pc) {
-        if (!ends_in_athrow(exhandlers.handler_pc(i))) {
-          verify_error(ErrorContext::bad_code(bci),
-            "Bad <init> method call from after the start of a try block");
-          return;
-        } else if (VerboseVerification) {
-          ResourceMark rm;
-          tty->print_cr(
-            "Survived call to ends_in_athrow(): %s",
-                        current_class()->name()->as_C_string());
+        if (bci >= start_pc && bci < end_pc) {
+          if (!ends_in_athrow(exhandlers.handler_pc(i))) {
+            verify_error(ErrorContext::bad_code(bci),
+              "Bad <init> method call from after the start of a try block");
+            return;
+          } else if (VerboseVerification) {
+            ResourceMark rm;
+            tty->print_cr(
+              "Survived call to ends_in_athrow(): %s",
+              current_class()->name()->as_C_string());
+          }
         }
       }
-    }
+
+      // Check the exception handler target stackmaps with the locals from the
+      // incoming stackmap (before initialize_object() changes them to outgoing
+      // state).
+      verify_exception_handler_targets(bci, true, current_frame,
+                                       stackmap_table, CHECK_VERIFY(this));
+    } // in_try_block
 
     current_frame->initialize_object(type, current_type());
     *this_uninit = true;
@@ -2493,6 +2504,13 @@
         }
       }
     }
+    // Check the exception handler target stackmaps with the locals from the
+    // incoming stackmap (before initialize_object() changes them to outgoing
+    // state).
+    if (in_try_block) {
+      verify_exception_handler_targets(bci, *this_uninit, current_frame,
+                                       stackmap_table, CHECK_VERIFY(this));
+    }
     current_frame->initialize_object(type, new_class_type);
   } else {
     verify_error(ErrorContext::bad_type(bci, current_frame->stack_top_ctx()),
@@ -2503,8 +2521,8 @@
 
 void ClassVerifier::verify_invoke_instructions(
     RawBytecodeStream* bcs, u4 code_length, StackMapFrame* current_frame,
-    bool *this_uninit, VerificationType return_type,
-    constantPoolHandle cp, TRAPS) {
+    bool in_try_block, bool *this_uninit, VerificationType return_type,
+    constantPoolHandle cp, StackMapTable* stackmap_table, TRAPS) {
   // Make sure the constant pool item is the right type
   u2 index = bcs->get_index_u2();
   Bytecodes::Code opcode = bcs->raw_code();
@@ -2640,7 +2658,8 @@
       opcode != Bytecodes::_invokedynamic) {
     if (method_name == vmSymbols::object_initializer_name()) {  // <init> method
       verify_invoke_init(bcs, index, ref_class_type, current_frame,
-        code_length, this_uninit, cp, CHECK_VERIFY(this));
+        code_length, in_try_block, this_uninit, cp, stackmap_table,
+        CHECK_VERIFY(this));
     } else {   // other methods
       // Ensures that target class is assignable to method class.
       if (opcode == Bytecodes::_invokespecial) {
--- a/src/share/vm/classfile/verifier.hpp	Wed Oct 15 10:09:04 2014 -0700
+++ b/src/share/vm/classfile/verifier.hpp	Tue Oct 28 10:52:17 2014 -0700
@@ -299,8 +299,9 @@
 
   void verify_invoke_init(
     RawBytecodeStream* bcs, u2 ref_index, VerificationType ref_class_type,
-    StackMapFrame* current_frame, u4 code_length, bool* this_uninit,
-    constantPoolHandle cp, TRAPS);
+    StackMapFrame* current_frame, u4 code_length, bool in_try_block,
+    bool* this_uninit, constantPoolHandle cp, StackMapTable* stackmap_table,
+    TRAPS);
 
   // Used by ends_in_athrow() to push all handlers that contain bci onto
   // the handler_stack, if the handler is not already on the stack.
@@ -314,8 +315,8 @@
 
   void verify_invoke_instructions(
     RawBytecodeStream* bcs, u4 code_length, StackMapFrame* current_frame,
-    bool* this_uninit, VerificationType return_type,
-    constantPoolHandle cp, TRAPS);
+    bool in_try_block, bool* this_uninit, VerificationType return_type,
+    constantPoolHandle cp, StackMapTable* stackmap_table, TRAPS);
 
   VerificationType get_newarray_type(u2 index, u2 bci, TRAPS);
   void verify_anewarray(u2 bci, u2 index, constantPoolHandle cp,
--- a/src/share/vm/classfile/vmSymbols.hpp	Wed Oct 15 10:09:04 2014 -0700
+++ b/src/share/vm/classfile/vmSymbols.hpp	Tue Oct 28 10:52:17 2014 -0700
@@ -81,6 +81,7 @@
   template(java_lang_ref_WeakReference,               "java/lang/ref/WeakReference")              \
   template(java_lang_ref_FinalReference,              "java/lang/ref/FinalReference")             \
   template(java_lang_ref_PhantomReference,            "java/lang/ref/PhantomReference")           \
+  template(sun_misc_Cleaner,                          "sun/misc/Cleaner")                         \
   template(java_lang_ref_Finalizer,                   "java/lang/ref/Finalizer")                  \
   template(java_lang_reflect_AccessibleObject,        "java/lang/reflect/AccessibleObject")       \
   template(java_lang_reflect_Method,                  "java/lang/reflect/Method")                 \
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed Oct 15 10:09:04 2014 -0700
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Tue Oct 28 10:52:17 2014 -0700
@@ -757,7 +757,7 @@
   // Support for parallelizing survivor space rescan
   if ((CMSParallelRemarkEnabled && CMSParallelSurvivorRemarkEnabled) || CMSParallelInitialMarkEnabled) {
     const size_t max_plab_samples =
-      ((DefNewGeneration*)_young_gen)->max_survivor_size()/MinTLABSize;
+      ((DefNewGeneration*)_young_gen)->max_survivor_size() / plab_sample_minimum_size();
 
     _survivor_plab_array  = NEW_C_HEAP_ARRAY(ChunkArray, ParallelGCThreads, mtGC);
     _survivor_chunk_array = NEW_C_HEAP_ARRAY(HeapWord*, 2*max_plab_samples, mtGC);
@@ -824,6 +824,12 @@
   _inter_sweep_timer.start();  // start of time
 }
 
+size_t CMSCollector::plab_sample_minimum_size() {
+  // The default value of MinTLABSize is 2k, but there is
+  // no way to get the default value if the flag has been overridden.
+  return MAX2(ThreadLocalAllocBuffer::min_size() * HeapWordSize, 2 * K);
+}
+
 const char* ConcurrentMarkSweepGeneration::name() const {
   return "concurrent mark-sweep generation";
 }
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Wed Oct 15 10:09:04 2014 -0700
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Tue Oct 28 10:52:17 2014 -0700
@@ -766,6 +766,10 @@
   size_t*    _cursor;
   ChunkArray* _survivor_plab_array;
 
+  // A bounded minimum size of PLABs, should not return too small values since
+  // this will affect the size of the data structures used for parallel young gen rescan
+  size_t plab_sample_minimum_size();
+
   // Support for marking stack overflow handling
   bool take_from_overflow_list(size_t num, CMSMarkStack* to_stack);
   bool par_take_from_overflow_list(size_t num,
--- a/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp	Wed Oct 15 10:09:04 2014 -0700
+++ b/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp	Tue Oct 28 10:52:17 2014 -0700
@@ -62,7 +62,8 @@
   ParGCAllocBuffer(size_t word_sz);
 
   static const size_t min_size() {
-    return ThreadLocalAllocBuffer::min_size();
+    // Make sure that we return something that is larger than AlignmentReserve
+    return align_object_size(MAX2(MinTLABSize / HeapWordSize, (uintx)oopDesc::header_size())) + AlignmentReserve;
   }
 
   static const size_t max_size() {
--- a/src/share/vm/memory/referenceProcessor.cpp	Wed Oct 15 10:09:04 2014 -0700
+++ b/src/share/vm/memory/referenceProcessor.cpp	Tue Oct 28 10:52:17 2014 -0700
@@ -119,6 +119,7 @@
   _discoveredWeakRefs    = &_discoveredSoftRefs[_max_num_q];
   _discoveredFinalRefs   = &_discoveredWeakRefs[_max_num_q];
   _discoveredPhantomRefs = &_discoveredFinalRefs[_max_num_q];
+  _discoveredCleanerRefs = &_discoveredPhantomRefs[_max_num_q];
 
   // Initialize all entries to NULL
   for (uint i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
@@ -250,6 +251,13 @@
     phantom_count =
       process_discovered_reflist(_discoveredPhantomRefs, NULL, false,
                                  is_alive, keep_alive, complete_gc, task_executor);
+
+    // Process cleaners, but include them in phantom statistics.  We expect
+    // Cleaner references to be temporary, and don't want to deal with
+    // possible incompatibilities arising from making it more visible.
+    phantom_count +=
+      process_discovered_reflist(_discoveredCleanerRefs, NULL, false,
+                                 is_alive, keep_alive, complete_gc, task_executor);
   }
 
   // Weak global JNI references. It would make more sense (semantically) to
@@ -899,6 +907,7 @@
   balance_queues(_discoveredWeakRefs);
   balance_queues(_discoveredFinalRefs);
   balance_queues(_discoveredPhantomRefs);
+  balance_queues(_discoveredCleanerRefs);
 }
 
 size_t
@@ -1058,6 +1067,9 @@
     case REF_PHANTOM:
       list = &_discoveredPhantomRefs[id];
       break;
+    case REF_CLEANER:
+      list = &_discoveredCleanerRefs[id];
+      break;
     case REF_NONE:
       // we should not reach here if we are an instanceRefKlass
     default:
@@ -1353,6 +1365,17 @@
       preclean_discovered_reflist(_discoveredPhantomRefs[i], is_alive,
                                   keep_alive, complete_gc, yield);
     }
+
+    // Cleaner references.  Included in timing for phantom references.  We
+    // expect Cleaner references to be temporary, and don't want to deal with
+    // possible incompatibilities arising from making it more visible.
+    for (uint i = 0; i < _max_num_q; i++) {
+      if (yield->should_return()) {
+        return;
+      }
+      preclean_discovered_reflist(_discoveredCleanerRefs[i], is_alive,
+                                  keep_alive, complete_gc, yield);
+    }
   }
 }
 
@@ -1421,6 +1444,7 @@
      case 1: return "WeakRef";
      case 2: return "FinalRef";
      case 3: return "PhantomRef";
+     case 4: return "CleanerRef";
    }
    ShouldNotReachHere();
    return NULL;
--- a/src/share/vm/memory/referenceProcessor.hpp	Wed Oct 15 10:09:04 2014 -0700
+++ b/src/share/vm/memory/referenceProcessor.hpp	Tue Oct 28 10:52:17 2014 -0700
@@ -272,9 +272,10 @@
   DiscoveredList* _discoveredWeakRefs;
   DiscoveredList* _discoveredFinalRefs;
   DiscoveredList* _discoveredPhantomRefs;
+  DiscoveredList* _discoveredCleanerRefs;
 
  public:
-  static int number_of_subclasses_of_ref() { return (REF_PHANTOM - REF_OTHER); }
+  static int number_of_subclasses_of_ref() { return (REF_CLEANER - REF_OTHER); }
 
   uint num_q()                             { return _num_q; }
   uint max_num_q()                         { return _max_num_q; }
--- a/src/share/vm/memory/referenceType.hpp	Wed Oct 15 10:09:04 2014 -0700
+++ b/src/share/vm/memory/referenceType.hpp	Tue Oct 28 10:52:17 2014 -0700
@@ -35,7 +35,8 @@
   REF_SOFT,      // Subclass of java/lang/ref/SoftReference
   REF_WEAK,      // Subclass of java/lang/ref/WeakReference
   REF_FINAL,     // Subclass of java/lang/ref/FinalReference
-  REF_PHANTOM    // Subclass of java/lang/ref/PhantomReference
+  REF_PHANTOM,   // Subclass of java/lang/ref/PhantomReference
+  REF_CLEANER    // Subclass of sun/misc/Cleaner
 };
 
 #endif // SHARE_VM_MEMORY_REFRERENCETYPE_HPP
--- a/src/share/vm/memory/threadLocalAllocBuffer.cpp	Wed Oct 15 10:09:04 2014 -0700
+++ b/src/share/vm/memory/threadLocalAllocBuffer.cpp	Tue Oct 28 10:52:17 2014 -0700
@@ -240,22 +240,19 @@
 }
 
 size_t ThreadLocalAllocBuffer::initial_desired_size() {
-  size_t init_sz;
+  size_t init_sz = 0;
 
   if (TLABSize > 0) {
-    init_sz = MIN2(TLABSize / HeapWordSize, max_size());
-  } else if (global_stats() == NULL) {
-    // Startup issue - main thread initialized before heap initialized.
-    init_sz = min_size();
-  } else {
+    init_sz = TLABSize / HeapWordSize;
+  } else if (global_stats() != NULL) {
     // Initial size is a function of the average number of allocating threads.
     unsigned nof_threads = global_stats()->allocating_threads_avg();
 
     init_sz  = (Universe::heap()->tlab_capacity(myThread()) / HeapWordSize) /
                       (nof_threads * target_refills());
     init_sz = align_object_size(init_sz);
-    init_sz = MIN2(MAX2(init_sz, min_size()), max_size());
   }
+  init_sz = MIN2(MAX2(init_sz, min_size()), max_size());
   return init_sz;
 }
 
--- a/src/share/vm/memory/threadLocalAllocBuffer.hpp	Wed Oct 15 10:09:04 2014 -0700
+++ b/src/share/vm/memory/threadLocalAllocBuffer.hpp	Tue Oct 28 10:52:17 2014 -0700
@@ -103,7 +103,7 @@
     // do nothing.  tlabs must be inited by initialize() calls
   }
 
-  static const size_t min_size()                 { return align_object_size(MinTLABSize / HeapWordSize); }
+  static const size_t min_size()                 { return align_object_size(MinTLABSize / HeapWordSize) + alignment_reserve(); }
   static const size_t max_size();
 
   HeapWord* start() const                        { return _start; }
--- a/src/share/vm/runtime/objectMonitor.cpp	Wed Oct 15 10:09:04 2014 -0700
+++ b/src/share/vm/runtime/objectMonitor.cpp	Tue Oct 28 10:52:17 2014 -0700
@@ -1633,6 +1633,33 @@
        }
      }
 
+     // Without the fix for 8028280, it is possible for the above call:
+     //
+     //   Thread::SpinAcquire (&_WaitSetLock, "WaitSet - unlink") ;
+     //
+     // to consume the unpark() that was done when the successor was set.
+     // The solution for this very rare possibility is to redo the unpark()
+     // outside of the JvmtiExport::should_post_monitor_waited() check.
+     //
+     if (node._notified != 0 && _succ == Self) {
+       // In this part of the monitor wait-notify-reenter protocol it
+       // is possible (and normal) for another thread to do a fastpath
+       // monitor enter-exit while this thread is still trying to get
+       // to the reenter portion of the protocol.
+       //
+       // The ObjectMonitor was notified and the current thread is
+       // the successor which also means that an unpark() has already
+       // been done. The JVMTI_EVENT_MONITOR_WAITED event handler can
+       // consume the unpark() that was done when the successor was
+       // set because the same ParkEvent is shared between Java
+       // monitors and JVM/TI RawMonitors (for now).
+       //
+       // We redo the unpark() to ensure forward progress, i.e., we
+       // don't want all pending threads hanging (parked) with none
+       // entering the unlocked monitor.
+       node._event->unpark();
+     }
+
      if (event.should_commit()) {
        post_monitor_wait_event(&event, node._notifier_tid, millis, ret == OS_TIMEOUT);
      }
--- a/src/share/vm/runtime/vmStructs.cpp	Wed Oct 15 10:09:04 2014 -0700
+++ b/src/share/vm/runtime/vmStructs.cpp	Tue Oct 28 10:52:17 2014 -0700
@@ -706,6 +706,7 @@
       static_field(SystemDictionary,            WK_KLASS(WeakReference_klass),                 klassOop)                             \
       static_field(SystemDictionary,            WK_KLASS(FinalReference_klass),                klassOop)                             \
       static_field(SystemDictionary,            WK_KLASS(PhantomReference_klass),              klassOop)                             \
+      static_field(SystemDictionary,            WK_KLASS(Cleaner_klass),                       klassOop)                             \
       static_field(SystemDictionary,            WK_KLASS(Finalizer_klass),                     klassOop)                             \
       static_field(SystemDictionary,            WK_KLASS(Thread_klass),                        klassOop)                             \
       static_field(SystemDictionary,            WK_KLASS(ThreadGroup_klass),                   klassOop)                             \
--- a/src/share/vm/utilities/defaultStream.hpp	Wed Oct 15 10:09:04 2014 -0700
+++ b/src/share/vm/utilities/defaultStream.hpp	Tue Oct 28 10:52:17 2014 -0700
@@ -41,6 +41,8 @@
 
   void init();
   void init_log();
+  fileStream* open_file(const char* log_name);
+  void start_log();
   void finish_log();
   void finish_log_on_error(char *buf, int buflen);
  public:
--- a/src/share/vm/utilities/ostream.cpp	Wed Oct 15 10:09:04 2014 -0700
+++ b/src/share/vm/utilities/ostream.cpp	Tue Oct 28 10:52:17 2014 -0700
@@ -405,6 +405,11 @@
     buffer_length += strlen(tms);
   }
 
+  // File name is too long.
+  if (buffer_length > JVM_MAXPATHLEN) {
+    return NULL;
+  }
+
   // Create big enough buffer.
   char *buf = NEW_C_HEAP_ARRAY(char, buffer_length, mtInternal);
 
@@ -473,53 +478,6 @@
                                 timestr);
 }
 
-#ifndef PRODUCT
-void test_loggc_filename() {
-  int pid;
-  char  tms[32];
-  char  i_result[FILENAMEBUFLEN];
-  const char* o_result;
-  get_datetime_string(tms, sizeof(tms));
-  pid = os::current_process_id();
-
-  // test.log
-  jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "test.log", tms);
-  o_result = make_log_name_internal("test.log", NULL, pid, tms);
-  assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"test.log\", NULL)");
-  FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
-
-  // test-%t-%p.log
-  jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "test-%s-pid%u.log", tms, pid);
-  o_result = make_log_name_internal("test-%t-%p.log", NULL, pid, tms);
-  assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"test-%%t-%%p.log\", NULL)");
-  FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
-
-  // test-%t%p.log
-  jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "test-%spid%u.log", tms, pid);
-  o_result = make_log_name_internal("test-%t%p.log", NULL, pid, tms);
-  assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"test-%%t%%p.log\", NULL)");
-  FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
-
-  // %p%t.log
-  jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "pid%u%s.log", pid, tms);
-  o_result = make_log_name_internal("%p%t.log", NULL, pid, tms);
-  assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"%%p%%t.log\", NULL)");
-  FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
-
-  // %p-test.log
-  jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "pid%u-test.log", pid);
-  o_result = make_log_name_internal("%p-test.log", NULL, pid, tms);
-  assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"%%p-test.log\", NULL)");
-  FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
-
-  // %t.log
-  jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "%s.log", tms);
-  o_result = make_log_name_internal("%t.log", NULL, pid, tms);
-  assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"%%t.log\", NULL)");
-  FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
-}
-#endif // PRODUCT
-
 fileStream::fileStream(const char* file_name) {
   _file = fopen(file_name, "w");
   if (_file != NULL) {
@@ -805,87 +763,55 @@
   return _log_file != NULL;
 }
 
+fileStream* defaultStream::open_file(const char* log_name) {
+  const char* try_name = make_log_name(log_name, NULL);
+  if (try_name == NULL) {
+    warning("Cannot open file %s: file name is too long.\n", log_name);
+    return NULL;
+  }
+
+  fileStream* file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
+  FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
+  if (file->is_open()) {
+    return file;
+  }
+
+  // Try again to open the file in the temp directory.
+  delete file;
+  char warnbuf[O_BUFLEN*2];
+  jio_snprintf(warnbuf, sizeof(warnbuf), "Warning:  Cannot open log file: %s\n", log_name);
+  // Note:  This feature is for maintainer use only.  No need for L10N.
+  jio_print(warnbuf);
+  try_name = make_log_name(log_name, os::get_temp_directory());
+  if (try_name == NULL) {
+    warning("Cannot open file %s: file name is too long for directory %s.\n", log_name, os::get_temp_directory());
+    return NULL;
+  }
+
+  jio_snprintf(warnbuf, sizeof(warnbuf),
+               "Warning:  Forcing option -XX:LogFile=%s\n", try_name);
+  jio_print(warnbuf);
+
+  file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
+  FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
+  if (file->is_open()) {
+    return file;
+  }
+
+  delete file;
+  return NULL;
+}
+
 void defaultStream::init_log() {
   // %%% Need a MutexLocker?
   const char* log_name = LogFile != NULL ? LogFile : "hotspot.log";
-  const char* try_name = make_log_name(log_name, NULL);
-  fileStream* file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
-  if (!file->is_open()) {
-    // Try again to open the file.
-    char warnbuf[O_BUFLEN*2];
-    jio_snprintf(warnbuf, sizeof(warnbuf),
-                 "Warning:  Cannot open log file: %s\n", try_name);
-    // Note:  This feature is for maintainer use only.  No need for L10N.
-    jio_print(warnbuf);
-    FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
-    try_name = make_log_name("hs_pid%p.log", os::get_temp_directory());
-    jio_snprintf(warnbuf, sizeof(warnbuf),
-                 "Warning:  Forcing option -XX:LogFile=%s\n", try_name);
-    jio_print(warnbuf);
-    delete file;
-    file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
-    FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
-  }
-  if (file->is_open()) {
+  fileStream* file = open_file(log_name);
+
+  if (file != NULL) {
     _log_file = file;
-    xmlStream* xs = new(ResourceObj::C_HEAP, mtInternal) xmlStream(file);
-    _outer_xmlStream = xs;
-    if (this == tty)  xtty = xs;
-    // Write XML header.
-    xs->print_cr("<?xml version='1.0' encoding='UTF-8'?>");
-    // (For now, don't bother to issue a DTD for this private format.)
-    jlong time_ms = os::javaTimeMillis() - tty->time_stamp().milliseconds();
-    // %%% Should be: jlong time_ms = os::start_time_milliseconds(), if
-    // we ever get round to introduce that method on the os class
-    xs->head("hotspot_log version='%d %d'"
-             " process='%d' time_ms='"INT64_FORMAT"'",
-             LOG_MAJOR_VERSION, LOG_MINOR_VERSION,
-             os::current_process_id(), time_ms);
-    // Write VM version header immediately.
-    xs->head("vm_version");
-    xs->head("name"); xs->text("%s", VM_Version::vm_name()); xs->cr();
-    xs->tail("name");
-    xs->head("release"); xs->text("%s", VM_Version::vm_release()); xs->cr();
-    xs->tail("release");
-    xs->head("info"); xs->text("%s", VM_Version::internal_vm_info_string()); xs->cr();
-    xs->tail("info");
-    xs->tail("vm_version");
-    // Record information about the command-line invocation.
-    xs->head("vm_arguments");  // Cf. Arguments::print_on()
-    if (Arguments::num_jvm_flags() > 0) {
-      xs->head("flags");
-      Arguments::print_jvm_flags_on(xs->text());
-      xs->tail("flags");
-    }
-    if (Arguments::num_jvm_args() > 0) {
-      xs->head("args");
-      Arguments::print_jvm_args_on(xs->text());
-      xs->tail("args");
-    }
-    if (Arguments::java_command() != NULL) {
-      xs->head("command"); xs->text()->print_cr("%s", Arguments::java_command());
-      xs->tail("command");
-    }
-    if (Arguments::sun_java_launcher() != NULL) {
-      xs->head("launcher"); xs->text()->print_cr("%s", Arguments::sun_java_launcher());
-      xs->tail("launcher");
-    }
-    if (Arguments::system_properties() !=  NULL) {
-      xs->head("properties");
-      // Print it as a java-style property list.
-      // System properties don't generally contain newlines, so don't bother with unparsing.
-      for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) {
-        xs->text()->print_cr("%s=%s", p->key(), p->value());
-      }
-      xs->tail("properties");
-    }
-    xs->tail("vm_arguments");
-    // tty output per se is grouped under the <tty>...</tty> element.
-    xs->head("tty");
-    // All further non-markup text gets copied to the tty:
-    xs->_text = this;  // requires friend declaration!
+    _outer_xmlStream = new(ResourceObj::C_HEAP, mtInternal) xmlStream(file);
+    start_log();
   } else {
-    delete(file);
     // and leave xtty as NULL
     LogVMOutput = false;
     DisplayVMOutput = true;
@@ -893,6 +819,64 @@
   }
 }
 
+void defaultStream::start_log() {
+  xmlStream* xs = _outer_xmlStream;
+  if (this == tty)  xtty = xs;
+  // Write XML header.
+  xs->print_cr("<?xml version='1.0' encoding='UTF-8'?>");
+  // (For now, don't bother to issue a DTD for this private format.)
+  jlong time_ms = os::javaTimeMillis() - tty->time_stamp().milliseconds();
+  // %%% Should be: jlong time_ms = os::start_time_milliseconds(), if
+  // we ever get round to introduce that method on the os class
+  xs->head("hotspot_log version='%d %d'"
+           " process='%d' time_ms='"INT64_FORMAT"'",
+           LOG_MAJOR_VERSION, LOG_MINOR_VERSION,
+           os::current_process_id(), time_ms);
+  // Write VM version header immediately.
+  xs->head("vm_version");
+  xs->head("name"); xs->text("%s", VM_Version::vm_name()); xs->cr();
+  xs->tail("name");
+  xs->head("release"); xs->text("%s", VM_Version::vm_release()); xs->cr();
+  xs->tail("release");
+  xs->head("info"); xs->text("%s", VM_Version::internal_vm_info_string()); xs->cr();
+  xs->tail("info");
+  xs->tail("vm_version");
+  // Record information about the command-line invocation.
+  xs->head("vm_arguments");  // Cf. Arguments::print_on()
+  if (Arguments::num_jvm_flags() > 0) {
+    xs->head("flags");
+    Arguments::print_jvm_flags_on(xs->text());
+    xs->tail("flags");
+  }
+  if (Arguments::num_jvm_args() > 0) {
+    xs->head("args");
+    Arguments::print_jvm_args_on(xs->text());
+    xs->tail("args");
+  }
+  if (Arguments::java_command() != NULL) {
+    xs->head("command"); xs->text()->print_cr("%s", Arguments::java_command());
+    xs->tail("command");
+  }
+  if (Arguments::sun_java_launcher() != NULL) {
+    xs->head("launcher"); xs->text()->print_cr("%s", Arguments::sun_java_launcher());
+    xs->tail("launcher");
+  }
+  if (Arguments::system_properties() !=  NULL) {
+    xs->head("properties");
+    // Print it as a java-style property list.
+    // System properties don't generally contain newlines, so don't bother with unparsing.
+    for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) {
+      xs->text()->print_cr("%s=%s", p->key(), p->value());
+    }
+    xs->tail("properties");
+  }
+  xs->tail("vm_arguments");
+  // tty output per se is grouped under the <tty>...</tty> element.
+  xs->head("tty");
+  // All further non-markup text gets copied to the tty:
+  xs->_text = this;  // requires friend declaration!
+}
+
 // finish_log() is called during normal VM shutdown. finish_log_on_error() is
 // called by ostream_abort() after a fatal error.
 //
@@ -1251,6 +1235,50 @@
 }
 
 #ifndef PRODUCT
+void test_loggc_filename() {
+  const char* o_result;
+
+  {
+    // longest filename
+    char longest_name[JVM_MAXPATHLEN];
+    memset(longest_name, 'a', sizeof(longest_name));
+    longest_name[JVM_MAXPATHLEN - 1] = '\0';
+    o_result = make_log_name((const char*)&longest_name, NULL);
+    assert(strcmp(longest_name, o_result) == 0, err_msg("longest name does not match. expected '%s' but got '%s'", longest_name, o_result));
+    FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
+  }
+
+  {
+    // too long file name
+    char too_long_name[JVM_MAXPATHLEN + 100];
+    int too_long_length = sizeof(too_long_name);
+    memset(too_long_name, 'a', too_long_length);
+    too_long_name[too_long_length - 1] = '\0';
+    o_result = make_log_name((const char*)&too_long_name, NULL);
+    assert(o_result == NULL, err_msg("Too long file name should return NULL, but got '%s'", o_result));
+  }
+
+  {
+    // too long with pid
+    char longest_name[JVM_MAXPATHLEN];
+    memset(longest_name, 'a', JVM_MAXPATHLEN);
+    longest_name[JVM_MAXPATHLEN - 3] = '%';
+    longest_name[JVM_MAXPATHLEN - 2] = 'p';
+    longest_name[JVM_MAXPATHLEN - 1] = '\0';
+    o_result = make_log_name((const char*)&longest_name, NULL);
+    assert(o_result == NULL, err_msg("Too long file name after %%p pid expansion should return NULL, but got '%s'", o_result));
+  }
+
+  {
+    // too long with pid (star)
+    char longest_name[JVM_MAXPATHLEN];
+    memset(longest_name, 'a', JVM_MAXPATHLEN);
+    longest_name[JVM_MAXPATHLEN - 2] = '*';
+    longest_name[JVM_MAXPATHLEN - 1] = '\0';
+    o_result = make_log_name((const char*)&longest_name, NULL);
+    assert(o_result == NULL, err_msg("Too long file name after star (pid) expansion should return NULL, but got '%s'", o_result));
+  }
+}
 
 #if defined(SOLARIS) || defined(LINUX) || defined(_ALLBSD_SOURCE)
 #include <sys/types.h>
--- a/test/serviceability/sa/jmap-hashcode/Test8028623.java	Wed Oct 15 10:09:04 2014 -0700
+++ b/test/serviceability/sa/jmap-hashcode/Test8028623.java	Tue Oct 28 10:52:17 2014 -0700
@@ -38,12 +38,12 @@
 
 public class Test8028623 {
 
-  public static int à = 1;
+  public static int ?? = 1;
   public static String dumpFile = "heap.out";
 
   public static void main (String[] args) {
 
-    System.out.println(Ã);
+    System.out.println(??);
 
     try {
         int pid = ProcessTools.getProcessId();