src/hotspot/share/gc/g1/g1RemSetTrackingPolicy.hpp
author sjohanss
Fri, 06 Apr 2018 11:41:21 +0200
changeset 49713 456e51e56ea2
parent 49607 acffe6ff3ae7
child 51007 fc9dd181d70e
permissions -rw-r--r--
8200169: Flatten G1Allocator class hierarchy Reviewed-by: tschatzl, sangheki

/*
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
 * 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.
 *
 * 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.
 *
 */

#ifndef SHARE_VM_GC_G1_G1REMSETTRACKINGPOLICY_HPP
#define SHARE_VM_GC_G1_G1REMSETTRACKINGPOLICY_HPP

#include "gc/g1/heapRegion.hpp"
#include "gc/g1/heapRegionType.hpp"
#include "memory/allocation.hpp"

// The remembered set tracking policy determines for a given region the state of
// the remembered set, ie. when it should be tracked, and if/when the remembered
// set is complete.
class G1RemSetTrackingPolicy : public CHeapObj<mtGC> {
private:
  // Is the given region an interesting humongous region to start remembered set tracking
  // for?
  bool is_interesting_humongous_region(HeapRegion* r) const;
public:
  // Do we need to scan the given region to get all outgoing references for remembered
  // set rebuild?
  bool needs_scan_for_rebuild(HeapRegion* r) const;
  // Update remembered set tracking state at allocation of the region. May be
  // called at any time. The caller makes sure that the changes to the remembered
  // set state are visible to other threads.
  void update_at_allocate(HeapRegion* r);
  // Update remembered set tracking state before we are going to rebuild remembered
  // sets. Called at safepoint in the remark pause.
  bool update_before_rebuild(HeapRegion* r, size_t live_bytes);
  // Update remembered set tracking state after rebuild is complete, i.e. the cleanup
  // pause. Called at safepoint.
  void update_after_rebuild(HeapRegion* r);
  // Update remembered set tracking state when the region is freed.
  void update_at_free(HeapRegion* r);
};

#endif /* SHARE_VM_GC_G1_G1REMSETTRACKINGPOLICY_HPP */