Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_realtime/RealtimeMarkTask.cpp
5985 views
1
/*******************************************************************************
2
* Copyright (c) 1991, 2020 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
/**
24
* @file
25
*/
26
27
#include "ut_j9mm.h"
28
29
#include "EnvironmentRealtime.hpp"
30
#include "GCExtensionsBase.hpp"
31
#include "GlobalGCStats.hpp"
32
#include "RealtimeGC.hpp"
33
#include "RealtimeMarkingScheme.hpp"
34
#include "RealtimeMarkTask.hpp"
35
36
void
37
MM_RealtimeMarkTask::run(MM_EnvironmentBase *env)
38
{
39
_markingScheme->markLiveObjectsInit(env, false);
40
_markingScheme->markLiveObjectsRoots(env);
41
_markingScheme->markLiveObjectsScan(env);
42
_markingScheme->markLiveObjectsComplete(env);
43
}
44
45
void
46
MM_RealtimeMarkTask::setup(MM_EnvironmentBase *envBase)
47
{
48
MM_EnvironmentRealtime *env = MM_EnvironmentRealtime::getEnvironment(envBase);
49
MM_GCExtensionsBase *extensions = env->getExtensions();
50
51
extensions->realtimeGC->getRealtimeDelegate()->clearGCStatsEnvironment(env);
52
53
/* record that this thread is participating in this cycle */
54
env->_markStats._gcCount = extensions->globalGCStats.gcCount;
55
env->_workPacketStats._gcCount = extensions->globalGCStats.gcCount;
56
57
if(env->isMainThread()) {
58
Assert_MM_true(_cycleState == env->_cycleState);
59
} else {
60
Assert_MM_true(NULL == env->_cycleState);
61
env->_cycleState = _cycleState;
62
}
63
}
64
65
void
66
MM_RealtimeMarkTask::cleanup(MM_EnvironmentBase *envBase)
67
{
68
MM_EnvironmentRealtime *env = MM_EnvironmentRealtime::getEnvironment(envBase);
69
MM_GCExtensionsBase *extensions = env->getExtensions();
70
MM_MetronomeDelegate *delegate = extensions->realtimeGC->getRealtimeDelegate();
71
OMRPORT_ACCESS_FROM_ENVIRONMENT(env);
72
73
delegate->mergeGCStats(env);
74
75
if (env->isMainThread()) {
76
Assert_MM_true(_cycleState == env->_cycleState);
77
} else {
78
env->_cycleState = NULL;
79
}
80
81
/* record the thread-specific parallelism stats in the trace buffer. This partially duplicates info in -Xtgc:parallel */
82
Trc_MM_RealtimeMarkTask_parallelStats(
83
env->getLanguageVMThread(),
84
(U_32)env->getWorkerID(),
85
(U_32)omrtime_hires_delta(0, env->_workPacketStats._workStallTime, OMRPORT_TIME_DELTA_IN_MILLISECONDS),
86
(U_32)omrtime_hires_delta(0, env->_workPacketStats._completeStallTime, OMRPORT_TIME_DELTA_IN_MILLISECONDS),
87
(U_32)omrtime_hires_delta(0, env->_markStats._syncStallTime, OMRPORT_TIME_DELTA_IN_MILLISECONDS),
88
(U_32)env->_workPacketStats._workStallCount,
89
(U_32)env->_workPacketStats._completeStallCount,
90
(U_32)env->_markStats._syncStallCount,
91
env->_workPacketStats.workPacketsAcquired,
92
env->_workPacketStats.workPacketsReleased,
93
env->_workPacketStats.workPacketsExchanged,
94
delegate->getSplitArraysProcessed(env));
95
}
96
97