Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_realtime/OwnableSynchronizerObjectBufferRealtime.cpp
5985 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
#include "j9.h"
24
#include "j9cfg.h"
25
#include "ModronAssertions.h"
26
27
#include "OwnableSynchronizerObjectBufferRealtime.hpp"
28
29
#include "OwnableSynchronizerObjectList.hpp"
30
#include "RealtimeGC.hpp"
31
#include "MetronomeDelegate.hpp"
32
33
MM_OwnableSynchronizerObjectBufferRealtime::MM_OwnableSynchronizerObjectBufferRealtime(MM_GCExtensions *extensions, UDATA maxObjectCount)
34
: MM_OwnableSynchronizerObjectBuffer(extensions, maxObjectCount)
35
,_ownableSynchronizerObjectListIndex(0)
36
{
37
_typeId = __FUNCTION__;
38
}
39
40
MM_OwnableSynchronizerObjectBufferRealtime *
41
MM_OwnableSynchronizerObjectBufferRealtime::newInstance(MM_EnvironmentBase *env)
42
{
43
MM_OwnableSynchronizerObjectBufferRealtime *ownableObjectBuffer = NULL;
44
MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(env);
45
46
ownableObjectBuffer = (MM_OwnableSynchronizerObjectBufferRealtime *)env->getForge()->allocate(sizeof(MM_OwnableSynchronizerObjectBufferRealtime), MM_AllocationCategory::FIXED, J9_GET_CALLSITE());
47
if (NULL != ownableObjectBuffer) {
48
new(ownableObjectBuffer) MM_OwnableSynchronizerObjectBufferRealtime(extensions, extensions->objectListFragmentCount);
49
if (!ownableObjectBuffer->initialize(env)) {
50
ownableObjectBuffer->kill(env);
51
ownableObjectBuffer = NULL;
52
}
53
}
54
55
return ownableObjectBuffer;
56
}
57
58
bool
59
MM_OwnableSynchronizerObjectBufferRealtime::initialize(MM_EnvironmentBase *base)
60
{
61
return true;
62
}
63
64
void
65
MM_OwnableSynchronizerObjectBufferRealtime::tearDown(MM_EnvironmentBase *base)
66
{
67
68
}
69
70
void
71
MM_OwnableSynchronizerObjectBufferRealtime::flushImpl(MM_EnvironmentBase* env)
72
{
73
MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(env);
74
MM_OwnableSynchronizerObjectList *ownableSynchronizerObjectList = &extensions->getOwnableSynchronizerObjectLists()[_ownableSynchronizerObjectListIndex];
75
ownableSynchronizerObjectList->addAll(env, _head, _tail);
76
_ownableSynchronizerObjectListIndex += 1;
77
if (extensions->realtimeGC->getRealtimeDelegate()->getOwnableSynchronizerObjectListCount(env) == _ownableSynchronizerObjectListIndex) {
78
_ownableSynchronizerObjectListIndex = 0;
79
}
80
}
81
82