Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_check/CheckRememberedSet.cpp
5990 views
1
/*******************************************************************************
2
* Copyright (c) 1991, 2014 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* 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 and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
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-exception
21
*******************************************************************************/
22
23
#include "CheckEngine.hpp"
24
#include "CheckRememberedSet.hpp"
25
#include "ModronTypes.hpp"
26
#include "ScanFormatter.hpp"
27
28
#if defined(J9VM_GC_GENERATIONAL)
29
30
GC_Check *
31
GC_CheckRememberedSet::newInstance(J9JavaVM *javaVM, GC_CheckEngine *engine)
32
{
33
MM_Forge *forge = MM_GCExtensions::getExtensions(javaVM)->getForge();
34
35
GC_CheckRememberedSet *check = (GC_CheckRememberedSet *) forge->allocate(sizeof(GC_CheckRememberedSet), MM_AllocationCategory::DIAGNOSTIC, J9_GET_CALLSITE());
36
if(check) {
37
new(check) GC_CheckRememberedSet(javaVM, engine);
38
}
39
return check;
40
}
41
42
void
43
GC_CheckRememberedSet::kill()
44
{
45
MM_Forge *forge = MM_GCExtensions::getExtensions(_javaVM)->getForge();
46
forge->free(this);
47
}
48
49
void
50
GC_CheckRememberedSet::check()
51
{
52
J9Object **slotPtr;
53
MM_SublistPuddle *puddle;
54
GC_RememberedSetIterator remSetIterator(&_extensions->rememberedSet);
55
56
/* no point checking if the scavenger wasn't turned on */
57
if(!_extensions->scavengerEnabled) {
58
return;
59
}
60
61
while((puddle = remSetIterator.nextList()) != NULL) {
62
GC_RememberedSetSlotIterator remSetSlotIterator(puddle);
63
64
while((slotPtr = (J9Object **)remSetSlotIterator.nextSlot()) != NULL) {
65
if (_engine->checkSlotRememberedSet(_javaVM, slotPtr, puddle) != J9MODRON_SLOT_ITERATOR_OK ){
66
return;
67
}
68
}
69
}
70
}
71
72
void
73
GC_CheckRememberedSet::print()
74
{
75
GC_RememberedSetIterator remSetIterator(&_extensions->rememberedSet);
76
J9Object **slotPtr;
77
MM_SublistPuddle *puddle;
78
GC_ScanFormatter formatter(_portLibrary, "RememberedSet Sublist", (void *)&_extensions->rememberedSet);
79
while ((puddle = remSetIterator.nextList()) != NULL) {
80
GC_RememberedSetSlotIterator remSetSlotIterator(puddle);
81
formatter.section("puddle", (void *) puddle);
82
83
while((slotPtr = (J9Object **)remSetSlotIterator.nextSlot()) != NULL) {
84
formatter.entry((void *)*slotPtr);
85
}
86
formatter.endSection();
87
}
88
formatter.end("RememberedSet Sublist", (void *)&_extensions->rememberedSet);
89
}
90
91
#endif /* J9VM_GC_GENERATIONAL */
92
93