Path: blob/master/runtime/gc_vlhgc/CopyForwardDelegate.hpp
5986 views
/*******************************************************************************1* Copyright (c) 1991, 2021 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception20*******************************************************************************/2122/**23* @file24* @ingroup GC_Modron_Tarok25*/2627#if !defined(COPYFORWARDDELEGATE_HPP_)28#define COPYFORWARDDELEGATE_HPP_2930#include "j9.h"31#include "j9cfg.h"3233#include "CopyForwardScheme.hpp"3435class MM_EnvironmentVLHGC;36class MM_GCExtensions;37class MM_HeapRegionManager;3839class MM_CopyForwardDelegate : public MM_BaseNonVirtual40{41/* Data Members */42private:43J9JavaVM *_javaVM; /**< Cached JVM reference */44MM_GCExtensions *_extensions; /**< Cached GC global variable container */45MM_CopyForwardScheme *_breadthFirstCopyForwardScheme; /**< Underlying mechanics for breadth-first copyForward garbage collection */4647protected:48public:4950/* Member Functions */51private:52/**53* Updates the contents of _extensions->compactGroupPersistentStats before a PGC copy-forward operation.54* @param env[in] The main GC thread55*/56void updatePersistentStatsBeforeCopyForward(MM_EnvironmentVLHGC *env);5758/**59* Updates the contents of _extensions->compactGroupPersistentStats before a PGC copy-forward operation.60* @param env[in] The main GC thread61*/62void updatePersistentStatsAfterCopyForward(MM_EnvironmentVLHGC *env);6364protected:65public:66MM_CopyForwardDelegate(MM_EnvironmentVLHGC *env);6768/**69* Initialize the receivers internal support structures and state.70* @param env[in] Main thread.71*/72bool initialize(MM_EnvironmentVLHGC *env);7374/**75* Clean up the receivers internal support structures and state.76* @param env[in] Main thread.77*/78void tearDown(MM_EnvironmentVLHGC *env);7980/**81* Runs a PGC collect using the copy forward mechanism. This call does report events, before and after the collection, but does not collect statistics.82* @param env[in] The main GC thread83*/84void performCopyForwardForPartialGC(MM_EnvironmentVLHGC *env);8586/**87* Infrastructure and state setup pre-copyForward.88* @param env[in] Main GC thread.89*/90void preCopyForwardSetup(MM_EnvironmentVLHGC *env);9192/**93* Infrastructure and state cleanup post-copyForward.94* @param env[in] Main GC thread.95*/96void postCopyForwardCleanup(MM_EnvironmentVLHGC *env);9798/**99* Estimate the number of bytes required for survivor space given the set of _shouldMark regions and their historical survival rates.100* @param env[in] the current thread101* @return the estimated number of bytes which will survive102*/103UDATA estimateRequiredSurvivorBytes(MM_EnvironmentVLHGC *env);104105/**106* Return true if the copyForward is running under Hybrid mode107*/108bool isHybrid(MM_EnvironmentVLHGC *env)109{110bool ret = false;111if (NULL != _breadthFirstCopyForwardScheme) {112ret = _breadthFirstCopyForwardScheme->isHybrid(env);113}114return ret;115}116117/**118* Set the number of regions, which are need to be reserved for Mark/Compact only in CollectionSet due to short of survivor regions for CopyForward119*/120void setReservedNonEvacuatedRegions(UDATA regionCount)121{122if (NULL != _breadthFirstCopyForwardScheme) {123_breadthFirstCopyForwardScheme->setReservedNonEvacuatedRegions(regionCount);124}125}126127MMINLINE bool isConcurrentCycleInProgress()128{129return _breadthFirstCopyForwardScheme->isConcurrentCycleInProgress();130}131};132133134#endif /* COPYFORWARDDELEGATE_HPP_ */135136137