< prev index next >

src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp

Print this page
rev 8031 : imported patch cms

@@ -63,12 +63,10 @@
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/vmThread.hpp"
 #include "services/memoryService.hpp"
 #include "services/runtimeService.hpp"
 
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
-
 // statics
 CMSCollector* ConcurrentMarkSweepGeneration::_collector = NULL;
 bool CMSCollector::_full_gc_requested = false;
 GCCause::Cause CMSCollector::_full_gc_cause = GCCause::_no_gc;
 

@@ -1591,11 +1589,11 @@
          "VM thread should have CMS token");
   getFreelistLocks();
   bitMapLock()->lock_without_safepoint_check();
   if (TraceCMSState) {
     gclog_or_tty->print_cr("CMS foreground collector has asked for control "
-      INTPTR_FORMAT " with first state %d", Thread::current(), first_state);
+      INTPTR_FORMAT " with first state %d", p2i(Thread::current()), first_state);
     gclog_or_tty->print_cr("    gets control with state %d", _collectorState);
   }
 
   // Inform cms gen if this was due to partial collection failing.
   // The CMS gen may use this fact to determine its expansion policy.

@@ -1761,31 +1759,31 @@
   ContiguousSpace* from_space = _young_gen->from();
   ContiguousSpace* to_space   = _young_gen->to();
   // Eden
   if (_eden_chunk_array != NULL) {
     gclog_or_tty->print_cr("eden " PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "(" SIZE_FORMAT ")",
-                           eden_space->bottom(), eden_space->top(),
-                           eden_space->end(), eden_space->capacity());
+                           p2i(eden_space->bottom()), p2i(eden_space->top()),
+                           p2i(eden_space->end()), eden_space->capacity());
     gclog_or_tty->print_cr("_eden_chunk_index=" SIZE_FORMAT ", "
                            "_eden_chunk_capacity=" SIZE_FORMAT,
                            _eden_chunk_index, _eden_chunk_capacity);
     for (size_t i = 0; i < _eden_chunk_index; i++) {
       gclog_or_tty->print_cr("_eden_chunk_array[" SIZE_FORMAT "]=" PTR_FORMAT,
-                             i, _eden_chunk_array[i]);
+                             i, p2i(_eden_chunk_array[i]));
     }
   }
   // Survivor
   if (_survivor_chunk_array != NULL) {
     gclog_or_tty->print_cr("survivor " PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "(" SIZE_FORMAT ")",
-                           from_space->bottom(), from_space->top(),
-                           from_space->end(), from_space->capacity());
+                           p2i(from_space->bottom()), p2i(from_space->top()),
+                           p2i(from_space->end()), from_space->capacity());
     gclog_or_tty->print_cr("_survivor_chunk_index=" SIZE_FORMAT ", "
                            "_survivor_chunk_capacity=" SIZE_FORMAT,
                            _survivor_chunk_index, _survivor_chunk_capacity);
     for (size_t i = 0; i < _survivor_chunk_index; i++) {
       gclog_or_tty->print_cr("_survivor_chunk_array[" SIZE_FORMAT "]=" PTR_FORMAT,
-                             i, _survivor_chunk_array[i]);
+                             i, p2i(_survivor_chunk_array[i]));
     }
   }
 }
 
 void CMSCollector::getFreelistLocks() const {

@@ -1888,11 +1886,11 @@
   // while the world is stopped because the foreground collector already
   // has the world stopped and would deadlock.
   while (_collectorState != Idling) {
     if (TraceCMSState) {
       gclog_or_tty->print_cr("Thread " INTPTR_FORMAT " in CMS state %d",
-        Thread::current(), _collectorState);
+        p2i(Thread::current()), _collectorState);
     }
     // The foreground collector
     //   holds the Heap_lock throughout its collection.
     //   holds the CMS token (but not the lock)
     //     except while it is waiting for the background collector to yield.

@@ -1922,11 +1920,11 @@
         assert(_foregroundGCShouldWait == false, "We set it to false in "
                "waitForForegroundGC()");
         if (TraceCMSState) {
           gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT
             " exiting collection CMS state %d",
-            Thread::current(), _collectorState);
+                        p2i(Thread::current()), _collectorState);
         }
         return;
       } else {
         // The background collector can run but check to see if the
         // foreground collector has done a collection while the

@@ -2029,11 +2027,11 @@
         ShouldNotReachHere();
         break;
     }
     if (TraceCMSState) {
       gclog_or_tty->print_cr("  Thread " INTPTR_FORMAT " done - next CMS state %d",
-        Thread::current(), _collectorState);
+        p2i(Thread::current()), _collectorState);
     }
     assert(_foregroundGCShouldWait, "block post-condition");
   }
 
   // Should this be in gc_epilogue?

@@ -2052,11 +2050,11 @@
            "Possible deadlock");
   }
   if (TraceCMSState) {
     gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT
       " exiting collection CMS state %d",
-      Thread::current(), _collectorState);
+          p2i(Thread::current()), _collectorState);
   }
   if (PrintGC && Verbose) {
     _cmsGen->print_heap_change(prev_used);
   }
 }

@@ -2110,11 +2108,11 @@
       ConcurrentMarkSweepThread::CMS_cms_wants_token);
     // Get a possibly blocked foreground thread going
     CGC_lock->notify();
     if (TraceCMSState) {
       gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT " waiting at CMS state %d",
-        Thread::current(), _collectorState);
+        p2i(Thread::current()), _collectorState);
     }
     while (_foregroundGCIsActive) {
       CGC_lock->wait(Mutex::_no_safepoint_check_flag);
     }
     ConcurrentMarkSweepThread::set_CMS_flag(

@@ -2122,11 +2120,11 @@
     ConcurrentMarkSweepThread::clear_CMS_flag(
       ConcurrentMarkSweepThread::CMS_cms_wants_token);
   }
   if (TraceCMSState) {
     gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT " continuing at CMS state %d",
-      Thread::current(), _collectorState);
+      p2i(Thread::current()), _collectorState);
   }
   return res;
 }
 
 // Because of the need to lock the free lists and other structures in

@@ -2354,17 +2352,17 @@
   assert(haveFreelistLocks(), "must hold free list locks");
   assert_lock_strong(bitMapLock());
 
   // Clear the marking bit map array before starting, but, just
   // for kicks, first report if the given address is already marked
-  gclog_or_tty->print_cr("Start: Address " PTR_FORMAT " is%s marked", addr,
+  gclog_or_tty->print_cr("Start: Address " PTR_FORMAT " is%s marked", p2i(addr),
                 _markBitMap.isMarked(addr) ? "" : " not");
 
   if (verify_after_remark()) {
     MutexLockerEx x(verification_mark_bm()->lock(), Mutex::_no_safepoint_check_flag);
     bool result = verification_mark_bm()->isMarked(addr);
-    gclog_or_tty->print_cr("TransitiveMark: Address " PTR_FORMAT " %s marked", addr,
+    gclog_or_tty->print_cr("TransitiveMark: Address " PTR_FORMAT " %s marked", p2i(addr),
                            result ? "IS" : "is NOT");
     return result;
   } else {
     gclog_or_tty->print_cr("Could not compute result");
     return false;

@@ -2375,17 +2373,17 @@
 void
 CMSCollector::print_on_error(outputStream* st) {
   CMSCollector* collector = ConcurrentMarkSweepGeneration::_collector;
   if (collector != NULL) {
     CMSBitMap* bitmap = &collector->_markBitMap;
-    st->print_cr("Marking Bits: (CMSBitMap*) " PTR_FORMAT, bitmap);
+    st->print_cr("Marking Bits: (CMSBitMap*) " PTR_FORMAT, p2i(bitmap));
     bitmap->print_on_error(st, " Bits: ");
 
     st->cr();
 
     CMSBitMap* mut_bitmap = &collector->_modUnionTable;
-    st->print_cr("Mod Union Table: (CMSBitMap*) " PTR_FORMAT, mut_bitmap);
+    st->print_cr("Mod Union Table: (CMSBitMap*) " PTR_FORMAT, p2i(mut_bitmap));
     mut_bitmap->print_on_error(st, " Bits: ");
   }
 }
 
 ////////////////////////////////////////////////////////

@@ -2404,11 +2402,11 @@
 
   bool do_bit(size_t offset) {
     HeapWord* addr = _marks->offsetToHeapWord(offset);
     if (!_marks->isMarked(addr)) {
       oop(addr)->print_on(gclog_or_tty);
-      gclog_or_tty->print_cr(" ("INTPTR_FORMAT" should have been marked)", addr);
+      gclog_or_tty->print_cr(" ("INTPTR_FORMAT" should have been marked)", p2i(addr));
       _failed = true;
     }
     return true;
   }
 

@@ -2472,11 +2470,11 @@
     // in the CMS marks-vector) immediately, also indicating the
     // identify of an object (A) that references the unmarked object (B) --
     // presumably, a mutation to A failed to be picked up by preclean/remark?
     verify_after_remark_work_2();
   } else {
-    warning("Unrecognized value %d for CMSRemarkVerifyVariant",
+    warning("Unrecognized value " UINTX_FORMAT " for CMSRemarkVerifyVariant",
             CMSRemarkVerifyVariant);
   }
   if (!silent) gclog_or_tty->print(" done] ");
   return true;
 }

@@ -5054,11 +5052,11 @@
     // Check that the merged array is in sorted order
     if (total > 0) {
       for (size_t i = 0; i < total - 1; i++) {
         if (PrintCMSStatistics > 0) {
           gclog_or_tty->print(" (chunk" SIZE_FORMAT ":" INTPTR_FORMAT ") ",
-                              i, _survivor_chunk_array[i]);
+                              i, p2i(_survivor_chunk_array[i]));
         }
         assert(_survivor_chunk_array[i] < _survivor_chunk_array[i+1],
                "Not sorted");
       }
     }

@@ -5698,12 +5696,12 @@
     (size_t)((double)largestOffset * nearLargestPercent) - MinChunkSize;
   if (PrintFLSStatistics != 0) {
     gclog_or_tty->print_cr(
       "CMS: Large Block: " PTR_FORMAT ";"
       " Proximity: " PTR_FORMAT " -> " PTR_FORMAT,
-      largestAddr,
-      _cmsSpace->nearLargestChunk(), minAddr + nearLargestOffset);
+      p2i(largestAddr),
+      p2i(_cmsSpace->nearLargestChunk()), p2i(minAddr + nearLargestOffset));
   }
   _cmsSpace->set_nearLargestChunk(minAddr + nearLargestOffset);
 }
 
 bool ConcurrentMarkSweepGeneration::isNearLargestChunk(HeapWord* addr) {

@@ -6182,11 +6180,11 @@
   HeapWord* addr = (HeapWord*)obj;
   if (_span.contains(addr)) {
     _verification_bm->mark(addr);
     if (!_cms_bm->isMarked(addr)) {
       oop(addr)->print();
-      gclog_or_tty->print_cr(" (" INTPTR_FORMAT " should have been marked)", addr);
+      gclog_or_tty->print_cr(" (" INTPTR_FORMAT " should have been marked)", p2i(addr));
       fatal("... aborting");
     }
   }
 }
 

@@ -6977,11 +6975,11 @@
     // Oop lies in _span and isn't yet grey or black
     _verification_bm->mark(addr);            // now grey
     if (!_cms_bm->isMarked(addr)) {
       oop(addr)->print();
       gclog_or_tty->print_cr(" (" INTPTR_FORMAT " should have been marked)",
-                             addr);
+                             p2i(addr));
       fatal("... aborting");
     }
 
     if (!_mark_stack->push(obj)) { // stack overflow
       if (PrintCMSStatistics != 0) {

@@ -7373,20 +7371,20 @@
   )
   assert(_limit >= _sp->bottom() && _limit <= _sp->end(),
          "sweep _limit out of bounds");
   if (CMSTraceSweeper) {
     gclog_or_tty->print_cr("\n====================\nStarting new sweep with limit " PTR_FORMAT,
-                        _limit);
+                        p2i(_limit));
   }
 }
 
 void SweepClosure::print_on(outputStream* st) const {
   tty->print_cr("_sp = [" PTR_FORMAT "," PTR_FORMAT ")",
-                _sp->bottom(), _sp->end());
-  tty->print_cr("_limit = " PTR_FORMAT, _limit);
-  tty->print_cr("_freeFinger = " PTR_FORMAT, _freeFinger);
-  NOT_PRODUCT(tty->print_cr("_last_fc = " PTR_FORMAT, _last_fc);)
+                p2i(_sp->bottom()), p2i(_sp->end()));
+  tty->print_cr("_limit = " PTR_FORMAT, p2i(_limit));
+  tty->print_cr("_freeFinger = " PTR_FORMAT, p2i(_freeFinger));
+  NOT_PRODUCT(tty->print_cr("_last_fc = " PTR_FORMAT, p2i(_last_fc));)
   tty->print_cr("_inFreeRange = %d, _freeRangeInFreeLists = %d, _lastFreeRangeCoalesced = %d",
                 _inFreeRange, _freeRangeInFreeLists, _lastFreeRangeCoalesced);
 }
 
 #ifndef PRODUCT

@@ -7426,20 +7424,20 @@
         dict_returned_bytes);
     }
   }
   if (CMSTraceSweeper) {
     gclog_or_tty->print_cr("end of sweep with _limit = " PTR_FORMAT "\n================",
-                           _limit);
+                           p2i(_limit));
   }
 }
 #endif  // PRODUCT
 
 void SweepClosure::initialize_free_range(HeapWord* freeFinger,
     bool freeRangeInFreeLists) {
   if (CMSTraceSweeper) {
     gclog_or_tty->print("---- Start free range at " PTR_FORMAT " with free block (%d)\n",
-               freeFinger, freeRangeInFreeLists);
+               p2i(freeFinger), freeRangeInFreeLists);
   }
   assert(!inFreeRange(), "Trampling existing free range");
   set_inFreeRange(true);
   set_lastFreeRangeCoalesced(false);
 

@@ -7499,18 +7497,18 @@
     assert(addr < _sp->end(), "addr out of bounds");
     // Flush any free range we might be holding as a single
     // coalesced chunk to the appropriate free list.
     if (inFreeRange()) {
       assert(freeFinger() >= _sp->bottom() && freeFinger() < _limit,
-             err_msg("freeFinger() " PTR_FORMAT" is out-of-bounds", freeFinger()));
+             err_msg("freeFinger() " PTR_FORMAT" is out-of-bounds", p2i(freeFinger())));
       flush_cur_free_chunk(freeFinger(),
                            pointer_delta(addr, freeFinger()));
       if (CMSTraceSweeper) {
         gclog_or_tty->print("Sweep: last chunk: ");
         gclog_or_tty->print("put_free_blk " PTR_FORMAT " ("SIZE_FORMAT") "
                    "[coalesced:%d]\n",
-                   freeFinger(), pointer_delta(addr, freeFinger()),
+                   p2i(freeFinger()), pointer_delta(addr, freeFinger()),
                    lastFreeRangeCoalesced() ? 1 : 0);
       }
     }
 
     // help the iterator loop finish

@@ -7650,11 +7648,11 @@
         }
       } else {
         // the midst of a free range, we are coalescing
         print_free_block_coalesced(fc);
         if (CMSTraceSweeper) {
-          gclog_or_tty->print("  -- pick up free block " PTR_FORMAT " (" SIZE_FORMAT ")\n", fc, size);
+          gclog_or_tty->print("  -- pick up free block " PTR_FORMAT " (" SIZE_FORMAT ")\n", p2i(fc), size);
         }
         // remove it from the free lists
         _sp->removeFreeChunkFromFreeLists(fc);
         set_lastFreeRangeCoalesced(true);
         // If the chunk is being coalesced and the current free range is

@@ -7712,11 +7710,11 @@
       initialize_free_range(addr, false);
     } else {
       // this will be swept up when we hit the end of the
       // free range
       if (CMSTraceSweeper) {
-        gclog_or_tty->print("  -- pick up garbage " PTR_FORMAT " (" SIZE_FORMAT ")\n", fc, size);
+        gclog_or_tty->print("  -- pick up garbage " PTR_FORMAT " (" SIZE_FORMAT ")\n", p2i(fc), size);
       }
       // If the chunk is being coalesced and the current free range is
       // in the free lists, remove the current free range so that it
       // will be returned to the free lists in its entirety - all
       // the coalesced pieces included.

@@ -7805,11 +7803,11 @@
   if (CMSTestInFreeList && fcInFreeLists) {
     assert(_sp->verify_chunk_in_free_list(fc), "free chunk is not in free lists");
   }
 
   if (CMSTraceSweeper) {
-    gclog_or_tty->print_cr("  -- pick up another chunk at " PTR_FORMAT " (" SIZE_FORMAT ")", fc, chunkSize);
+    gclog_or_tty->print_cr("  -- pick up another chunk at " PTR_FORMAT " (" SIZE_FORMAT ")", p2i(fc), chunkSize);
   }
 
   HeapWord* const fc_addr = (HeapWord*) fc;
 
   bool coalesce;

@@ -7904,18 +7902,18 @@
   HeapWord* const eob = ((HeapWord*)fc) + chunk_size;
   assert(_sp->used_region().contains(eob - 1),
          err_msg("eob = " PTR_FORMAT " eob-1 = " PTR_FORMAT " _limit = " PTR_FORMAT
                  " out of bounds wrt _sp = [" PTR_FORMAT "," PTR_FORMAT ")"
                  " when examining fc = " PTR_FORMAT "(" SIZE_FORMAT ")",
-                 eob, eob-1, _limit, _sp->bottom(), _sp->end(), fc, chunk_size));
+                                 p2i(eob), p2i(eob-1), p2i(_limit), p2i(_sp->bottom()), p2i(_sp->end()), p2i(fc), chunk_size));
   if (eob >= _limit) {
     assert(eob == _limit || fc->is_free(), "Only a free chunk should allow us to cross over the limit");
     if (CMSTraceSweeper) {
       gclog_or_tty->print_cr("_limit " PTR_FORMAT " reached or crossed by block "
                              "[" PTR_FORMAT "," PTR_FORMAT ") in space "
                              "[" PTR_FORMAT "," PTR_FORMAT ")",
-                             _limit, fc, eob, _sp->bottom(), _sp->end());
+                             p2i(_limit), p2i(fc), p2i(eob), p2i(_sp->bottom()), p2i(_sp->end()));
     }
     // Return the storage we are tracking back into the free lists.
     if (CMSTraceSweeper) {
       gclog_or_tty->print_cr("Flushing ... ");
     }

@@ -7935,11 +7933,11 @@
       assert(!_sp->verify_chunk_in_free_list(fc),
         "chunk should not be in free lists yet");
     }
     if (CMSTraceSweeper) {
       gclog_or_tty->print_cr(" -- add free block " PTR_FORMAT " (" SIZE_FORMAT ") to free lists",
-                    chunk, size);
+                    p2i(chunk), size);
     }
     // A new free range is going to be starting.  The current
     // free range has not been added to the free lists yet or
     // was removed so add it back.
     // If the current free range was coalesced, then the death

@@ -8008,11 +8006,11 @@
 #endif
 
 void SweepClosure::print_free_block_coalesced(FreeChunk* fc) const {
   if (CMSTraceSweeper) {
     gclog_or_tty->print_cr("Sweep:coal_free_blk " PTR_FORMAT " (" SIZE_FORMAT ")",
-                           fc, fc->size());
+                           p2i(fc), fc->size());
   }
 }
 
 // CMSIsAliveClosure
 bool CMSIsAliveClosure::do_object_b(oop obj) {
< prev index next >