Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/env/ClassLoaderTable.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 CLASSLOADERTABLE_INCL
24
#define CLASSLOADERTABLE_INCL
25
26
#include "env/TRMemory.hpp"
27
28
29
#define CLASSLOADERTABLE_SIZE 2053
30
31
class TR_J9SharedCache;
32
struct TR_ClassLoaderInfo;
33
34
class TR_PersistentClassLoaderTable
35
{
36
public:
37
38
TR_PERSISTENT_ALLOC(TR_Memory::PersistentCHTable)
39
TR_PersistentClassLoaderTable(TR_PersistentMemory *persistentMemory);
40
41
void associateClassLoaderWithClass(J9VMThread *vmThread, void *loader, TR_OpaqueClassBlock *clazz);
42
void *lookupClassChainAssociatedWithClassLoader(void *loader) const;
43
void *lookupClassLoaderAssociatedWithClassChain(void *chain) const;
44
#if defined(J9VM_OPT_JITSERVER)
45
// JIT client needs to associate each class loader with the name of its first loaded class
46
// in order to support AOT method serialization (and caching at JITServer) and deserialization.
47
std::pair<void *, void *>// loader, chain
48
lookupClassLoaderAndChainAssociatedWithClassName(const uint8_t *data, size_t length) const;
49
#endif /* defined(J9VM_OPT_JITSERVER) */
50
void removeClassLoader(J9VMThread *vmThread, void *loader);
51
52
TR_J9SharedCache *getSharedCache() const { return _sharedCache; }
53
void setSharedCache(TR_J9SharedCache *sharedCache) { _sharedCache = sharedCache; }
54
55
private:
56
57
friend class TR_Debug;
58
59
TR_PersistentMemory *const _persistentMemory;
60
TR_J9SharedCache *_sharedCache;
61
62
TR_ClassLoaderInfo *_loaderTable[CLASSLOADERTABLE_SIZE];
63
TR_ClassLoaderInfo *_chainTable[CLASSLOADERTABLE_SIZE];
64
#if defined(J9VM_OPT_JITSERVER)
65
TR_ClassLoaderInfo *_nameTable[CLASSLOADERTABLE_SIZE];
66
#endif /* defined(J9VM_OPT_JITSERVER) */
67
};
68
69
#endif
70
71