Path: blob/master/runtime/gc_trace/TgcCopyForward.cpp
5985 views
1/*******************************************************************************2* Copyright (c) 1991, 2020 IBM Corp. and others3*4* This program and the accompanying materials are made available under5* the terms of the Eclipse Public License 2.0 which accompanies this6* 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 and8* is available at https://www.apache.org/licenses/LICENSE-2.0.9*10* This Source Code may also be made available under the following11* Secondary Licenses when the conditions for such availability set12* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU13* General Public License, version 2 with the GNU Classpath14* Exception [1] and GNU General Public License, version 2 with the15* OpenJDK Assembly Exception [2].16*17* [1] https://www.gnu.org/software/classpath/license.html18* [2] http://openjdk.java.net/legal/assembly-exception.html19*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-exception21*******************************************************************************/2223#include "j9.h"24#include "j9cfg.h"25#include "j9port.h"26#include "modronopt.h"27#include "mmhook.h"2829#if defined(J9VM_GC_VLHGC)30#include "CycleState.hpp"31#include "EnvironmentVLHGC.hpp"32#include "GCExtensions.hpp"33#include "TgcExtensions.hpp"34#include "VMThreadListIterator.hpp"3536/****************************************37* Hook callback38****************************************39*/4041static void42tgcHookCopyForwardEnd(J9HookInterface** hook, UDATA eventNum, void* eventData, void* userData)43{44J9VMThread *vmThread = static_cast<J9VMThread*>(((MM_CopyForwardEndEvent *)eventData)->currentThread->_language_vmthread);45MM_TgcExtensions *tgcExtensions = MM_TgcExtensions::getExtensions(vmThread);4647tgcExtensions->printf("CFDF: cards packets overflow next depth root\n");4849J9VMThread *walkThread = NULL;50GC_VMThreadListIterator threadIterator(vmThread);51while ((walkThread = threadIterator.nextVMThread()) != NULL) {52MM_EnvironmentVLHGC *env = MM_EnvironmentVLHGC::getEnvironment(walkThread);53if ((walkThread == vmThread) || (env->getThreadType() == GC_WORKER_THREAD)) {54tgcExtensions->printf("%4zu: %7zu %7zu %7zu %7zu %7zu %7zu\n",55env->getWorkerID(),56env->_copyForwardStats._objectsCardClean,57env->_copyForwardStats._objectsScannedFromWorkPackets,58env->_copyForwardStats._objectsScannedFromOverflowedRegion,59env->_copyForwardStats._objectsScannedFromNextInChain,60env->_copyForwardStats._objectsScannedFromDepthStack,61env->_copyForwardStats._objectsScannedFromRoot62);63}64}65}6667/****************************************68* Initialization69****************************************70*/7172bool73tgcCopyForwardInitialize(J9JavaVM *javaVM)74{75MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(javaVM);76bool result = true;7778J9HookInterface** privateHooks = J9_HOOK_INTERFACE(extensions->privateHookInterface);79(*privateHooks)->J9HookRegisterWithCallSite(privateHooks, J9HOOK_MM_PRIVATE_COPY_FORWARD_END, tgcHookCopyForwardEnd, OMR_GET_CALLSITE(), javaVM);8081return result;82}8384#endif /* J9VM_GC_VLHGC */858687