| 1 | /* | 
|---|
| 2 | * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. | 
|---|
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 
|---|
| 4 | * | 
|---|
| 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 | 
|---|
| 7 | * published by the Free Software Foundation. | 
|---|
| 8 | * | 
|---|
| 9 | * This code is distributed in the hope that it will be useful, but WITHOUT | 
|---|
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 
|---|
| 11 | * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License | 
|---|
| 12 | * version 2 for more details (a copy is included in the LICENSE file that | 
|---|
| 13 | * accompanied this code). | 
|---|
| 14 | * | 
|---|
| 15 | * You should have received a copy of the GNU General Public License version | 
|---|
| 16 | * 2 along with this work; if not, write to the Free Software Foundation, | 
|---|
| 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | 
|---|
| 18 | * | 
|---|
| 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | 
|---|
| 20 | * or visit www.oracle.com if you need additional information or have any | 
|---|
| 21 | * questions. | 
|---|
| 22 | * | 
|---|
| 23 | */ | 
|---|
| 24 |  | 
|---|
| 25 | #ifndef SHARE_GC_G1_G1REMSETTRACKINGPOLICY_HPP | 
|---|
| 26 | #define SHARE_GC_G1_G1REMSETTRACKINGPOLICY_HPP | 
|---|
| 27 |  | 
|---|
| 28 | #include "gc/g1/heapRegion.hpp" | 
|---|
| 29 | #include "gc/g1/heapRegionType.hpp" | 
|---|
| 30 | #include "memory/allocation.hpp" | 
|---|
| 31 |  | 
|---|
| 32 | // The remembered set tracking policy determines for a given region the state of | 
|---|
| 33 | // the remembered set, ie. when it should be tracked, and if/when the remembered | 
|---|
| 34 | // set is complete. | 
|---|
| 35 | class G1RemSetTrackingPolicy : public CHeapObj<mtGC> { | 
|---|
| 36 | public: | 
|---|
| 37 | // Do we need to scan the given region to get all outgoing references for remembered | 
|---|
| 38 | // set rebuild? | 
|---|
| 39 | bool needs_scan_for_rebuild(HeapRegion* r) const; | 
|---|
| 40 | // Update remembered set tracking state at allocation of the region. May be | 
|---|
| 41 | // called at any time. The caller makes sure that the changes to the remembered | 
|---|
| 42 | // set state are visible to other threads. | 
|---|
| 43 | void update_at_allocate(HeapRegion* r); | 
|---|
| 44 | // Update remembered set tracking state for humongous regions before we are going to | 
|---|
| 45 | // rebuild remembered sets. Called at safepoint in the remark pause. | 
|---|
| 46 | bool update_humongous_before_rebuild(HeapRegion* r, bool is_live); | 
|---|
| 47 | // Update remembered set tracking state before we are going to rebuild remembered | 
|---|
| 48 | // sets. Called at safepoint in the remark pause. | 
|---|
| 49 | bool update_before_rebuild(HeapRegion* r, size_t live_bytes); | 
|---|
| 50 | // Update remembered set tracking state after rebuild is complete, i.e. the cleanup | 
|---|
| 51 | // pause. Called at safepoint. | 
|---|
| 52 | void update_after_rebuild(HeapRegion* r); | 
|---|
| 53 | // Update remembered set tracking state when the region is freed. | 
|---|
| 54 | void update_at_free(HeapRegion* r); | 
|---|
| 55 | }; | 
|---|
| 56 |  | 
|---|
| 57 | #endif // SHARE_GC_G1_G1REMSETTRACKINGPOLICY_HPP | 
|---|
| 58 |  | 
|---|