Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_check/CheckUnfinalizedList.cpp
5985 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 "CheckUnfinalizedList.hpp"
25
#include "ModronTypes.hpp"
26
#include "ObjectAccessBarrier.hpp"
27
#include "ScanFormatter.hpp"
28
#include "UnfinalizedObjectList.hpp"
29
30
#if defined(J9VM_GC_FINALIZATION)
31
32
GC_Check *
33
GC_CheckUnfinalizedList::newInstance(J9JavaVM *javaVM, GC_CheckEngine *engine)
34
{
35
MM_Forge *forge = MM_GCExtensions::getExtensions(javaVM)->getForge();
36
37
GC_CheckUnfinalizedList *check = (GC_CheckUnfinalizedList *) forge->allocate(sizeof(GC_CheckUnfinalizedList), MM_AllocationCategory::DIAGNOSTIC, J9_GET_CALLSITE());
38
if(check) {
39
new(check) GC_CheckUnfinalizedList(javaVM, engine);
40
}
41
return check;
42
}
43
44
void
45
GC_CheckUnfinalizedList::kill()
46
{
47
MM_Forge *forge = MM_GCExtensions::getExtensions(_javaVM)->getForge();
48
forge->free(this);
49
}
50
51
void
52
GC_CheckUnfinalizedList::check()
53
{
54
MM_ObjectAccessBarrier *barrier = _extensions->accessBarrier;
55
MM_UnfinalizedObjectList *unfinalizedObjectList = _extensions->unfinalizedObjectLists;
56
57
while(NULL != unfinalizedObjectList) {
58
J9Object *objectPtr = unfinalizedObjectList->getHeadOfList();
59
while (NULL != objectPtr) {
60
if (_engine->checkSlotUnfinalizedList(_javaVM, &objectPtr, unfinalizedObjectList) != J9MODRON_SLOT_ITERATOR_OK ){
61
return;
62
}
63
objectPtr = barrier->getFinalizeLink(objectPtr);
64
}
65
unfinalizedObjectList = unfinalizedObjectList->getNextList();
66
}
67
}
68
69
void
70
GC_CheckUnfinalizedList::print()
71
{
72
MM_ObjectAccessBarrier *barrier = _extensions->accessBarrier;
73
MM_UnfinalizedObjectList *unfinalizedObjectList = _extensions->unfinalizedObjectLists;
74
75
GC_ScanFormatter formatter(_portLibrary, "unfinalizedObjectList");
76
while(NULL != unfinalizedObjectList) {
77
formatter.section("list", (void *) unfinalizedObjectList);
78
J9Object *objectPtr = unfinalizedObjectList->getHeadOfList();
79
while (NULL != objectPtr) {
80
formatter.entry((void *) objectPtr);
81
objectPtr = barrier->getFinalizeLink(objectPtr);
82
}
83
formatter.endSection();
84
unfinalizedObjectList = unfinalizedObjectList->getNextList();
85
}
86
formatter.end("unfinalizedObjectList");
87
}
88
89
#endif /* J9VM_GC_FINALIZATION */
90
91