Path: blob/master/runtime/gc_modron_startup/GCVerboseInterface.cpp
5985 views
/*******************************************************************************1* Copyright (c) 1991, 2021 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* 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-exception20*******************************************************************************/2122#include "j9.h"23#include "j9cfg.h"24#include "VerboseGCInterface.h"2526#include "GCExtensions.hpp"2728extern "C" {29/**30* Return the verbose gc API function table.31* This routine should return a table whose functions do nothing (default behavior).32* @return the verbose GC API function table.33*/34void *35getVerboseGCFunctionTable(J9JavaVM *javaVM)36{37void *result = NULL;38MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(javaVM);39if (NULL != extensions) {40result = &extensions->verboseFunctionTable;41}42return result;43}4445/**46* Dummy function for verbose function table.47* @param filename The name of the file or output stream to log to.48* @param numFiles The number of files to log to.49* @param numCycles The number of gc cycles to log to each file.50* @return 051*/52UDATA53dummygcDebugVerboseStartupLogging(J9JavaVM *javaVM, char* filename, UDATA numFiles, UDATA numCycles)54{55return 0;56}5758/**59* Dummy function for verbose function table.60* @param releaseVerboseStructures Indicator of whether it is safe to free the infrastructure.61*/62void63dummygcDebugVerboseShutdownLogging(J9JavaVM *javaVM, UDATA releaseVerboseStructures)64{65}6667UDATA68dummyconfigureVerbosegc(J9JavaVM *javaVM, int enable, char* filename, UDATA numFiles, UDATA numCycles)69{70const char *verboseDLLName = J9_VERBOSE_DLL_NAME;7172#if defined(OMR_MIXED_REFERENCES_MODE_STATIC)73if (!J9JAVAVM_COMPRESS_OBJECT_REFERENCES(vm)) {74verboseDLLName = J9_VERBOSE_FULL_DLL_NAME;75}76#endif /* defined(OMR_MIXED_REFERENCES_MODE_STATIC) */7778/* The verbose DLL isn't loaded, so call back into the VM to load it. This will79* reconfigure the function table to point at the functions in the verbose DLL. */80if (JNI_OK != javaVM->internalVMFunctions->postInitLoadJ9DLL(javaVM, verboseDLLName, NULL)) {81/* we failed to load the library */82return 0;83}8485/* Now that the function table has been reconfigured, we can call the right function to86* start/stop verbosegc. */87J9MemoryManagerVerboseInterface *vrbFuncTable = (J9MemoryManagerVerboseInterface *)javaVM->memoryManagerFunctions->getVerboseGCFunctionTable(javaVM);88return vrbFuncTable->configureVerbosegc(javaVM, enable, filename, numFiles, numCycles);89}9091UDATA92dummyQueryVerbosegc(J9JavaVM *javaVM)93{94return 0;95}9697/**98* Dummy function for verbose function table.99*/100void101dummygcDumpMemorySizes(J9JavaVM *javaVM)102{103}104105/**106* Initialises the verbose function table with the dummy routines.107* @param table Pointer to the Verbose function table.108*/109void110initializeVerboseFunctionTableWithDummies(J9MemoryManagerVerboseInterface *table)111{112table->gcDebugVerboseStartupLogging = dummygcDebugVerboseStartupLogging;113table->gcDebugVerboseShutdownLogging = dummygcDebugVerboseShutdownLogging;114table->gcDumpMemorySizes = dummygcDumpMemorySizes;115table->configureVerbosegc = dummyconfigureVerbosegc;116table->queryVerbosegc = dummyQueryVerbosegc;117}118119} /* extern "C" */120121122123