United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6983930 CMS: Various small cleanups ca September 2010
JDK-6983930 : CMS: Various small cleanups ca September 2010

Details
Type:
Enhancement
Submit Date:
2010-09-10
Status:
Closed
Updated Date:
2011-04-23
Project Name:
JDK
Resolved Date:
2011-04-23
Component:
hotspot
OS:
generic
Sub-Component:
gc
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
hs19
Fixed Versions:
hs20 (b01)

Related Reports
Backport:
Backport:

Sub Tasks

Description
Small set of cleanups in CMS code:
(1) convert some guarantee()s to assert()s
(2) fix typos in comments/documentation etc.

                                    

Comments
EVALUATION

Yup!
                                     
2010-09-10
SUGGESTED FIX

diff -r dee553c74493 src/share/vm/gc_implementation/concurrentMarkSweep/binaryTreeDictionary.cpp
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/binaryTreeDictionary.cpp       Wed Sep 01 00:40:05 2010 -0700
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/binaryTreeDictionary.cpp       Fri Sep 10 11:23:51 2010 -0700
@@ -256,7 +256,7 @@ TreeChunk* TreeList::head_as_TreeChunk()
 }

 TreeChunk* TreeList::first_available() {
-  guarantee(head() != NULL, "The head of the list cannot be NULL");
+  assert(head() != NULL, "The head of the list cannot be NULL");
   FreeChunk* fc = head()->next();
   TreeChunk* retTC;
   if (fc == NULL) {
@@ -272,7 +272,7 @@ TreeChunk* TreeList::first_available() {
 // those in the list for this size; potentially slow and expensive,
 // use with caution!
 TreeChunk* TreeList::largest_address() {
-  guarantee(head() != NULL, "The head of the list cannot be NULL");
+  assert(head() != NULL, "The head of the list cannot be NULL");
   FreeChunk* fc = head()->next();
   TreeChunk* retTC;
   if (fc == NULL) {
diff -r dee553c74493 src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp   Wed Sep 01 00:40:05 2010 -0700
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp   Fri Sep 10 11:23:51 2010 -0700
@@ -1946,8 +1946,8 @@ void CompactibleFreeListSpace::save_mark

 bool CompactibleFreeListSpace::no_allocs_since_save_marks() {
   assert(_promoInfo.tracking(), "No preceding save_marks?");
-  guarantee(SharedHeap::heap()->n_par_threads() == 0,
-            "Shouldn't be called (yet) during parallel part of gc.");
+  assert(SharedHeap::heap()->n_par_threads() == 0,
+         "Shouldn't be called if using parallel gc.");
   return _promoInfo.noPromotions();
 }

@@ -2569,7 +2569,7 @@ void CFLS_LAB::modify_initialization(siz

 HeapWord* CFLS_LAB::alloc(size_t word_sz) {
   FreeChunk* res;
-  guarantee(word_sz == _cfls->adjustObjectSize(word_sz), "Error");
+  assert(word_sz == _cfls->adjustObjectSize(word_sz), "Error");
   if (word_sz >=  CompactibleFreeListSpace::IndexSetSize) {
     // This locking manages sync with other large object allocations.
     MutexLockerEx x(_cfls->parDictionaryAllocLock(),
diff -r dee553c74493 src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp      Wed Sep 01 00:40:05 2010 -070
0
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp      Fri Sep 10 11:23:51 2010 -070
0
@@ -1332,7 +1332,7 @@ ConcurrentMarkSweepGeneration::allocatio
 // -----------------------------------------------------
 // FREE:      klass_word & 1 == 1; mark_word holds block size
 //
-// OBJECT:    klass_word installed; klass_word != 0 && klass_word & 0 == 0;
+// OBJECT:    klass_word installed; klass_word != 0 && klass_word & 1 == 0;
 //            obj->size() computes correct size
 //            [Perm Gen objects needs to be "parsable" before they can be navigated]
 //
diff -r dee553c74493 src/share/vm/gc_implementation/concurrentMarkSweep/freeList.cpp
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/freeList.cpp   Wed Sep 01 00:40:05 2010 -0700
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/freeList.cpp   Fri Sep 10 11:23:51 2010 -0700
@@ -165,13 +165,8 @@ void FreeList::removeChunk(FreeChunk*fc)
        "Next of tail should be NULL");
    }
    decrement_count();
-#define TRAP_CODE 1
-#if TRAP_CODE
-   if (head() == NULL) {
-     guarantee(tail() == NULL, "INVARIANT");
-     guarantee(count() == 0, "INVARIANT");
-   }
-#endif
+   assert(((head() == NULL) + (tail() == NULL) + (count() == 0)) % 3 == 0,
+          "H/T/C Inconsistency");
    // clear next and prev fields of fc, debug only
    NOT_PRODUCT(
      fc->linkPrev(NULL);
diff -r dee553c74493 src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp      Wed Sep 01 00:40:05 2010 -0700
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp      Fri Sep 10 11:23:51 2010 -0700
@@ -253,8 +253,8 @@ void PromotionInfo::print_statistics(uin
        cur_spool = cur_spool->nextSpoolBlock) {
     // the first entry is just a self-pointer; indices 1 through
     // bufferSize - 1 are occupied (thus, bufferSize - 1 slots).
-    guarantee((void*)cur_spool->displacedHdr == (void*)&cur_spool->displacedHdr,
-              "first entry of displacedHdr should be self-referential");
+    assert((void*)cur_spool->displacedHdr == (void*)&cur_spool->displacedHdr,
+           "first entry of displacedHdr should be self-referential");
     slots += cur_spool->bufferSize - 1;
     blocks++;
   }
diff -r dee553c74493 src/share/vm/runtime/globals.hpp
--- a/src/share/vm/runtime/globals.hpp  Wed Sep 01 00:40:05 2010 -0700
+++ b/src/share/vm/runtime/globals.hpp  Fri Sep 10 11:23:51 2010 -0700
@@ -1541,13 +1541,13 @@ class CommandLineFlags {
           "Use BinaryTreeDictionary as default in the CMS generation")      \
                                                                             \
   product(uintx, CMSIndexedFreeListReplenish, 4,                            \
-          "Replenish and indexed free list with this number of chunks")     \
+          "Replenish an indexed free list with this number of chunks")     \
                                                                             \
   product(bool, CMSReplenishIntermediate, true,                             \
           "Replenish all intermediate free-list caches")                    \
                                                                             \
   product(bool, CMSSplitIndexedFreeListBlocks, true,                        \
-          "When satisfying batched demand, splot blocks from the "          \
+          "When satisfying batched demand, split blocks from the "          \
           "IndexedFreeList whose size is a multiple of requested size")     \
                                                                             \
   product(bool, CMSLoopWarn, false,                                         \
                                     
2010-09-10
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/179464550c7d
                                     
2010-09-11
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/179464550c7d
                                     
2010-09-20



Hardware and Software, Engineered to Work Together