Path: blob/master/runtime/gc_realtime/SweepSchemeRealtime.hpp
5986 views
/*******************************************************************************1* Copyright (c) 1991, 2019 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#if !defined(SWEEPSCHEMEREALTIME_HPP_)23#define SWEEPSCHEMEREALTIME_HPP_2425#include "omr.h"2627#include "RealtimeGC.hpp"28#include "SweepSchemeSegregated.hpp"2930class MM_EnvironmentBase;31class MM_MarkMap;32class MM_Scheduler;3334class MM_SweepSchemeRealtime : public MM_SweepSchemeSegregated35{36/*37* Data members38*/39private:40MM_RealtimeGC *_realtimeGC; /**< The RealtimeGC that this sweepScheme is associated with */41MM_Scheduler *_scheduler;42uintptr_t _coalesceFreeRegionCount;43uintptr_t _sweepSmallRegionCount;44uintptr_t _yieldSmallRegionCount;4546protected:47public:4849/*50* Function members51*/52private:53virtual void yieldFromSweep(MM_EnvironmentBase *env, uintptr_t yieldSlackTime = 0);5455virtual uintptr_t resetCoalesceFreeRegionCount(MM_EnvironmentBase *env);56virtual bool updateCoalesceFreeRegionCount(uintptr_t range);5758virtual uintptr_t resetSweepSmallRegionCount(MM_EnvironmentBase *env, uintptr_t yieldSmallRegionCount);59virtual bool updateSweepSmallRegionCount();6061protected:62virtual void preSweep(MM_EnvironmentBase *env);63virtual void postSweep(MM_EnvironmentBase *env);6465virtual void incrementalSweepArraylet(MM_EnvironmentBase *env);6667MM_SweepSchemeRealtime(MM_EnvironmentBase *env, MM_RealtimeGC *realtimeGC, MM_Scheduler *scheduler, MM_MarkMap *markMap) :68MM_SweepSchemeSegregated(env, markMap)69,_realtimeGC(realtimeGC)70,_scheduler(scheduler)71,_coalesceFreeRegionCount(0)72,_sweepSmallRegionCount(0)73,_yieldSmallRegionCount(0)74{75_typeId = __FUNCTION__;76};7778public:79static MM_SweepSchemeRealtime *newInstance(MM_EnvironmentBase *env, MM_RealtimeGC *realtimeGC, MM_Scheduler *scheduler, MM_MarkMap *markMap);80void kill(MM_EnvironmentBase *env);8182void83sweep(MM_EnvironmentBase *env)84{85MM_SweepSchemeSegregated::sweep(env, _realtimeGC->_memoryPool, _realtimeGC->isFixHeapForWalk());86}87};8889#endif /* SWEEPSCHEMEREALTIME_HPP_ */909192