Path: blob/master/runtime/gc_glue_java/MarkingSchemeRootMarker.cpp
5990 views
1/*******************************************************************************2* Copyright (c) 1991, 2017 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 "j9consts.h"2627#include "EnvironmentBase.hpp"28#include "Heap.hpp"29#include "MarkingDelegate.hpp"30#include "MarkingScheme.hpp"31#include "MarkingSchemeRootMarker.hpp"32#include "StackSlotValidator.hpp"33#include "VMThreadIterator.hpp"3435void36MM_MarkingSchemeRootMarker::doSlot(omrobjectptr_t *slotPtr)37{38_markingScheme->inlineMarkObject(_env, *slotPtr);39}4041void42MM_MarkingSchemeRootMarker::doStackSlot(omrobjectptr_t *slotPtr, void *walkState, const void* stackLocation)43{44omrobjectptr_t object = *slotPtr;45if (_markingScheme->isHeapObject(object) && !_extensions->heap->objectIsInGap(object)) {46/* heap object - validate and mark */47Assert_MM_validStackSlot(MM_StackSlotValidator(0, object, stackLocation, walkState).validate(_env));48_markingScheme->inlineMarkObject(_env, object);4950} else if (NULL != object) {51/* stack object - just validate */52Assert_MM_validStackSlot(MM_StackSlotValidator(MM_StackSlotValidator::NOT_ON_HEAP, object, stackLocation, walkState).validate(_env));53}54}5556void57MM_MarkingSchemeRootMarker::doVMThreadSlot(omrobjectptr_t *slotPtr, GC_VMThreadIterator *vmThreadIterator)58{59omrobjectptr_t object = *slotPtr;60if (_markingScheme->isHeapObject(object) && !_extensions->heap->objectIsInGap(object)) {61_markingScheme->inlineMarkObject(_env, object);62} else if (NULL != object) {63Assert_MM_true(vmthreaditerator_state_monitor_records == vmThreadIterator->getState());64}65}6667void68MM_MarkingSchemeRootMarker::doClass(J9Class *clazz)69{70_markingDelegate->scanClass(_env, clazz);71}7273void74MM_MarkingSchemeRootMarker::doClassLoader(J9ClassLoader *classLoader)75{76/* Scan any classloader that hasn't previously marked as dead. Don't mark them as scanned, since77* we won't be running MM_ParallelGlobalGC::unloadDeadClassLoaders() which clears the bit78*/79if(J9_GC_CLASS_LOADER_DEAD != (classLoader->gcFlags & J9_GC_CLASS_LOADER_DEAD)) {80_markingScheme->inlineMarkObject(_env, classLoader->classLoaderObject);81}82}8384void85MM_MarkingSchemeRootMarker::doFinalizableObject(omrobjectptr_t object)86{87_markingScheme->inlineMarkObject(_env, object);88}89909192