Path: blob/master/runtime/gc_realtime/RealtimeRootScanner.hpp
5986 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/**23* @file24* @ingroup GC_Metronome25*/2627#if !defined(REALTIMEROOTSCANNER_HPP_)28#define REALTIMEROOTSCANNER_HPP_2930#include "j9.h"31#include "j9cfg.h"32#include "modronopt.h"3334#include "EnvironmentRealtime.hpp"35#include "GlobalCollector.hpp"36#include "GCExtensions.hpp"37#include "Scheduler.hpp"38#include "MemorySubSpace.hpp"39#include "MemorySubSpaceMetronome.hpp"40#include "MemoryPoolSegregated.hpp"41#include "ObjectAllocationInterface.hpp"42#include "RootScanner.hpp"43#include "RealtimeGC.hpp"44#include "RealtimeMarkingScheme.hpp"45#include "StackSlotValidator.hpp"4647class MM_ParallelDispatcher;48class MM_MemorySubSpace;49class MM_MemorySubSpaceMetronome;5051class MM_RealtimeRootScanner : public MM_RootScanner52{53/*54* Data members55*/56private:57protected:58MM_RealtimeGC *_realtimeGC;59MM_RealtimeMarkingScheme *_markingScheme;60MM_EnvironmentRealtime *_env;6162public:63UDATA _threadCount;64I_32 _yieldCount;6566/*67* Function members68*/69private:70protected:71public:72virtual void doClass(J9Class* clazz);7374#if defined(J9VM_GC_REALTIME)75void doStringTableSlot(J9Object **slotPtr, GC_StringTableIterator *stringTableIterator);76virtual void doStringCacheTableSlot(J9Object **slotPtr);77#endif /* J9VM_GC_REALTIME */7879virtual void scanThreads(MM_EnvironmentBase *env);80virtual bool scanOneThread(MM_EnvironmentBase *env, J9VMThread* walkThread, void* localData);81virtual void scanOneThreadImpl(MM_EnvironmentRealtime *env, J9VMThread* walkThread, void* localData);82void reportThreadCount(MM_EnvironmentBase *env);83void scanAtomicRoots(MM_EnvironmentRealtime *env);8485/* The yield family of methods override the RootScanner to do actual yielding.86* Their implementations basically use the scheduler API */87virtual bool shouldYieldFromClassScan(UDATA timeSlackNanoSec = 0);88virtual bool shouldYieldFromStringScan();89virtual bool shouldYieldFromMonitorScan();90virtual bool shouldYield();91virtual void yield();92virtual bool condYield(U_64 timeSlackNanoSec = 0);9394CompletePhaseCode scanClassesComplete(MM_EnvironmentBase *env);9596virtual const char* scannerName() = 0;9798virtual void doClassSlot(J9Class *classPtr);99100virtual void scanMonitorLookupCaches(MM_EnvironmentBase *env);101102virtual void scanStringTable(MM_EnvironmentBase *env);103104MM_RealtimeRootScanner(MM_EnvironmentRealtime *env, MM_RealtimeGC *realtimeGC)105: MM_RootScanner(env)106, _realtimeGC(realtimeGC)107, _markingScheme(realtimeGC->getMarkingScheme())108, _env(env)109, _threadCount(0)110, _yieldCount(0)111{112_typeId = __FUNCTION__;113#if defined(J9VM_GC_REALTIME)114/* String table should be clearable, not a hard root */115setStringTableAsRoot(false);116#endif /* defined(J9VM_GC_REALTIME) */117}118};119120#endif /* REALTIMEROOTSCANNER_HPP_ */121122123124