Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp @ 17937:78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
8043029: Change 8037816 breaks HS build with older GCC versions which don't support diagnostic pragmas
8043164: Format warning in traceStream.hpp
Summary: Backport of main fix + two corrections, enables clang compilation, turns on format attributes, corrects/mutes warnings
Reviewed-by: kvn, coleenp, iveresov, twisti
author | drchase |
---|---|
date | Thu, 22 May 2014 15:52:41 -0400 |
parents | bbfbe9b06038 |
children | 52b4284cb496 ce8f6bb717c9 6e56d7f1634f |
comparison
equal
deleted
inserted
replaced
17935:7384f6a12fc1 | 17937:78bbf4d43a14 |
---|---|
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. |
425 } | 425 } |
426 | 426 |
427 void LinearAllocBlock::print_on(outputStream* st) const { | 427 void LinearAllocBlock::print_on(outputStream* st) const { |
428 st->print_cr(" LinearAllocBlock: ptr = " PTR_FORMAT ", word_size = " SIZE_FORMAT | 428 st->print_cr(" LinearAllocBlock: ptr = " PTR_FORMAT ", word_size = " SIZE_FORMAT |
429 ", refillsize = " SIZE_FORMAT ", allocation_size_limit = " SIZE_FORMAT, | 429 ", refillsize = " SIZE_FORMAT ", allocation_size_limit = " SIZE_FORMAT, |
430 _ptr, _word_size, _refillSize, _allocation_size_limit); | 430 p2i(_ptr), _word_size, _refillSize, _allocation_size_limit); |
431 } | 431 } |
432 | 432 |
433 void CompactibleFreeListSpace::print_on(outputStream* st) const { | 433 void CompactibleFreeListSpace::print_on(outputStream* st) const { |
434 st->print_cr("COMPACTIBLE FREELIST SPACE"); | 434 st->print_cr("COMPACTIBLE FREELIST SPACE"); |
435 st->print_cr(" Space:"); | 435 st->print_cr(" Space:"); |
456 for (size_t i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) { | 456 for (size_t i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) { |
457 _indexedFreeList[i].print_on(gclog_or_tty); | 457 _indexedFreeList[i].print_on(gclog_or_tty); |
458 for (FreeChunk* fc = _indexedFreeList[i].head(); fc != NULL; | 458 for (FreeChunk* fc = _indexedFreeList[i].head(); fc != NULL; |
459 fc = fc->next()) { | 459 fc = fc->next()) { |
460 gclog_or_tty->print_cr("\t[" PTR_FORMAT "," PTR_FORMAT ") %s", | 460 gclog_or_tty->print_cr("\t[" PTR_FORMAT "," PTR_FORMAT ") %s", |
461 fc, (HeapWord*)fc + i, | 461 p2i(fc), p2i((HeapWord*)fc + i), |
462 fc->cantCoalesce() ? "\t CC" : ""); | 462 fc->cantCoalesce() ? "\t CC" : ""); |
463 } | 463 } |
464 } | 464 } |
465 } | 465 } |
466 | 466 |
500 size_t sz = _sp->block_size_no_stall(addr, _collector); | 500 size_t sz = _sp->block_size_no_stall(addr, _collector); |
501 assert(sz != 0, "Should always be able to compute a size"); | 501 assert(sz != 0, "Should always be able to compute a size"); |
502 if (_sp->block_is_obj(addr)) { | 502 if (_sp->block_is_obj(addr)) { |
503 const bool dead = _post_remark && !_live_bit_map->isMarked(addr); | 503 const bool dead = _post_remark && !_live_bit_map->isMarked(addr); |
504 _st->print_cr(PTR_FORMAT ": %s object of size " SIZE_FORMAT "%s", | 504 _st->print_cr(PTR_FORMAT ": %s object of size " SIZE_FORMAT "%s", |
505 addr, | 505 p2i(addr), |
506 dead ? "dead" : "live", | 506 dead ? "dead" : "live", |
507 sz, | 507 sz, |
508 (!dead && CMSPrintObjectsInDump) ? ":" : "."); | 508 (!dead && CMSPrintObjectsInDump) ? ":" : "."); |
509 if (CMSPrintObjectsInDump && !dead) { | 509 if (CMSPrintObjectsInDump && !dead) { |
510 oop(addr)->print_on(_st); | 510 oop(addr)->print_on(_st); |
511 _st->print_cr("--------------------------------------"); | 511 _st->print_cr("--------------------------------------"); |
512 } | 512 } |
513 } else { // free block | 513 } else { // free block |
514 _st->print_cr(PTR_FORMAT ": free block of size " SIZE_FORMAT "%s", | 514 _st->print_cr(PTR_FORMAT ": free block of size " SIZE_FORMAT "%s", |
515 addr, sz, CMSPrintChunksInDump ? ":" : "."); | 515 p2i(addr), sz, CMSPrintChunksInDump ? ":" : "."); |
516 if (CMSPrintChunksInDump) { | 516 if (CMSPrintChunksInDump) { |
517 ((FreeChunk*)addr)->print_on(_st); | 517 ((FreeChunk*)addr)->print_on(_st); |
518 _st->print_cr("--------------------------------------"); | 518 _st->print_cr("--------------------------------------"); |
519 } | 519 } |
520 } | 520 } |
562 assert_lock_strong(&_freelistLock); | 562 assert_lock_strong(&_freelistLock); |
563 gclog_or_tty->print("Statistics for IndexedFreeLists:\n" | 563 gclog_or_tty->print("Statistics for IndexedFreeLists:\n" |
564 "--------------------------------\n"); | 564 "--------------------------------\n"); |
565 size_t total_size = totalSizeInIndexedFreeLists(); | 565 size_t total_size = totalSizeInIndexedFreeLists(); |
566 size_t free_blocks = numFreeBlocksInIndexedFreeLists(); | 566 size_t free_blocks = numFreeBlocksInIndexedFreeLists(); |
567 gclog_or_tty->print("Total Free Space: %d\n", total_size); | 567 gclog_or_tty->print("Total Free Space: " SIZE_FORMAT "\n", total_size); |
568 gclog_or_tty->print("Max Chunk Size: %d\n", maxChunkSizeInIndexedFreeLists()); | 568 gclog_or_tty->print("Max Chunk Size: " SIZE_FORMAT "\n", maxChunkSizeInIndexedFreeLists()); |
569 gclog_or_tty->print("Number of Blocks: %d\n", free_blocks); | 569 gclog_or_tty->print("Number of Blocks: " SIZE_FORMAT "\n", free_blocks); |
570 if (free_blocks != 0) { | 570 if (free_blocks != 0) { |
571 gclog_or_tty->print("Av. Block Size: %d\n", total_size/free_blocks); | 571 gclog_or_tty->print("Av. Block Size: " SIZE_FORMAT "\n", total_size/free_blocks); |
572 } | 572 } |
573 } | 573 } |
574 | 574 |
575 size_t CompactibleFreeListSpace::numFreeBlocksInIndexedFreeLists() const { | 575 size_t CompactibleFreeListSpace::numFreeBlocksInIndexedFreeLists() const { |
576 size_t res = 0; | 576 size_t res = 0; |
2009 MemRegion ur = used_region(); | 2009 MemRegion ur = used_region(); |
2010 MemRegion urasm = used_region_at_save_marks(); | 2010 MemRegion urasm = used_region_at_save_marks(); |
2011 assert(ur.contains(urasm), | 2011 assert(ur.contains(urasm), |
2012 err_msg(" Error at save_marks(): [" PTR_FORMAT "," PTR_FORMAT ")" | 2012 err_msg(" Error at save_marks(): [" PTR_FORMAT "," PTR_FORMAT ")" |
2013 " should contain [" PTR_FORMAT "," PTR_FORMAT ")", | 2013 " should contain [" PTR_FORMAT "," PTR_FORMAT ")", |
2014 ur.start(), ur.end(), urasm.start(), urasm.end())); | 2014 p2i(ur.start()), p2i(ur.end()), p2i(urasm.start()), p2i(urasm.end()))); |
2015 #endif | 2015 #endif |
2016 // inform allocator that promotions should be tracked. | 2016 // inform allocator that promotions should be tracked. |
2017 assert(_promoInfo.noPromotions(), "_promoInfo inconsistency"); | 2017 assert(_promoInfo.noPromotions(), "_promoInfo inconsistency"); |
2018 _promoInfo.startTrackingPromotions(); | 2018 _promoInfo.startTrackingPromotions(); |
2019 } | 2019 } |
2179 assert_locked(); | 2179 assert_locked(); |
2180 size_t i; | 2180 size_t i; |
2181 for (i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) { | 2181 for (i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) { |
2182 AdaptiveFreeList<FreeChunk>* fl = &_indexedFreeList[i]; | 2182 AdaptiveFreeList<FreeChunk>* fl = &_indexedFreeList[i]; |
2183 if (PrintFLSStatistics > 1) { | 2183 if (PrintFLSStatistics > 1) { |
2184 gclog_or_tty->print("size[%d] : ", i); | 2184 gclog_or_tty->print("size[" SIZE_FORMAT "] : ", i); |
2185 } | 2185 } |
2186 fl->compute_desired(inter_sweep_current, inter_sweep_estimate, intra_sweep_estimate); | 2186 fl->compute_desired(inter_sweep_current, inter_sweep_estimate, intra_sweep_estimate); |
2187 fl->set_coal_desired((ssize_t)((double)fl->desired() * CMSSmallCoalSurplusPercent)); | 2187 fl->set_coal_desired((ssize_t)((double)fl->desired() * CMSSmallCoalSurplusPercent)); |
2188 fl->set_before_sweep(fl->count()); | 2188 fl->set_before_sweep(fl->count()); |
2189 fl->set_bfr_surp(fl->surplus()); | 2189 fl->set_bfr_surp(fl->surplus()); |
2232 | 2232 |
2233 void CompactibleFreeListSpace::endSweepFLCensus(size_t sweep_count) { | 2233 void CompactibleFreeListSpace::endSweepFLCensus(size_t sweep_count) { |
2234 if (PrintFLSStatistics > 0) { | 2234 if (PrintFLSStatistics > 0) { |
2235 HeapWord* largestAddr = (HeapWord*) dictionary()->find_largest_dict(); | 2235 HeapWord* largestAddr = (HeapWord*) dictionary()->find_largest_dict(); |
2236 gclog_or_tty->print_cr("CMS: Large block " PTR_FORMAT, | 2236 gclog_or_tty->print_cr("CMS: Large block " PTR_FORMAT, |
2237 largestAddr); | 2237 p2i(largestAddr)); |
2238 } | 2238 } |
2239 setFLSurplus(); | 2239 setFLSurplus(); |
2240 setFLHints(); | 2240 setFLHints(); |
2241 if (PrintGC && PrintFLSCensus > 0) { | 2241 if (PrintGC && PrintFLSCensus > 0) { |
2242 printFLCensus(sweep_count); | 2242 printFLCensus(sweep_count); |
2381 if (res == 0) { | 2381 if (res == 0) { |
2382 gclog_or_tty->print_cr("Livelock: no rank reduction!"); | 2382 gclog_or_tty->print_cr("Livelock: no rank reduction!"); |
2383 gclog_or_tty->print_cr( | 2383 gclog_or_tty->print_cr( |
2384 " Current: addr = " PTR_FORMAT ", size = " SIZE_FORMAT ", obj = %s, live = %s \n" | 2384 " Current: addr = " PTR_FORMAT ", size = " SIZE_FORMAT ", obj = %s, live = %s \n" |
2385 " Previous: addr = " PTR_FORMAT ", size = " SIZE_FORMAT ", obj = %s, live = %s \n", | 2385 " Previous: addr = " PTR_FORMAT ", size = " SIZE_FORMAT ", obj = %s, live = %s \n", |
2386 addr, res, was_obj ?"true":"false", was_live ?"true":"false", | 2386 p2i(addr), res, was_obj ?"true":"false", was_live ?"true":"false", |
2387 _last_addr, _last_size, _last_was_obj?"true":"false", _last_was_live?"true":"false"); | 2387 p2i(_last_addr), _last_size, _last_was_obj?"true":"false", _last_was_live?"true":"false"); |
2388 _sp->print_on(gclog_or_tty); | 2388 _sp->print_on(gclog_or_tty); |
2389 guarantee(false, "Seppuku!"); | 2389 guarantee(false, "Seppuku!"); |
2390 } | 2390 } |
2391 _last_addr = addr; | 2391 _last_addr = addr; |
2392 _last_size = res; | 2392 _last_size = res; |
2710 } | 2710 } |
2711 // Reset counters for next round | 2711 // Reset counters for next round |
2712 _global_num_workers[i] = 0; | 2712 _global_num_workers[i] = 0; |
2713 _global_num_blocks[i] = 0; | 2713 _global_num_blocks[i] = 0; |
2714 if (PrintOldPLAB) { | 2714 if (PrintOldPLAB) { |
2715 gclog_or_tty->print_cr("[%d]: %d", i, (size_t)_blocks_to_claim[i].average()); | 2715 gclog_or_tty->print_cr("[" SIZE_FORMAT "]: " SIZE_FORMAT, i, (size_t)_blocks_to_claim[i].average()); |
2716 } | 2716 } |
2717 } | 2717 } |
2718 } | 2718 } |
2719 } | 2719 } |
2720 | 2720 |
2749 _indexedFreeList[i] = AdaptiveFreeList<FreeChunk>(); | 2749 _indexedFreeList[i] = AdaptiveFreeList<FreeChunk>(); |
2750 _indexedFreeList[i].set_size(i); | 2750 _indexedFreeList[i].set_size(i); |
2751 } | 2751 } |
2752 } | 2752 } |
2753 if (PrintOldPLAB) { | 2753 if (PrintOldPLAB) { |
2754 gclog_or_tty->print_cr("%d[%d]: %d/%d/%d", | 2754 gclog_or_tty->print_cr("%d[" SIZE_FORMAT "]: " SIZE_FORMAT "/" SIZE_FORMAT "/" SIZE_FORMAT, |
2755 tid, i, num_retire, _num_blocks[i], (size_t)_blocks_to_claim[i].average()); | 2755 tid, i, num_retire, _num_blocks[i], (size_t)_blocks_to_claim[i].average()); |
2756 } | 2756 } |
2757 // Reset stats for next round | 2757 // Reset stats for next round |
2758 _num_blocks[i] = 0; | 2758 _num_blocks[i] = 0; |
2759 } | 2759 } |