changeset 7852:32ad3e099966

Merge
author dlong
date Fri, 16 Jan 2015 05:02:11 -0500
parents 520b40caa4d3 03237a717eca
children 8596a20c8de1
files test/runtime/7194254/Test7194254.java
diffstat 31 files changed, 417 insertions(+), 304 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Jan 15 11:30:13 2015 +0100
+++ b/.hgtags	Fri Jan 16 05:02:11 2015 -0500
@@ -447,3 +447,4 @@
 38cb4fbd47e3472bd1b5ebac83bda96fe4869c4f jdk9-b42
 65a9747147b8090037541040ba67156ec914db6a jdk9-b43
 43a44b56dca61a4d766a20f0528fdd8b5ceff873 jdk9-b44
+5dc8184af1e2bb30b0103113d1f1a58a21a80c37 jdk9-b45
--- a/src/cpu/ppc/vm/templateInterpreter_ppc.cpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/cpu/ppc/vm/templateInterpreter_ppc.cpp	Fri Jan 16 05:02:11 2015 -0500
@@ -264,11 +264,11 @@
       __ cmpdi(CCR0, Rmdo, 0);
       __ beq(CCR0, no_mdo);
 
-      // Increment backedge counter in the MDO.
-      const int mdo_bc_offs = in_bytes(MethodData::backedge_counter_offset()) + in_bytes(InvocationCounter::counter_offset());
-      __ lwz(Rscratch2, mdo_bc_offs, Rmdo);
+      // Increment invocation counter in the MDO.
+      const int mdo_ic_offs = in_bytes(MethodData::invocation_counter_offset()) + in_bytes(InvocationCounter::counter_offset());
+      __ lwz(Rscratch2, mdo_ic_offs, Rmdo);
       __ addi(Rscratch2, Rscratch2, increment);
-      __ stw(Rscratch2, mdo_bc_offs, Rmdo);
+      __ stw(Rscratch2, mdo_ic_offs, Rmdo);
       __ load_const_optimized(Rscratch1, mask, R0);
       __ and_(Rscratch1, Rscratch2, Rscratch1);
       __ bne(CCR0, done);
@@ -276,12 +276,12 @@
     }
 
     // Increment counter in MethodCounters*.
-    const int mo_bc_offs = in_bytes(MethodCounters::backedge_counter_offset()) + in_bytes(InvocationCounter::counter_offset());
+    const int mo_ic_offs = in_bytes(MethodCounters::invocation_counter_offset()) + in_bytes(InvocationCounter::counter_offset());
     __ bind(no_mdo);
     __ get_method_counters(R19_method, R3_counters, done);
-    __ lwz(Rscratch2, mo_bc_offs, R3_counters);
+    __ lwz(Rscratch2, mo_ic_offs, R3_counters);
     __ addi(Rscratch2, Rscratch2, increment);
-    __ stw(Rscratch2, mo_bc_offs, R3_counters);
+    __ stw(Rscratch2, mo_ic_offs, R3_counters);
     __ load_const_optimized(Rscratch1, mask, R0);
     __ and_(Rscratch1, Rscratch2, Rscratch1);
     __ beq(CCR0, *overflow);
--- a/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp	Fri Jan 16 05:02:11 2015 -0500
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2008, 2011 Red Hat, Inc.
+ * Copyright 2007, 2008, 2011, 2015, Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -237,7 +237,13 @@
   // operation.  Note that some platforms only support this with the
   // limitation that the only valid value to store is the immediate
   // constant 1.  There is a test for this in JNI_CreateJavaVM().
-  return __sync_lock_test_and_set (dest, exchange_value);
+  jint result = __sync_lock_test_and_set (dest, exchange_value);
+  // All atomic operations are expected to be full memory barriers
+  // (see atomic.hpp). However, __sync_lock_test_and_set is not
+  // a full memory barrier, but an acquire barrier. Hence, this added
+  // barrier.
+  __sync_synchronize();
+  return result;
 #endif // M68K
 #endif // ARM
 }
@@ -250,7 +256,9 @@
 #ifdef M68K
   return m68k_lock_test_and_set(dest, exchange_value);
 #else
-  return __sync_lock_test_and_set (dest, exchange_value);
+  intptr_t result = __sync_lock_test_and_set (dest, exchange_value);
+  __sync_synchronize();
+  return result;
 #endif // M68K
 #endif // ARM
 }
--- a/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp	Fri Jan 16 05:02:11 2015 -0500
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2008, 2011 Red Hat, Inc.
+ * Copyright 2007, 2008, 2011, 2015, Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -231,7 +231,13 @@
   // operation.  Note that some platforms only support this with the
   // limitation that the only valid value to store is the immediate
   // constant 1.  There is a test for this in JNI_CreateJavaVM().
-  return __sync_lock_test_and_set (dest, exchange_value);
+  jint result = __sync_lock_test_and_set (dest, exchange_value);
+  // All atomic operations are expected to be full memory barriers
+  // (see atomic.hpp). However, __sync_lock_test_and_set is not
+  // a full memory barrier, but an acquire barrier. Hence, this added
+  // barrier.
+  __sync_synchronize();
+  return result;
 #endif // M68K
 #endif // ARM
 }
@@ -244,7 +250,9 @@
 #ifdef M68K
   return m68k_lock_test_and_set(dest, exchange_value);
 #else
-  return __sync_lock_test_and_set (dest, exchange_value);
+  intptr_t result = __sync_lock_test_and_set (dest, exchange_value);
+  __sync_synchronize();
+  return result;
 #endif // M68K
 #endif // ARM
 }
--- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri Jan 16 05:02:11 2015 -0500
@@ -1910,7 +1910,6 @@
   }
 
   void work(uint worker_id) {
-    double start = os::elapsedTime();
     FreeRegionList local_cleanup_list("Local Cleanup List");
     HRRSCleanupTask hrrs_cleanup_task;
     G1NoteEndOfConcMarkClosure g1_note_end(_g1h, &local_cleanup_list,
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Jan 16 05:02:11 2015 -0500
@@ -1229,7 +1229,6 @@
       TraceCollectorStats tcs(g1mm()->full_collection_counters());
       TraceMemoryManagerStats tms(true /* fullGC */, gc_cause());
 
-      double start = os::elapsedTime();
       g1_policy()->record_full_collection_start();
 
       // Note: When we have a more flexible GC logging framework that
@@ -1436,7 +1435,6 @@
 
       _allocator->init_mutator_alloc_region();
 
-      double end = os::elapsedTime();
       g1_policy()->record_full_collection_end();
 
       if (G1Log::fine()) {
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Fri Jan 16 05:02:11 2015 -0500
@@ -56,7 +56,6 @@
 class GenerationSpec;
 class OopsInHeapRegionClosure;
 class G1KlassScanClosure;
-class G1ScanHeapEvacClosure;
 class ObjectClosure;
 class SpaceClosure;
 class CompactibleSpaceClosure;
--- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Fri Jan 16 05:02:11 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -153,14 +153,6 @@
   _inc_cset_predicted_elapsed_time_ms(0.0),
   _inc_cset_predicted_elapsed_time_ms_diffs(0.0),
 
-#ifdef _MSC_VER // the use of 'this' below gets a warning, make it go away
-#pragma warning( disable:4355 ) // 'this' : used in base member initializer list
-#endif // _MSC_VER
-
-  _short_lived_surv_rate_group(new SurvRateGroup(this, "Short Lived",
-                                                 G1YoungSurvRateNumRegionsSummary)),
-  _survivor_surv_rate_group(new SurvRateGroup(this, "Survivor",
-                                              G1YoungSurvRateNumRegionsSummary)),
   // add here any more surv rate groups
   _recorded_survivor_regions(0),
   _recorded_survivor_head(NULL),
@@ -169,6 +161,22 @@
 
   _gc_overhead_perc(0.0) {
 
+  uintx confidence_perc = G1ConfidencePercent;
+  // Put an artificial ceiling on this so that it's not set to a silly value.
+  if (confidence_perc > 100) {
+    confidence_perc = 100;
+    warning("G1ConfidencePercent is set to a value that is too large, "
+            "it's been updated to %u", confidence_perc);
+  }
+  // '_sigma' must be initialized before the SurvRateGroups below because they
+  // indirecty access '_sigma' trough the 'this' pointer in their constructor.
+  _sigma = (double) confidence_perc / 100.0;
+
+  _short_lived_surv_rate_group =
+    new SurvRateGroup(this, "Short Lived", G1YoungSurvRateNumRegionsSummary);
+  _survivor_surv_rate_group =
+    new SurvRateGroup(this, "Survivor", G1YoungSurvRateNumRegionsSummary);
+
   // Set up the region size and associated fields. Given that the
   // policy is created before the heap, we have to set this up here,
   // so it's done as soon as possible.
@@ -283,15 +291,6 @@
   double time_slice  = (double) GCPauseIntervalMillis / 1000.0;
   _mmu_tracker = new G1MMUTrackerQueue(time_slice, max_gc_time);
 
-  uintx confidence_perc = G1ConfidencePercent;
-  // Put an artificial ceiling on this so that it's not set to a silly value.
-  if (confidence_perc > 100) {
-    confidence_perc = 100;
-    warning("G1ConfidencePercent is set to a value that is too large, "
-            "it's been updated to %u", confidence_perc);
-  }
-  _sigma = (double) confidence_perc / 100.0;
-
   // start conservatively (around 50ms is about right)
   _concurrent_mark_remark_times_ms->add(0.05);
   _concurrent_mark_cleanup_times_ms->add(0.20);
--- a/src/share/vm/gc_implementation/g1/g1MarkSweep.hpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/share/vm/gc_implementation/g1/g1MarkSweep.hpp	Fri Jan 16 05:02:11 2015 -0500
@@ -46,9 +46,6 @@
 class G1PrepareCompactClosure;
 
 class G1MarkSweep : AllStatic {
-  friend class VM_G1MarkSweep;
-  friend class Scavenge;
-
  public:
 
   static void invoke_at_safepoint(ReferenceProcessor* rp,
--- a/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp	Fri Jan 16 05:02:11 2015 -0500
@@ -45,7 +45,8 @@
 #include "utilities/bitMap.inline.hpp"
 
 G1PageBasedVirtualSpace::G1PageBasedVirtualSpace() : _low_boundary(NULL),
-  _high_boundary(NULL), _committed(), _page_size(0), _special(false), _executable(false) {
+  _high_boundary(NULL), _committed(), _page_size(0), _special(false),
+  _dirty(), _executable(false) {
 }
 
 bool G1PageBasedVirtualSpace::initialize_with_granularity(ReservedSpace rs, size_t page_size) {
@@ -66,6 +67,9 @@
   assert(_committed.size() == 0, "virtual space initialized more than once");
   uintx size_in_bits = rs.size() / page_size;
   _committed.resize(size_in_bits, /* in_resource_area */ false);
+  if (_special) {
+    _dirty.resize(size_in_bits, /* in_resource_area */ false);
+  }
 
   return true;
 }
@@ -84,6 +88,7 @@
   _executable             = false;
   _page_size              = 0;
   _committed.resize(0, false);
+  _dirty.resize(0, false);
 }
 
 size_t G1PageBasedVirtualSpace::committed_size() const {
@@ -120,34 +125,43 @@
   return num * _page_size;
 }
 
-MemRegion G1PageBasedVirtualSpace::commit(uintptr_t start, size_t size_in_pages) {
+bool G1PageBasedVirtualSpace::commit(uintptr_t start, size_t size_in_pages) {
   // We need to make sure to commit all pages covered by the given area.
   guarantee(is_area_uncommitted(start, size_in_pages), "Specified area is not uncommitted");
 
-  if (!_special) {
+  bool zero_filled = true;
+  uintptr_t end = start + size_in_pages;
+
+  if (_special) {
+    // Check for dirty pages and update zero_filled if any found.
+    if (_dirty.get_next_one_offset(start,end) < end) {
+      zero_filled = false;
+      _dirty.clear_range(start, end);
+    }
+  } else {
     os::commit_memory_or_exit(page_start(start), byte_size_for_pages(size_in_pages), _executable,
                               err_msg("Failed to commit pages from "SIZE_FORMAT" of length "SIZE_FORMAT, start, size_in_pages));
   }
-  _committed.set_range(start, start + size_in_pages);
+  _committed.set_range(start, end);
 
-  MemRegion result((HeapWord*)page_start(start), byte_size_for_pages(size_in_pages) / HeapWordSize);
   if (AlwaysPreTouch) {
-    os::pretouch_memory((char*)result.start(), (char*)result.end());
+    os::pretouch_memory(page_start(start), page_start(end));
   }
-  return result;
+  return zero_filled;
 }
 
-MemRegion G1PageBasedVirtualSpace::uncommit(uintptr_t start, size_t size_in_pages) {
+void G1PageBasedVirtualSpace::uncommit(uintptr_t start, size_t size_in_pages) {
   guarantee(is_area_committed(start, size_in_pages), "checking");
 
-  if (!_special) {
+  if (_special) {
+    // Mark that memory is dirty. If committed again the memory might
+    // need to be cleared explicitly.
+    _dirty.set_range(start, start + size_in_pages);
+  } else {
     os::uncommit_memory(page_start(start), byte_size_for_pages(size_in_pages));
   }
 
   _committed.clear_range(start, start + size_in_pages);
-
-  MemRegion result((HeapWord*)page_start(start), byte_size_for_pages(size_in_pages) / HeapWordSize);
-  return result;
 }
 
 bool G1PageBasedVirtualSpace::contains(const void* p) const {
@@ -157,7 +171,7 @@
 #ifndef PRODUCT
 void G1PageBasedVirtualSpace::print_on(outputStream* out) {
   out->print   ("Virtual space:");
-  if (special()) out->print(" (pinned in memory)");
+  if (_special) out->print(" (pinned in memory)");
   out->cr();
   out->print_cr(" - committed: " SIZE_FORMAT, committed_size());
   out->print_cr(" - reserved:  " SIZE_FORMAT, reserved_size());
--- a/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.hpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.hpp	Fri Jan 16 05:02:11 2015 -0500
@@ -49,6 +49,12 @@
   // Bitmap used for verification of commit/uncommit operations.
   BitMap _committed;
 
+  // Bitmap used to keep track of which pages are dirty or not for _special
+  // spaces. This is needed because for those spaces the underlying memory
+  // will only be zero filled the first time it is committed. Calls to commit
+  // will use this bitmap and return whether or not the memory is zero filled.
+  BitMap _dirty;
+
   // Indicates that the entire space has been committed and pinned in memory,
   // os::commit_memory() or os::uncommit_memory() have no function.
   bool _special;
@@ -71,12 +77,11 @@
  public:
 
   // Commit the given area of pages starting at start being size_in_pages large.
-  MemRegion commit(uintptr_t start, size_t size_in_pages);
+  // Returns true if the given area is zero filled upon completion.
+  bool commit(uintptr_t start, size_t size_in_pages);
 
   // Uncommit the given area of pages starting at start being size_in_pages large.
-  MemRegion uncommit(uintptr_t start, size_t size_in_pages);
-
-  bool special() const { return _special; }
+  void uncommit(uintptr_t start, size_t size_in_pages);
 
   // Initialization
   G1PageBasedVirtualSpace();
--- a/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp	Fri Jan 16 05:02:11 2015 -0500
@@ -67,9 +67,9 @@
   }
 
   virtual void commit_regions(uintptr_t start_idx, size_t num_regions) {
-    _storage.commit(start_idx * _pages_per_region, num_regions * _pages_per_region);
+    bool zero_filled = _storage.commit(start_idx * _pages_per_region, num_regions * _pages_per_region);
     _commit_map.set_range(start_idx, start_idx + num_regions);
-    fire_on_commit(start_idx, num_regions, true);
+    fire_on_commit(start_idx, num_regions, zero_filled);
   }
 
   virtual void uncommit_regions(uintptr_t start_idx, size_t num_regions) {
@@ -117,8 +117,7 @@
       uint old_refcount = _refcounts.get_by_index(idx);
       bool zero_filled = false;
       if (old_refcount == 0) {
-        _storage.commit(idx, 1);
-        zero_filled = true;
+        zero_filled = _storage.commit(idx, 1);
       }
       _refcounts.set_by_index(idx, old_refcount + 1);
       _commit_map.set_bit(i);
--- a/src/share/vm/gc_implementation/g1/g1RemSet.hpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/share/vm/gc_implementation/g1/g1RemSet.hpp	Fri Jan 16 05:02:11 2015 -0500
@@ -31,7 +31,6 @@
 // collection set.
 
 class G1CollectedHeap;
-class CardTableModRefBarrierSet;
 class ConcurrentG1Refine;
 class G1ParPushHeapRSClosure;
 
--- a/src/share/vm/memory/metaspace.cpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/share/vm/memory/metaspace.cpp	Fri Jan 16 05:02:11 2015 -0500
@@ -3170,7 +3170,9 @@
     }
 
     // the min_misc_data_size and min_misc_code_size estimates are based on
-    // MetaspaceShared::generate_vtable_methods()
+    // MetaspaceShared::generate_vtable_methods().
+    // The minimum size only accounts for the vtable methods. Any size less than the
+    // minimum required size would cause vm crash when allocating the vtable methods.
     uint min_misc_data_size = align_size_up(
       MetaspaceShared::num_virtuals * MetaspaceShared::vtbl_list_size * sizeof(void*), max_alignment);
 
@@ -3336,6 +3338,10 @@
   Metachunk* new_chunk = get_initialization_chunk(NonClassType,
                                                   word_size,
                                                   vsm()->medium_chunk_bunch());
+  // For dumping shared archive, report error if allocation has failed.
+  if (DumpSharedSpaces && new_chunk == NULL) {
+    report_insufficient_metaspace(MetaspaceAux::committed_bytes() + word_size * BytesPerWord);
+  }
   assert(!DumpSharedSpaces || new_chunk != NULL, "should have enough space for both chunks");
   if (new_chunk != NULL) {
     // Add to this manager's list of chunks in use and current_chunk().
@@ -3349,6 +3355,11 @@
                                                       class_vsm()->medium_chunk_bunch());
     if (class_chunk != NULL) {
       class_vsm()->add_chunk(class_chunk, true);
+    } else {
+      // For dumping shared archive, report error if allocation has failed.
+      if (DumpSharedSpaces) {
+        report_insufficient_metaspace(MetaspaceAux::committed_bytes() + class_word_size * BytesPerWord);
+      }
     }
   }
 
--- a/src/share/vm/runtime/globals.hpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/share/vm/runtime/globals.hpp	Fri Jan 16 05:02:11 2015 -0500
@@ -2951,10 +2951,6 @@
   develop(intx, MallocCatchPtr, -1,                                         \
           "Hit breakpoint when mallocing/freeing this pointer")             \
                                                                             \
-  notproduct(intx, AssertRepeat, 1,                                         \
-          "number of times to evaluate expression in assert "               \
-          "(to estimate overhead); only works with -DUSE_REPEATED_ASSERTS") \
-                                                                            \
   notproduct(ccstrlist, SuppressErrorAt, "",                                \
           "List of assertions (file:line) to muzzle")                       \
                                                                             \
--- a/src/share/vm/runtime/os.cpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/share/vm/runtime/os.cpp	Fri Jan 16 05:02:11 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -547,20 +547,16 @@
 // This function supports testing of the malloc out of memory
 // condition without really running the system out of memory.
 //
-static u_char* testMalloc(size_t alloc_size) {
-  assert(MallocMaxTestWords > 0, "sanity check");
+static bool has_reached_max_malloc_test_peak(size_t alloc_size) {
+  if (MallocMaxTestWords > 0) {
+    jint words = (jint)(alloc_size / BytesPerWord);
 
-  if ((cur_malloc_words + (alloc_size / BytesPerWord)) > MallocMaxTestWords) {
-    return NULL;
+    if ((cur_malloc_words + words) > MallocMaxTestWords) {
+      return true;
+    }
+    Atomic::add(words, (volatile jint *)&cur_malloc_words);
   }
-
-  u_char* ptr = (u_char*)::malloc(alloc_size);
-
-  if (ptr != NULL) {
-    Atomic::add(((jint) (alloc_size / BytesPerWord)),
-                (volatile jint *) &cur_malloc_words);
-  }
-  return ptr;
+  return false;
 }
 
 void* os::malloc(size_t size, MEMFLAGS flags) {
@@ -608,12 +604,13 @@
 
   NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap());
 
+  // For the test flag -XX:MallocMaxTestWords
+  if (has_reached_max_malloc_test_peak(size)) {
+    return NULL;
+  }
+
   u_char* ptr;
-  if (MallocMaxTestWords > 0) {
-    ptr = testMalloc(alloc_size);
-  } else {
-    ptr = (u_char*)::malloc(alloc_size);
-  }
+  ptr = (u_char*)::malloc(alloc_size);
 
 #ifdef ASSERT
   if (ptr == NULL) {
@@ -642,6 +639,11 @@
 
 void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, const NativeCallStack& stack) {
 
+  // For the test flag -XX:MallocMaxTestWords
+  if (has_reached_max_malloc_test_peak(size)) {
+    return NULL;
+  }
+
 #ifndef ASSERT
   NOT_PRODUCT(inc_stat_counter(&num_mallocs, 1));
   NOT_PRODUCT(inc_stat_counter(&alloc_bytes, size));
--- a/src/share/vm/shark/llvmHeaders.hpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/share/vm/shark/llvmHeaders.hpp	Fri Jan 16 05:02:11 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -87,30 +87,7 @@
   #undef assert
 #endif
 
-// from hotspot/src/share/vm/utilities/debug.hpp
-#ifdef ASSERT
-#ifndef USE_REPEATED_ASSERTS
-#define assert(p, msg)                                                       \
-do {                                                                         \
-  if (!(p)) {                                                                \
-    report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", msg);       \
-    BREAKPOINT;                                                              \
-  }                                                                          \
-} while (0)
-#else // #ifndef USE_REPEATED_ASSERTS
-#define assert(p, msg)
-do {                                                                         \
-  for (int __i = 0; __i < AssertRepeat; __i++) {                             \
-    if (!(p)) {                                                              \
-      report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", msg);     \
-      BREAKPOINT;                                                            \
-    }                                                                        \
-  }                                                                          \
-} while (0)
-#endif // #ifndef USE_REPEATED_ASSERTS
-#else
-  #define assert(p, msg)
-#endif
+#define assert(p, msg) vmassert(p, msg)
 
 #ifdef DEBUG
   #undef DEBUG
--- a/src/share/vm/utilities/debug.cpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/share/vm/utilities/debug.cpp	Fri Jan 16 05:02:11 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -273,6 +273,14 @@
    exit(2);
 }
 
+void report_insufficient_metaspace(size_t required_size) {
+  warning("\nThe MaxMetaspaceSize of " UINTX_FORMAT " bytes is not large enough.\n"
+          "Either don't specify the -XX:MaxMetaspaceSize=<size>\n"
+          "or increase the size to at least " SIZE_FORMAT ".\n",
+          MaxMetaspaceSize, required_size);
+  exit(2);
+}
+
 void report_java_out_of_memory(const char* message) {
   static jint out_of_memory_reported = 0;
 
@@ -326,9 +334,9 @@
 
   // Keep this in sync with test/runtime/6888954/vmerrors.sh.
   switch (n) {
-    case  1: assert(str == NULL, "expected null");
-    case  2: assert(num == 1023 && *str == 'X',
-                    err_msg("num=" SIZE_FORMAT " str=\"%s\"", num, str));
+    case  1: vmassert(str == NULL, "expected null");
+    case  2: vmassert(num == 1023 && *str == 'X',
+                      err_msg("num=" SIZE_FORMAT " str=\"%s\"", num, str));
     case  3: guarantee(str == NULL, "expected null");
     case  4: guarantee(num == 1023 && *str == 'X',
                        err_msg("num=" SIZE_FORMAT " str=\"%s\"", num, str));
--- a/src/share/vm/utilities/debug.hpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/share/vm/utilities/debug.hpp	Fri Jan 16 05:02:11 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -105,58 +105,42 @@
   va_end(argp);
 }
 
-// Used to format messages for assert(), guarantee(), fatal(), etc.
+// Used to format messages for vmassert(), guarantee(), fatal(), etc.
 typedef FormatBuffer<> err_msg;
 typedef FormatBufferResource err_msg_res;
 
 // assertions
-#ifdef ASSERT
-#ifndef USE_REPEATED_ASSERTS
-#define assert(p, msg)                                                       \
+#ifndef ASSERT
+#define vmassert(p, msg)
+#else
+// Note: message says "assert" rather than "vmassert" for backward
+// compatibility with tools that parse/match the message text.
+#define vmassert(p, msg)                                                     \
 do {                                                                         \
   if (!(p)) {                                                                \
     report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", msg);       \
     BREAKPOINT;                                                              \
   }                                                                          \
 } while (0)
-#else // #ifndef USE_REPEATED_ASSERTS
-#define assert(p, msg)
-do {                                                                         \
-  for (int __i = 0; __i < AssertRepeat; __i++) {                             \
-    if (!(p)) {                                                              \
-      report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", msg);     \
-      BREAKPOINT;                                                            \
-    }                                                                        \
-  }                                                                          \
-} while (0)
-#endif // #ifndef USE_REPEATED_ASSERTS
+#endif
 
-// This version of assert is for use with checking return status from
+// For backward compatibility.
+#define assert(p, msg) vmassert(p, msg)
+
+// This version of vmassert is for use with checking return status from
 // library calls that return actual error values eg. EINVAL,
 // ENOMEM etc, rather than returning -1 and setting errno.
 // When the status is not what is expected it is very useful to know
 // what status was actually returned, so we pass the status variable as
 // an extra arg and use strerror to convert it to a meaningful string
 // like "Invalid argument", "out of memory" etc
-#define assert_status(p, status, msg)                                        \
-do {                                                                         \
-  if (!(p)) {                                                                \
-    report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed",             \
-                    err_msg("error %s(%d) %s", strerror(status),             \
-                            status, msg));                                   \
-    BREAKPOINT;                                                              \
-  }                                                                          \
-} while (0)
+#define vmassert_status(p, status, msg) \
+  vmassert(p, err_msg("error %s(%d), %s", strerror(status), status, msg))
 
-// Do not assert this condition if there's already another error reported.
-#define assert_if_no_error(cond,msg) assert((cond) || is_error_reported(), msg)
-#else // #ifdef ASSERT
-  #define assert(p,msg)
-  #define assert_status(p,status,msg)
-  #define assert_if_no_error(cond,msg)
-#endif // #ifdef ASSERT
+// For backward compatibility.
+#define assert_status(p, status, msg) vmassert_status(p, status, msg)
 
-// guarantee is like assert except it's always executed -- use it for
+// guarantee is like vmassert except it's always executed -- use it for
 // cheap tests that catch errors that would otherwise be hard to find.
 // guarantee is also used for Verify options.
 #define guarantee(p, msg)                                                    \
@@ -225,21 +209,22 @@
 
 void warning(const char* format, ...) ATTRIBUTE_PRINTF(1, 2);
 
-#ifdef ASSERT
-// Compile-time asserts.
-template <bool> struct StaticAssert;
-template <> struct StaticAssert<true> {};
+// Compile-time asserts.  Cond must be a compile-time constant expression that
+// is convertible to bool.  STATIC_ASSERT() can be used anywhere a declaration
+// may appear.
+//
+// Implementation Note: STATIC_ASSERT_FAILURE<true> provides a value member
+// rather than type member that could be used directly in the typedef, because
+// a type member would require conditional use of "typename", depending on
+// whether Cond is dependent or not.  The use of a value member leads to the
+// use of an array type.
 
-// Only StaticAssert<true> is defined, so if cond evaluates to false we get
-// a compile time exception when trying to use StaticAssert<false>.
-#define STATIC_ASSERT(cond)                   \
-  do {                                        \
-    StaticAssert<(cond)> DUMMY_STATIC_ASSERT; \
-    (void)DUMMY_STATIC_ASSERT; /* ignore */   \
-  } while (false)
-#else
-#define STATIC_ASSERT(cond)
-#endif
+template<bool x> struct STATIC_ASSERT_FAILURE;
+template<> struct STATIC_ASSERT_FAILURE<true> { enum { value = 1 }; };
+
+#define STATIC_ASSERT(Cond)                             \
+  typedef char STATIC_ASSERT_FAILURE_ ## __LINE__ [     \
+    STATIC_ASSERT_FAILURE< (Cond) >::value ]
 
 // out of shared space reporting
 enum SharedSpaceType {
@@ -251,6 +236,8 @@
 
 void report_out_of_shared_space(SharedSpaceType space_type);
 
+void report_insufficient_metaspace(size_t required_size);
+
 // out of memory reporting
 void report_java_out_of_memory(const char* message);
 
@@ -258,7 +245,7 @@
 bool is_error_reported();
 void set_error_reported();
 
-/* Test assert(), fatal(), guarantee(), etc. */
+/* Test vmassert(), fatal(), guarantee(), etc. */
 NOT_PRODUCT(void test_error_handler();)
 
 void pd_ps(frame f);
--- a/src/share/vm/utilities/xmlstream.cpp	Thu Jan 15 11:30:13 2015 +0100
+++ b/src/share/vm/utilities/xmlstream.cpp	Fri Jan 16 05:02:11 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -33,6 +33,10 @@
 #include "runtime/vmThread.hpp"
 #include "utilities/xmlstream.hpp"
 
+// Do not assert this condition if there's already another error reported.
+#define assert_if_no_error(cond, msg) \
+  vmassert((cond) || is_error_reported(), msg)
+
 void xmlStream::initialize(outputStream* out) {
   _out = out;
   _last_flush = 0;
--- a/test/TEST.groups	Thu Jan 15 11:30:13 2015 +0100
+++ b/test/TEST.groups	Fri Jan 16 05:02:11 2015 -0500
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 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
@@ -69,7 +69,6 @@
   gc/metaspace/TestPerfCountersAndMemoryPools.java \
   runtime/6819213/TestBootNativeLibraryPath.java \
   runtime/7158988/FieldMonitor.java \
-  runtime/7194254/Test7194254.java \
   runtime/Metaspace/FragmentMetaspace.java \
   runtime/NMT/BaselineWithParameter.java \
   runtime/NMT/JcmdBaselineDetail.java \
@@ -94,6 +93,7 @@
   runtime/NMT/VirtualAllocTestType.java \
   runtime/RedefineObject/TestRedefineObject.java \
   runtime/Thread/TestThreadDumpMonitorContention.java \
+  runtime/Thread/ThreadPriorities.java \
   runtime/XCheckJniJsig/XCheckJSig.java \
   serviceability/attach/AttachWithStalePidFile.java \
   serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java \
@@ -232,7 +232,8 @@
   gc/g1/ \
   gc/metaspace/G1AddMetaspaceDependency.java \
   gc/metaspace/TestMetaspacePerfCounters.java \
-  gc/startup_warnings/TestG1.java 
+  gc/startup_warnings/TestG1.java \
+  gc/whitebox/TestConcMarkCycleWB.java
 
 # All tests that explicitly set the serial GC
 #
--- a/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java	Thu Jan 15 11:30:13 2015 +0100
+++ b/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java	Fri Jan 16 05:02:11 2015 -0500
@@ -26,6 +26,7 @@
  * @bug 8042235
  * @summary redefining method used by multiple MethodHandles crashes VM
  * @compile -XDignore.symbol.file RedefineMethodUsedByMultipleMethodHandles.java
+ * @ignore 7076820
  * @run main RedefineMethodUsedByMultipleMethodHandles
  */
 
--- a/test/compiler/profiling/spectrapredefineclass/Launcher.java	Thu Jan 15 11:30:13 2015 +0100
+++ b/test/compiler/profiling/spectrapredefineclass/Launcher.java	Fri Jan 16 05:02:11 2015 -0500
@@ -28,6 +28,7 @@
  * @bug 8038636
  * @library /testlibrary
  * @build Agent
+ * @ignore 7076820
  * @run main ClassFileInstaller Agent
  * @run main Launcher
  * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 -XX:ReservedCodeCacheSize=3M Agent
--- a/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java	Thu Jan 15 11:30:13 2015 +0100
+++ b/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java	Fri Jan 16 05:02:11 2015 -0500
@@ -28,6 +28,7 @@
  * @bug 8040237
  * @library /testlibrary
  * @build Agent Test A B
+ * @ignore 7076820
  * @run main ClassFileInstaller Agent
  * @run main Launcher
  * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 -XX:ReservedCodeCacheSize=3M Agent
--- a/test/gc/TestSmallHeap.java	Thu Jan 15 11:30:13 2015 +0100
+++ b/test/gc/TestSmallHeap.java	Fri Jan 16 05:02:11 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -26,34 +26,46 @@
  * @bug 8067438
  * @requires vm.gc=="null"
  * @summary Verify that starting the VM with a small heap works
- * @library /testlibrary
- * @run main/othervm -Xmx4m -XX:+UseParallelGC TestSmallHeap
- * @run main/othervm -Xmx4m -XX:+UseSerialGC TestSmallHeap
- * @run main/othervm -Xmx4m -XX:+UseG1GC TestSmallHeap
- * @run main/othervm -Xmx4m -XX:+UseConcMarkSweepGC -XX:CMSMarkStackSizeMax=1032 TestSmallHeap
+ * @library /testlibrary /../../test/lib
+ * @build TestSmallHeap
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmx2m -XX:+UseParallelGC TestSmallHeap
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmx2m -XX:+UseSerialGC TestSmallHeap
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmx2m -XX:+UseG1GC TestSmallHeap
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmx2m -XX:+UseConcMarkSweepGC TestSmallHeap
  *
- * Note: It would be nice to verify the minimal supported heap size here,
- * but that turns out to be quite tricky since we align the heap size based
- * on the card table size. And the card table size is aligned based on the
- * minimal pages size provided by the os. This means that on most platforms,
- * where the minimal page size is 4k, we get a minimal heap size of 2m but
- * on Solaris/Sparc we have a page size of 8k and get a minimal heap size
- * of 8m.
+ * Note: It would be nice to verify the minimal supported heap size (2m) here,
+ * but we align the heap size based on the card table size. And the card table
+ * size is aligned based on the minimal pages size provided by the os. This
+ * means that on most platforms, where the minimal page size is 4k, we get a
+ * minimal heap size of 2m but on Solaris/Sparc we have a page size of 8k and
+ * get a minimal heap size of 4m. And on platforms where the page size is 64k
+ * we get a minimal heap size of 32m. We never use large pages for the card table.
+ *
  * There is also no check in the VM for verifying that the maximum heap size
  * is larger than the supported minimal heap size. This means that specifying
- * -Xmx1m on the command line is fine but will give a heap of 2m (or 4m).
- * To work around these rather strange behaviors this test uses 4m for all
- * platforms.
+ * -Xmx1m on the command line is fine but will give a heap of 2m (or 4m or 32m).
+ *
+ * To work around these rather strange behaviors this test uses -Xmx2m but then
+ * calculates what the expected heap size should be. The calculation is a
+ * simplified version of the code in the VM. We assume that the card table will
+ * use one page. Each byte in the card table corresponds to 512 bytes on the heap.
+ * So, the expected heap size is page_size * 512.
  */
 
+import com.oracle.java.testlibrary.*;
+import static com.oracle.java.testlibrary.Asserts.*;
+import sun.hotspot.WhiteBox;
 import sun.management.ManagementFactoryHelper;
-import static com.oracle.java.testlibrary.Asserts.*;
 
 public class TestSmallHeap {
 
     public static void main(String[] args) {
+        WhiteBox wb = WhiteBox.getWhiteBox();
+        int pageSize = wb.getVMPageSize();
+        int heapBytesPerCard = 512;
+        long expectedMaxHeap = pageSize * heapBytesPerCard;
         String maxHeap = ManagementFactoryHelper.getDiagnosticMXBean().getVMOption("MaxHeapSize").getValue();
-        String expectedMaxHeap = "4194304";
-        assertEQ(maxHeap, expectedMaxHeap);
+        assertEQ(Long.parseLong(maxHeap), expectedMaxHeap);
     }
 }
--- a/test/runtime/7194254/Test7194254.java	Thu Jan 15 11:30:13 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2012, 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     7194254
- * @summary Creates several threads with different java priorities and checks
- *      whether jstack reports correct priorities for them.
- *
- * @ignore 8060219
- * @run main Test7194254
- */
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.lang.management.ManagementFactory;
-import java.lang.management.RuntimeMXBean;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.CyclicBarrier;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class Test7194254 {
-
-    public static void main(String[] args) throws Exception {
-        final int NUMBER_OF_JAVA_PRIORITIES =
-                Thread.MAX_PRIORITY - Thread.MIN_PRIORITY + 1;
-        final CyclicBarrier barrier =
-                new CyclicBarrier(NUMBER_OF_JAVA_PRIORITIES + 1);
-
-        for (int p = Thread.MIN_PRIORITY; p <= Thread.MAX_PRIORITY; ++p) {
-            final int priority = p;
-            new Thread("Priority=" + p) {
-                {
-                    setPriority(priority);
-                }
-                public void run() {
-                    try {
-                        barrier.await(); // 1st
-                        barrier.await(); // 2nd
-                    } catch (Exception exc) {
-                        // ignore
-                    }
-                }
-            }.start();
-        }
-        barrier.await(); // 1st
-
-        int matches = 0;
-        List<String> failed = new ArrayList<>();
-        try {
-            String pid = getPid();
-            String jstack = System.getProperty("java.home") + "/../bin/jstack";
-            Process process = new ProcessBuilder(jstack, pid)
-                    .redirectErrorStream(true).start();
-            Pattern pattern = Pattern.compile(
-                    "\\\"Priority=(\\d+)\\\".* prio=(\\d+).*");
-            try (BufferedReader reader = new BufferedReader(
-                    new InputStreamReader(process.getInputStream()))) {
-                String line;
-                while((line = reader.readLine()) != null) {
-                    Matcher matcher = pattern.matcher(line);
-                    if (matcher.matches()) {
-                        matches += 1;
-                        String expected = matcher.group(1);
-                        String actual = matcher.group(2);
-                        if (!expected.equals(actual)) {
-                            failed.add(line);
-                        }
-                    }
-                }
-            }
-            barrier.await(); // 2nd
-        } finally {
-            barrier.reset();
-        }
-
-        if (matches != NUMBER_OF_JAVA_PRIORITIES) {
-            throw new AssertionError("matches: expected " +
-                    NUMBER_OF_JAVA_PRIORITIES + ", but was " + matches);
-        }
-        if (!failed.isEmpty()) {
-            throw new AssertionError(failed.size() + ":" + failed);
-        }
-        System.out.println("Test passes.");
-    }
-
-    static String getPid() {
-        RuntimeMXBean runtimebean = ManagementFactory.getRuntimeMXBean();
-        String vmname = runtimebean.getName();
-        int i = vmname.indexOf('@');
-        if (i != -1) {
-            vmname = vmname.substring(0, i);
-        }
-        return vmname;
-    }
-
-}
-
--- a/test/runtime/NMT/ChangeTrackingLevel.java	Thu Jan 15 11:30:13 2015 +0100
+++ b/test/runtime/NMT/ChangeTrackingLevel.java	Fri Jan 16 05:02:11 2015 -0500
@@ -27,6 +27,7 @@
  * @summary Test that you can decrease NMT tracking level but not increase it.
  * @key nmt
  * @library /testlibrary /../../test/lib
+ * @ignore 8067167
  * @build ChangeTrackingLevel
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/runtime/NMT/PrintNMTStatistics.java	Thu Jan 15 11:30:13 2015 +0100
+++ b/test/runtime/NMT/PrintNMTStatistics.java	Fri Jan 16 05:02:11 2015 -0500
@@ -27,6 +27,7 @@
  * @bug 8005936 8058606
  * @summary Verify PrintNMTStatistics on normal JVM exit for detail and summary tracking level
  * @library /testlibrary
+ * @ignore 8067167
  */
 
 import com.oracle.java.testlibrary.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/runtime/SharedArchiveFile/MaxMetaspaceSize.java	Fri Jan 16 05:02:11 2015 -0500
@@ -0,0 +1,41 @@
+/*
+ * 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 8067187
+ * @summary Testing CDS dumping with the -XX:MaxMetaspaceSize=<size> option
+ * @library /testlibrary
+ */
+
+import com.oracle.java.testlibrary.*;
+
+public class MaxMetaspaceSize {
+  public static void main(String[] args) throws Exception {
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+        "-XX:MaxMetaspaceSize=20m", "-Xshare:dump");
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+      output.shouldContain("is not large enough.\nEither don't specify the -XX:MaxMetaspaceSize=<size>\nor increase the size to at least");
+      output.shouldHaveExitValue(2);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/runtime/Thread/ThreadPriorities.java	Fri Jan 16 05:02:11 2015 -0500
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2012, 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     7194254
+ * @summary Creates several threads with different java priorities and checks
+ *      whether jstack reports correct priorities for them.
+ *
+ * @library /testlibrary
+ * @run main ThreadPriorities
+ */
+
+import java.util.ArrayList;
+import java.util.concurrent.CyclicBarrier;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.oracle.java.testlibrary.*;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class ThreadPriorities {
+
+    public static void main(String[] args) throws Throwable {
+        final int NUMBER_OF_JAVA_PRIORITIES =
+                Thread.MAX_PRIORITY - Thread.MIN_PRIORITY + 1;
+        final CyclicBarrier barrier =
+                new CyclicBarrier(NUMBER_OF_JAVA_PRIORITIES + 1);
+
+        for (int p = Thread.MIN_PRIORITY; p <= Thread.MAX_PRIORITY; ++p) {
+            final int priority = p;
+            new Thread("Priority=" + p) {
+                {
+                    setPriority(priority);
+                }
+                public void run() {
+                    try {
+                        barrier.await(); // 1st
+                        barrier.await(); // 2nd
+                    } catch (Exception exc) {
+                        // ignore
+                    }
+                }
+            }.start();
+        }
+        barrier.await(); // 1st
+
+        int matches = 0;
+        ArrayList<String> failed = new ArrayList<>();
+        ProcessBuilder pb = new ProcessBuilder(
+                JDKToolFinder.getJDKTool("jstack"),
+                String.valueOf(ProcessTools.getProcessId()));
+
+        String[] output = new OutputAnalyzer(pb.start()).getOutput().split("\\n+");
+
+        Pattern pattern = Pattern.compile(
+                "\\\"Priority=(\\d+)\\\".* prio=(\\d+).*");
+        for (String line : output) {
+            Matcher matcher = pattern.matcher(line);
+            if (matcher.matches()) {
+                matches += 1;
+                String expected = matcher.group(1);
+                String actual = matcher.group(2);
+                if (!expected.equals(actual)) {
+                    failed.add(line);
+                }
+            }
+        }
+        barrier.await(); // 2nd
+        barrier.reset();
+
+        assertEquals(matches, NUMBER_OF_JAVA_PRIORITIES);
+        assertTrue(failed.isEmpty(), failed.size() + ":" + failed);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/runtime/Unsafe/Reallocate.java	Fri Jan 16 05:02:11 2015 -0500
@@ -0,0 +1,67 @@
+/*
+ * 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 8058897
+ * @library /testlibrary
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=100m Reallocate
+ */
+
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class Reallocate {
+    public static void main(String args[]) throws Exception {
+        Unsafe unsafe = Utils.getUnsafe();
+
+        long address = unsafe.allocateMemory(1);
+        assertNotEquals(address, 0L);
+
+        // Make sure we reallocate correctly
+        unsafe.putByte(address, Byte.MAX_VALUE);
+        address = unsafe.reallocateMemory(address, 2);
+        assertNotEquals(address, 0L);
+        assertEquals(unsafe.getByte(address), Byte.MAX_VALUE);
+
+        // Reallocating with a 0 size should return a null pointer
+        address = unsafe.reallocateMemory(address, 0);
+        assertEquals(address, 0L);
+
+        // Reallocating with a null pointer should result in a normal allocation
+        address = unsafe.reallocateMemory(0L, 1);
+        assertNotEquals(address, 0L);
+        unsafe.putByte(address, Byte.MAX_VALUE);
+        assertEquals(unsafe.getByte(address), Byte.MAX_VALUE);
+
+        // Make sure we can throw an OOME when we fail to reallocate due to OOM
+        try {
+            unsafe.reallocateMemory(address, 100 * 1024 * 1024 * 8);
+        } catch (OutOfMemoryError e) {
+            // Expected
+            return;
+        }
+        throw new RuntimeException("Did not get expected OOM");
+    }
+}