2008-06-05 15:57:56 -07:00
|
|
|
/*
|
2019-01-10 15:13:51 -05:00
|
|
|
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
|
2008-06-05 15:57:56 -07:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
2010-05-27 19:08:38 -07:00
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
2008-06-05 15:57:56 -07:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-01-10 15:13:51 -05:00
|
|
|
#ifndef SHARE_GC_G1_G1REMSET_HPP
|
|
|
|
#define SHARE_GC_G1_G1REMSET_HPP
|
2010-11-23 13:22:55 -08:00
|
|
|
|
2018-02-26 09:34:12 +01:00
|
|
|
#include "gc/g1/g1CardTable.hpp"
|
2018-03-26 16:51:43 +02:00
|
|
|
#include "gc/g1/g1OopClosures.hpp"
|
2018-12-07 13:54:45 +01:00
|
|
|
#include "gc/g1/g1GCPhaseTimes.hpp"
|
2015-05-13 15:16:06 +02:00
|
|
|
#include "gc/g1/g1RemSetSummary.hpp"
|
2015-12-21 12:02:03 +01:00
|
|
|
#include "gc/g1/heapRegion.hpp"
|
|
|
|
#include "memory/allocation.hpp"
|
|
|
|
#include "memory/iterator.hpp"
|
2018-04-27 12:06:46 +02:00
|
|
|
#include "utilities/ticks.hpp"
|
2013-05-28 09:32:06 +02:00
|
|
|
|
2008-06-05 15:57:56 -07:00
|
|
|
// A G1RemSet provides ways of iterating over pointers into a selected
|
|
|
|
// collection set.
|
|
|
|
|
2015-12-21 12:02:03 +01:00
|
|
|
class BitMap;
|
2018-03-19 07:38:18 +01:00
|
|
|
class CardTableBarrierSet;
|
2016-01-07 16:25:53 +01:00
|
|
|
class G1BlockOffsetTable;
|
2015-12-21 12:02:03 +01:00
|
|
|
class CodeBlobClosure;
|
|
|
|
class G1CollectedHeap;
|
2018-03-26 16:51:43 +02:00
|
|
|
class G1CMBitMap;
|
2016-05-02 12:07:58 -04:00
|
|
|
class G1HotCardCache;
|
2016-04-18 16:51:14 +02:00
|
|
|
class G1RemSetScanState;
|
2017-06-28 10:58:19 +02:00
|
|
|
class G1ParScanThreadState;
|
2019-06-27 11:48:32 +02:00
|
|
|
class G1ParScanThreadStateSet;
|
2016-03-18 15:20:43 +01:00
|
|
|
class G1Policy;
|
2019-05-14 15:36:26 +02:00
|
|
|
class G1ScanCardClosure;
|
2015-12-21 12:02:03 +01:00
|
|
|
class HeapRegionClaimer;
|
2008-06-05 15:57:56 -07:00
|
|
|
|
2010-10-12 09:36:48 -07:00
|
|
|
// A G1RemSet in which each heap region has a rem set that records the
|
|
|
|
// external heap references into it. Uses a mod ref bs to track updates,
|
|
|
|
// so that they can be used to update the individual region remsets.
|
2012-06-28 17:03:16 -04:00
|
|
|
class G1RemSet: public CHeapObj<mtGC> {
|
2013-05-28 09:32:06 +02:00
|
|
|
private:
|
2016-04-18 16:51:14 +02:00
|
|
|
G1RemSetScanState* _scan_state;
|
2016-04-06 13:41:59 +02:00
|
|
|
|
2013-05-28 09:32:06 +02:00
|
|
|
G1RemSetSummary _prev_period_summary;
|
2015-11-09 11:26:15 +01:00
|
|
|
|
2018-04-18 11:36:48 +02:00
|
|
|
G1CollectedHeap* _g1h;
|
2008-06-05 15:57:56 -07:00
|
|
|
|
2018-02-26 09:34:12 +01:00
|
|
|
G1CardTable* _ct;
|
2016-03-18 15:20:43 +01:00
|
|
|
G1Policy* _g1p;
|
2016-05-02 12:07:58 -04:00
|
|
|
G1HotCardCache* _hot_card_cache;
|
2008-06-05 15:57:56 -07:00
|
|
|
|
2019-07-17 16:33:19 +02:00
|
|
|
void print_merge_heap_roots_stats();
|
2008-06-05 15:57:56 -07:00
|
|
|
public:
|
2019-03-13 21:01:56 +01:00
|
|
|
|
|
|
|
typedef CardTable::CardValue CardValue;
|
2015-12-22 11:02:04 +01:00
|
|
|
// Gives an approximation on how many threads can be expected to add records to
|
|
|
|
// a remembered set in parallel. This can be used for sizing data structures to
|
|
|
|
// decrease performance losses due to data structure sharing.
|
|
|
|
// Examples for quantities that influence this value are the maximum number of
|
|
|
|
// mutator threads, maximum number of concurrent refinement or GC threads.
|
|
|
|
static uint num_par_rem_sets();
|
|
|
|
|
|
|
|
// Initialize data that depends on the heap size being known.
|
2016-04-06 13:41:59 +02:00
|
|
|
void initialize(size_t capacity, uint max_regions);
|
2015-12-22 11:02:04 +01:00
|
|
|
|
2018-04-18 11:36:48 +02:00
|
|
|
G1RemSet(G1CollectedHeap* g1h,
|
2018-02-26 09:34:12 +01:00
|
|
|
G1CardTable* ct,
|
2016-05-02 12:07:58 -04:00
|
|
|
G1HotCardCache* hot_card_cache);
|
2010-10-12 09:36:48 -07:00
|
|
|
~G1RemSet();
|
2008-06-05 15:57:56 -07:00
|
|
|
|
2019-06-27 11:48:32 +02:00
|
|
|
// Scan all cards in the non-collection set regions that potentially contain
|
|
|
|
// references into the current whole collection set.
|
|
|
|
void scan_heap_roots(G1ParScanThreadState* pss,
|
|
|
|
uint worker_id,
|
|
|
|
G1GCPhaseTimes::GCParPhases scan_phase,
|
|
|
|
G1GCPhaseTimes::GCParPhases objcopy_phase);
|
|
|
|
|
|
|
|
// Merge cards from various sources (remembered sets, hot card cache, log buffers)
|
|
|
|
// and calculate the cards that need to be scanned later (via scan_heap_roots()).
|
2019-07-17 16:33:19 +02:00
|
|
|
// If initial_evacuation is set, this is called during the initial evacuation.
|
|
|
|
void merge_heap_roots(bool initial_evacuation);
|
2010-10-12 09:36:48 -07:00
|
|
|
|
2019-06-27 11:48:32 +02:00
|
|
|
// Prepare for and cleanup after scanning the heap roots. Must be called
|
|
|
|
// once before and after in sequential code.
|
|
|
|
void prepare_for_scan_heap_roots();
|
|
|
|
// Cleans the card table from temporary duplicate detection information.
|
|
|
|
void cleanup_after_scan_heap_roots();
|
2019-11-27 12:18:40 +01:00
|
|
|
// Excludes the given region from heap root scanning.
|
|
|
|
void exclude_region_from_scan(uint region_idx);
|
|
|
|
// Creates a snapshot of the current _top values at the start of collection to
|
|
|
|
// filter out card marks that we do not want to scan.
|
|
|
|
void prepare_region_for_scan(HeapRegion* region);
|
2019-06-27 11:48:32 +02:00
|
|
|
|
|
|
|
// Do work for regions in the current increment of the collection set, scanning
|
|
|
|
// non-card based (heap) roots.
|
|
|
|
void scan_collection_set_regions(G1ParScanThreadState* pss,
|
|
|
|
uint worker_id,
|
|
|
|
G1GCPhaseTimes::GCParPhases scan_phase,
|
|
|
|
G1GCPhaseTimes::GCParPhases coderoots_phase,
|
|
|
|
G1GCPhaseTimes::GCParPhases objcopy_phase);
|
2008-06-05 15:57:56 -07:00
|
|
|
|
2019-11-22 17:03:55 -08:00
|
|
|
// Two methods for concurrent refinement support, executed concurrently to
|
|
|
|
// the mutator:
|
|
|
|
// Cleans the card at "*card_ptr_addr" before refinement, returns true iff the
|
|
|
|
// card needs later refinement. Note that "*card_ptr_addr" could be updated to
|
|
|
|
// a different card due to use of hot card cache.
|
|
|
|
bool clean_card_before_refine(CardValue** const card_ptr_addr);
|
|
|
|
// Refine the region corresponding to "card_ptr". Must be called after
|
|
|
|
// being filtered by clean_card_before_refine(), and after proper
|
|
|
|
// fence/synchronization.
|
|
|
|
void refine_card_concurrently(CardValue* const card_ptr,
|
|
|
|
const uint worker_id);
|
2017-06-02 13:47:54 +02:00
|
|
|
|
2013-05-28 09:32:06 +02:00
|
|
|
// Print accumulated summary info from the start of the VM.
|
2017-02-27 12:41:41 -05:00
|
|
|
void print_summary_info();
|
2010-10-12 09:36:48 -07:00
|
|
|
|
2013-05-28 09:32:06 +02:00
|
|
|
// Print accumulated summary info from the last time called.
|
2017-02-27 12:41:41 -05:00
|
|
|
void print_periodic_summary_info(const char* header, uint period_count);
|
2013-05-28 09:32:06 +02:00
|
|
|
|
2018-03-26 16:51:43 +02:00
|
|
|
// Rebuilds the remembered set by scanning from bottom to TARS for all regions
|
|
|
|
// using the given work gang.
|
|
|
|
void rebuild_rem_set(G1ConcurrentMark* cm, WorkGang* workers, uint worker_id_offset);
|
2008-06-05 15:57:56 -07:00
|
|
|
};
|
|
|
|
|
2019-01-10 15:13:51 -05:00
|
|
|
#endif // SHARE_GC_G1_G1REMSET_HPP
|