8139922: Get rid of dead code in ConcurrentMark
Summary: ConcurrentMark contains lots of unused code which has been removed.
Reviewed-by: jmasa, tschatzl
--- a/hotspot/src/share/vm/gc/g1/concurrentMark.cpp Tue Nov 24 11:49:44 2015 +0000
+++ b/hotspot/src/share/vm/gc/g1/concurrentMark.cpp Tue Nov 24 15:13:02 2015 -0500
@@ -74,9 +74,7 @@
addr = (HeapWord*)align_size_up((intptr_t)addr,
HeapWordSize << _shifter);
size_t addrOffset = heapWordToOffset(addr);
- if (limit == NULL) {
- limit = _bmStartWord + _bmWordSize;
- }
+ assert(limit != NULL, "limit must not be NULL");
size_t limitOffset = heapWordToOffset(limit);
size_t nextOffset = _bm.get_next_one_offset(addrOffset, limitOffset);
HeapWord* nextAddr = offsetToHeapWord(nextOffset);
@@ -86,26 +84,6 @@
return nextAddr;
}
-HeapWord* CMBitMapRO::getNextUnmarkedWordAddress(const HeapWord* addr,
- const HeapWord* limit) const {
- size_t addrOffset = heapWordToOffset(addr);
- if (limit == NULL) {
- limit = _bmStartWord + _bmWordSize;
- }
- size_t limitOffset = heapWordToOffset(limit);
- size_t nextOffset = _bm.get_next_zero_offset(addrOffset, limitOffset);
- HeapWord* nextAddr = offsetToHeapWord(nextOffset);
- assert(nextAddr >= addr, "get_next_one postcondition");
- assert(nextAddr == limit || !isMarked(nextAddr),
- "get_next_one postcondition");
- return nextAddr;
-}
-
-int CMBitMapRO::heapWordDiffToOffsetDiff(size_t diff) const {
- assert((diff & ((1 << _shifter) - 1)) == 0, "argument check");
- return (int) (diff >> _shifter);
-}
-
#ifndef PRODUCT
bool CMBitMapRO::covers(MemRegion heap_rs) const {
// assert(_bm.map() == _virtual_space.low(), "map inconsistency");
@@ -211,17 +189,6 @@
return;
}
-void CMBitMap::markRange(MemRegion mr) {
- mr.intersection(MemRegion(_bmStartWord, _bmWordSize));
- assert(!mr.is_empty(), "unexpected empty region");
- assert((offsetToHeapWord(heapWordToOffset(mr.end())) ==
- ((HeapWord *) mr.end())),
- "markRange memory region end is not card aligned");
- // convert address range into offset range
- _bm.at_put_range(heapWordToOffset(mr.start()),
- heapWordToOffset(mr.end()), true);
-}
-
void CMBitMap::clearRange(MemRegion mr) {
mr.intersection(MemRegion(_bmStartWord, _bmWordSize));
assert(!mr.is_empty(), "unexpected empty region");
@@ -230,20 +197,6 @@
heapWordToOffset(mr.end()), false);
}
-MemRegion CMBitMap::getAndClearMarkedRegion(HeapWord* addr,
- HeapWord* end_addr) {
- HeapWord* start = getNextMarkedWordAddress(addr);
- start = MIN2(start, end_addr);
- HeapWord* end = getNextUnmarkedWordAddress(start);
- end = MIN2(end, end_addr);
- assert(start <= end, "Consistency check");
- MemRegion mr(start, end);
- if (!mr.is_empty()) {
- clearRange(mr);
- }
- return mr;
-}
-
CMMarkStack::CMMarkStack(ConcurrentMark* cm) :
_base(NULL), _cm(cm)
{}
@@ -466,8 +419,6 @@
_max_parallel_marking_threads(0),
_sleep_factor(0.0),
_marking_task_overhead(1.0),
- _cleanup_sleep_factor(0.0),
- _cleanup_task_overhead(1.0),
_cleanup_list("Cleanup List"),
_region_bm((BitMap::idx_t)(g1h->max_regions()), false /* in_resource_area*/),
_card_bm((g1h->reserved_region().byte_size() + CardTableModRefBS::card_size - 1) >>
@@ -568,22 +519,6 @@
_parallel_marking_threads = ConcGCThreads;
_max_parallel_marking_threads = _parallel_marking_threads;
- if (parallel_marking_threads() > 1) {
- _cleanup_task_overhead = 1.0;
- } else {
- _cleanup_task_overhead = marking_task_overhead();
- }
- _cleanup_sleep_factor =
- (1.0 - cleanup_task_overhead()) / cleanup_task_overhead();
-
-#if 0
- gclog_or_tty->print_cr("Marking Threads %d", parallel_marking_threads());
- gclog_or_tty->print_cr("CM Marking Task Overhead %1.4lf", marking_task_overhead());
- gclog_or_tty->print_cr("CM Sleep Factor %1.4lf", sleep_factor());
- gclog_or_tty->print_cr("CL Marking Task Overhead %1.4lf", cleanup_task_overhead());
- gclog_or_tty->print_cr("CL Sleep Factor %1.4lf", cleanup_sleep_factor());
-#endif
-
_parallel_workers = new WorkGang("G1 Marker",
_max_parallel_marking_threads, false, true);
if (_parallel_workers == NULL) {
@@ -840,14 +775,6 @@
void ConcurrentMark::checkpointRootsInitialPost() {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
- // If we force an overflow during remark, the remark operation will
- // actually abort and we'll restart concurrent marking. If we always
- // force an overflow during remark we'll never actually complete the
- // marking phase. So, we initialize this here, at the start of the
- // cycle, so that at the remaining overflow number will decrease at
- // every remark and we'll eventually not need to cause one.
- force_overflow_stw()->init();
-
// Start Concurrent Marking weak-reference discovery.
ReferenceProcessor* rp = g1h->ref_processor_cm();
// enable ("weak") refs discovery
@@ -920,7 +847,6 @@
// we exit this method to abort the pause and restart concurrent
// marking.
reset_marking_state(true /* clear_overflow */);
- force_overflow()->update();
if (G1Log::fine()) {
gclog_or_tty->gclog_stamp();
@@ -940,32 +866,6 @@
// at this point everything should be re-initialized and ready to go
}
-#ifndef PRODUCT
-void ForceOverflowSettings::init() {
- _num_remaining = G1ConcMarkForceOverflow;
- _force = false;
- update();
-}
-
-void ForceOverflowSettings::update() {
- if (_num_remaining > 0) {
- _num_remaining -= 1;
- _force = true;
- } else {
- _force = false;
- }
-}
-
-bool ForceOverflowSettings::should_force() {
- if (_force) {
- _force = false;
- return true;
- } else {
- return false;
- }
-}
-#endif // !PRODUCT
-
class CMConcurrentMarkingTask: public AbstractGangTask {
private:
ConcurrentMark* _cm;
@@ -1131,7 +1031,6 @@
// stop-the-world GC happens even as we mark in this generation.
_restart_for_overflow = false;
- force_overflow_conc()->init();
// _g1h has _n_par_threads
_parallel_marking_threads = calc_parallel_marking_threads();
@@ -2440,10 +2339,6 @@
((CMBitMap*)_prevMarkBitMap)->clearRange(mr);
}
-void ConcurrentMark::clearRangeNextBitmap(MemRegion mr) {
- _nextMarkBitMap->clearRange(mr);
-}
-
HeapRegion*
ConcurrentMark::claim_region(uint worker_id) {
// "checkpoint" the finger
@@ -3535,15 +3430,6 @@
}
}
- // If we are about to wrap up and go into termination, check if we
- // should raise the overflow flag.
- if (do_termination && !has_aborted()) {
- if (_cm->force_overflow()->should_force()) {
- _cm->set_has_overflown();
- regular_clock_call();
- }
- }
-
// We still haven't aborted. Now, let's try to get into the
// termination protocol.
if (do_termination && !has_aborted()) {
--- a/hotspot/src/share/vm/gc/g1/concurrentMark.hpp Tue Nov 24 11:49:44 2015 +0000
+++ b/hotspot/src/share/vm/gc/g1/concurrentMark.hpp Tue Nov 24 15:13:02 2015 -0500
@@ -65,11 +65,8 @@
// constructor
CMBitMapRO(int shifter);
- enum { do_yield = true };
-
// inquiries
HeapWord* startWord() const { return _bmStartWord; }
- size_t sizeInWords() const { return _bmWordSize; }
// the following is one past the last word in space
HeapWord* endWord() const { return _bmStartWord + _bmWordSize; }
@@ -83,18 +80,12 @@
// iteration
inline bool iterate(BitMapClosure* cl, MemRegion mr);
- inline bool iterate(BitMapClosure* cl);
// Return the address corresponding to the next marked bit at or after
// "addr", and before "limit", if "limit" is non-NULL. If there is no
// such bit, returns "limit" if that is non-NULL, or else "endWord()".
HeapWord* getNextMarkedWordAddress(const HeapWord* addr,
const HeapWord* limit = NULL) const;
- // Return the address corresponding to the next unmarked bit at or after
- // "addr", and before "limit", if "limit" is non-NULL. If there is no
- // such bit, returns "limit" if that is non-NULL, or else "endWord()".
- HeapWord* getNextUnmarkedWordAddress(const HeapWord* addr,
- const HeapWord* limit = NULL) const;
// conversion utilities
HeapWord* offsetToHeapWord(size_t offset) const {
@@ -103,7 +94,6 @@
size_t heapWordToOffset(const HeapWord* addr) const {
return pointer_delta(addr, _bmStartWord) >> _shifter;
}
- int heapWordDiffToOffsetDiff(size_t diff) const;
// The argument addr should be the start address of a valid object
HeapWord* nextObject(HeapWord* addr) {
@@ -153,20 +143,9 @@
inline void mark(HeapWord* addr);
inline void clear(HeapWord* addr);
inline bool parMark(HeapWord* addr);
- inline bool parClear(HeapWord* addr);
- void markRange(MemRegion mr);
void clearRange(MemRegion mr);
- // Starting at the bit corresponding to "addr" (inclusive), find the next
- // "1" bit, if any. This bit starts some run of consecutive "1"'s; find
- // the end of this run (stopping at "end_addr"). Return the MemRegion
- // covering from the start of the region corresponding to the first bit
- // of the run to the end of the region corresponding to the last bit of
- // the run. If there is no "1" bit at or after "addr", return an empty
- // MemRegion.
- MemRegion getAndClearMarkedRegion(HeapWord* addr, HeapWord* end_addr);
-
// Clear the whole mark bitmap.
void clearAll();
};
@@ -231,19 +210,6 @@
template<typename Fn> void iterate(Fn fn);
};
-class ForceOverflowSettings VALUE_OBJ_CLASS_SPEC {
-private:
-#ifndef PRODUCT
- uintx _num_remaining;
- bool _force;
-#endif // !defined(PRODUCT)
-
-public:
- void init() PRODUCT_RETURN;
- void update() PRODUCT_RETURN;
- bool should_force() PRODUCT_RETURN_( return false; );
-};
-
class YoungList;
// Root Regions are regions that are not empty at the beginning of a
@@ -326,10 +292,6 @@
double _marking_task_overhead; // Marking target overhead for
// a single task
- // Same as the two above, but for the cleanup task
- double _cleanup_sleep_factor;
- double _cleanup_task_overhead;
-
FreeRegionList _cleanup_list;
// Concurrent marking support structures
@@ -404,9 +366,6 @@
WorkGang* _parallel_workers;
- ForceOverflowSettings _force_overflow_conc;
- ForceOverflowSettings _force_overflow_stw;
-
void weakRefsWorkParallelPart(BoolObjectClosure* is_alive, bool purged_classes);
void weakRefsWork(bool clear_all_soft_refs);
@@ -443,8 +402,6 @@
uint max_parallel_marking_threads() const { return _max_parallel_marking_threads;}
double sleep_factor() { return _sleep_factor; }
double marking_task_overhead() { return _marking_task_overhead;}
- double cleanup_sleep_factor() { return _cleanup_sleep_factor; }
- double cleanup_task_overhead() { return _cleanup_task_overhead;}
HeapWord* finger() { return _finger; }
bool concurrent() { return _concurrent; }
@@ -502,22 +459,6 @@
void enter_first_sync_barrier(uint worker_id);
void enter_second_sync_barrier(uint worker_id);
- ForceOverflowSettings* force_overflow_conc() {
- return &_force_overflow_conc;
- }
-
- ForceOverflowSettings* force_overflow_stw() {
- return &_force_overflow_stw;
- }
-
- ForceOverflowSettings* force_overflow() {
- if (concurrent()) {
- return force_overflow_conc();
- } else {
- return force_overflow_stw();
- }
- }
-
// Live Data Counting data structures...
// These data structures are initialized at the start of
// marking. They are written to while marking is active.
@@ -625,28 +566,6 @@
uint worker_id,
HeapRegion* hr = NULL);
- // It iterates over the heap and for each object it comes across it
- // will dump the contents of its reference fields, as well as
- // liveness information for the object and its referents. The dump
- // will be written to a file with the following name:
- // G1PrintReachableBaseFile + "." + str.
- // vo decides whether the prev (vo == UsePrevMarking), the next
- // (vo == UseNextMarking) marking information, or the mark word
- // (vo == UseMarkWord) will be used to determine the liveness of
- // each object / referent.
- // If all is true, all objects in the heap will be dumped, otherwise
- // only the live ones. In the dump the following symbols / breviations
- // are used:
- // M : an explicitly live object (its bitmap bit is set)
- // > : an implicitly live object (over tams)
- // O : an object outside the G1 heap (typically: in the perm gen)
- // NOT : a reference field whose referent is not live
- // AND MARKED : indicates that an object is both explicitly and
- // implicitly live (it should be one or the other, not both)
- void print_reachable(const char* str,
- VerifyOption vo,
- bool all) PRODUCT_RETURN;
-
// Clear the next marking bitmap (will be called concurrently).
void clearNextBitmap();
@@ -686,7 +605,6 @@
// next bitmaps. NB: the previous bitmap is usually
// read-only, so use this carefully!
void clearRangePrevBitmap(MemRegion mr);
- void clearRangeNextBitmap(MemRegion mr);
// Notify data structures that a GC has started.
void note_start_of_gc() {
--- a/hotspot/src/share/vm/gc/g1/concurrentMark.inline.hpp Tue Nov 24 11:49:44 2015 +0000
+++ b/hotspot/src/share/vm/gc/g1/concurrentMark.inline.hpp Tue Nov 24 15:13:02 2015 -0500
@@ -185,11 +185,6 @@
return true;
}
-inline bool CMBitMapRO::iterate(BitMapClosure* cl) {
- MemRegion mr(startWord(), sizeInWords());
- return iterate(cl, mr);
-}
-
#define check_mark(addr) \
assert(_bmStartWord <= (addr) && (addr) < (_bmStartWord + _bmWordSize), \
"outside underlying space?"); \
@@ -213,11 +208,6 @@
return _bm.par_set_bit(heapWordToOffset(addr));
}
-inline bool CMBitMap::parClear(HeapWord* addr) {
- check_mark(addr);
- return _bm.par_clear_bit(heapWordToOffset(addr));
-}
-
#undef check_mark
template<typename Fn>