changeset 23510:9df17c84dacc

Merge
author ehelin
date Fri, 28 Mar 2014 10:41:20 +0100
parents f41b7404d441 08e26f93c9a5
children a6e433ebd892
files hotspot/src/share/vm/runtime/arguments.cpp
diffstat 21 files changed, 376 insertions(+), 223 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/make/Makefile	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/make/Makefile	Fri Mar 28 10:41:20 2014 +0100
@@ -287,8 +287,43 @@
 	@$(ECHO) "Error: trying to build a minimal target but JVM_VARIANT_MINIMAL1 is not true."
 endif
 
+remove_old_debuginfo:
+ifeq ($(JVM_VARIANT_CLIENT), true)
+  ifeq ($(ZIP_DEBUGINFO_FILES),1)
+    ifeq ($(OSNAME), windows)
+	  $(RM) -f $(EXPORT_CLIENT_DIR)/jvm.map $(EXPORT_CLIENT_DIR)/jvm.pdb
+    else
+	  $(RM) -f $(EXPORT_CLIENT_DIR)/libjvm.debuginfo
+    endif
+  else
+	$(RM) -f $(EXPORT_CLIENT_DIR)/libjvm.diz
+  endif
+endif
+ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
+  ifeq ($(ZIP_DEBUGINFO_FILES),1)
+    ifeq ($(OSNAME), windows)
+	  $(RM) -f $(EXPORT_SERVER_DIR)/jvm.map $(EXPORT_SERVER_DIR)/jvm.pdb
+    else
+      ifeq ($(OS_VENDOR), Darwin)
+	    $(RM) -rf $(EXPORT_SERVER_DIR)/libjvm.dylib.dSYM
+      else
+	    $(RM) -f $(EXPORT_SERVER_DIR)/libjvm.debuginfo
+      endif
+    endif
+  else
+	$(RM) -f $(EXPORT_SERVER_DIR)/libjvm.diz
+  endif
+endif
+ifeq ($(JVM_VARIANT_MINIMAL1),true)
+  ifeq ($(ZIP_DEBUGINFO_FILES),1)
+	$(RM) -f $(EXPORT_MINIMAL_DIR)/libjvm.debuginfo
+  else
+	$(RM) -f $(EXPORT_MINIMAL_DIR)/libjvm.diz
+  endif
+endif
+
 # Export file rule
-generic_export: $(EXPORT_LIST)
+generic_export: $(EXPORT_LIST) remove_old_debuginfo
 
 export_product:
 	$(MAKE) BUILD_FLAVOR=$(@:export_%=%) generic_export
@@ -841,4 +876,4 @@
 	export_jdk_product export_jdk_fastdebug export_jdk_debug \
 	create_jdk copy_jdk update_jdk test_jdk \
 	copy_product_jdk copy_fastdebug_jdk copy_debug_jdk  \
-	$(HS_ALT_MAKE)/Makefile.make
+	$(HS_ALT_MAKE)/Makefile.make remove_old_debuginfo
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Fri Mar 28 10:41:20 2014 +0100
@@ -793,53 +793,6 @@
   }
 }
 
-// Apply the given closure to each oop in the space \intersect memory region.
-void CompactibleFreeListSpace::oop_iterate(MemRegion mr, ExtendedOopClosure* cl) {
-  assert_lock_strong(freelistLock());
-  if (is_empty()) {
-    return;
-  }
-  MemRegion cur = MemRegion(bottom(), end());
-  mr = mr.intersection(cur);
-  if (mr.is_empty()) {
-    return;
-  }
-  if (mr.equals(cur)) {
-    oop_iterate(cl);
-    return;
-  }
-  assert(mr.end() <= end(), "just took an intersection above");
-  HeapWord* obj_addr = block_start(mr.start());
-  HeapWord* t = mr.end();
-
-  SpaceMemRegionOopsIterClosure smr_blk(cl, mr);
-  if (block_is_obj(obj_addr)) {
-    // Handle first object specially.
-    oop obj = oop(obj_addr);
-    obj_addr += adjustObjectSize(obj->oop_iterate(&smr_blk));
-  } else {
-    FreeChunk* fc = (FreeChunk*)obj_addr;
-    obj_addr += fc->size();
-  }
-  while (obj_addr < t) {
-    HeapWord* obj = obj_addr;
-    obj_addr += block_size(obj_addr);
-    // If "obj_addr" is not greater than top, then the
-    // entire object "obj" is within the region.
-    if (obj_addr <= t) {
-      if (block_is_obj(obj)) {
-        oop(obj)->oop_iterate(cl);
-      }
-    } else {
-      // "obj" extends beyond end of region
-      if (block_is_obj(obj)) {
-        oop(obj)->oop_iterate(&smr_blk);
-      }
-      break;
-    }
-  }
-}
-
 // NOTE: In the following methods, in order to safely be able to
 // apply the closure to an object, we need to be sure that the
 // object has been initialized. We are guaranteed that an object
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp	Fri Mar 28 10:41:20 2014 +0100
@@ -351,7 +351,6 @@
   Mutex* freelistLock() const { return &_freelistLock; }
 
   // Iteration support
-  void oop_iterate(MemRegion mr, ExtendedOopClosure* cl);
   void oop_iterate(ExtendedOopClosure* cl);
 
   void object_iterate(ObjectClosure* blk);
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Fri Mar 28 10:41:20 2014 +0100
@@ -3164,16 +3164,6 @@
 }
 
 void
-ConcurrentMarkSweepGeneration::oop_iterate(MemRegion mr, ExtendedOopClosure* cl) {
-  if (freelistLock()->owned_by_self()) {
-    Generation::oop_iterate(mr, cl);
-  } else {
-    MutexLockerEx x(freelistLock(), Mutex::_no_safepoint_check_flag);
-    Generation::oop_iterate(mr, cl);
-  }
-}
-
-void
 ConcurrentMarkSweepGeneration::oop_iterate(ExtendedOopClosure* cl) {
   if (freelistLock()->owned_by_self()) {
     Generation::oop_iterate(cl);
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Fri Mar 28 10:41:20 2014 +0100
@@ -1285,7 +1285,6 @@
   void save_sweep_limit();
 
   // More iteration support
-  virtual void oop_iterate(MemRegion mr, ExtendedOopClosure* cl);
   virtual void oop_iterate(ExtendedOopClosure* cl);
   virtual void safe_object_iterate(ObjectClosure* cl);
   virtual void object_iterate(ObjectClosure* cl);
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri Mar 28 10:41:20 2014 +0100
@@ -2018,8 +2018,8 @@
     // that calculated by walking the marking bitmap.
 
     // Bitmaps to hold expected values
-    BitMap expected_region_bm(_region_bm.size(), false);
-    BitMap expected_card_bm(_card_bm.size(), false);
+    BitMap expected_region_bm(_region_bm.size(), true);
+    BitMap expected_card_bm(_card_bm.size(), true);
 
     G1ParVerifyFinalCountTask g1_par_verify_task(g1h,
                                                  &_region_bm,
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Fri Mar 28 10:41:20 2014 +0100
@@ -550,7 +550,8 @@
 
        if (PrintTenuringDistribution) {
          gclog_or_tty->cr();
-         gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold %u (max %u)",
+         gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold "
+                                UINTX_FORMAT " (max threshold " UINTX_FORMAT ")",
                                 size_policy->calculated_survivor_size_in_bytes(),
                                 _tenuring_threshold, MaxTenuringThreshold);
        }
@@ -829,10 +830,10 @@
 void PSScavenge::initialize() {
   // Arguments must have been parsed
 
-  if (AlwaysTenure) {
-    _tenuring_threshold = 0;
-  } else if (NeverTenure) {
-    _tenuring_threshold = markOopDesc::max_age + 1;
+  if (AlwaysTenure || NeverTenure) {
+    assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1,
+        err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is ", MaxTenuringThreshold));
+    _tenuring_threshold = MaxTenuringThreshold;
   } else {
     // We want to smooth out our startup times for the AdaptiveSizePolicy
     _tenuring_threshold = (UseAdaptiveSizePolicy) ? InitialTenuringThreshold :
--- a/hotspot/src/share/vm/gc_implementation/shared/ageTable.cpp	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/ageTable.cpp	Fri Mar 28 10:41:20 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -80,28 +80,37 @@
 
 uint ageTable::compute_tenuring_threshold(size_t survivor_capacity) {
   size_t desired_survivor_size = (size_t)((((double) survivor_capacity)*TargetSurvivorRatio)/100);
-  size_t total = 0;
-  uint age = 1;
-  assert(sizes[0] == 0, "no objects with age zero should be recorded");
-  while (age < table_size) {
-    total += sizes[age];
-    // check if including objects of age 'age' made us pass the desired
-    // size, if so 'age' is the new threshold
-    if (total > desired_survivor_size) break;
-    age++;
+  uint result;
+
+  if (AlwaysTenure || NeverTenure) {
+    assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1,
+        err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is ", MaxTenuringThreshold));
+    result = MaxTenuringThreshold;
+  } else {
+    size_t total = 0;
+    uint age = 1;
+    assert(sizes[0] == 0, "no objects with age zero should be recorded");
+    while (age < table_size) {
+      total += sizes[age];
+      // check if including objects of age 'age' made us pass the desired
+      // size, if so 'age' is the new threshold
+      if (total > desired_survivor_size) break;
+      age++;
+    }
+    result = age < MaxTenuringThreshold ? age : MaxTenuringThreshold;
   }
-  uint result = age < MaxTenuringThreshold ? age : MaxTenuringThreshold;
 
   if (PrintTenuringDistribution || UsePerfData) {
 
     if (PrintTenuringDistribution) {
       gclog_or_tty->cr();
-      gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold %u (max %u)",
+      gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold "
+        UINTX_FORMAT " (max threshold " UINTX_FORMAT ")",
         desired_survivor_size*oopSize, result, MaxTenuringThreshold);
     }
 
-    total = 0;
-    age = 1;
+    size_t total = 0;
+    uint age = 1;
     while (age < table_size) {
       total += sizes[age];
       if (sizes[age] > 0) {
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Fri Mar 28 10:41:20 2014 +0100
@@ -837,12 +837,6 @@
   }
 }
 
-void GenCollectedHeap::oop_iterate(MemRegion mr, ExtendedOopClosure* cl) {
-  for (int i = 0; i < _n_gens; i++) {
-    _gens[i]->oop_iterate(mr, cl);
-  }
-}
-
 void GenCollectedHeap::object_iterate(ObjectClosure* cl) {
   for (int i = 0; i < _n_gens; i++) {
     _gens[i]->object_iterate(cl);
--- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp	Fri Mar 28 10:41:20 2014 +0100
@@ -212,7 +212,6 @@
 
   // Iteration functions.
   void oop_iterate(ExtendedOopClosure* cl);
-  void oop_iterate(MemRegion mr, ExtendedOopClosure* cl);
   void object_iterate(ObjectClosure* cl);
   void safe_object_iterate(ObjectClosure* cl);
   Space* space_containing(const void* addr) const;
--- a/hotspot/src/share/vm/memory/generation.cpp	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/src/share/vm/memory/generation.cpp	Fri Mar 28 10:41:20 2014 +0100
@@ -295,22 +295,16 @@
 
 class GenerationOopIterateClosure : public SpaceClosure {
  public:
-  ExtendedOopClosure* cl;
-  MemRegion mr;
+  ExtendedOopClosure* _cl;
   virtual void do_space(Space* s) {
-    s->oop_iterate(mr, cl);
+    s->oop_iterate(_cl);
   }
-  GenerationOopIterateClosure(ExtendedOopClosure* _cl, MemRegion _mr) :
-    cl(_cl), mr(_mr) {}
+  GenerationOopIterateClosure(ExtendedOopClosure* cl) :
+    _cl(cl) {}
 };
 
 void Generation::oop_iterate(ExtendedOopClosure* cl) {
-  GenerationOopIterateClosure blk(cl, _reserved);
-  space_iterate(&blk);
-}
-
-void Generation::oop_iterate(MemRegion mr, ExtendedOopClosure* cl) {
-  GenerationOopIterateClosure blk(cl, mr);
+  GenerationOopIterateClosure blk(cl);
   space_iterate(&blk);
 }
 
--- a/hotspot/src/share/vm/memory/generation.hpp	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/src/share/vm/memory/generation.hpp	Fri Mar 28 10:41:20 2014 +0100
@@ -543,10 +543,6 @@
   // generation, calling "cl.do_oop" on each.
   virtual void oop_iterate(ExtendedOopClosure* cl);
 
-  // Same as above, restricted to the intersection of a memory region and
-  // the generation.
-  virtual void oop_iterate(MemRegion mr, ExtendedOopClosure* cl);
-
   // Iterate over all objects in the generation, calling "cl.do_object" on
   // each.
   virtual void object_iterate(ObjectClosure* cl);
--- a/hotspot/src/share/vm/memory/metaspace.cpp	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Fri Mar 28 10:41:20 2014 +0100
@@ -3343,37 +3343,22 @@
 }
 
 void Metaspace::deallocate(MetaWord* ptr, size_t word_size, bool is_class) {
-  if (SafepointSynchronize::is_at_safepoint()) {
-    assert(Thread::current()->is_VM_thread(), "should be the VM thread");
-    // Don't take Heap_lock
-    MutexLockerEx ml(vsm()->lock(), Mutex::_no_safepoint_check_flag);
-    if (word_size < TreeChunk<Metablock, FreeList<Metablock> >::min_size()) {
-      // Dark matter.  Too small for dictionary.
+  assert(!SafepointSynchronize::is_at_safepoint()
+         || Thread::current()->is_VM_thread(), "should be the VM thread");
+
+  MutexLockerEx ml(vsm()->lock(), Mutex::_no_safepoint_check_flag);
+
+  if (word_size < TreeChunk<Metablock, FreeList<Metablock> >::min_size()) {
+    // Dark matter.  Too small for dictionary.
 #ifdef ASSERT
-      Copy::fill_to_words((HeapWord*)ptr, word_size, 0xf5f5f5f5);
+    Copy::fill_to_words((HeapWord*)ptr, word_size, 0xf5f5f5f5);
 #endif
-      return;
-    }
-    if (is_class && using_class_space()) {
-      class_vsm()->deallocate(ptr, word_size);
-    } else {
-      vsm()->deallocate(ptr, word_size);
-    }
+    return;
+  }
+  if (is_class && using_class_space()) {
+    class_vsm()->deallocate(ptr, word_size);
   } else {
-    MutexLockerEx ml(vsm()->lock(), Mutex::_no_safepoint_check_flag);
-
-    if (word_size < TreeChunk<Metablock, FreeList<Metablock> >::min_size()) {
-      // Dark matter.  Too small for dictionary.
-#ifdef ASSERT
-      Copy::fill_to_words((HeapWord*)ptr, word_size, 0xf5f5f5f5);
-#endif
-      return;
-    }
-    if (is_class && using_class_space()) {
-      class_vsm()->deallocate(ptr, word_size);
-    } else {
-      vsm()->deallocate(ptr, word_size);
-    }
+    vsm()->deallocate(ptr, word_size);
   }
 }
 
--- a/hotspot/src/share/vm/memory/sharedHeap.hpp	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/src/share/vm/memory/sharedHeap.hpp	Fri Mar 28 10:41:20 2014 +0100
@@ -163,9 +163,6 @@
   // Iteration functions.
   void oop_iterate(ExtendedOopClosure* cl) = 0;
 
-  // Same as above, restricted to a memory region.
-  virtual void oop_iterate(MemRegion mr, ExtendedOopClosure* cl) = 0;
-
   // Iterate over all spaces in use in the heap, in an undefined order.
   virtual void space_iterate(SpaceClosure* cl) = 0;
 
--- a/hotspot/src/share/vm/memory/space.cpp	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/src/share/vm/memory/space.cpp	Fri Mar 28 10:41:20 2014 +0100
@@ -42,9 +42,6 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/macros.hpp"
 
-void SpaceMemRegionOopsIterClosure::do_oop(oop* p)       { SpaceMemRegionOopsIterClosure::do_oop_work(p); }
-void SpaceMemRegionOopsIterClosure::do_oop(narrowOop* p) { SpaceMemRegionOopsIterClosure::do_oop_work(p); }
-
 HeapWord* DirtyCardToOopClosure::get_actual_top(HeapWord* top,
                                                 HeapWord* top_obj) {
   if (top_obj != NULL) {
@@ -686,43 +683,6 @@
   }
 }
 
-void ContiguousSpace::oop_iterate(MemRegion mr, ExtendedOopClosure* blk) {
-  if (is_empty()) {
-    return;
-  }
-  MemRegion cur = MemRegion(bottom(), top());
-  mr = mr.intersection(cur);
-  if (mr.is_empty()) {
-    return;
-  }
-  if (mr.equals(cur)) {
-    oop_iterate(blk);
-    return;
-  }
-  assert(mr.end() <= top(), "just took an intersection above");
-  HeapWord* obj_addr = block_start(mr.start());
-  HeapWord* t = mr.end();
-
-  // Handle first object specially.
-  oop obj = oop(obj_addr);
-  SpaceMemRegionOopsIterClosure smr_blk(blk, mr);
-  obj_addr += obj->oop_iterate(&smr_blk);
-  while (obj_addr < t) {
-    oop obj = oop(obj_addr);
-    assert(obj->is_oop(), "expected an oop");
-    obj_addr += obj->size();
-    // If "obj_addr" is not greater than top, then the
-    // entire object "obj" is within the region.
-    if (obj_addr <= t) {
-      obj->oop_iterate(blk);
-    } else {
-      // "obj" extends beyond end of region
-      obj->oop_iterate(&smr_blk);
-      break;
-    }
-  };
-}
-
 void ContiguousSpace::object_iterate(ObjectClosure* blk) {
   if (is_empty()) return;
   WaterMark bm = bottom_mark();
--- a/hotspot/src/share/vm/memory/space.hpp	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/src/share/vm/memory/space.hpp	Fri Mar 28 10:41:20 2014 +0100
@@ -81,31 +81,6 @@
 class CardTableRS;
 class DirtyCardToOopClosure;
 
-// An oop closure that is circumscribed by a filtering memory region.
-class SpaceMemRegionOopsIterClosure: public ExtendedOopClosure {
- private:
-  ExtendedOopClosure* _cl;
-  MemRegion   _mr;
- protected:
-  template <class T> void do_oop_work(T* p) {
-    if (_mr.contains(p)) {
-      _cl->do_oop(p);
-    }
-  }
- public:
-  SpaceMemRegionOopsIterClosure(ExtendedOopClosure* cl, MemRegion mr):
-    _cl(cl), _mr(mr) {}
-  virtual void do_oop(oop* p);
-  virtual void do_oop(narrowOop* p);
-  virtual bool do_metadata() {
-    // _cl is of type ExtendedOopClosure instead of OopClosure, so that we can check this.
-    assert(!_cl->do_metadata(), "I've checked all call paths, this shouldn't happen.");
-    return false;
-  }
-  virtual void do_klass(Klass* k)                         { ShouldNotReachHere(); }
-  virtual void do_class_loader_data(ClassLoaderData* cld) { ShouldNotReachHere(); }
-};
-
 // A Space describes a heap area. Class Space is an abstract
 // base class.
 //
@@ -221,11 +196,6 @@
   // applications of the closure are not included in the iteration.
   virtual void oop_iterate(ExtendedOopClosure* cl);
 
-  // Same as above, restricted to the intersection of a memory region and
-  // the space.  Fields in objects allocated by applications of the closure
-  // are not included in the iteration.
-  virtual void oop_iterate(MemRegion mr, ExtendedOopClosure* cl) = 0;
-
   // Iterate over all objects in the space, calling "cl.do_object" on
   // each.  Objects allocated by applications of the closure are not
   // included in the iteration.
@@ -866,7 +836,6 @@
 
   // Iteration
   void oop_iterate(ExtendedOopClosure* cl);
-  void oop_iterate(MemRegion mr, ExtendedOopClosure* cl);
   void object_iterate(ObjectClosure* blk);
   // For contiguous spaces this method will iterate safely over objects
   // in the space (i.e., between bottom and top) when at a safepoint.
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Fri Mar 28 10:41:20 2014 +0100
@@ -1187,11 +1187,6 @@
     FLAG_SET_DEFAULT(OldPLABSize, (intx)1024);
   }
 
-  // AlwaysTenure flag should make ParNew promote all at first collection.
-  // See CR 6362902.
-  if (AlwaysTenure) {
-    FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0);
-  }
   // When using compressed oops, we use local overflow stacks,
   // rather than using a global overflow list chained through
   // the klass word of the object's pre-image.
@@ -2344,10 +2339,8 @@
   status = status && verify_percentage(YoungGenerationSizeSupplement, "YoungGenerationSizeSupplement");
   status = status && verify_percentage(TenuredGenerationSizeSupplement, "TenuredGenerationSizeSupplement");
 
-  // the "age" field in the oop header is 4 bits; do not want to pull in markOop.hpp
-  // just for that, so hardcode here.
-  status = status && verify_interval(MaxTenuringThreshold, 0, 15, "MaxTenuringThreshold");
-  status = status && verify_interval(InitialTenuringThreshold, 0, MaxTenuringThreshold, "MaxTenuringThreshold");
+  status = status && verify_interval(MaxTenuringThreshold, 0, markOopDesc::max_age + 1, "MaxTenuringThreshold");
+  status = status && verify_interval(InitialTenuringThreshold, 0, MaxTenuringThreshold, "InitialTenuringThreshold");
   status = status && verify_percentage(TargetSurvivorRatio, "TargetSurvivorRatio");
   status = status && verify_percentage(MarkSweepDeadRatio, "MarkSweepDeadRatio");
 
@@ -3073,14 +3066,31 @@
       // but disallow DR and offlining (5008695).
       FLAG_SET_CMDLINE(bool, BindGCTaskThreadsToCPUs, true);
 
+    // Need to keep consistency of MaxTenuringThreshold and AlwaysTenure/NeverTenure;
+    // and the last option wins.
     } else if (match_option(option, "-XX:+NeverTenure", &tail)) {
-      // The last option must always win.
+      FLAG_SET_CMDLINE(bool, NeverTenure, true);
       FLAG_SET_CMDLINE(bool, AlwaysTenure, false);
-      FLAG_SET_CMDLINE(bool, NeverTenure, true);
+      FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, markOopDesc::max_age + 1);
     } else if (match_option(option, "-XX:+AlwaysTenure", &tail)) {
-      // The last option must always win.
       FLAG_SET_CMDLINE(bool, NeverTenure, false);
       FLAG_SET_CMDLINE(bool, AlwaysTenure, true);
+      FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0);
+    } else if (match_option(option, "-XX:MaxTenuringThreshold=", &tail)) {
+      uintx max_tenuring_thresh = 0;
+      if(!parse_uintx(tail, &max_tenuring_thresh, 0)) {
+        jio_fprintf(defaultStream::error_stream(),
+                    "Invalid MaxTenuringThreshold: %s\n", option->optionString);
+      }
+      FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, max_tenuring_thresh);
+
+      if (MaxTenuringThreshold == 0) {
+        FLAG_SET_CMDLINE(bool, NeverTenure, false);
+        FLAG_SET_CMDLINE(bool, AlwaysTenure, true);
+      } else {
+        FLAG_SET_CMDLINE(bool, NeverTenure, false);
+        FLAG_SET_CMDLINE(bool, AlwaysTenure, false);
+      }
     } else if (match_option(option, "-XX:+CMSPermGenSweepingEnabled", &tail) ||
                match_option(option, "-XX:-CMSPermGenSweepingEnabled", &tail)) {
       jio_fprintf(defaultStream::error_stream(),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/arguments/FlagsValue.java	Fri Mar 28 10:41:20 2014 +0100
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2014, 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.
+*/
+
+import java.util.regex.*;
+
+public class FlagsValue {
+  public static boolean getFlagBoolValue(String flag, String where) {
+    Matcher m = Pattern.compile(flag + "\\s+:?= (true|false)").matcher(where);
+    if (!m.find()) {
+      throw new RuntimeException("Could not find value for flag " + flag + " in output string");
+    }
+    return m.group(1).equals("true");
+  }
+
+  public static long getFlagLongValue(String flag, String where) {
+    Matcher m = Pattern.compile(flag + "\\s+:?=\\s+\\d+").matcher(where);
+    if (!m.find()) {
+      throw new RuntimeException("Could not find value for flag " + flag + " in output string");
+    }
+    String match = m.group();
+    return Long.parseLong(match.substring(match.lastIndexOf(" ") + 1, match.length()));
+  }
+}
\ No newline at end of file
--- a/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java	Fri Mar 28 10:41:20 2014 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2014, 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
@@ -63,13 +63,13 @@
     // successful tests
     runWithThresholds(0, 10, false);
     runWithThresholds(5, 5, false);
+    runWithThresholds(8, 16, false);
     // failing tests
     runWithThresholds(10, 0, true);
     runWithThresholds(9, 8, true);
     runWithThresholds(-1, 8, true);
     runWithThresholds(8, -1, true);
-    runWithThresholds(8, 16, true);
     runWithThresholds(16, 8, true);
+    runWithThresholds(8, 17, true);
   }
-}
-
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/arguments/TestObjectTenuringFlags.java	Fri Mar 28 10:41:20 2014 +0100
@@ -0,0 +1,215 @@
+/*
+* Copyright (c) 2014, 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 TestObjectTenuringFlags
+ * @key gc
+ * @bug 6521376
+ * @summary Tests argument processing for NeverTenure, AlwaysTenure,
+ * and MaxTenuringThreshold
+ * @library /testlibrary
+ * @build TestObjectTenuringFlags FlagsValue
+ * @run main/othervm TestObjectTenuringFlags
+ */
+
+import com.oracle.java.testlibrary.*;
+
+import java.util.*;
+
+public class TestObjectTenuringFlags {
+  public static void main(String args[]) throws Exception {
+    // default case
+    runTenuringFlagsConsistencyTest(
+        new String[]{},
+        false /* shouldFail */,
+        new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 7, 15));
+
+    // valid cases
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:+NeverTenure"},
+        false /* shouldFail */,
+        new ExpectedTenuringFlags(false /* alwaysTenure */, true /* neverTenure */, 7, 16));
+
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:+AlwaysTenure"},
+        false /* shouldFail */,
+        new ExpectedTenuringFlags(true /* alwaysTenure */, false /* neverTenure */, 0, 0));
+
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:MaxTenuringThreshold=0"},
+        false /* shouldFail */,
+        new ExpectedTenuringFlags(true /* alwaysTenure */, false /* neverTenure */, 0, 0));
+
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:MaxTenuringThreshold=5"},
+        false /* shouldFail */,
+        new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 5, 5));
+
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:MaxTenuringThreshold=10"},
+        false /* shouldFail */,
+        new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 7, 10));
+
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:MaxTenuringThreshold=15"},
+        false /* shouldFail */,
+        new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 7, 15));
+
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:MaxTenuringThreshold=16"},
+        false /* shouldFail */,
+        new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 7, 16));
+
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:InitialTenuringThreshold=0"},
+        false /* shouldFail */,
+        new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 0, 15));
+
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:InitialTenuringThreshold=5"},
+        false /* shouldFail */,
+        new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 5, 15));
+
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:InitialTenuringThreshold=10"},
+        false /* shouldFail */,
+        new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 10, 15));
+
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:InitialTenuringThreshold=15"},
+        false /* shouldFail */,
+        new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 15, 15));
+
+    // "Last option wins" cases
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:+AlwaysTenure", "-XX:+NeverTenure"},
+        false /* shouldFail */,
+        new ExpectedTenuringFlags(false /* alwaysTenure */, true /* neverTenure */, 7, 16));
+
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:+NeverTenure", "-XX:+AlwaysTenure"},
+        false /* shouldFail */,
+        new ExpectedTenuringFlags(true /* alwaysTenure */, false /* neverTenure */, 0, 0));
+
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:MaxTenuringThreshold=16", "-XX:+AlwaysTenure"},
+        false /* shouldFail */,
+        new ExpectedTenuringFlags(true /* alwaysTenure */, false /* neverTenure */, 0, 0));
+
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:+AlwaysTenure", "-XX:MaxTenuringThreshold=16"},
+        false /* shouldFail */,
+        new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 7, 16));
+
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:MaxTenuringThreshold=0", "-XX:+NeverTenure"},
+        false /* shouldFail */,
+        new ExpectedTenuringFlags(false /* alwaysTenure */, true /* neverTenure */, 7, 16));
+
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:+NeverTenure", "-XX:MaxTenuringThreshold=0"},
+        false /* shouldFail */,
+        new ExpectedTenuringFlags(true /* alwaysTenure */, false /* neverTenure */, 0, 0));
+
+    // Illegal cases
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:MaxTenuringThreshold=17"},
+        true /* shouldFail */,
+        new ExpectedTenuringFlags());
+
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:InitialTenuringThreshold=16"},
+        true /* shouldFail */,
+        new ExpectedTenuringFlags());
+
+    runTenuringFlagsConsistencyTest(
+        new String[]{"-XX:InitialTenuringThreshold=17"},
+        true /* shouldFail */,
+        new ExpectedTenuringFlags());
+  }
+
+  private static void runTenuringFlagsConsistencyTest(String[] tenuringFlags,
+          boolean shouldFail,
+          ExpectedTenuringFlags expectedFlags) throws Exception {
+    List<String> vmOpts = new ArrayList<>();
+    if (tenuringFlags.length > 0) {
+      Collections.addAll(vmOpts, tenuringFlags);
+    }
+    Collections.addAll(vmOpts, "-XX:+PrintFlagsFinal", "-version");
+
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()]));
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+
+    if (shouldFail) {
+      output.shouldHaveExitValue(1);
+    } else {
+      output.shouldHaveExitValue(0);
+      String stdout = output.getStdout();
+      checkTenuringFlagsConsistency(stdout, expectedFlags);
+    }
+  }
+
+  private static void checkTenuringFlagsConsistency(String output, ExpectedTenuringFlags expectedFlags) {
+    if (expectedFlags.alwaysTenure != FlagsValue.getFlagBoolValue("AlwaysTenure", output)) {
+      throw new RuntimeException(
+            "Actual flag AlwaysTenure " + FlagsValue.getFlagBoolValue("AlwaysTenure", output) +
+            " is not equal to expected flag AlwaysTenure " + expectedFlags.alwaysTenure);
+    }
+
+    if (expectedFlags.neverTenure != FlagsValue.getFlagBoolValue("NeverTenure", output)) {
+      throw new RuntimeException(
+            "Actual flag NeverTenure " + FlagsValue.getFlagBoolValue("NeverTenure", output) +
+            " is not equal to expected flag NeverTenure " + expectedFlags.neverTenure);
+    }
+
+    if (expectedFlags.initialTenuringThreshold != FlagsValue.getFlagLongValue("InitialTenuringThreshold", output)) {
+      throw new RuntimeException(
+            "Actual flag InitialTenuringThreshold " + FlagsValue.getFlagLongValue("InitialTenuringThreshold", output) +
+            " is not equal to expected flag InitialTenuringThreshold " + expectedFlags.initialTenuringThreshold);
+    }
+
+    if (expectedFlags.maxTenuringThreshold != FlagsValue.getFlagLongValue("MaxTenuringThreshold", output)) {
+      throw new RuntimeException(
+            "Actual flag MaxTenuringThreshold " + FlagsValue.getFlagLongValue("MaxTenuringThreshold", output) +
+            " is not equal to expected flag MaxTenuringThreshold " + expectedFlags.maxTenuringThreshold);
+    }
+  }
+}
+
+class ExpectedTenuringFlags {
+    public boolean alwaysTenure;
+    public boolean neverTenure;
+    public long initialTenuringThreshold;
+    public long maxTenuringThreshold;
+
+    public ExpectedTenuringFlags(boolean alwaysTenure,
+            boolean neverTenure,
+            long initialTenuringThreshold,
+            long maxTenuringThreshold) {
+      this.alwaysTenure = alwaysTenure;
+      this.neverTenure = neverTenure;
+      this.initialTenuringThreshold = initialTenuringThreshold;
+      this.maxTenuringThreshold = maxTenuringThreshold;
+    }
+    public ExpectedTenuringFlags() {}
+}
--- a/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java	Thu Mar 27 08:03:57 2014 -0700
+++ b/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java	Fri Mar 28 10:41:20 2014 +0100
@@ -26,7 +26,7 @@
  * @bug 8004924
  * @summary Checks that jmap -heap contains the flag CompressedClassSpaceSize
  * @library /testlibrary
- * @run main/othervm -XX:CompressedClassSpaceSize=50m CompressedClassSpaceSizeInJmapHeap
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:CompressedClassSpaceSize=50m CompressedClassSpaceSizeInJmapHeap
  */
 
 import com.oracle.java.testlibrary.*;
@@ -37,6 +37,11 @@
 
 public class CompressedClassSpaceSizeInJmapHeap {
     public static void main(String[] args) throws Exception {
+        if (!Platform.is64bit()) {
+            // Compressed Class Space is only available on 64-bit JVMs
+            return;
+        }
+
         String pid = Integer.toString(ProcessTools.getProcessId());
 
         JDKToolLauncher jmap = JDKToolLauncher.create("jmap")