Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_trace/TgcCopyForward.cpp
5985 views
1
2
/*******************************************************************************
3
* Copyright (c) 1991, 2020 IBM Corp. and others
4
*
5
* This program and the accompanying materials are made available under
6
* the terms of the Eclipse Public License 2.0 which accompanies this
7
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
8
* or the Apache License, Version 2.0 which accompanies this distribution and
9
* is available at https://www.apache.org/licenses/LICENSE-2.0.
10
*
11
* This Source Code may also be made available under the following
12
* Secondary Licenses when the conditions for such availability set
13
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
14
* General Public License, version 2 with the GNU Classpath
15
* Exception [1] and GNU General Public License, version 2 with the
16
* OpenJDK Assembly Exception [2].
17
*
18
* [1] https://www.gnu.org/software/classpath/license.html
19
* [2] http://openjdk.java.net/legal/assembly-exception.html
20
*
21
* 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
22
*******************************************************************************/
23
24
#include "j9.h"
25
#include "j9cfg.h"
26
#include "j9port.h"
27
#include "modronopt.h"
28
#include "mmhook.h"
29
30
#if defined(J9VM_GC_VLHGC)
31
#include "CycleState.hpp"
32
#include "EnvironmentVLHGC.hpp"
33
#include "GCExtensions.hpp"
34
#include "TgcExtensions.hpp"
35
#include "VMThreadListIterator.hpp"
36
37
/****************************************
38
* Hook callback
39
****************************************
40
*/
41
42
static void
43
tgcHookCopyForwardEnd(J9HookInterface** hook, UDATA eventNum, void* eventData, void* userData)
44
{
45
J9VMThread *vmThread = static_cast<J9VMThread*>(((MM_CopyForwardEndEvent *)eventData)->currentThread->_language_vmthread);
46
MM_TgcExtensions *tgcExtensions = MM_TgcExtensions::getExtensions(vmThread);
47
48
tgcExtensions->printf("CFDF: cards packets overflow next depth root\n");
49
50
J9VMThread *walkThread = NULL;
51
GC_VMThreadListIterator threadIterator(vmThread);
52
while ((walkThread = threadIterator.nextVMThread()) != NULL) {
53
MM_EnvironmentVLHGC *env = MM_EnvironmentVLHGC::getEnvironment(walkThread);
54
if ((walkThread == vmThread) || (env->getThreadType() == GC_WORKER_THREAD)) {
55
tgcExtensions->printf("%4zu: %7zu %7zu %7zu %7zu %7zu %7zu\n",
56
env->getWorkerID(),
57
env->_copyForwardStats._objectsCardClean,
58
env->_copyForwardStats._objectsScannedFromWorkPackets,
59
env->_copyForwardStats._objectsScannedFromOverflowedRegion,
60
env->_copyForwardStats._objectsScannedFromNextInChain,
61
env->_copyForwardStats._objectsScannedFromDepthStack,
62
env->_copyForwardStats._objectsScannedFromRoot
63
);
64
}
65
}
66
}
67
68
/****************************************
69
* Initialization
70
****************************************
71
*/
72
73
bool
74
tgcCopyForwardInitialize(J9JavaVM *javaVM)
75
{
76
MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(javaVM);
77
bool result = true;
78
79
J9HookInterface** privateHooks = J9_HOOK_INTERFACE(extensions->privateHookInterface);
80
(*privateHooks)->J9HookRegisterWithCallSite(privateHooks, J9HOOK_MM_PRIVATE_COPY_FORWARD_END, tgcHookCopyForwardEnd, OMR_GET_CALLSITE(), javaVM);
81
82
return result;
83
}
84
85
#endif /* J9VM_GC_VLHGC */
86
87