Path: blob/master/runtime/gc_realtime/IncrementalOverflow.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/**23* @file24* @ingroup GC_Modron_Standard25*/2627#if !defined(INCREMENTALOVERFLOW_HPP_)28#define INCREMENTALOVERFLOW_HPP_2930#include "EnvironmentBase.hpp"31#include "Metronome.hpp"32#include "WorkPacketOverflow.hpp"3334class MM_Packet;35class MM_HeapRegionDescriptorRealtime;3637/**38* @todo Provide class documentation39*/40class MM_IncrementalOverflow : public MM_WorkPacketOverflow41{42/* Data members & types */43public:44protected:45private:46MM_GCExtensionsBase *_extensions;47MM_HeapRegionDescriptorRealtime *_overflowList;48bool _overflowThisGCCycle; /**< set to signify an overflow happened sometime during GC cycle */4950/* Methods */51public:52static MM_IncrementalOverflow *newInstance(MM_EnvironmentBase *env, MM_WorkPackets *workPackets);53virtual void reset(MM_EnvironmentBase *env);5455virtual bool isEmpty()56{57return (_overflowList == NULL);58}5960bool isOverflowThisGCCycle() const { return _overflowThisGCCycle; }61void resetOverflowThisGCCycle() { _overflowThisGCCycle = false; }6263virtual void emptyToOverflow(MM_EnvironmentBase *env, MM_Packet *packet, MM_OverflowType type);64virtual void fillFromOverflow(MM_EnvironmentBase *env, MM_Packet *packet);65virtual void overflowItem(MM_EnvironmentBase *env, void *item, MM_OverflowType type);6667/**68* Create a IncrementalOverflow object.69*/70MM_IncrementalOverflow(MM_EnvironmentBase *env, MM_WorkPackets *workPackets) :71MM_WorkPacketOverflow(env, workPackets),72_overflowList(NULL),73_overflowThisGCCycle(false)74{75_typeId = __FUNCTION__;76};7778protected:79bool initialize(MM_EnvironmentBase *env);80void tearDown(MM_EnvironmentBase *env);81private:82void overflowItemInternal(MM_EnvironmentBase *env, void *item, MM_OverflowType type);83void push(MM_EnvironmentBase *env, MM_HeapRegionDescriptorRealtime *region);84void pushNoLock(MM_EnvironmentBase *env, MM_HeapRegionDescriptorRealtime *region);85MM_HeapRegionDescriptorRealtime *pop(MM_EnvironmentBase *env);86void pushLocal(MM_EnvironmentBase *env, MM_HeapRegionDescriptorRealtime *region, MM_OverflowType type);87void flushLocal(MM_EnvironmentBase *env, MM_OverflowType type);88};8990#endif /* INCREMENTALOVERFLOW_HPP_ */919293