Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/env/J9KnownObjectTable.hpp
6000 views
1
/*******************************************************************************
2
* Copyright (c) 2000, 2021 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
#ifndef J9_KNOWN_OBJECT_TABLE_INCL
24
#define J9_KNOWN_OBJECT_TABLE_INCL
25
26
/*
27
* The following #define and typedef must appear before any #includes in this file
28
*/
29
#ifndef J9_KNOWN_OBJECT_TABLE_CONNECTOR
30
#define J9_KNOWN_OBJECT_TABLE_CONNECTOR
31
namespace J9 { class KnownObjectTable; }
32
namespace J9 { typedef J9::KnownObjectTable KnownObjectTableConnector; }
33
#endif
34
35
#include "env/OMRKnownObjectTable.hpp"
36
#include "infra/Annotations.hpp"
37
#include "infra/Array.hpp"
38
#include "infra/BitVector.hpp"
39
#if defined(J9VM_OPT_JITSERVER)
40
#include <tuple>
41
#include <vector>
42
#endif /* defined(J9VM_OPT_JITSERVER) */
43
44
namespace J9 { class Compilation; }
45
namespace TR { class Compilation; }
46
class TR_J9VMBase;
47
namespace J9 { class ObjectModel; }
48
class TR_VMFieldsInfo;
49
class TR_BitVector;
50
51
#if defined(J9VM_OPT_JITSERVER)
52
struct
53
TR_KnownObjectTableDumpInfoStruct
54
{
55
uintptr_t *ref;
56
uintptr_t objectPointer;
57
int32_t hashCode;
58
59
TR_KnownObjectTableDumpInfoStruct(uintptr_t *objRef, uintptr_t objPtr, int32_t code) :
60
ref(objRef),
61
objectPointer(objPtr),
62
hashCode(code) {}
63
};
64
65
// <TR_KnownObjectTableDumpInfoStruct, std::string classNameStr>
66
using TR_KnownObjectTableDumpInfo = std::tuple<TR_KnownObjectTableDumpInfoStruct, std::string>;
67
#endif /* defined(J9VM_OPT_JITSERVER) */
68
69
70
namespace J9
71
{
72
73
class OMR_EXTENSIBLE KnownObjectTable : public OMR::KnownObjectTableConnector
74
{
75
friend class ::TR_J9VMBase;
76
friend class Compilation;
77
TR_Array<uintptr_t*> _references;
78
TR_Array<int32_t> _stableArrayRanks;
79
80
81
public:
82
TR_ALLOC(TR_Memory::FrontEnd);
83
84
KnownObjectTable(TR::Compilation *comp);
85
86
TR::KnownObjectTable *self();
87
88
Index getEndIndex();
89
Index getOrCreateIndex(uintptr_t objectPointer);
90
Index getOrCreateIndex(uintptr_t objectPointer, bool isArrayWithConstantElements);
91
uintptr_t *getPointerLocation(Index index);
92
bool isNull(Index index);
93
94
void dumpTo(TR::FILE *file, TR::Compilation *comp);
95
96
Index getOrCreateIndexAt(uintptr_t *objectReferenceLocation);
97
Index getOrCreateIndexAt(uintptr_t *objectReferenceLocation, bool isArrayWithConstantElements);
98
Index getExistingIndexAt(uintptr_t *objectReferenceLocation);
99
100
uintptr_t getPointer(Index index);
101
102
#if defined(J9VM_OPT_JITSERVER)
103
void updateKnownObjectTableAtServer(Index index, uintptr_t *objectReferenceLocationClient);
104
void getKnownObjectTableDumpInfo(std::vector<TR_KnownObjectTableDumpInfo> &knotDumpInfoList);
105
#endif /* defined(J9VM_OPT_JITSERVER) */
106
107
void addStableArray(Index index, int32_t stableArrayRank);
108
bool isArrayWithStableElements(Index index);
109
110
private:
111
112
void dumpObjectTo(TR::FILE *file, Index i, const char *fieldName, const char *sep, TR::Compilation *comp, TR_BitVector &visited, TR_VMFieldsInfo **fieldsInfoByIndex, int32_t depth);
113
};
114
115
}
116
117
#endif
118
119