Path: blob/master/runtime/gc_check/CheckCycle.hpp
5985 views
1/*******************************************************************************2* Copyright (c) 1991, 2014 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/**24* @file25* @ingroup GC_Check26*/2728#if !defined(CHECKCYCLE_HPP_)29#define CHECKCYCLE_HPP_3031#include "j9.h"32#include "j9cfg.h"3334#include "Base.hpp"35#include "CheckBase.hpp"3637class GC_Check;38class GC_CheckEngine;3940class GC_CheckCycle : public MM_Base41{42/*43* Data members44*/45private:46typedef struct {47const char *name;48UDATA bitmask;49GC_Check *(*function)(J9JavaVM *javaVM, GC_CheckEngine *engine);50} funcStruct;5152const static funcStruct funcArray[];5354UDATA _checkFlags;55UDATA _miscFlags;56GCCheckInvokedBy _invokedBy; /**< What stage of GC invoked the check */57UDATA _manualCheckInvocation; /**< Allow user to identify which installed GCCheck triggered message */58UDATA _errorCount; /**< Number of errors encountered */5960GC_Check *_checks; /**< Pointer to head of linked list of checks to run in this cycle */6162J9JavaVM *_javaVM;63J9PortLibrary *_portLibrary;64GC_CheckEngine *_engine;6566protected:67public:6869/*70* Function members71*/72private:73void generateCheckList(UDATA scanFlags);7475bool initialize(const char *args);7677protected:78public:7980static void printHelp(J9PortLibrary *portLib);8182UDATA getCheckFlags() { return _checkFlags; };83UDATA getMiscFlags() { return _miscFlags; };84GCCheckInvokedBy getInvoker() { return _invokedBy; };85UDATA getManualCheckNumber() { return _manualCheckInvocation; };8687UDATA nextErrorCount() { return ++_errorCount; };8889/**90* Run the checks91* Iterates over the _checks linked list calling run() on each item in the list.92* @param invokedBy Identifier of the point in the GC the check has been called from93* @param filterFlags Tells which subset of the check list should be used (1bit meaning the checker will be used)94*/95void run(GCCheckInvokedBy invokedBy, UDATA filterFlags = J9MODRON_GCCHK_SCAN_ALL_SLOTS);96void fixDeadObjects(GCCheckInvokedBy invokedBy);97static GC_CheckCycle *newInstance(J9JavaVM *javaVM, GC_CheckEngine *, const char *args, UDATA manualCountInvocation = 0);98virtual void kill();99100GC_CheckCycle(J9JavaVM *javaVM, GC_CheckEngine *engine, UDATA manualCountInvocation)101: MM_Base()102, _checkFlags(0)103, _miscFlags(0)104, _invokedBy(invocation_unknown)105, _manualCheckInvocation(manualCountInvocation)106, _errorCount(0)107, _checks(NULL)108, _javaVM(javaVM)109, _portLibrary(javaVM->portLibrary)110, _engine(engine)111{}112};113114#endif /* CHECKCYCLE_HPP_ */115116117