src/hotspot/share/classfile/classLoaderData.hpp
author stuefe
Tue, 26 Nov 2019 16:21:29 +0100
branchstuefe-new-metaspace-branch
changeset 59272 54750b448264
parent 58063 bdf136b8ae0e
permissions -rw-r--r--
Metadatatype back to metaspace.hpp to reduce patch size
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52907
diff changeset
     2
 * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
     4
 *
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
     7
 * published by the Free Software Foundation.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
     8
 *
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14847
92a59a418262 8004982: JDK8 source with GPL header errors
katleman
parents: 14588
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    13
 * accompanied this code).
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    14
 *
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    18
 *
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    21
 * questions.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    22
 *
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    23
 */
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52907
diff changeset
    25
#ifndef SHARE_CLASSFILE_CLASSLOADERDATA_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52907
diff changeset
    26
#define SHARE_CLASSFILE_CLASSLOADERDATA_HPP
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    27
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    28
#include "memory/allocation.hpp"
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    29
#include "memory/memRegion.hpp"
59272
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 58063
diff changeset
    30
#include "memory/metaspace.hpp"
46961
c9094b1e5f87 8186088: ConstantPoolCache::_resolved_references is not a JNIHandle
coleenp
parents: 46746
diff changeset
    31
#include "oops/oopHandle.hpp"
49738
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49603
diff changeset
    32
#include "oops/weakHandle.hpp"
55268
c5fe45d1281d 8224151: Test vmTestbase/nsk/sysdict/vm/stress/chain/chain007/chain007.java might hang with release binaries
coleenp
parents: 54839
diff changeset
    33
#include "runtime/atomic.hpp"
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    34
#include "runtime/mutex.hpp"
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    35
#include "utilities/growableArray.hpp"
27673
df559a888b9f 8065361: Fixup headers and definitions for INCLUDE_TRACE
mgronlun
parents: 27461
diff changeset
    36
#include "utilities/macros.hpp"
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents: 49824
diff changeset
    37
#if INCLUDE_JFR
caf115bb98ad 8199712: Flight Recorder
egahlin
parents: 49824
diff changeset
    38
#include "jfr/support/jfrTraceIdExtension.hpp"
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17110
diff changeset
    39
#endif
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17110
diff changeset
    40
50634
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50302
diff changeset
    41
// external name (synthetic) for the primordial "bootstrap" class loader instance
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50302
diff changeset
    42
#define BOOTSTRAP_LOADER_NAME "bootstrap"
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50302
diff changeset
    43
#define BOOTSTRAP_LOADER_NAME_LEN 9
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents: 49824
diff changeset
    44
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    45
//
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    46
// A class loader represents a linkset. Conceptually, a linkset identifies
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    47
// the complete transitive closure of resolved links that a dynamic linker can
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    48
// produce.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    49
//
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    50
// A ClassLoaderData also encapsulates the allocation space, called a metaspace,
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    51
// used by the dynamic linker to allocate the runtime representation of all
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    52
// the types it defines.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    53
//
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
    54
// ClassLoaderData are stored in the runtime representation of classes,
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
    55
// and provides iterators for root tracing and other GC operations.
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    56
51959
db0c3952de52 8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents: 51682
diff changeset
    57
class ClassLoaderDataGraph;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    58
class JNIMethodBlock;
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
    59
class ModuleEntry;
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
    60
class PackageEntry;
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
    61
class ModuleEntryTable;
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
    62
class PackageEntryTable;
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
    63
class DictionaryEntry;
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
    64
class Dictionary;
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17110
diff changeset
    65
58063
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents: 58005
diff changeset
    66
namespace metaspace {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents: 58005
diff changeset
    67
  class ClassLoaderMetaspace;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents: 58005
diff changeset
    68
}
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents: 58005
diff changeset
    69
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    70
// ClassLoaderData class
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    71
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    72
class ClassLoaderData : public CHeapObj<mtClass> {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    73
  friend class VMStructs;
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 48884
diff changeset
    74
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    75
 private:
49364
601146c66cad 8173070: Remove ValueObj class for allocation subclassing for runtime code
coleenp
parents: 49352
diff changeset
    76
  class ChunkedHandleList {
44084
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    77
    struct Chunk : public CHeapObj<mtClass> {
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    78
      static const size_t CAPACITY = 32;
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    79
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    80
      oop _data[CAPACITY];
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    81
      volatile juint _size;
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    82
      Chunk* _next;
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    83
51334
cc2c79d22508 8208671: Runtime, JFR, Serviceability changes to allow enabling -Wreorder
tschatzl
parents: 50759
diff changeset
    84
      Chunk(Chunk* c) : _size(0), _next(c) { }
44084
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    85
    };
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    86
47634
6a0c42c40cd1 8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents: 47580
diff changeset
    87
    Chunk* volatile _head;
44084
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    88
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    89
    void oops_do_chunk(OopClosure* f, Chunk* c, const juint size);
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    90
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    91
   public:
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    92
    ChunkedHandleList() : _head(NULL) {}
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    93
    ~ChunkedHandleList();
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    94
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    95
    // Only one thread at a time can add, guarded by ClassLoaderData::metaspace_lock().
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    96
    // However, multiple threads can execute oops_do concurrently with add.
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
    97
    oop* add(oop o);
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 48884
diff changeset
    98
    bool contains(oop p);
49403
58fdb6c2a274 8199272: Broken assertion in ClassLoaderData::remove_handle
coleenp
parents: 49401
diff changeset
    99
    NOT_PRODUCT(bool owner_of(oop* p);)
44084
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   100
    void oops_do(OopClosure* f);
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 48884
diff changeset
   101
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 48884
diff changeset
   102
    int count() const;
44084
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   103
  };
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   104
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   105
  friend class ClassLoaderDataGraph;
51608
625a5bdde0c5 8210155: Lock ClassLoaderDataGraph
coleenp
parents: 51530
diff changeset
   106
  friend class ClassLoaderDataGraphIterator;
25492
d27050bdfb04 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 25491
diff changeset
   107
  friend class ClassLoaderDataGraphKlassIteratorAtomic;
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   108
  friend class ClassLoaderDataGraphKlassIteratorStatic;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   109
  friend class ClassLoaderDataGraphMetaspaceIterator;
50746
85789fb05154 8198909: [Graal] compiler/codecache/stress/UnexpectedDeoptimizationTest.java crashed with SIGSEGV
never
parents: 50634
diff changeset
   110
  friend class Klass;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   111
  friend class MetaDataFactory;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   112
  friend class Method;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   113
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   114
  static ClassLoaderData * _the_null_class_loader_data;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   115
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   116
  WeakHandle<vm_class_loader_data> _holder; // The oop that determines lifetime of this class loader
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   117
  OopHandle _class_loader;    // The instance of java/lang/ClassLoader associated with
49738
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49603
diff changeset
   118
                              // this ClassLoaderData
16684
2af47517ffbd 8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents: 16617
diff changeset
   119
58063
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents: 58005
diff changeset
   120
  metaspace::ClassLoaderMetaspace* volatile _metaspace;  // Meta-space where meta-data defined by the
38937
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38014
diff changeset
   121
                                    // classes in the class loader are allocated.
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   122
  Mutex* _metaspace_lock;  // Locks the metaspace for allocations and setup.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   123
  bool _unloading;         // true if this class loader goes away
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51375
diff changeset
   124
  bool _is_unsafe_anonymous; // CLD is dedicated to one class and that class determines the CLDs lifecycle.
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51375
diff changeset
   125
                             // For example, an unsafe anonymous class.
47580
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   126
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   127
  // Remembered sets support for the oops in the class loader data.
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   128
  bool _modified_oops;             // Card Table Equivalent (YC/CMS support)
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   129
  bool _accumulated_modified_oops; // Mod Union Equivalent (CMS support)
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   130
58005
9ee010450e84 8230401: ClassLoaderData::_keep_alive is read with wrong type in c2i entry barrier
eosterlund
parents: 55603
diff changeset
   131
  int _keep_alive;         // if this CLD is kept alive.
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51375
diff changeset
   132
                           // Used for unsafe anonymous classes and the boot class
40358
48774f26918a 8162553: Crash in class unloading due to null CLD having a zero _keep_alive value
lfoltan
parents: 39616
diff changeset
   133
                           // loader. _keep_alive does not need to be volatile or
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51375
diff changeset
   134
                           // atomic since there is one unique CLD per unsafe anonymous class.
47580
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   135
52141
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51973
diff changeset
   136
  volatile int _claim; // non-zero if claimed, for example during GC traces.
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51973
diff changeset
   137
                       // To avoid applying oop closure more than once.
44084
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   138
  ChunkedHandleList _handles; // Handles to constant pool arrays, Modules, etc, which
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   139
                              // have the same life cycle of the corresponding ClassLoader.
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   140
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 48884
diff changeset
   141
  NOT_PRODUCT(volatile int _dependency_count;)  // number of class loader dependencies
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 48884
diff changeset
   142
38937
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38014
diff changeset
   143
  Klass* volatile _klasses;              // The classes defined by the class loader.
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38014
diff changeset
   144
  PackageEntryTable* volatile _packages; // The packages defined by the class loader.
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   145
  ModuleEntryTable*  volatile _modules;  // The modules defined by the class loader.
46387
c46632622b17 8176472: Lazily create ModuleEntryTable
rprotacio
parents: 46380
diff changeset
   146
  ModuleEntry* _unnamed_module;          // This class loader's unnamed module.
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   147
  Dictionary*  _dictionary;              // The loaded InstanceKlasses, including initiated by this class loader
31046
d01ad7a0ecb0 8081320: Backout JDK-8059340: ConstantPool::_resolved_references is missing in heap dump
vlivanov
parents: 31038
diff changeset
   148
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   149
  // These method IDs are created for the class loader and set to NULL when the
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   150
  // class loader is unloaded.  They are rarely freed, only for redefine classes
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   151
  // and if they lose a data race in InstanceKlass.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   152
  JNIMethodBlock*                  _jmethod_ids;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   153
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   154
  // Metadata to be deallocated when it's safe at class unloading, when
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   155
  // this class loader isn't unloaded itself.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   156
  GrowableArray<Metadata*>*      _deallocate_list;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   157
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   158
  // Support for walking class loader data objects
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   159
  ClassLoaderData* _next; /// Next loader_datas created
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   160
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   161
  Klass*  _class_loader_klass;
50634
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50302
diff changeset
   162
  Symbol* _name;
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50302
diff changeset
   163
  Symbol* _name_and_id;
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents: 49824
diff changeset
   164
  JFR_ONLY(DEFINE_TRACE_ID_FIELD;)
42639
762117d57d05 8170672: Event-based tracing to support classloader instances
mgronlun
parents: 40358
diff changeset
   165
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   166
  void set_next(ClassLoaderData* next) { _next = next; }
55268
c5fe45d1281d 8224151: Test vmTestbase/nsk/sysdict/vm/stress/chain/chain007/chain007.java might hang with release binaries
coleenp
parents: 54839
diff changeset
   167
  ClassLoaderData* next() const        { return Atomic::load(&_next); }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   168
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51375
diff changeset
   169
  ClassLoaderData(Handle h_class_loader, bool is_unsafe_anonymous);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   170
  ~ClassLoaderData();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   171
47580
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   172
  // The CLD are not placed in the Heap, so the Card Table or
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   173
  // the Mod Union Table can't be used to mark when CLD have modified oops.
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   174
  // The CT and MUT bits saves this information for the whole class loader data.
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   175
  void clear_modified_oops()             { _modified_oops = false; }
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   176
 public:
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   177
  void record_modified_oops()            { _modified_oops = true; }
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   178
  bool has_modified_oops()               { return _modified_oops; }
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   179
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   180
  void accumulate_modified_oops()        { if (has_modified_oops()) _accumulated_modified_oops = true; }
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   181
  void clear_accumulated_modified_oops() { _accumulated_modified_oops = false; }
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   182
  bool has_accumulated_modified_oops()   { return _accumulated_modified_oops; }
51682
a30461a359f5 8210321: Create NO_KEEPALIVE CLD holder accessor
eosterlund
parents: 51681
diff changeset
   183
  oop holder_no_keepalive() const;
52907
7cc17c043ce0 8214972: Uses of klass_holder() except GC need to apply GC barriers
coleenp
parents: 52141
diff changeset
   184
  oop holder_phantom() const;
51682
a30461a359f5 8210321: Create NO_KEEPALIVE CLD holder accessor
eosterlund
parents: 51681
diff changeset
   185
47580
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   186
 private:
14588
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13759
diff changeset
   187
  void unload();
38014
8731fa11f766 8152949: Jigsaw crash when Klass in _fixup_module_field_list is unloaded
lfoltan
parents: 36508
diff changeset
   188
  bool keep_alive() const       { return _keep_alive > 0; }
49738
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49603
diff changeset
   189
51973
2f1698b6db15 8211328: Different declaration and definition of ClassLoaderData::classes_do() leads to build failures
simonis
parents: 51959
diff changeset
   190
  void classes_do(void f(Klass* const));
21183
e148e499e5cd 8024423: JVMTI: GetLoadedClasses doesn't enumerate anonymous classes
farvidsson
parents: 18025
diff changeset
   191
  void loaded_classes_do(KlassClosure* klass_closure);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   192
  void classes_do(void f(InstanceKlass*));
23526
6851d341ad52 8037970: make PrintMethodData a diagnostic options
roland
parents: 22905
diff changeset
   193
  void methods_do(void f(Method*));
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   194
  void modules_do(void f(ModuleEntry*));
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   195
  void packages_do(void f(PackageEntry*));
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   196
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   197
  // Deallocate free list during class unloading.
51338
aa3bfacc912c 8208677: Move inner metaspace cleaning out of class unloading
coleenp
parents: 51334
diff changeset
   198
  void free_deallocate_list();                      // for the classes that are not unloaded
aa3bfacc912c 8208677: Move inner metaspace cleaning out of class unloading
coleenp
parents: 51334
diff changeset
   199
  void free_deallocate_list_C_heap_structures();    // for the classes that are unloaded
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   200
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   201
  // Allocate out of this class loader data
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   202
  MetaWord* allocate(size_t size);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   203
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   204
  Dictionary* create_dictionary();
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   205
50759
00c4edaf2017 8205509: assert(_name_and_id != 0LL) failed: encountered a class loader null name and id
lfoltan
parents: 50746
diff changeset
   206
  void initialize_name(Handle class_loader);
52141
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51973
diff changeset
   207
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   208
 public:
48529
6a5e7a575830 8193933: Export ClassLoaderData claim state to support interleaved object traversal
mgronlun
parents: 48395
diff changeset
   209
  // GC interface.
52141
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51973
diff changeset
   210
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51973
diff changeset
   211
  // The "claim" is typically used to check if oops_do needs to be applied on
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51973
diff changeset
   212
  // the CLD or not. Most GCs only perform strong marking during the marking phase.
55603
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 55268
diff changeset
   213
  enum Claim {
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 55268
diff changeset
   214
    _claim_none         = 0,
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 55268
diff changeset
   215
    _claim_finalizable  = 2,
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 55268
diff changeset
   216
    _claim_strong       = 3,
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 55268
diff changeset
   217
    _claim_other        = 4
52141
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51973
diff changeset
   218
  };
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51973
diff changeset
   219
  void clear_claim() { _claim = 0; }
55603
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 55268
diff changeset
   220
  void clear_claim(int claim);
52141
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51973
diff changeset
   221
  bool claimed() const { return _claim != 0; }
55603
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 55268
diff changeset
   222
  bool claimed(int claim) const { return (_claim & claim) == claim; }
52141
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51973
diff changeset
   223
  bool try_claim(int claim);
25492
d27050bdfb04 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 25491
diff changeset
   224
51681
72bdaf11dd6a 8210233: Prepare Klass::is_loader_alive() for concurrent class unloading
eosterlund
parents: 51608
diff changeset
   225
  // Computes if the CLD is alive or not. This is safe to call in concurrent
72bdaf11dd6a 8210233: Prepare Klass::is_loader_alive() for concurrent class unloading
eosterlund
parents: 51608
diff changeset
   226
  // contexts.
49738
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49603
diff changeset
   227
  bool is_alive() const;
25492
d27050bdfb04 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 25491
diff changeset
   228
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   229
  // Accessors
58063
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents: 58005
diff changeset
   230
  metaspace::ClassLoaderMetaspace* metaspace_or_null() const { return _metaspace; }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   231
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   232
  static ClassLoaderData* the_null_class_loader_data() {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   233
    return _the_null_class_loader_data;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   234
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   235
25325
e3af4e02b0d5 8026977: NPG: Remove ConstantPool::lock
coleenp
parents: 25051
diff changeset
   236
  Mutex* metaspace_lock() const { return _metaspace_lock; }
e3af4e02b0d5 8026977: NPG: Remove ConstantPool::lock
coleenp
parents: 25051
diff changeset
   237
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51375
diff changeset
   238
  bool is_unsafe_anonymous() const { return _is_unsafe_anonymous; }
14588
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13759
diff changeset
   239
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 48884
diff changeset
   240
  static void init_null_class_loader_data();
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   241
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   242
  bool is_the_null_class_loader_data() const {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   243
    return this == _the_null_class_loader_data;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   244
  }
49352
0b48f0aa79ec 8191585: VM anonymous classes created during CDS dump time cause crash
iklam
parents: 49348
diff changeset
   245
0b48f0aa79ec 8191585: VM anonymous classes created during CDS dump time cause crash
iklam
parents: 49348
diff changeset
   246
  // Returns true if this class loader data is for the system class loader.
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51375
diff changeset
   247
  // (Note that the class loader data may be unsafe anonymous.)
39616
f82b1f888578 8159262: Walking PackageEntry Export and ModuleEntry Reads Must Occur Only When Neccessary And Wait Until ClassLoader's Aliveness Determined
lfoltan
parents: 38937
diff changeset
   248
  bool is_system_class_loader_data() const;
49352
0b48f0aa79ec 8191585: VM anonymous classes created during CDS dump time cause crash
iklam
parents: 49348
diff changeset
   249
0b48f0aa79ec 8191585: VM anonymous classes created during CDS dump time cause crash
iklam
parents: 49348
diff changeset
   250
  // Returns true if this class loader data is for the platform class loader.
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51375
diff changeset
   251
  // (Note that the class loader data may be unsafe anonymous.)
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   252
  bool is_platform_class_loader_data() const;
48871
120d6893f32f 8190235: Clarify ClassLoaderData::is_*_class_loader_data() method implementations
hseigel
parents: 48860
diff changeset
   253
120d6893f32f 8190235: Clarify ClassLoaderData::is_*_class_loader_data() method implementations
hseigel
parents: 48860
diff changeset
   254
  // Returns true if this class loader data is for the boot class loader.
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51375
diff changeset
   255
  // (Note that the class loader data may be unsafe anonymous.)
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   256
  inline bool is_boot_class_loader_data() const;
48871
120d6893f32f 8190235: Clarify ClassLoaderData::is_*_class_loader_data() method implementations
hseigel
parents: 48860
diff changeset
   257
39616
f82b1f888578 8159262: Walking PackageEntry Export and ModuleEntry Reads Must Occur Only When Neccessary And Wait Until ClassLoader's Aliveness Determined
lfoltan
parents: 38937
diff changeset
   258
  bool is_builtin_class_loader_data() const;
48860
5bce1b7e7800 8190359: Reduce the number of recorded klass dependencies
hseigel
parents: 48637
diff changeset
   259
  bool is_permanent_class_loader_data() const;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   260
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   261
  // The Metaspace is created lazily so may be NULL.  This
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   262
  // method will allocate a Metaspace if needed.
58063
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents: 58005
diff changeset
   263
  metaspace::ClassLoaderMetaspace* metaspace_non_null();
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   264
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   265
  inline oop class_loader() const;
22900
e699fc9dc806 8035412: Cleanup ClassLoaderData::is_alive
stefank
parents: 22201
diff changeset
   266
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   267
  // Returns true if this class loader data is for a loader going away.
51681
72bdaf11dd6a 8210233: Prepare Klass::is_loader_alive() for concurrent class unloading
eosterlund
parents: 51608
diff changeset
   268
  // Note that this is only safe after the GC has computed if the CLD is
72bdaf11dd6a 8210233: Prepare Klass::is_loader_alive() for concurrent class unloading
eosterlund
parents: 51608
diff changeset
   269
  // unloading or not. In concurrent contexts where there are no such
72bdaf11dd6a 8210233: Prepare Klass::is_loader_alive() for concurrent class unloading
eosterlund
parents: 51608
diff changeset
   270
  // guarantees, is_alive() should be used instead.
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   271
  bool is_unloading() const     {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   272
    assert(!(is_the_null_class_loader_data() && _unloading), "The null class loader can never be unloaded");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   273
    return _unloading;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   274
  }
22900
e699fc9dc806 8035412: Cleanup ClassLoaderData::is_alive
stefank
parents: 22201
diff changeset
   275
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51375
diff changeset
   276
  // Used to refcount an unsafe anonymous class's CLD in order to
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   277
  // indicate their aliveness.
38014
8731fa11f766 8152949: Jigsaw crash when Klass in _fixup_module_field_list is unloaded
lfoltan
parents: 36508
diff changeset
   278
  void inc_keep_alive();
8731fa11f766 8152949: Jigsaw crash when Klass in _fixup_module_field_list is unloaded
lfoltan
parents: 36508
diff changeset
   279
  void dec_keep_alive();
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   280
49738
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49603
diff changeset
   281
  void initialize_holder(Handle holder);
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49603
diff changeset
   282
52141
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51973
diff changeset
   283
  void oops_do(OopClosure* f, int claim_value, bool clear_modified_oops = false);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   284
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   285
  void classes_do(KlassClosure* klass_closure);
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   286
  Klass* klasses() { return _klasses; }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   287
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   288
  JNIMethodBlock* jmethod_ids() const              { return _jmethod_ids; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   289
  void set_jmethod_ids(JNIMethodBlock* new_block)  { _jmethod_ids = new_block; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   290
54807
33fe50b6d707 8223626: move print() functions to cpp files
coleenp
parents: 53244
diff changeset
   291
  void print() const;
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 48884
diff changeset
   292
  void print_on(outputStream* out) const PRODUCT_RETURN;
54807
33fe50b6d707 8223626: move print() functions to cpp files
coleenp
parents: 53244
diff changeset
   293
  void print_value() const;
15437
eabd4555d072 6479360: PrintClassHistogram improvements
acorn
parents: 14848
diff changeset
   294
  void print_value_on(outputStream* out) const;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   295
  void verify();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   296
46961
c9094b1e5f87 8186088: ConstantPoolCache::_resolved_references is not a JNIHandle
coleenp
parents: 46746
diff changeset
   297
  OopHandle add_handle(Handle h);
47095
9d21da6fe729 8181170: resolved_references array leaks for RedefineClasses
coleenp
parents: 46961
diff changeset
   298
  void remove_handle(OopHandle h);
46961
c9094b1e5f87 8186088: ConstantPoolCache::_resolved_references is not a JNIHandle
coleenp
parents: 46746
diff changeset
   299
  void init_handle_locked(OopHandle& pd, Handle h);  // used for concurrent access to ModuleEntry::_pd field
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34257
diff changeset
   300
  void add_class(Klass* k, bool publicize = true);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   301
  void remove_class(Klass* k);
22794
f1c014ad3754 8027146: Class loading verification failure if GC occurs in Universe::flush_dependents_on
coleenp
parents: 22201
diff changeset
   302
  bool contains_klass(Klass* k);
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 48884
diff changeset
   303
  void record_dependency(const Klass* to);
46420
227f72691ac1 8179235: PackageEntryTables should be created eagerly
hseigel
parents: 46387
diff changeset
   304
  PackageEntryTable* packages() { return _packages; }
46387
c46632622b17 8176472: Lazily create ModuleEntryTable
rprotacio
parents: 46380
diff changeset
   305
  ModuleEntry* unnamed_module() { return _unnamed_module; }
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   306
  ModuleEntryTable* modules();
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   307
  bool modules_defined() { return (_modules != NULL); }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   308
54839
e9db10a375d9 8222841: Incorrect static call stub interactions with class unloading
eosterlund
parents: 54807
diff changeset
   309
  // Offsets
e9db10a375d9 8222841: Incorrect static call stub interactions with class unloading
eosterlund
parents: 54807
diff changeset
   310
  static ByteSize holder_offset()     { return in_ByteSize(offset_of(ClassLoaderData, _holder)); }
e9db10a375d9 8222841: Incorrect static call stub interactions with class unloading
eosterlund
parents: 54807
diff changeset
   311
  static ByteSize keep_alive_offset() { return in_ByteSize(offset_of(ClassLoaderData, _keep_alive)); }
e9db10a375d9 8222841: Incorrect static call stub interactions with class unloading
eosterlund
parents: 54807
diff changeset
   312
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   313
  // Loaded class dictionary
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   314
  Dictionary* dictionary() const { return _dictionary; }
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   315
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   316
  void add_to_deallocate_list(Metadata* m);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   317
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   318
  static ClassLoaderData* class_loader_data(oop loader);
15847
f9ce2cd20dee 8008549: NPG: SystemDictionary::find(...) unnecessarily keeps class loaders alive
stefank
parents: 15437
diff changeset
   319
  static ClassLoaderData* class_loader_data_or_null(oop loader);
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51375
diff changeset
   320
  static ClassLoaderData* unsafe_anonymous_class_loader_data(Handle loader);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   321
50634
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50302
diff changeset
   322
  // Returns Klass* of associated class loader, or NULL if associated loader is 'bootstrap'.
50302
fd2fccf3b079 8203455: jcmd: VM.metaspace: print loader name for anonymous CLDs
stuefe
parents: 50113
diff changeset
   323
  // Also works if unloading.
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   324
  Klass* class_loader_klass() const { return _class_loader_klass; }
50302
fd2fccf3b079 8203455: jcmd: VM.metaspace: print loader name for anonymous CLDs
stuefe
parents: 50113
diff changeset
   325
50634
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50302
diff changeset
   326
  // Returns the class loader's explict name as specified during
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50302
diff changeset
   327
  // construction or the class loader's qualified class name.
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50302
diff changeset
   328
  // Works during unloading.
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50302
diff changeset
   329
  const char* loader_name() const;
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50302
diff changeset
   330
  // Returns the explicitly specified class loader name or NULL.
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50302
diff changeset
   331
  Symbol* name() const { return _name; }
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50302
diff changeset
   332
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50302
diff changeset
   333
  // Obtain the class loader's _name_and_id, works during unloading.
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50302
diff changeset
   334
  const char* loader_name_and_id() const;
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50302
diff changeset
   335
  Symbol* name_and_id() const { return _name_and_id; }
50302
fd2fccf3b079 8203455: jcmd: VM.metaspace: print loader name for anonymous CLDs
stuefe
parents: 50113
diff changeset
   336
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents: 49824
diff changeset
   337
  JFR_ONLY(DEFINE_TRACE_ID_METHODS;)
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   338
};
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   339
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52907
diff changeset
   340
#endif // SHARE_CLASSFILE_CLASSLOADERDATA_HPP