Path: blob/master/runtime/gc_vlhgc/CopyForwardSchemeTask.hpp
5986 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#if !defined(COPYFORWARDSCHEMETASK_HPP_)24#define COPYFORWARDSCHEMETASK_HPP_2526#include "omrcfg.h"2728#include "modronopt.h"29#include "omrcomp.h"30#include "omrmodroncore.h"3132#include "CopyForwardScheme.hpp"33#include "EnvironmentVLHGC.hpp"34#include "InterRegionRememberedSet.hpp"35#include "ParallelTask.hpp"3637class MM_CycleState;3839class MM_CopyForwardSchemeTask : public MM_ParallelTask40{41private:42MM_CopyForwardScheme *_copyForwardScheme; /**< Tasks controlling scheme instance */43MM_CycleState *_cycleState; /**< Collection cycle state active for the task */4445public:46virtual UDATA getVMStateID() { return OMRVMSTATE_GC_SCAVENGE; };4748virtual void run(MM_EnvironmentBase *envBase)49{50MM_EnvironmentVLHGC *env = MM_EnvironmentVLHGC::getEnvironment(envBase);51_copyForwardScheme->workThreadGarbageCollect(env);52}5354void setup(MM_EnvironmentBase *envBase)55{56MM_EnvironmentVLHGC *env = MM_EnvironmentVLHGC::getEnvironment(envBase);57if (env->isMainThread()) {58Assert_MM_true(_cycleState == env->_cycleState);59} else {60Assert_MM_true(NULL == env->_cycleState);61env->_cycleState = _cycleState;62}6364env->_workPacketStats.clear();65env->_copyForwardStats.clear();6667/* record that this thread is participating in this cycle */68env->_copyForwardStats._gcCount = MM_GCExtensions::getExtensions(env)->globalVLHGCStats.gcCount;69env->_workPacketStats._gcCount = MM_GCExtensions::getExtensions(env)->globalVLHGCStats.gcCount;70}7172void cleanup(MM_EnvironmentBase *envBase)73{74MM_EnvironmentVLHGC *env = MM_EnvironmentVLHGC::getEnvironment(envBase);7576if (env->isMainThread()) {77Assert_MM_true(_cycleState == env->_cycleState);78} else {79env->_cycleState = NULL;80}8182env->_lastOverflowedRsclWithReleasedBuffers = NULL;83}8485void mainCleanup(MM_EnvironmentBase *envBase)86{87MM_EnvironmentVLHGC *env = MM_EnvironmentVLHGC::getEnvironment(envBase);8889MM_GCExtensions::getExtensions(env)->interRegionRememberedSet->resetOverflowedList();90}9192#if defined(J9MODRON_TGC_PARALLEL_STATISTICS)93void synchronizeGCThreads(MM_EnvironmentBase *env, const char *id);94bool synchronizeGCThreadsAndReleaseMain(MM_EnvironmentBase *env, const char *id);95bool synchronizeGCThreadsAndReleaseSingleThread(MM_EnvironmentBase *env, const char *id);9697bool synchronizeGCThreadsAndReleaseMainForAbort(MM_EnvironmentBase *env, const char *id);98void synchronizeGCThreadsForMark(MM_EnvironmentBase *env, const char *id);99bool synchronizeGCThreadsAndReleaseMainForMark(MM_EnvironmentBase *env, const char *id);100void synchronizeGCThreadsForInterRegionRememberedSet(MM_EnvironmentBase *env, const char *id);101#endif /* J9MODRON_TGC_PARALLEL_STATISTICS */102103/**104* Create a CopyForwardSchemeTask object.105*/106MM_CopyForwardSchemeTask(MM_EnvironmentVLHGC *env, MM_ParallelDispatcher *dispatcher, MM_CopyForwardScheme *copyForwardScheme, MM_CycleState *cycleState) :107MM_ParallelTask((MM_EnvironmentBase *)env, dispatcher)108, _copyForwardScheme(copyForwardScheme)109, _cycleState(cycleState)110{111_typeId = __FUNCTION__;112}113};114115#endif /* COPYFORWARDSCHEMETASK_HPP_ */116117