Merge
authorzmajo
Mon, 21 Mar 2016 11:21:07 +0100
changeset 36810 18da75b9b9ab
parent 36809 6f9362b27d4f (current diff)
parent 36614 5d0164473902 (diff)
child 36811 721b2da25ee1
Merge
hotspot/src/share/vm/code/nmethod.cpp
--- a/hotspot/.hgtags	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/.hgtags	Mon Mar 21 11:21:07 2016 +0100
@@ -512,3 +512,4 @@
 c5146d4da417f76edfc43097d2e2ced042a65b4e jdk-9+107
 934f6793f5f7dca44f69b4559d525fa64b31840d jdk-9+108
 7e7e50ac4faf19899fc811569e32cfa478759ebb jdk-9+109
+2f5d1578b24060ea06bd1f340a124db95d1475b2 jdk-9+110
--- a/hotspot/make/lib/Lib-jdk.hotspot.agent.gmk	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/make/lib/Lib-jdk.hotspot.agent.gmk	Mon Mar 21 11:21:07 2016 +0100
@@ -91,7 +91,7 @@
   ifeq ($(OPENJDK_TARGET_CPU), x86_64)
     SA_CXXFLAGS += -DWIN64
   else
-    SA_CXXFLAGS += -RTC1 -ZI
+    SA_CXXFLAGS += -RTC1
     SA_LDFLAGS += -SAFESEH
   endif
 endif
--- a/hotspot/src/os/posix/vm/os_posix.cpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/os/posix/vm/os_posix.cpp	Mon Mar 21 11:21:07 2016 +0100
@@ -336,13 +336,13 @@
   const char *start;
 
   if (lib_name != NULL) {
-    len = name_len = strlen(lib_name);
+    name_len = strlen(lib_name);
     if (is_absolute_path) {
       // Need to strip path, prefix and suffix
       if ((start = strrchr(lib_name, *os::file_separator())) != NULL) {
         lib_name = ++start;
       }
-      if (len <= (prefix_len + suffix_len)) {
+      if (strlen(lib_name) <= (prefix_len + suffix_len)) {
         return NULL;
       }
       lib_name += prefix_len;
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Mon Mar 21 11:21:07 2016 +0100
@@ -951,11 +951,11 @@
     FILETIME wt;
     GetSystemTimeAsFileTime(&wt);
     jlong rtc_millis = windows_to_java_time(wt);
-    jlong user_millis = windows_to_java_time(user_time);
-    jlong system_millis = windows_to_java_time(kernel_time);
     *process_real_time = ((double) rtc_millis) / ((double) MILLIUNITS);
-    *process_user_time = ((double) user_millis) / ((double) MILLIUNITS);
-    *process_system_time = ((double) system_millis) / ((double) MILLIUNITS);
+    *process_user_time =
+      (double) jlong_from(user_time.dwHighDateTime, user_time.dwLowDateTime) / (10 * MICROUNITS);
+    *process_system_time =
+      (double) jlong_from(kernel_time.dwHighDateTime, kernel_time.dwLowDateTime) / (10 * MICROUNITS);
     return true;
   } else {
     return false;
--- a/hotspot/src/share/vm/code/codeCache.cpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Mon Mar 21 11:21:07 2016 +0100
@@ -637,16 +637,19 @@
 }
 
 // Walk the list of methods which might contain non-perm oops.
-void CodeCache::scavenge_root_nmethods_do(CodeBlobClosure* f) {
+void CodeCache::scavenge_root_nmethods_do(CodeBlobToOopClosure* f) {
   assert_locked_or_safepoint(CodeCache_lock);
 
   if (UseG1GC) {
     return;
   }
 
+  const bool fix_relocations = f->fix_relocations();
   debug_only(mark_scavenge_root_nmethods());
 
-  for (nmethod* cur = scavenge_root_nmethods(); cur != NULL; cur = cur->scavenge_root_link()) {
+  nmethod* prev = NULL;
+  nmethod* cur = scavenge_root_nmethods();
+  while (cur != NULL) {
     debug_only(cur->clear_scavenge_root_marked());
     assert(cur->scavenge_root_not_marked(), "");
     assert(cur->on_scavenge_root_list(), "else shouldn't be on this list");
@@ -659,6 +662,18 @@
       // Perform cur->oops_do(f), maybe just once per nmethod.
       f->do_code_blob(cur);
     }
+    nmethod* const next = cur->scavenge_root_link();
+    // The scavengable nmethod list must contain all methods with scavengable
+    // oops. It is safe to include more nmethod on the list, but we do not
+    // expect any live non-scavengable nmethods on the list.
+    if (fix_relocations) {
+      if (!is_live || !cur->detect_scavenge_root_oops()) {
+        unlink_scavenge_root_nmethod(cur, prev);
+      } else {
+        prev = cur;
+      }
+    }
+    cur = next;
   }
 
   // Check for stray marks.
@@ -678,6 +693,24 @@
   print_trace("add_scavenge_root", nm);
 }
 
+void CodeCache::unlink_scavenge_root_nmethod(nmethod* nm, nmethod* prev) {
+  assert_locked_or_safepoint(CodeCache_lock);
+
+  assert((prev == NULL && scavenge_root_nmethods() == nm) ||
+         (prev != NULL && prev->scavenge_root_link() == nm), "precondition");
+
+  assert(!UseG1GC, "G1 does not use the scavenge_root_nmethods list");
+
+  print_trace("unlink_scavenge_root", nm);
+  if (prev == NULL) {
+    set_scavenge_root_nmethods(nm->scavenge_root_link());
+  } else {
+    prev->set_scavenge_root_link(nm->scavenge_root_link());
+  }
+  nm->set_scavenge_root_link(NULL);
+  nm->clear_on_scavenge_root_list();
+}
+
 void CodeCache::drop_scavenge_root_nmethod(nmethod* nm) {
   assert_locked_or_safepoint(CodeCache_lock);
 
@@ -686,20 +719,13 @@
   }
 
   print_trace("drop_scavenge_root", nm);
-  nmethod* last = NULL;
-  nmethod* cur = scavenge_root_nmethods();
-  while (cur != NULL) {
-    nmethod* next = cur->scavenge_root_link();
+  nmethod* prev = NULL;
+  for (nmethod* cur = scavenge_root_nmethods(); cur != NULL; cur = cur->scavenge_root_link()) {
     if (cur == nm) {
-      if (last != NULL)
-            last->set_scavenge_root_link(next);
-      else  set_scavenge_root_nmethods(next);
-      nm->set_scavenge_root_link(NULL);
-      nm->clear_on_scavenge_root_list();
+      unlink_scavenge_root_nmethod(cur, prev);
       return;
     }
-    last = cur;
-    cur = next;
+    prev = cur;
   }
   assert(false, "should have been on list");
 }
@@ -728,11 +754,7 @@
     } else {
       // Prune it from the list, so we don't have to look at it any more.
       print_trace("prune_scavenge_root", cur);
-      cur->set_scavenge_root_link(NULL);
-      cur->clear_on_scavenge_root_list();
-      if (last != NULL)
-            last->set_scavenge_root_link(next);
-      else  set_scavenge_root_nmethods(next);
+      unlink_scavenge_root_nmethod(cur, last);
     }
     cur = next;
   }
--- a/hotspot/src/share/vm/code/codeCache.hpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/code/codeCache.hpp	Mon Mar 21 11:21:07 2016 +0100
@@ -116,6 +116,10 @@
   static int    allocated_segments();
   static size_t freelists_length();
 
+  static void set_scavenge_root_nmethods(nmethod* nm) { _scavenge_root_nmethods = nm; }
+  static void prune_scavenge_root_nmethods();
+  static void unlink_scavenge_root_nmethod(nmethod* nm, nmethod* prev);
+
  public:
   // Initialization
   static void initialize();
@@ -153,13 +157,17 @@
   // to "true" iff some code got unloaded.
   static void do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred);
   static void asserted_non_scavengable_nmethods_do(CodeBlobClosure* f = NULL) PRODUCT_RETURN;
-  static void scavenge_root_nmethods_do(CodeBlobClosure* f);
+
+  // Apply f to every live code blob in scavengable nmethods. Prune nmethods
+  // from the list of scavengable nmethods if f->fix_relocations() and a nmethod
+  // no longer has scavengable oops.  If f->fix_relocations(), then f must copy
+  // objects to their new location immediately to avoid fixing nmethods on the
+  // basis of the old object locations.
+  static void scavenge_root_nmethods_do(CodeBlobToOopClosure* f);
 
   static nmethod* scavenge_root_nmethods()            { return _scavenge_root_nmethods; }
-  static void set_scavenge_root_nmethods(nmethod* nm) { _scavenge_root_nmethods = nm; }
   static void add_scavenge_root_nmethod(nmethod* nm);
   static void drop_scavenge_root_nmethod(nmethod* nm);
-  static void prune_scavenge_root_nmethods();
 
   // Printing/debugging
   static void print();                           // prints summary
--- a/hotspot/src/share/vm/code/nmethod.cpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Mon Mar 21 11:21:07 2016 +0100
@@ -1381,7 +1381,6 @@
   assert(_method == NULL, "Tautology");
 
   set_osr_link(NULL);
-  //set_scavenge_root_link(NULL); // done by prune_scavenge_root_nmethods
   NMethodSweeper::report_state_change(this);
 }
 
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Mon Mar 21 11:21:07 2016 +0100
@@ -2329,9 +2329,13 @@
     GCIdMarkAndRestore conc_gc_id_mark(_cmThread->gc_id());
     if (_cm->has_aborted()) {
       _gc_tracer_cm->report_concurrent_mode_failure();
+
+      // ConcurrentGCTimer will be ended as well.
+      _cm->register_concurrent_gc_end_and_stop_timer();
+    } else {
+      _gc_timer_cm->register_gc_end();
     }
 
-    _gc_timer_cm->register_gc_end();
     _gc_tracer_cm->report_gc_end(_gc_timer_cm->gc_end(), _gc_timer_cm->time_partitions());
 
     // Clear state variables to prepare for the next concurrent cycle.
--- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp	Mon Mar 21 11:21:07 2016 +0100
@@ -269,6 +269,8 @@
   _reserve_regions = 0;
 
   _cset_chooser = new CollectionSetChooser();
+
+  _ihop_control = create_ihop_control();
 }
 
 G1CollectorPolicy::~G1CollectorPolicy() {
@@ -469,8 +471,6 @@
   if (max_young_size != MaxNewSize) {
     FLAG_SET_ERGO(size_t, MaxNewSize, max_young_size);
   }
-
-  _ihop_control = create_ihop_control();
 }
 
 void G1CollectorPolicy::initialize_flags() {
@@ -565,6 +565,8 @@
   _reserve_regions = (uint) ceil(reserve_regions_d);
 
   _young_gen_sizer->heap_size_changed(new_number_of_regions);
+
+  _ihop_control->update_target_occupancy(new_number_of_regions * HeapRegion::GrainBytes);
 }
 
 uint G1CollectorPolicy::calculate_young_list_desired_min_length(
@@ -1234,13 +1236,11 @@
 G1IHOPControl* G1CollectorPolicy::create_ihop_control() const {
   if (G1UseAdaptiveIHOP) {
     return new G1AdaptiveIHOPControl(InitiatingHeapOccupancyPercent,
-                                     G1CollectedHeap::heap()->max_capacity(),
                                      &_predictor,
                                      G1ReservePercent,
                                      G1HeapWastePercent);
   } else {
-    return new G1StaticIHOPControl(InitiatingHeapOccupancyPercent,
-                                   G1CollectedHeap::heap()->max_capacity());
+    return new G1StaticIHOPControl(InitiatingHeapOccupancyPercent);
   }
 }
 
--- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp	Mon Mar 21 11:21:07 2016 +0100
@@ -441,7 +441,7 @@
   _has_aborted(false),
   _restart_for_overflow(false),
   _concurrent_marking_in_progress(false),
-  _concurrent_phase_started(false),
+  _concurrent_phase_status(ConcPhaseNotStarted),
 
   // _verbose_level set below
 
@@ -1008,16 +1008,43 @@
 }
 
 void G1ConcurrentMark::register_concurrent_phase_start(const char* title) {
-  assert(!_concurrent_phase_started, "Sanity");
-  _concurrent_phase_started = true;
+  uint old_val = 0;
+  do {
+    old_val = Atomic::cmpxchg(ConcPhaseStarted, &_concurrent_phase_status, ConcPhaseNotStarted);
+  } while (old_val != ConcPhaseNotStarted);
   _g1h->gc_timer_cm()->register_gc_concurrent_start(title);
 }
 
+void G1ConcurrentMark::register_concurrent_phase_end_common(bool end_timer) {
+  if (_concurrent_phase_status == ConcPhaseNotStarted) {
+    return;
+  }
+
+  uint old_val = Atomic::cmpxchg(ConcPhaseStopping, &_concurrent_phase_status, ConcPhaseStarted);
+  if (old_val == ConcPhaseStarted) {
+    _g1h->gc_timer_cm()->register_gc_concurrent_end();
+    // If 'end_timer' is true, we came here to end timer which needs concurrent phase ended.
+    // We need to end it before changing the status to 'ConcPhaseNotStarted' to prevent
+    // starting a new concurrent phase by 'ConcurrentMarkThread'.
+    if (end_timer) {
+      _g1h->gc_timer_cm()->register_gc_end();
+    }
+    old_val = Atomic::cmpxchg(ConcPhaseNotStarted, &_concurrent_phase_status, ConcPhaseStopping);
+    assert(old_val == ConcPhaseStopping, "Should not have changed since we entered this scope.");
+  } else {
+    do {
+      // Let other thread finish changing '_concurrent_phase_status' to 'ConcPhaseNotStarted'.
+      os::naked_short_sleep(1);
+    } while (_concurrent_phase_status != ConcPhaseNotStarted);
+  }
+}
+
 void G1ConcurrentMark::register_concurrent_phase_end() {
-  if (_concurrent_phase_started) {
-    _concurrent_phase_started = false;
-    _g1h->gc_timer_cm()->register_gc_concurrent_end();
-  }
+  register_concurrent_phase_end_common(false);
+}
+
+void G1ConcurrentMark::register_concurrent_gc_end_and_stop_timer() {
+  register_concurrent_phase_end_common(true);
 }
 
 void G1ConcurrentMark::markFromRoots() {
@@ -2605,9 +2632,6 @@
 
   _g1h->trace_heap_after_concurrent_cycle();
 
-  // Close any open concurrent phase timing
-  register_concurrent_phase_end();
-
   _g1h->register_concurrent_cycle_end();
 }
 
--- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.hpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.hpp	Mon Mar 21 11:21:07 2016 +0100
@@ -352,8 +352,17 @@
   // time of remark.
   volatile bool           _concurrent_marking_in_progress;
 
-  // Keep track of whether we have started concurrent phase or not.
-  bool                    _concurrent_phase_started;
+  // There would be a race between ConcurrentMarkThread and VMThread(ConcurrentMark::abort())
+  // to call ConcurrentGCTimer::register_gc_concurrent_end().
+  // And this variable is used to keep track of concurrent phase.
+  volatile uint           _concurrent_phase_status;
+  // Concurrent phase is not yet started.
+  static const uint       ConcPhaseNotStarted = 0;
+  // Concurrent phase is started.
+  static const uint       ConcPhaseStarted = 1;
+  // Caller thread of ConcurrentGCTimer::register_gc_concurrent_end() is ending concurrent phase.
+  // So other thread should wait until the status to be changed to ConcPhaseNotStarted.
+  static const uint       ConcPhaseStopping = 2;
 
   // All of these times are in ms
   NumberSeq _init_times;
@@ -485,6 +494,9 @@
   // Set to true when initialization is complete
   bool _completed_initialization;
 
+  // end_timer, true to end gc timer after ending concurrent phase.
+  void register_concurrent_phase_end_common(bool end_timer);
+
 public:
   // Manipulation of the global mark stack.
   // The push and pop operations are used by tasks for transfers
@@ -520,6 +532,8 @@
 
   void register_concurrent_phase_start(const char* title);
   void register_concurrent_phase_end();
+  // Ends both concurrent phase and timer.
+  void register_concurrent_gc_end_and_stop_timer();
 
   void update_accum_task_vtime(int i, double vtime) {
     _accum_task_vtime[i] += vtime;
--- a/hotspot/src/share/vm/gc/g1/g1IHOPControl.cpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1IHOPControl.cpp	Mon Mar 21 11:21:07 2016 +0100
@@ -29,15 +29,21 @@
 #include "gc/shared/gcTrace.hpp"
 #include "logging/log.hpp"
 
-G1IHOPControl::G1IHOPControl(double initial_ihop_percent, size_t target_occupancy) :
+G1IHOPControl::G1IHOPControl(double initial_ihop_percent) :
   _initial_ihop_percent(initial_ihop_percent),
-  _target_occupancy(target_occupancy),
+  _target_occupancy(0),
   _last_allocated_bytes(0),
   _last_allocation_time_s(0.0)
 {
   assert(_initial_ihop_percent >= 0.0 && _initial_ihop_percent <= 100.0, "Initial IHOP value must be between 0 and 100 but is %.3f", initial_ihop_percent);
 }
 
+void G1IHOPControl::update_target_occupancy(size_t new_target_occupancy) {
+  log_debug(gc, ihop)("Target occupancy update: old: " SIZE_FORMAT "B, new: " SIZE_FORMAT "B",
+                      _target_occupancy, new_target_occupancy);
+  _target_occupancy = new_target_occupancy;
+}
+
 void G1IHOPControl::update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) {
   assert(allocation_time_s >= 0.0, "Allocation time must be positive but is %.3f", allocation_time_s);
 
@@ -46,6 +52,7 @@
 }
 
 void G1IHOPControl::print() {
+  assert(_target_occupancy > 0, "Target occupancy still not updated yet.");
   size_t cur_conc_mark_start_threshold = get_conc_mark_start_threshold();
   log_debug(gc, ihop)("Basic information (value update), threshold: " SIZE_FORMAT "B (%1.2f), target occupancy: " SIZE_FORMAT "B, current occupancy: " SIZE_FORMAT "B, "
                       "recent allocation size: " SIZE_FORMAT "B, recent allocation duration: %1.2fms, recent old gen allocation rate: %1.2fB/s, recent marking phase length: %1.2fms",
@@ -60,6 +67,7 @@
 }
 
 void G1IHOPControl::send_trace_event(G1NewTracer* tracer) {
+  assert(_target_occupancy > 0, "Target occupancy still not updated yet.");
   tracer->report_basic_ihop_statistics(get_conc_mark_start_threshold(),
                                        _target_occupancy,
                                        G1CollectedHeap::heap()->used(),
@@ -68,10 +76,9 @@
                                        last_marking_length_s());
 }
 
-G1StaticIHOPControl::G1StaticIHOPControl(double ihop_percent, size_t target_occupancy) :
-  G1IHOPControl(ihop_percent, target_occupancy),
+G1StaticIHOPControl::G1StaticIHOPControl(double ihop_percent) :
+  G1IHOPControl(ihop_percent),
   _last_marking_length_s(0.0) {
-  assert(_target_occupancy > 0, "Target occupancy must be larger than zero.");
 }
 
 #ifndef PRODUCT
@@ -85,7 +92,8 @@
 void G1StaticIHOPControl::test() {
   size_t const initial_ihop = 45;
 
-  G1StaticIHOPControl ctrl(initial_ihop, 100);
+  G1StaticIHOPControl ctrl(initial_ihop);
+  ctrl.update_target_occupancy(100);
 
   size_t threshold = ctrl.get_conc_mark_start_threshold();
   assert(threshold == initial_ihop,
@@ -115,11 +123,10 @@
 #endif
 
 G1AdaptiveIHOPControl::G1AdaptiveIHOPControl(double ihop_percent,
-                                             size_t initial_target_occupancy,
                                              G1Predictions const* predictor,
                                              size_t heap_reserve_percent,
                                              size_t heap_waste_percent) :
-  G1IHOPControl(ihop_percent, initial_target_occupancy),
+  G1IHOPControl(ihop_percent),
   _predictor(predictor),
   _marking_times_s(10, 0.95),
   _allocation_rate_s(10, 0.95),
@@ -130,6 +137,7 @@
 }
 
 size_t G1AdaptiveIHOPControl::actual_target_threshold() const {
+  guarantee(_target_occupancy > 0, "Target occupancy still not updated yet.");
   // The actual target threshold takes the heap reserve and the expected waste in
   // free space  into account.
   // _heap_reserve is that part of the total heap capacity that is reserved for
@@ -227,7 +235,8 @@
   // target_size - (young_size + alloc_amount/alloc_time * marking_time)
 
   G1Predictions pred(0.95);
-  G1AdaptiveIHOPControl ctrl(initial_threshold, target_size, &pred, 0, 0);
+  G1AdaptiveIHOPControl ctrl(initial_threshold, &pred, 0, 0);
+  ctrl.update_target_occupancy(target_size);
 
   // First "load".
   size_t const alloc_time1 = 2;
@@ -288,5 +297,6 @@
 
 void IHOP_test() {
   G1StaticIHOPControl::test();
+  G1AdaptiveIHOPControl::test();
 }
 #endif
--- a/hotspot/src/share/vm/gc/g1/g1IHOPControl.hpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1IHOPControl.hpp	Mon Mar 21 11:21:07 2016 +0100
@@ -38,7 +38,8 @@
  protected:
   // The initial IHOP value relative to the target occupancy.
   double _initial_ihop_percent;
-  // The target maximum occupancy of the heap.
+  // The target maximum occupancy of the heap. The target occupancy is the number
+  // of bytes when marking should be finished and reclaim started.
   size_t _target_occupancy;
 
   // Most recent complete mutator allocation period in seconds.
@@ -46,10 +47,9 @@
   // Amount of bytes allocated during _last_allocation_time_s.
   size_t _last_allocated_bytes;
 
-  // Initialize an instance with the initial IHOP value in percent and the target
-  // occupancy. The target occupancy is the number of bytes when marking should
-  // be finished and reclaim started.
-  G1IHOPControl(double initial_ihop_percent, size_t target_occupancy);
+  // Initialize an instance with the initial IHOP value in percent. The target
+  // occupancy will be updated at the first heap expansion.
+  G1IHOPControl(double initial_ihop_percent);
 
   // Most recent time from the end of the initial mark to the start of the first
   // mixed gc.
@@ -60,6 +60,8 @@
   // Get the current non-young occupancy at which concurrent marking should start.
   virtual size_t get_conc_mark_start_threshold() = 0;
 
+  // Adjust target occupancy.
+  virtual void update_target_occupancy(size_t new_target_occupancy);
   // Update information about time during which allocations in the Java heap occurred,
   // how large these allocations were in bytes, and an additional buffer.
   // The allocations should contain any amount of space made unusable for further
@@ -86,9 +88,12 @@
  protected:
   double last_marking_length_s() const { return _last_marking_length_s; }
  public:
-  G1StaticIHOPControl(double ihop_percent, size_t target_occupancy);
+  G1StaticIHOPControl(double ihop_percent);
 
-  size_t get_conc_mark_start_threshold() { return (size_t) (_initial_ihop_percent * _target_occupancy / 100.0); }
+  size_t get_conc_mark_start_threshold() {
+    guarantee(_target_occupancy > 0, "Target occupancy must have been initialized.");
+    return (size_t) (_initial_ihop_percent * _target_occupancy / 100.0);
+  }
 
   virtual void update_marking_length(double marking_length_s) {
    assert(marking_length_s > 0.0, "Marking length must be larger than zero but is %.3f", marking_length_s);
@@ -132,7 +137,6 @@
   virtual double last_marking_length_s() const { return _marking_times_s.last(); }
  public:
   G1AdaptiveIHOPControl(double ihop_percent,
-                        size_t initial_target_occupancy,
                         G1Predictions const* predictor,
                         size_t heap_reserve_percent, // The percentage of total heap capacity that should not be tapped into.
                         size_t heap_waste_percent);  // The percentage of the free space in the heap that we think is not usable for allocation.
--- a/hotspot/src/share/vm/gc/g1/g1OopClosures.inline.hpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1OopClosures.inline.hpp	Mon Mar 21 11:21:07 2016 +0100
@@ -171,14 +171,7 @@
 #ifdef ASSERT
   // can't do because of races
   // assert(obj == NULL || obj->is_oop(), "expected an oop");
-
-  // Do the safe subset of is_oop
-#ifdef CHECK_UNHANDLED_OOPS
-  oopDesc* o = obj.obj();
-#else
-  oopDesc* o = obj;
-#endif // CHECK_UNHANDLED_OOPS
-  assert((intptr_t)o % MinObjAlignmentInBytes == 0, "not oop aligned");
+  assert(check_obj_alignment(obj), "not oop aligned");
   assert(_g1->is_in_reserved(obj), "must be in heap");
 #endif // ASSERT
 
--- a/hotspot/src/share/vm/gc/g1/g1RemSet.inline.hpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1RemSet.inline.hpp	Mon Mar 21 11:21:07 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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
@@ -44,14 +44,7 @@
 #ifdef ASSERT
   // can't do because of races
   // assert(obj == NULL || obj->is_oop(), "expected an oop");
-
-  // Do the safe subset of is_oop
-#ifdef CHECK_UNHANDLED_OOPS
-  oopDesc* o = obj.obj();
-#else
-  oopDesc* o = obj;
-#endif // CHECK_UNHANDLED_OOPS
-  assert((intptr_t)o % MinObjAlignmentInBytes == 0, "not oop aligned");
+  assert(check_obj_alignment(obj), "not oop aligned");
   assert(_g1->is_in_reserved(obj), "must be in heap");
 #endif // ASSERT
 
--- a/hotspot/src/share/vm/gc/parallel/psCompactionManager.inline.hpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/gc/parallel/psCompactionManager.inline.hpp	Mon Mar 21 11:21:07 2016 +0100
@@ -125,14 +125,14 @@
   T* const beg = base + beg_index;
   T* const end = base + end_index;
 
+  if (end_index < len) {
+    cm->push_objarray(obj, end_index); // Push the continuation.
+  }
+
   // Push the non-NULL elements of the next stride on the marking stack.
   for (T* e = beg; e < end; e++) {
     cm->mark_and_push<T>(e);
   }
-
-  if (end_index < len) {
-    cm->push_objarray(obj, end_index); // Push the continuation.
-  }
 }
 
 inline void ParCompactionManager::follow_contents(objArrayOop obj, int index) {
--- a/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp	Mon Mar 21 11:21:07 2016 +0100
@@ -1484,17 +1484,6 @@
 }
 
 void
-PSParallelCompact::clear_source_region(HeapWord* beg_addr, HeapWord* end_addr)
-{
-  RegionData* const beg_ptr = _summary_data.addr_to_region_ptr(beg_addr);
-  HeapWord* const end_aligned_up = _summary_data.region_align_up(end_addr);
-  RegionData* const end_ptr = _summary_data.addr_to_region_ptr(end_aligned_up);
-  for (RegionData* cur = beg_ptr; cur < end_ptr; ++cur) {
-    cur->set_source_region(0);
-  }
-}
-
-void
 PSParallelCompact::summarize_space(SpaceId id, bool maximum_compaction)
 {
   assert(id < last_space_id, "id out of range");
--- a/hotspot/src/share/vm/gc/parallel/psParallelCompact.hpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/gc/parallel/psParallelCompact.hpp	Mon Mar 21 11:21:07 2016 +0100
@@ -1065,9 +1065,6 @@
   // non-empty.
   static void fill_dense_prefix_end(SpaceId id);
 
-  // Clear the summary data source_region field for the specified addresses.
-  static void clear_source_region(HeapWord* beg_addr, HeapWord* end_addr);
-
   static void summarize_spaces_quick();
   static void summarize_space(SpaceId id, bool maximum_compaction);
   static void summary_phase(ParCompactionManager* cm, bool maximum_compaction);
--- a/hotspot/src/share/vm/gc/parallel/psScavenge.cpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/gc/parallel/psScavenge.cpp	Mon Mar 21 11:21:07 2016 +0100
@@ -600,12 +600,6 @@
 
     NOT_PRODUCT(reference_processor()->verify_no_references_recorded());
 
-    {
-      GCTraceTime(Debug, gc, phases) tm("Prune Scavenge Root Methods", &_gc_timer);
-
-      CodeCache::prune_scavenge_root_nmethods();
-    }
-
     // Re-verify object start arrays
     if (VerifyObjectStartArray &&
         VerifyAfterGC) {
--- a/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp	Mon Mar 21 11:21:07 2016 +0100
@@ -561,7 +561,7 @@
                                      OopClosure* weak_roots,
                                      CLDClosure* strong_cld_closure,
                                      CLDClosure* weak_cld_closure,
-                                     CodeBlobClosure* code_roots) {
+                                     CodeBlobToOopClosure* code_roots) {
   // General roots.
   assert(Threads::thread_claim_parity() != 0, "must have called prologue code");
   assert(code_roots != NULL, "code root closure should always be set");
@@ -578,7 +578,7 @@
   // Don't process them if they will be processed during the ClassLoaderDataGraph phase.
   CLDClosure* roots_from_clds_p = (strong_cld_closure != weak_cld_closure) ? strong_cld_closure : NULL;
   // Only process code roots from thread stacks if we aren't visiting the entire CodeCache anyway
-  CodeBlobClosure* roots_from_code_p = (so & SO_AllCodeCache) ? NULL : code_roots;
+  CodeBlobToOopClosure* roots_from_code_p = (so & SO_AllCodeCache) ? NULL : code_roots;
 
   bool is_par = scope->n_threads() > 1;
   Threads::possibly_parallel_oops_do(is_par, strong_roots, roots_from_clds_p, roots_from_code_p);
--- a/hotspot/src/share/vm/gc/shared/genCollectedHeap.hpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/gc/shared/genCollectedHeap.hpp	Mon Mar 21 11:21:07 2016 +0100
@@ -399,7 +399,7 @@
                      OopClosure* weak_roots,
                      CLDClosure* strong_cld_closure,
                      CLDClosure* weak_cld_closure,
-                     CodeBlobClosure* code_roots);
+                     CodeBlobToOopClosure* code_roots);
 
  public:
   static const bool StrongAndWeakRoots = false;
--- a/hotspot/src/share/vm/logging/log.hpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/logging/log.hpp	Mon Mar 21 11:21:07 2016 +0100
@@ -107,18 +107,25 @@
     return LogTagSetMapping<T0, T1, T2, T3, T4>::tagset().is_level(level);
   }
 
+  ATTRIBUTE_PRINTF(2, 3)
+  static void write(LogLevelType level, const char* fmt, ...) {
+    va_list args;
+    va_start(args, fmt);
+    vwrite(level, fmt, args);
+    va_end(args);
+  };
+
   template <LogLevelType Level>
   ATTRIBUTE_PRINTF(1, 2)
   static void write(const char* fmt, ...) {
     va_list args;
     va_start(args, fmt);
-    vwrite<Level>(fmt, args);
+    vwrite(Level, fmt, args);
     va_end(args);
   };
 
-  template <LogLevelType Level>
-  ATTRIBUTE_PRINTF(1, 0)
-  static void vwrite(const char* fmt, va_list args) {
+  ATTRIBUTE_PRINTF(2, 0)
+  static void vwrite(LogLevelType level, const char* fmt, va_list args) {
     char buf[LogBufferSize];
     va_list saved_args;         // For re-format on buf overflow.
     va_copy(saved_args, args);
@@ -132,27 +139,26 @@
       prefix_len = LogPrefix<T0, T1, T2, T3, T4>::prefix(newbuf, newbuf_len);
       ret = os::log_vsnprintf(newbuf + prefix_len, newbuf_len - prefix_len, fmt, saved_args);
       assert(ret >= 0, "Log message buffer issue");
-      puts<Level>(newbuf);
+      puts(level, newbuf);
       FREE_C_HEAP_ARRAY(char, newbuf);
     } else {
-      puts<Level>(buf);
+      puts(level, buf);
     }
   }
 
-  template <LogLevelType Level>
-  static void puts(const char* string) {
-    LogTagSetMapping<T0, T1, T2, T3, T4>::tagset().log(Level, string);
+  static void puts(LogLevelType level, const char* string) {
+    LogTagSetMapping<T0, T1, T2, T3, T4>::tagset().log(level, string);
   }
 
 #define LOG_LEVEL(level, name) ATTRIBUTE_PRINTF(2, 0) \
   Log& v##name(const char* fmt, va_list args) { \
-    vwrite<LogLevel::level>(fmt, args); \
+    vwrite(LogLevel::level, fmt, args); \
     return *this; \
   } \
   Log& name(const char* fmt, ...) ATTRIBUTE_PRINTF(2, 3) { \
     va_list args; \
     va_start(args, fmt); \
-    vwrite<LogLevel::level>(fmt, args); \
+    vwrite(LogLevel::level, fmt, args); \
     va_end(args); \
     return *this; \
   } \
--- a/hotspot/src/share/vm/memory/iterator.hpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/memory/iterator.hpp	Mon Mar 21 11:21:07 2016 +0100
@@ -285,9 +285,12 @@
  protected:
   void do_nmethod(nmethod* nm);
  public:
+  // If fix_relocations(), then cl must copy objects to their new location immediately to avoid
+  // patching nmethods with the old locations.
   CodeBlobToOopClosure(OopClosure* cl, bool fix_relocations) : _cl(cl), _fix_relocations(fix_relocations) {}
   virtual void do_code_blob(CodeBlob* cb);
 
+  bool fix_relocations() const { return _fix_relocations; }
   const static bool FixRelocations = true;
 };
 
--- a/hotspot/src/share/vm/oops/oop.inline.hpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/oops/oop.inline.hpp	Mon Mar 21 11:21:07 2016 +0100
@@ -295,7 +295,7 @@
 // in inner GC loops so these are separated.
 
 inline bool check_obj_alignment(oop obj) {
-  return cast_from_oop<intptr_t>(obj) % MinObjAlignmentInBytes == 0;
+  return (cast_from_oop<intptr_t>(obj) & MinObjAlignmentInBytesMask) == 0;
 }
 
 oop oopDesc::decode_heap_oop_not_null(narrowOop v) {
--- a/hotspot/src/share/vm/oops/symbol.cpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/oops/symbol.cpp	Mon Mar 21 11:21:07 2016 +0100
@@ -158,9 +158,21 @@
 }
 
 void Symbol::print_symbol_on(outputStream* st) const {
-  ResourceMark rm;
+  char *s;
   st = st ? st : tty;
-  st->print("%s", as_quoted_ascii());
+  {
+    // ResourceMark may not affect st->print(). If st is a string
+    // stream it could resize, using the same resource arena.
+    ResourceMark rm;
+    s = as_quoted_ascii();
+    s = os::strdup(s);
+  }
+  if (s == NULL) {
+    st->print("(null)");
+  } else {
+    st->print("%s", s);
+    os::free(s);
+  }
 }
 
 char* Symbol::as_quoted_ascii() const {
--- a/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp	Mon Mar 21 11:21:07 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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
@@ -247,6 +247,9 @@
 void emit_range_double(const char* /*name*/)    { /* NOP */ }
 
 // CommandLineFlagRange emitting code functions if range arguments are provided
+void emit_range_int(const char* name, int min, int max)       {
+  CommandLineFlagRangeList::add(new CommandLineFlagRange_int(name, min, max));
+}
 void emit_range_intx(const char* name, intx min, intx max) {
   CommandLineFlagRangeList::add(new CommandLineFlagRange_intx(name, min, max));
 }
--- a/hotspot/src/share/vm/runtime/globals.hpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Mon Mar 21 11:21:07 2016 +0100
@@ -891,9 +891,6 @@
   notproduct(bool, VerifyLastFrame, false,                                  \
           "Verify oops on last frame on entry to VM")                       \
                                                                             \
-  develop(bool, TraceHandleAllocation, false,                               \
-          "Print out warnings when suspiciously many handles are allocated")\
-                                                                            \
   product(bool, FailOverToOldVerifier, true,                                \
           "Fail over to old verifier when split verifier fails")            \
                                                                             \
@@ -1603,10 +1600,10 @@
   product(bool, ResizePLAB, true,                                           \
           "Dynamically resize (survivor space) promotion LAB's")            \
                                                                             \
-  product(intx, ParGCArrayScanChunk, 50,                                    \
+  product(int, ParGCArrayScanChunk, 50,                                     \
           "Scan a subset of object array and push remainder, if array is "  \
           "bigger than this")                                               \
-          range(1, max_intx)                                                \
+          range(1, max_jint/3)                                              \
                                                                             \
   product(bool, ParGCUseLocalOverflow, false,                               \
           "Instead of a global overflow list, use local overflow stacks")   \
@@ -3024,14 +3021,6 @@
   notproduct(ccstrlist, SuppressErrorAt, "",                                \
           "List of assertions (file:line) to muzzle")                       \
                                                                             \
-  notproduct(size_t, HandleAllocationLimit, 1024,                           \
-          "Threshold for HandleMark allocation when +TraceHandleAllocation "\
-          "is used")                                                        \
-                                                                            \
-  develop(size_t, TotalHandleAllocationLimit, 1024,                         \
-          "Threshold for total handle allocation when "                     \
-          "+TraceHandleAllocation is used")                                 \
-                                                                            \
   develop(intx, StackPrintLimit, 100,                                       \
           "number of stack frames to print in VM-level stack dump")         \
                                                                             \
--- a/hotspot/src/share/vm/runtime/handles.cpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/runtime/handles.cpp	Mon Mar 21 11:21:07 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
@@ -129,14 +129,6 @@
     k = k->next();
   }
 
-  // The thread local handle areas should not get very large
-  if (TraceHandleAllocation && (size_t)handles_visited > TotalHandleAllocationLimit) {
-#ifdef ASSERT
-    warning("%d: Visited in HandleMark : " SIZE_FORMAT, _nof_handlemarks, handles_visited);
-#else
-    warning("Visited in HandleMark : " SIZE_FORMAT, handles_visited);
-#endif
-  }
   if (_prev != NULL) _prev->oops_do(f);
 }
 
@@ -165,31 +157,6 @@
   assert(area->_handle_mark_nesting > 0, "must stack allocate HandleMarks" );
   debug_only(area->_handle_mark_nesting--);
 
-  // Debug code to trace the number of handles allocated per mark/
-#ifdef ASSERT
-  if (TraceHandleAllocation) {
-    size_t handles = 0;
-    Chunk *c = _chunk->next();
-    if (c == NULL) {
-      handles = area->_hwm - _hwm; // no new chunk allocated
-    } else {
-      handles = _max - _hwm;      // add rest in first chunk
-      while(c != NULL) {
-        handles += c->length();
-        c = c->next();
-      }
-      handles -= area->_max - area->_hwm; // adjust for last trunk not full
-    }
-    handles /= sizeof(void *); // Adjust for size of a handle
-    if (handles > HandleAllocationLimit) {
-      // Note: _nof_handlemarks is only set in debug mode
-      warning("%d: Allocated in HandleMark : " SIZE_FORMAT, _nof_handlemarks, handles);
-    }
-
-    tty->print_cr("Handles " SIZE_FORMAT, handles);
-  }
-#endif
-
   // Delete later chunks
   if( _chunk->next() ) {
     // reset arena size before delete chunks. Otherwise, the total
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Mon Mar 21 11:21:07 2016 +0100
@@ -313,7 +313,7 @@
 // ANSI C++ does not allow casting from one pointer type to a function pointer
 // directly without at best a warning. This macro accomplishes it silently
 // In every case that is present at this point the value be cast is a pointer
-// to a C linkage function. In somecase the type used for the cast reflects
+// to a C linkage function. In some case the type used for the cast reflects
 // that linkage and a picky compiler would not complain. In other cases because
 // there is no convenient place to place a typedef with extern C linkage (i.e
 // a platform dependent header file) it doesn't. At this point no compiler seems
@@ -678,7 +678,7 @@
 inline const char* type2name(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2name_tab[t] : NULL; }
 extern BasicType name2type(const char* name);
 
-// Auxilary math routines
+// Auxiliary math routines
 // least common multiple
 extern size_t lcm(size_t a, size_t b);
 
@@ -801,7 +801,7 @@
 
 // TosState describes the top-of-stack state before and after the execution of
 // a bytecode or method. The top-of-stack value may be cached in one or more CPU
-// registers. The TosState corresponds to the 'machine represention' of this cached
+// registers. The TosState corresponds to the 'machine representation' of this cached
 // value. There's 4 states corresponding to the JAVA types int, long, float & double
 // as well as a 5th state in case the top-of-stack value is actually on the top
 // of stack (in memory) and thus not cached. The atos state corresponds to the itos
@@ -876,7 +876,7 @@
 // a transition from one state to another. These extra states makes it possible for the safepoint code to
 // handle certain thread_states without having to suspend the thread - making the safepoint code faster.
 //
-// Given a state, the xxx_trans state can always be found by adding 1.
+// Given a state, the xxxx_trans state can always be found by adding 1.
 //
 enum JavaThreadState {
   _thread_uninitialized     =  0, // should never happen (missing initialization)
@@ -1425,7 +1425,7 @@
 // operations.
 
 // The goal of this code to avoid undefined or implementation-defined
-// behaviour.  The use of an lvalue to reference cast is explicitly
+// behavior.  The use of an lvalue to reference cast is explicitly
 // permitted by Lvalues and rvalues [basic.lval].  [Section 3.10 Para
 // 15 in C++03]
 #define JAVA_INTEGER_OP(OP, NAME, TYPE, UNSIGNED_TYPE)  \
--- a/hotspot/src/share/vm/utilities/ostream.cpp	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/src/share/vm/utilities/ostream.cpp	Mon Mar 21 11:21:07 2016 +0100
@@ -338,7 +338,9 @@
       }
       char* oldbuf = buffer;
       assert(rm == NULL || Thread::current()->current_resource_mark() == rm,
-             "stringStream is re-allocated with a different ResourceMark");
+             "StringStream is re-allocated with a different ResourceMark. Current: "
+             PTR_FORMAT " original: " PTR_FORMAT,
+             p2i(Thread::current()->current_resource_mark()), p2i(rm));
       buffer = NEW_RESOURCE_ARRAY(char, end);
       if (buffer_pos > 0) {
         memcpy(buffer, oldbuf, buffer_pos);
--- a/hotspot/test/TEST.groups	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/test/TEST.groups	Mon Mar 21 11:21:07 2016 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2016, 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
@@ -230,8 +230,10 @@
 #
 needs_g1gc = \
   compiler/regalloc/C1ObjectSpillInLogicOp.java \
+  gc/TestSmallHeap.java \
   gc/TestSystemGC.java \
   gc/arguments/TestAlignmentToUseLargePages.java \
+  gc/arguments/TestG1ConcRefinementThreads.java \
   gc/arguments/TestG1HeapRegionSize.java \
   gc/arguments/TestG1HeapSizeFlags.java \
   gc/arguments/TestG1PercentageOptions.java \
@@ -242,11 +244,11 @@
   gc/class_unloading/TestG1ClassUnloadingHWM.java \
   gc/ergonomics/TestDynamicNumberOfGCThreads.java \
   gc/g1/ \
+  gc/logging/TestGCId.java \
   gc/metaspace/G1AddMetaspaceDependency.java \
   gc/metaspace/TestMetaspacePerfCounters.java \
   gc/startup_warnings/TestG1.java \
-  gc/whitebox/TestConcMarkCycleWB.java \
-  gc/arguments/TestG1ConcRefinementThreads.java
+  gc/whitebox/TestConcMarkCycleWB.java 
 
 hotspot_native_sanity = \
   native_sanity
--- a/hotspot/test/gc/TestCardTablePageCommits.java	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/test/gc/TestCardTablePageCommits.java	Mon Mar 21 11:21:07 2016 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2014, 2016, 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,6 +31,7 @@
  * @key gc
  * @bug 8059066
  * @summary Tests that the card table does not commit the same page twice
+ * @requires vm.gc=="Parallel" | vm.gc=="null"
  * @library /testlibrary
  * @modules java.base/sun.misc
  *          java.management
--- a/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java	Mon Mar 21 11:21:07 2016 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2016, 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
@@ -25,6 +25,7 @@
  * @test TestCMSHeapSizeFlags
  * @key gc
  * @bug 8006088
+ * @requires vm.gc=="ConcMarkSweep" | vm.gc=="null"
  * @summary Tests argument processing for initial and maximum heap size for the CMS collector
  * @library /testlibrary /test/lib
  * @modules java.base/sun.misc
--- a/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java	Mon Mar 21 11:21:07 2016 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2014, 2016, 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
@@ -25,6 +25,7 @@
  * @test TestG1ConcRefinementThreads
  * @key gc
  * @bug 8047976
+ * @requires vm.gc=="G1" | vm.gc=="null"
  * @summary Tests argument processing for G1ConcRefinementThreads
  * @library /testlibrary
  * @modules java.base/sun.misc
--- a/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java	Mon Mar 21 11:21:07 2016 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2016, 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
@@ -25,6 +25,7 @@
  * @test TestG1HeapSizeFlags
  * @key gc
  * @bug 8006088
+ * @requires vm.gc=="G1" | vm.gc=="null"
  * @summary Tests argument processing for initial and maximum heap size for the G1 collector
  * @library /testlibrary /test/lib
  * @modules java.base/sun.misc
--- a/hotspot/test/gc/arguments/TestG1PercentageOptions.java	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/test/gc/arguments/TestG1PercentageOptions.java	Mon Mar 21 11:21:07 2016 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2016, 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
@@ -25,6 +25,7 @@
  * @test TestG1PercentageOptions
  * @key gc
  * @bug 8068942
+ * @requires vm.gc=="G1" | vm.gc=="null"
  * @summary Test argument processing of various percentage options
  * @library /testlibrary
  * @modules java.base/sun.misc
--- a/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java	Mon Mar 21 11:21:07 2016 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2016, 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
@@ -27,6 +27,7 @@
  * @bug 8006088
  * @summary Tests argument processing for initial and maximum heap size for the
  * parallel collectors.
+ * @requires vm.gc=="null"
  * @library /testlibrary /test/lib
  * @modules java.base/sun.misc
  *          java.management
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java	Mon Mar 21 11:21:07 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -27,6 +27,7 @@
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
  * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
  * @library /testlibrary /test/lib
  * @modules java.base/sun.misc
  *          java.management
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java	Mon Mar 21 11:21:07 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -27,6 +27,7 @@
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
  * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
  * @library /testlibrary /test/lib
  * @modules java.base/sun.misc
  *          java.management
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java	Mon Mar 21 11:21:07 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -27,6 +27,7 @@
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
  * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
  * @library /testlibrary /test/lib
  * @modules java.base/sun.misc
  *          java.management
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java	Mon Mar 21 11:21:07 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -27,6 +27,7 @@
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
  * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
  * @library /testlibrary /test/lib
  * @modules java.base/sun.misc
  *          java.management
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java	Mon Mar 21 11:21:07 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -27,6 +27,7 @@
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
  * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
  * @library /testlibrary /test/lib
  * @modules java.base/sun.misc
   *          java.management
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java	Mon Mar 21 11:21:07 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -27,6 +27,7 @@
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
  * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
  * @library /testlibrary /test/lib
  * @modules java.base/sun.misc
  *          java.management
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java	Mon Mar 21 11:21:07 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -27,6 +27,7 @@
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
  * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
  * @library /testlibrary /test/lib
  * @modules java.base/sun.misc
  *          java.management
--- a/hotspot/test/gc/logging/TestGCId.java	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/test/gc/logging/TestGCId.java	Mon Mar 21 11:21:07 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -25,6 +25,7 @@
  * @test TestGCId
  * @bug 8043607
  * @summary Ensure that the GCId is logged
+ * @requires vm.gc=="null"
  * @key gc
  * @library /testlibrary
  * @modules java.base/sun.misc
--- a/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java	Mon Mar 21 09:51:20 2016 +0100
+++ b/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java	Mon Mar 21 11:21:07 2016 +0100
@@ -84,13 +84,6 @@
         setAllowedExitCodes("SharedMiscCodeSize", 2);
 
         /*
-         * JDK-8145204
-         * Temporarily remove testing of max range for ParGCArrayScanChunk because
-         * JVM can hang when ParGCArrayScanChunk=4294967296 and ParallelGC is used
-         */
-        excludeTestMaxRange("ParGCArrayScanChunk");
-
-        /*
          * Remove CICompilerCount from testing because currently it can hang system
          */
         excludeTestMaxRange("CICompilerCount");