Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_modron_startup/GCVerboseInterface.cpp
5985 views
1
/*******************************************************************************
2
* Copyright (c) 1991, 2021 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 "VerboseGCInterface.h"
26
27
#include "GCExtensions.hpp"
28
29
extern "C" {
30
/**
31
* Return the verbose gc API function table.
32
* This routine should return a table whose functions do nothing (default behavior).
33
* @return the verbose GC API function table.
34
*/
35
void *
36
getVerboseGCFunctionTable(J9JavaVM *javaVM)
37
{
38
void *result = NULL;
39
MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(javaVM);
40
if (NULL != extensions) {
41
result = &extensions->verboseFunctionTable;
42
}
43
return result;
44
}
45
46
/**
47
* Dummy function for verbose function table.
48
* @param filename The name of the file or output stream to log to.
49
* @param numFiles The number of files to log to.
50
* @param numCycles The number of gc cycles to log to each file.
51
* @return 0
52
*/
53
UDATA
54
dummygcDebugVerboseStartupLogging(J9JavaVM *javaVM, char* filename, UDATA numFiles, UDATA numCycles)
55
{
56
return 0;
57
}
58
59
/**
60
* Dummy function for verbose function table.
61
* @param releaseVerboseStructures Indicator of whether it is safe to free the infrastructure.
62
*/
63
void
64
dummygcDebugVerboseShutdownLogging(J9JavaVM *javaVM, UDATA releaseVerboseStructures)
65
{
66
}
67
68
UDATA
69
dummyconfigureVerbosegc(J9JavaVM *javaVM, int enable, char* filename, UDATA numFiles, UDATA numCycles)
70
{
71
const char *verboseDLLName = J9_VERBOSE_DLL_NAME;
72
73
#if defined(OMR_MIXED_REFERENCES_MODE_STATIC)
74
if (!J9JAVAVM_COMPRESS_OBJECT_REFERENCES(vm)) {
75
verboseDLLName = J9_VERBOSE_FULL_DLL_NAME;
76
}
77
#endif /* defined(OMR_MIXED_REFERENCES_MODE_STATIC) */
78
79
/* The verbose DLL isn't loaded, so call back into the VM to load it. This will
80
* reconfigure the function table to point at the functions in the verbose DLL. */
81
if (JNI_OK != javaVM->internalVMFunctions->postInitLoadJ9DLL(javaVM, verboseDLLName, NULL)) {
82
/* we failed to load the library */
83
return 0;
84
}
85
86
/* Now that the function table has been reconfigured, we can call the right function to
87
* start/stop verbosegc. */
88
J9MemoryManagerVerboseInterface *vrbFuncTable = (J9MemoryManagerVerboseInterface *)javaVM->memoryManagerFunctions->getVerboseGCFunctionTable(javaVM);
89
return vrbFuncTable->configureVerbosegc(javaVM, enable, filename, numFiles, numCycles);
90
}
91
92
UDATA
93
dummyQueryVerbosegc(J9JavaVM *javaVM)
94
{
95
return 0;
96
}
97
98
/**
99
* Dummy function for verbose function table.
100
*/
101
void
102
dummygcDumpMemorySizes(J9JavaVM *javaVM)
103
{
104
}
105
106
/**
107
* Initialises the verbose function table with the dummy routines.
108
* @param table Pointer to the Verbose function table.
109
*/
110
void
111
initializeVerboseFunctionTableWithDummies(J9MemoryManagerVerboseInterface *table)
112
{
113
table->gcDebugVerboseStartupLogging = dummygcDebugVerboseStartupLogging;
114
table->gcDebugVerboseShutdownLogging = dummygcDebugVerboseShutdownLogging;
115
table->gcDumpMemorySizes = dummygcDumpMemorySizes;
116
table->configureVerbosegc = dummyconfigureVerbosegc;
117
table->queryVerbosegc = dummyQueryVerbosegc;
118
}
119
120
} /* extern "C" */
121
122
123