Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_realtime/MemorySubSpaceMetronome.hpp
5986 views
1
/*******************************************************************************
2
* Copyright (c) 1991, 2019 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* 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-exception
21
*******************************************************************************/
22
23
#if !defined(MEMORYSUBSPACEMETRONOME_HPP_)
24
#define MEMORYSUBSPACEMETRONOME_HPP_
25
26
#include "omr.h"
27
#include "omrcfg.h"
28
29
#include "MemorySubSpaceSegregated.hpp"
30
31
class MM_AllocateDescription;
32
class MM_EnvironmentBase;
33
class MM_GCCode;
34
class MM_MemoryPool;
35
36
/**
37
* @todo Provide class documentation
38
* @ingroup GC_Metronome
39
*/
40
class MM_MemorySubSpaceMetronome : public MM_MemorySubSpaceSegregated
41
{
42
private:
43
/* TODO: this is temporary as a way to avoid dup code in MemorySubSpaceMetronome::allocate.
44
* We will specifically fix this allocate method in a separate design.
45
*/
46
void *allocateMixedObjectOrArraylet(MM_EnvironmentBase *env, MM_AllocateDescription *allocDescription, AllocateType allocType);
47
void collectOnOOM(MM_EnvironmentBase *env, MM_GCCode gcCode, MM_AllocateDescription *allocDescription);
48
49
protected:
50
bool initialize(MM_EnvironmentBase *env);
51
52
public:
53
static MM_MemorySubSpaceMetronome *newInstance(
54
MM_EnvironmentBase *env, MM_PhysicalSubArena *physicalSubArena, MM_MemoryPool *memoryPool,
55
bool usesGlobalCollector, UDATA minimumSize, UDATA initialSize, UDATA maximumSize);
56
57
virtual const char *getName() { return MEMORY_SUBSPACE_NAME_METRONOME; }
58
virtual const char *getDescription() { return MEMORY_SUBSPACE_DESCRIPTION_METRONOME; }
59
60
virtual void systemGarbageCollect(MM_EnvironmentBase *env, U_32 gcCode);
61
virtual void *allocateObject(MM_EnvironmentBase *env, MM_AllocateDescription *allocDescription, MM_MemorySubSpace *baseSubSpace, MM_MemorySubSpace *previousSubSpace, bool shouldCollectOnFailure);
62
virtual void *allocateArrayletLeaf(MM_EnvironmentBase *env, MM_AllocateDescription *allocDescription, MM_MemorySubSpace *baseSubSpace, MM_MemorySubSpace *previousSubSpace, bool shouldCollectOnFailure);
63
64
void collect(MM_EnvironmentBase *env, MM_GCCode gcCode);
65
66
MM_MemorySubSpaceMetronome(
67
MM_EnvironmentBase *env, MM_PhysicalSubArena *physicalSubArena, MM_MemoryPool *memoryPool,
68
bool usesGlobalCollector, UDATA minimumSize, UDATA initialSize, UDATA maximumSize
69
)
70
: MM_MemorySubSpaceSegregated(env, physicalSubArena, memoryPool, usesGlobalCollector, minimumSize, initialSize, maximumSize)
71
{
72
_typeId = __FUNCTION__;
73
};
74
};
75
76
#endif /* MEMORYSUBSPACEMETRONOME_HPP_ */
77
78
79