hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
changeset 24424 2658d7834c6e
parent 24351 61b33cc6d3cf
child 24487 71ff0bd674eb
equal deleted inserted replaced
24358:8528b67f6562 24424:2658d7834c6e
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   426 }
   426 }
   427 
   427 
   428 void LinearAllocBlock::print_on(outputStream* st) const {
   428 void LinearAllocBlock::print_on(outputStream* st) const {
   429   st->print_cr(" LinearAllocBlock: ptr = " PTR_FORMAT ", word_size = " SIZE_FORMAT
   429   st->print_cr(" LinearAllocBlock: ptr = " PTR_FORMAT ", word_size = " SIZE_FORMAT
   430             ", refillsize = " SIZE_FORMAT ", allocation_size_limit = " SIZE_FORMAT,
   430             ", refillsize = " SIZE_FORMAT ", allocation_size_limit = " SIZE_FORMAT,
   431             _ptr, _word_size, _refillSize, _allocation_size_limit);
   431             p2i(_ptr), _word_size, _refillSize, _allocation_size_limit);
   432 }
   432 }
   433 
   433 
   434 void CompactibleFreeListSpace::print_on(outputStream* st) const {
   434 void CompactibleFreeListSpace::print_on(outputStream* st) const {
   435   st->print_cr("COMPACTIBLE FREELIST SPACE");
   435   st->print_cr("COMPACTIBLE FREELIST SPACE");
   436   st->print_cr(" Space:");
   436   st->print_cr(" Space:");
   457   for (size_t i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) {
   457   for (size_t i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) {
   458     _indexedFreeList[i].print_on(gclog_or_tty);
   458     _indexedFreeList[i].print_on(gclog_or_tty);
   459     for (FreeChunk* fc = _indexedFreeList[i].head(); fc != NULL;
   459     for (FreeChunk* fc = _indexedFreeList[i].head(); fc != NULL;
   460          fc = fc->next()) {
   460          fc = fc->next()) {
   461       gclog_or_tty->print_cr("\t[" PTR_FORMAT "," PTR_FORMAT ")  %s",
   461       gclog_or_tty->print_cr("\t[" PTR_FORMAT "," PTR_FORMAT ")  %s",
   462                           fc, (HeapWord*)fc + i,
   462                           p2i(fc), p2i((HeapWord*)fc + i),
   463                           fc->cantCoalesce() ? "\t CC" : "");
   463                           fc->cantCoalesce() ? "\t CC" : "");
   464     }
   464     }
   465   }
   465   }
   466 }
   466 }
   467 
   467 
   501   size_t sz = _sp->block_size_no_stall(addr, _collector);
   501   size_t sz = _sp->block_size_no_stall(addr, _collector);
   502   assert(sz != 0, "Should always be able to compute a size");
   502   assert(sz != 0, "Should always be able to compute a size");
   503   if (_sp->block_is_obj(addr)) {
   503   if (_sp->block_is_obj(addr)) {
   504     const bool dead = _post_remark && !_live_bit_map->isMarked(addr);
   504     const bool dead = _post_remark && !_live_bit_map->isMarked(addr);
   505     _st->print_cr(PTR_FORMAT ": %s object of size " SIZE_FORMAT "%s",
   505     _st->print_cr(PTR_FORMAT ": %s object of size " SIZE_FORMAT "%s",
   506       addr,
   506       p2i(addr),
   507       dead ? "dead" : "live",
   507       dead ? "dead" : "live",
   508       sz,
   508       sz,
   509       (!dead && CMSPrintObjectsInDump) ? ":" : ".");
   509       (!dead && CMSPrintObjectsInDump) ? ":" : ".");
   510     if (CMSPrintObjectsInDump && !dead) {
   510     if (CMSPrintObjectsInDump && !dead) {
   511       oop(addr)->print_on(_st);
   511       oop(addr)->print_on(_st);
   512       _st->print_cr("--------------------------------------");
   512       _st->print_cr("--------------------------------------");
   513     }
   513     }
   514   } else { // free block
   514   } else { // free block
   515     _st->print_cr(PTR_FORMAT ": free block of size " SIZE_FORMAT "%s",
   515     _st->print_cr(PTR_FORMAT ": free block of size " SIZE_FORMAT "%s",
   516       addr, sz, CMSPrintChunksInDump ? ":" : ".");
   516       p2i(addr), sz, CMSPrintChunksInDump ? ":" : ".");
   517     if (CMSPrintChunksInDump) {
   517     if (CMSPrintChunksInDump) {
   518       ((FreeChunk*)addr)->print_on(_st);
   518       ((FreeChunk*)addr)->print_on(_st);
   519       _st->print_cr("--------------------------------------");
   519       _st->print_cr("--------------------------------------");
   520     }
   520     }
   521   }
   521   }
  1981   MemRegion ur    = used_region();
  1981   MemRegion ur    = used_region();
  1982   MemRegion urasm = used_region_at_save_marks();
  1982   MemRegion urasm = used_region_at_save_marks();
  1983   assert(ur.contains(urasm),
  1983   assert(ur.contains(urasm),
  1984          err_msg(" Error at save_marks(): [" PTR_FORMAT "," PTR_FORMAT ")"
  1984          err_msg(" Error at save_marks(): [" PTR_FORMAT "," PTR_FORMAT ")"
  1985                  " should contain [" PTR_FORMAT "," PTR_FORMAT ")",
  1985                  " should contain [" PTR_FORMAT "," PTR_FORMAT ")",
  1986                  ur.start(), ur.end(), urasm.start(), urasm.end()));
  1986                  p2i(ur.start()), p2i(ur.end()), p2i(urasm.start()), p2i(urasm.end())));
  1987 #endif
  1987 #endif
  1988   // inform allocator that promotions should be tracked.
  1988   // inform allocator that promotions should be tracked.
  1989   assert(_promoInfo.noPromotions(), "_promoInfo inconsistency");
  1989   assert(_promoInfo.noPromotions(), "_promoInfo inconsistency");
  1990   _promoInfo.startTrackingPromotions();
  1990   _promoInfo.startTrackingPromotions();
  1991 }
  1991 }
  2204 
  2204 
  2205 void CompactibleFreeListSpace::endSweepFLCensus(size_t sweep_count) {
  2205 void CompactibleFreeListSpace::endSweepFLCensus(size_t sweep_count) {
  2206   if (PrintFLSStatistics > 0) {
  2206   if (PrintFLSStatistics > 0) {
  2207     HeapWord* largestAddr = (HeapWord*) dictionary()->find_largest_dict();
  2207     HeapWord* largestAddr = (HeapWord*) dictionary()->find_largest_dict();
  2208     gclog_or_tty->print_cr("CMS: Large block " PTR_FORMAT,
  2208     gclog_or_tty->print_cr("CMS: Large block " PTR_FORMAT,
  2209                            largestAddr);
  2209                            p2i(largestAddr));
  2210   }
  2210   }
  2211   setFLSurplus();
  2211   setFLSurplus();
  2212   setFLHints();
  2212   setFLHints();
  2213   if (PrintGC && PrintFLSCensus > 0) {
  2213   if (PrintGC && PrintFLSCensus > 0) {
  2214     printFLCensus(sweep_count);
  2214     printFLCensus(sweep_count);
  2353     if (res == 0) {
  2353     if (res == 0) {
  2354       gclog_or_tty->print_cr("Livelock: no rank reduction!");
  2354       gclog_or_tty->print_cr("Livelock: no rank reduction!");
  2355       gclog_or_tty->print_cr(
  2355       gclog_or_tty->print_cr(
  2356         " Current:  addr = " PTR_FORMAT ", size = " SIZE_FORMAT ", obj = %s, live = %s \n"
  2356         " Current:  addr = " PTR_FORMAT ", size = " SIZE_FORMAT ", obj = %s, live = %s \n"
  2357         " Previous: addr = " PTR_FORMAT ", size = " SIZE_FORMAT ", obj = %s, live = %s \n",
  2357         " Previous: addr = " PTR_FORMAT ", size = " SIZE_FORMAT ", obj = %s, live = %s \n",
  2358         addr,       res,        was_obj      ?"true":"false", was_live      ?"true":"false",
  2358         p2i(addr),       res,        was_obj      ?"true":"false", was_live      ?"true":"false",
  2359         _last_addr, _last_size, _last_was_obj?"true":"false", _last_was_live?"true":"false");
  2359         p2i(_last_addr), _last_size, _last_was_obj?"true":"false", _last_was_live?"true":"false");
  2360       _sp->print_on(gclog_or_tty);
  2360       _sp->print_on(gclog_or_tty);
  2361       guarantee(false, "Seppuku!");
  2361       guarantee(false, "Seppuku!");
  2362     }
  2362     }
  2363     _last_addr = addr;
  2363     _last_addr = addr;
  2364     _last_size = res;
  2364     _last_size = res;