Path: blob/master/runtime/gc_realtime/MemorySubSpaceMetronome.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(MEMORYSUBSPACEMETRONOME_HPP_)23#define MEMORYSUBSPACEMETRONOME_HPP_2425#include "omr.h"26#include "omrcfg.h"2728#include "MemorySubSpaceSegregated.hpp"2930class MM_AllocateDescription;31class MM_EnvironmentBase;32class MM_GCCode;33class MM_MemoryPool;3435/**36* @todo Provide class documentation37* @ingroup GC_Metronome38*/39class MM_MemorySubSpaceMetronome : public MM_MemorySubSpaceSegregated40{41private:42/* TODO: this is temporary as a way to avoid dup code in MemorySubSpaceMetronome::allocate.43* We will specifically fix this allocate method in a separate design.44*/45void *allocateMixedObjectOrArraylet(MM_EnvironmentBase *env, MM_AllocateDescription *allocDescription, AllocateType allocType);46void collectOnOOM(MM_EnvironmentBase *env, MM_GCCode gcCode, MM_AllocateDescription *allocDescription);4748protected:49bool initialize(MM_EnvironmentBase *env);5051public:52static MM_MemorySubSpaceMetronome *newInstance(53MM_EnvironmentBase *env, MM_PhysicalSubArena *physicalSubArena, MM_MemoryPool *memoryPool,54bool usesGlobalCollector, UDATA minimumSize, UDATA initialSize, UDATA maximumSize);5556virtual const char *getName() { return MEMORY_SUBSPACE_NAME_METRONOME; }57virtual const char *getDescription() { return MEMORY_SUBSPACE_DESCRIPTION_METRONOME; }5859virtual void systemGarbageCollect(MM_EnvironmentBase *env, U_32 gcCode);60virtual void *allocateObject(MM_EnvironmentBase *env, MM_AllocateDescription *allocDescription, MM_MemorySubSpace *baseSubSpace, MM_MemorySubSpace *previousSubSpace, bool shouldCollectOnFailure);61virtual void *allocateArrayletLeaf(MM_EnvironmentBase *env, MM_AllocateDescription *allocDescription, MM_MemorySubSpace *baseSubSpace, MM_MemorySubSpace *previousSubSpace, bool shouldCollectOnFailure);6263void collect(MM_EnvironmentBase *env, MM_GCCode gcCode);6465MM_MemorySubSpaceMetronome(66MM_EnvironmentBase *env, MM_PhysicalSubArena *physicalSubArena, MM_MemoryPool *memoryPool,67bool usesGlobalCollector, UDATA minimumSize, UDATA initialSize, UDATA maximumSize68)69: MM_MemorySubSpaceSegregated(env, physicalSubArena, memoryPool, usesGlobalCollector, minimumSize, initialSize, maximumSize)70{71_typeId = __FUNCTION__;72};73};7475#endif /* MEMORYSUBSPACEMETRONOME_HPP_ */76777879