Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_check/CheckMonitorTable.cpp
5985 views
1
2
/*******************************************************************************
3
* Copyright (c) 1991, 2014 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
27
#include "CheckEngine.hpp"
28
#include "CheckMonitorTable.hpp"
29
#include "ModronTypes.hpp"
30
#include "ScanFormatter.hpp"
31
32
GC_Check *
33
GC_CheckMonitorTable::newInstance(J9JavaVM *javaVM, GC_CheckEngine *engine)
34
{
35
MM_Forge *forge = MM_GCExtensions::getExtensions(javaVM)->getForge();
36
37
GC_CheckMonitorTable *check = (GC_CheckMonitorTable *) forge->allocate(sizeof(GC_CheckMonitorTable), MM_AllocationCategory::DIAGNOSTIC, J9_GET_CALLSITE());
38
if(check) {
39
new(check) GC_CheckMonitorTable(javaVM, engine);
40
}
41
return check;
42
}
43
44
void
45
GC_CheckMonitorTable::kill()
46
{
47
MM_Forge *forge = MM_GCExtensions::getExtensions(_javaVM)->getForge();
48
forge->free(this);
49
}
50
51
void
52
GC_CheckMonitorTable::check()
53
{
54
J9ObjectMonitor *objectMonitor = NULL;
55
J9MonitorTableListEntry *monitorTableList = _javaVM->monitorTableList;
56
while (NULL != monitorTableList) {
57
J9HashTable *table = monitorTableList->monitorTable;
58
if (NULL != table) {
59
GC_HashTableIterator iterator(table);
60
while (NULL != (objectMonitor = (J9ObjectMonitor*)iterator.nextSlot())) {
61
J9ThreadAbstractMonitor * monitor = (J9ThreadAbstractMonitor *)objectMonitor->monitor;
62
J9Object **slotPtr = (J9Object**)&monitor->userData;
63
if(_engine->checkSlotPool(_javaVM, slotPtr, table) != J9MODRON_SLOT_ITERATOR_OK ) {
64
return;
65
}
66
}
67
}
68
monitorTableList = monitorTableList->next;
69
}
70
}
71
72
void
73
GC_CheckMonitorTable::print()
74
{
75
J9ObjectMonitor *objectMonitor = NULL;
76
J9MonitorTableListEntry *monitorTableList = _javaVM->monitorTableList;
77
78
GC_ScanFormatter formatter(_portLibrary, "MonitorTableList", (void *)monitorTableList);
79
80
81
while (NULL != monitorTableList) {
82
J9HashTable *table = monitorTableList->monitorTable;
83
if (NULL != table) {
84
formatter.section("MonitorTable", (void *)table);
85
86
GC_HashTableIterator iterator(table);
87
while (NULL != (objectMonitor = (J9ObjectMonitor*)iterator.nextSlot())) {
88
J9ThreadAbstractMonitor * monitor = (J9ThreadAbstractMonitor *)objectMonitor->monitor;
89
J9Object *objectPtr = (J9Object *)monitor->userData;
90
formatter.entry((void *) objectPtr);
91
}
92
formatter.endSection();
93
}
94
monitorTableList = monitorTableList->next;
95
}
96
97
formatter.end("MonitorTableList", (void *)monitorTableList);
98
}
99
100