Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_glue_java/MarkingSchemeRootMarker.cpp
5990 views
1
2
/*******************************************************************************
3
* Copyright (c) 1991, 2017 IBM Corp. and others
4
*
5
* This program and the accompanying materials are made available under
6
* the terms of the Eclipse Public License 2.0 which accompanies this
7
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
8
* or the Apache License, Version 2.0 which accompanies this distribution and
9
* is available at https://www.apache.org/licenses/LICENSE-2.0.
10
*
11
* This Source Code may also be made available under the following
12
* Secondary Licenses when the conditions for such availability set
13
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
14
* General Public License, version 2 with the GNU Classpath
15
* Exception [1] and GNU General Public License, version 2 with the
16
* OpenJDK Assembly Exception [2].
17
*
18
* [1] https://www.gnu.org/software/classpath/license.html
19
* [2] http://openjdk.java.net/legal/assembly-exception.html
20
*
21
* 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-exception
22
*******************************************************************************/
23
24
#include "j9.h"
25
#include "j9cfg.h"
26
#include "j9consts.h"
27
28
#include "EnvironmentBase.hpp"
29
#include "Heap.hpp"
30
#include "MarkingDelegate.hpp"
31
#include "MarkingScheme.hpp"
32
#include "MarkingSchemeRootMarker.hpp"
33
#include "StackSlotValidator.hpp"
34
#include "VMThreadIterator.hpp"
35
36
void
37
MM_MarkingSchemeRootMarker::doSlot(omrobjectptr_t *slotPtr)
38
{
39
_markingScheme->inlineMarkObject(_env, *slotPtr);
40
}
41
42
void
43
MM_MarkingSchemeRootMarker::doStackSlot(omrobjectptr_t *slotPtr, void *walkState, const void* stackLocation)
44
{
45
omrobjectptr_t object = *slotPtr;
46
if (_markingScheme->isHeapObject(object) && !_extensions->heap->objectIsInGap(object)) {
47
/* heap object - validate and mark */
48
Assert_MM_validStackSlot(MM_StackSlotValidator(0, object, stackLocation, walkState).validate(_env));
49
_markingScheme->inlineMarkObject(_env, object);
50
51
} else if (NULL != object) {
52
/* stack object - just validate */
53
Assert_MM_validStackSlot(MM_StackSlotValidator(MM_StackSlotValidator::NOT_ON_HEAP, object, stackLocation, walkState).validate(_env));
54
}
55
}
56
57
void
58
MM_MarkingSchemeRootMarker::doVMThreadSlot(omrobjectptr_t *slotPtr, GC_VMThreadIterator *vmThreadIterator)
59
{
60
omrobjectptr_t object = *slotPtr;
61
if (_markingScheme->isHeapObject(object) && !_extensions->heap->objectIsInGap(object)) {
62
_markingScheme->inlineMarkObject(_env, object);
63
} else if (NULL != object) {
64
Assert_MM_true(vmthreaditerator_state_monitor_records == vmThreadIterator->getState());
65
}
66
}
67
68
void
69
MM_MarkingSchemeRootMarker::doClass(J9Class *clazz)
70
{
71
_markingDelegate->scanClass(_env, clazz);
72
}
73
74
void
75
MM_MarkingSchemeRootMarker::doClassLoader(J9ClassLoader *classLoader)
76
{
77
/* Scan any classloader that hasn't previously marked as dead. Don't mark them as scanned, since
78
* we won't be running MM_ParallelGlobalGC::unloadDeadClassLoaders() which clears the bit
79
*/
80
if(J9_GC_CLASS_LOADER_DEAD != (classLoader->gcFlags & J9_GC_CLASS_LOADER_DEAD)) {
81
_markingScheme->inlineMarkObject(_env, classLoader->classLoaderObject);
82
}
83
}
84
85
void
86
MM_MarkingSchemeRootMarker::doFinalizableObject(omrobjectptr_t object)
87
{
88
_markingScheme->inlineMarkObject(_env, object);
89
}
90
91
92