src/hotspot/share/classfile/classLoaderData.cpp
author stefank
Tue, 26 Nov 2019 10:47:46 +0100
changeset 59290 97d13893ec3c
parent 59252 623722a6aeb9
permissions -rw-r--r--
8234748: Clean up atomic and orderAccess includes Reviewed-by: dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
     1
 /*
54343
6a1406c718ec 8221643: Tighten up assert(_keep_alive >= 0) in CLD::inc_keep_alive
zgu
parents: 52852
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
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
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
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    25
// A ClassLoaderData identifies the full set of class types that a class
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    26
// loader's name resolution strategy produces for a given configuration of the
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    27
// class loader.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    28
// Class types in the ClassLoaderData may be defined by from class file binaries
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    29
// provided by the class loader, or from other class loader it interacts with
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    30
// according to its name resolution strategy.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    31
//
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    32
// Class loaders that implement a deterministic name resolution strategy
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    33
// (including with respect to their delegation behavior), such as the boot, the
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
    34
// platform, and the system loaders of the JDK's built-in class loader
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    35
// hierarchy, always produce the same linkset for a given configuration.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    36
//
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    37
// ClassLoaderData carries information related to a linkset (e.g.,
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    38
// metaspace holding its klass definitions).
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    39
// The System Dictionary and related data structures (e.g., placeholder table,
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    40
// loader constraints table) as well as the runtime representation of classes
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    41
// only reference ClassLoaderData.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    42
//
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    43
// Instances of java.lang.ClassLoader holds a pointer to a ClassLoaderData that
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    44
// that represent the loader's "linking domain" in the JVM.
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
// The bootstrap loader (represented by NULL) also has a ClassLoaderData,
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    47
// the singleton class the_null_class_loader_data().
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    48
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    49
#include "precompiled.hpp"
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    50
#include "classfile/classLoaderData.inline.hpp"
51959
db0c3952de52 8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents: 51887
diff changeset
    51
#include "classfile/classLoaderDataGraph.inline.hpp"
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
    52
#include "classfile/dictionary.hpp"
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    53
#include "classfile/javaClasses.hpp"
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
    54
#include "classfile/moduleEntry.hpp"
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
    55
#include "classfile/packageEntry.hpp"
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
    56
#include "classfile/symbolTable.hpp"
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    57
#include "classfile/systemDictionary.hpp"
35917
463d67f86eaa 8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents: 35492
diff changeset
    58
#include "logging/log.hpp"
46701
f559541c0daa 8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents: 46464
diff changeset
    59
#include "logging/logStream.hpp"
49360
886acec3b4c6 8199275: Fix inclusions of allocation.inline.hpp
stefank
parents: 49348
diff changeset
    60
#include "memory/allocation.inline.hpp"
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    61
#include "memory/metadataFactory.hpp"
37248
11a660dbbb8e 8132524: Missing includes to resourceArea.hpp
jprovino
parents: 37242
diff changeset
    62
#include "memory/resourceArea.hpp"
48613
d8bdf14c4f1e 8191888: Refactor ClassLoaderData::remove_handle to use the Access API
eosterlund
parents: 48405
diff changeset
    63
#include "oops/access.inline.hpp"
29081
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents: 28365
diff changeset
    64
#include "oops/oop.inline.hpp"
49816
a3e79f97e86b 8200555: OopHandle should use Access API
coleenp
parents: 49738
diff changeset
    65
#include "oops/oopHandle.inline.hpp"
49738
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
    66
#include "oops/weakHandle.inline.hpp"
40655
9f644073d3a0 8157907: Incorrect inclusion of atomic.hpp instead of atomic.inline.hpp
dholmes
parents: 40358
diff changeset
    67
#include "runtime/atomic.hpp"
49393
93fe2fc5c093 8199472: Fix non-PCH build after JDK-8199319
simonis
parents: 49360
diff changeset
    68
#include "runtime/handles.inline.hpp"
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    69
#include "runtime/mutex.hpp"
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    70
#include "runtime/safepoint.hpp"
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    71
#include "utilities/growableArray.hpp"
21767
41eaa9a17059 8028128: Add a type safe alternative for working with counter based data
mgronlun
parents: 21183
diff changeset
    72
#include "utilities/macros.hpp"
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    73
#include "utilities/ostream.hpp"
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17119
diff changeset
    74
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    75
ClassLoaderData * ClassLoaderData::_the_null_class_loader_data = NULL;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    76
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
    77
void ClassLoaderData::init_null_class_loader_data() {
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
    78
  assert(_the_null_class_loader_data == NULL, "cannot initialize twice");
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
    79
  assert(ClassLoaderDataGraph::_head == NULL, "cannot initialize twice");
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
    80
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
    81
  _the_null_class_loader_data = new ClassLoaderData(Handle(), false);
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
    82
  ClassLoaderDataGraph::_head = _the_null_class_loader_data;
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
    83
  assert(_the_null_class_loader_data->is_the_null_class_loader_data(), "Must be");
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
    84
51338
aa3bfacc912c 8208677: Move inner metaspace cleaning out of class unloading
coleenp
parents: 51334
diff changeset
    85
  LogTarget(Trace, class, loader, data) lt;
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
    86
  if (lt.is_enabled()) {
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
    87
    ResourceMark rm;
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
    88
    LogStream ls(lt);
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
    89
    ls.print("create ");
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
    90
    _the_null_class_loader_data->print_value_on(&ls);
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
    91
    ls.cr();
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
    92
  }
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
    93
}
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
    94
50634
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
    95
// Obtain and set the class loader's name within the ClassLoaderData so
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
    96
// it will be available for error messages, logging, JFR, etc.  The name
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
    97
// and klass are available after the class_loader oop is no longer alive,
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
    98
// during unloading.
50759
00c4edaf2017 8205509: assert(_name_and_id != 0LL) failed: encountered a class loader null name and id
lfoltan
parents: 50634
diff changeset
    99
void ClassLoaderData::initialize_name(Handle class_loader) {
50634
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   100
  Thread* THREAD = Thread::current();
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   101
  ResourceMark rm(THREAD);
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   102
50634
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   103
  // Obtain the class loader's name.  If the class loader's name was not
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   104
  // explicitly set during construction, the CLD's _name field will be null.
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   105
  oop cl_name = java_lang_ClassLoader::name(class_loader());
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   106
  if (cl_name != NULL) {
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   107
    const char* cl_instance_name = java_lang_String::as_utf8_string(cl_name);
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   108
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   109
    if (cl_instance_name != NULL && cl_instance_name[0] != '\0') {
54847
59ea39bb2809 8223657: Remove unused THREAD argument from SymbolTable functions
coleenp
parents: 54807
diff changeset
   110
      _name = SymbolTable::new_symbol(cl_instance_name);
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   111
    }
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   112
  }
50634
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   113
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   114
  // Obtain the class loader's name and identity hash.  If the class loader's
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   115
  // name was not explicitly set during construction, the class loader's name and id
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   116
  // will be set to the qualified class name of the class loader along with its
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   117
  // identity hash.
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   118
  // If for some reason the ClassLoader's constructor has not been run, instead of
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   119
  // leaving the _name_and_id field null, fall back to the external qualified class
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   120
  // name.  Thus CLD's _name_and_id field should never have a null value.
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   121
  oop cl_name_and_id = java_lang_ClassLoader::nameAndId(class_loader());
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   122
  const char* cl_instance_name_and_id =
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   123
                  (cl_name_and_id == NULL) ? _class_loader_klass->external_name() :
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   124
                                             java_lang_String::as_utf8_string(cl_name_and_id);
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   125
  assert(cl_instance_name_and_id != NULL && cl_instance_name_and_id[0] != '\0', "class loader has no name and id");
54847
59ea39bb2809 8223657: Remove unused THREAD argument from SymbolTable functions
coleenp
parents: 54807
diff changeset
   126
  _name_and_id = SymbolTable::new_symbol(cl_instance_name_and_id);
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   127
}
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   128
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   129
ClassLoaderData::ClassLoaderData(Handle h_class_loader, bool is_unsafe_anonymous) :
51334
cc2c79d22508 8208671: Runtime, JFR, Serviceability changes to allow enabling -Wreorder
tschatzl
parents: 50803
diff changeset
   130
  _metaspace(NULL),
58375
a1eba2e37671 8231472: Clean up Monitor::_safepoint_check usage to Mutex::_safepoint_check
coleenp
parents: 58177
diff changeset
   131
  _metaspace_lock(new Mutex(Mutex::leaf+1, "Metaspace allocation lock", true,
a1eba2e37671 8231472: Clean up Monitor::_safepoint_check usage to Mutex::_safepoint_check
coleenp
parents: 58177
diff changeset
   132
                            Mutex::_safepoint_check_never)),
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   133
  _unloading(false), _is_unsafe_anonymous(is_unsafe_anonymous),
51334
cc2c79d22508 8208671: Runtime, JFR, Serviceability changes to allow enabling -Wreorder
tschatzl
parents: 50803
diff changeset
   134
  _modified_oops(true), _accumulated_modified_oops(false),
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   135
  // An unsafe anonymous class loader data doesn't have anything to keep
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   136
  // it from being unloaded during parsing of the unsafe anonymous class.
22900
e699fc9dc806 8035412: Cleanup ClassLoaderData::is_alive
stefank
parents: 22201
diff changeset
   137
  // The null-class-loader should always be kept alive.
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   138
  _keep_alive((is_unsafe_anonymous || h_class_loader.is_null()) ? 1 : 0),
52141
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51962
diff changeset
   139
  _claim(0),
51334
cc2c79d22508 8208671: Runtime, JFR, Serviceability changes to allow enabling -Wreorder
tschatzl
parents: 50803
diff changeset
   140
  _handles(),
cc2c79d22508 8208671: Runtime, JFR, Serviceability changes to allow enabling -Wreorder
tschatzl
parents: 50803
diff changeset
   141
  _klasses(NULL), _packages(NULL), _modules(NULL), _unnamed_module(NULL), _dictionary(NULL),
cc2c79d22508 8208671: Runtime, JFR, Serviceability changes to allow enabling -Wreorder
tschatzl
parents: 50803
diff changeset
   142
  _jmethod_ids(NULL),
cc2c79d22508 8208671: Runtime, JFR, Serviceability changes to allow enabling -Wreorder
tschatzl
parents: 50803
diff changeset
   143
  _deallocate_list(NULL),
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   144
  _next(NULL),
51334
cc2c79d22508 8208671: Runtime, JFR, Serviceability changes to allow enabling -Wreorder
tschatzl
parents: 50803
diff changeset
   145
  _class_loader_klass(NULL), _name(NULL), _name_and_id(NULL) {
46387
c46632622b17 8176472: Lazily create ModuleEntryTable
rprotacio
parents: 46380
diff changeset
   146
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   147
  if (!h_class_loader.is_null()) {
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   148
    _class_loader = _handles.add(h_class_loader());
50759
00c4edaf2017 8205509: assert(_name_and_id != 0LL) failed: encountered a class loader null name and id
lfoltan
parents: 50634
diff changeset
   149
    _class_loader_klass = h_class_loader->klass();
51698
74dde8b66b7f 8210422: runtime/modules/ModuleStress/ExportModuleStressTest.java - assertion failed: address not aligned: 0x00000008baadbabe
coleenp
parents: 51682
diff changeset
   150
    initialize_name(h_class_loader);
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   151
  }
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   152
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   153
  if (!is_unsafe_anonymous) {
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   154
    // The holder is initialized later for unsafe anonymous classes, and before calling anything
49738
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
   155
    // that call class_loader().
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
   156
    initialize_holder(h_class_loader);
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
   157
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   158
    // A ClassLoaderData created solely for an unsafe anonymous class should never have a
49738
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
   159
    // ModuleEntryTable or PackageEntryTable created for it. The defining package
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   160
    // and module for an unsafe anonymous class will be found in its host class.
46420
227f72691ac1 8179235: PackageEntryTables should be created eagerly
hseigel
parents: 46387
diff changeset
   161
    _packages = new PackageEntryTable(PackageEntryTable::_packagetable_entry_size);
46387
c46632622b17 8176472: Lazily create ModuleEntryTable
rprotacio
parents: 46380
diff changeset
   162
    if (h_class_loader.is_null()) {
c46632622b17 8176472: Lazily create ModuleEntryTable
rprotacio
parents: 46380
diff changeset
   163
      // Create unnamed module for boot loader
c46632622b17 8176472: Lazily create ModuleEntryTable
rprotacio
parents: 46380
diff changeset
   164
      _unnamed_module = ModuleEntry::create_boot_unnamed_module(this);
c46632622b17 8176472: Lazily create ModuleEntryTable
rprotacio
parents: 46380
diff changeset
   165
    } else {
c46632622b17 8176472: Lazily create ModuleEntryTable
rprotacio
parents: 46380
diff changeset
   166
      // Create unnamed module for all other loaders
c46632622b17 8176472: Lazily create ModuleEntryTable
rprotacio
parents: 46380
diff changeset
   167
      _unnamed_module = ModuleEntry::create_unnamed_module(this);
c46632622b17 8176472: Lazily create ModuleEntryTable
rprotacio
parents: 46380
diff changeset
   168
    }
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   169
    _dictionary = create_dictionary();
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   170
  }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   171
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   172
  NOT_PRODUCT(_dependency_count = 0); // number of class loader dependencies
16684
2af47517ffbd 8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents: 16617
diff changeset
   173
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents: 49824
diff changeset
   174
  JFR_ONLY(INIT_ID(this);)
14588
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   175
}
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   176
44084
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   177
ClassLoaderData::ChunkedHandleList::~ChunkedHandleList() {
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   178
  Chunk* c = _head;
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   179
  while (c != NULL) {
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   180
    Chunk* next = c->_next;
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   181
    delete c;
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   182
    c = next;
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   183
  }
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   184
}
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   185
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   186
oop* ClassLoaderData::ChunkedHandleList::add(oop o) {
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   187
  if (_head == NULL || _head->_size == Chunk::CAPACITY) {
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   188
    Chunk* next = new Chunk(_head);
59247
56bf71d64d51 8234562: Move OrderAccess::release_store*/load_acquire to Atomic
stefank
parents: 58375
diff changeset
   189
    Atomic::release_store(&_head, next);
44084
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   190
  }
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   191
  oop* handle = &_head->_data[_head->_size];
52852
eb95a38b2964 8214782: Add missing access barriers on CLD handle area
pliden
parents: 52587
diff changeset
   192
  NativeAccess<IS_DEST_UNINITIALIZED>::oop_store(handle, o);
59247
56bf71d64d51 8234562: Move OrderAccess::release_store*/load_acquire to Atomic
stefank
parents: 58375
diff changeset
   193
  Atomic::release_store(&_head->_size, _head->_size + 1);
44084
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   194
  return handle;
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   195
}
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   196
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   197
int ClassLoaderData::ChunkedHandleList::count() const {
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   198
  int count = 0;
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   199
  Chunk* chunk = _head;
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   200
  while (chunk != NULL) {
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   201
    count += chunk->_size;
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   202
    chunk = chunk->_next;
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   203
  }
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   204
  return count;
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   205
}
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   206
44084
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   207
inline void ClassLoaderData::ChunkedHandleList::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
   208
  for (juint i = 0; i < size; i++) {
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   209
    if (c->_data[i] != NULL) {
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   210
      f->do_oop(&c->_data[i]);
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   211
    }
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   212
  }
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   213
}
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   214
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   215
void ClassLoaderData::ChunkedHandleList::oops_do(OopClosure* f) {
59247
56bf71d64d51 8234562: Move OrderAccess::release_store*/load_acquire to Atomic
stefank
parents: 58375
diff changeset
   216
  Chunk* head = Atomic::load_acquire(&_head);
44084
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   217
  if (head != NULL) {
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   218
    // Must be careful when reading size of head
59247
56bf71d64d51 8234562: Move OrderAccess::release_store*/load_acquire to Atomic
stefank
parents: 58375
diff changeset
   219
    oops_do_chunk(f, head, Atomic::load_acquire(&head->_size));
44084
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   220
    for (Chunk* c = head->_next; c != NULL; c = c->_next) {
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   221
      oops_do_chunk(f, c, c->_size);
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   222
    }
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   223
  }
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   224
}
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   225
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   226
class VerifyContainsOopClosure : public OopClosure {
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   227
  oop  _target;
44084
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   228
  bool _found;
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   229
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   230
 public:
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   231
  VerifyContainsOopClosure(oop target) : _target(target), _found(false) {}
44084
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   232
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   233
  void do_oop(oop* p) {
58177
4932dce35882 8230841: Remove oopDesc::equals()
pliden
parents: 55603
diff changeset
   234
    if (p != NULL && NativeAccess<AS_NO_KEEPALIVE>::oop_load(p) == _target) {
44084
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   235
      _found = true;
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   236
    }
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   237
  }
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   238
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   239
  void do_oop(narrowOop* p) {
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   240
    // The ChunkedHandleList should not contain any narrowOop
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   241
    ShouldNotReachHere();
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   242
  }
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   243
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   244
  bool found() const {
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   245
    return _found;
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   246
  }
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   247
};
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   248
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   249
bool ClassLoaderData::ChunkedHandleList::contains(oop p) {
44084
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   250
  VerifyContainsOopClosure cl(p);
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   251
  oops_do(&cl);
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   252
  return cl.found();
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   253
}
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   254
49403
58fdb6c2a274 8199272: Broken assertion in ClassLoaderData::remove_handle
coleenp
parents: 49401
diff changeset
   255
#ifndef PRODUCT
58fdb6c2a274 8199272: Broken assertion in ClassLoaderData::remove_handle
coleenp
parents: 49401
diff changeset
   256
bool ClassLoaderData::ChunkedHandleList::owner_of(oop* oop_handle) {
58fdb6c2a274 8199272: Broken assertion in ClassLoaderData::remove_handle
coleenp
parents: 49401
diff changeset
   257
  Chunk* chunk = _head;
58fdb6c2a274 8199272: Broken assertion in ClassLoaderData::remove_handle
coleenp
parents: 49401
diff changeset
   258
  while (chunk != NULL) {
58fdb6c2a274 8199272: Broken assertion in ClassLoaderData::remove_handle
coleenp
parents: 49401
diff changeset
   259
    if (&(chunk->_data[0]) <= oop_handle && oop_handle < &(chunk->_data[chunk->_size])) {
58fdb6c2a274 8199272: Broken assertion in ClassLoaderData::remove_handle
coleenp
parents: 49401
diff changeset
   260
      return true;
58fdb6c2a274 8199272: Broken assertion in ClassLoaderData::remove_handle
coleenp
parents: 49401
diff changeset
   261
    }
58fdb6c2a274 8199272: Broken assertion in ClassLoaderData::remove_handle
coleenp
parents: 49401
diff changeset
   262
    chunk = chunk->_next;
58fdb6c2a274 8199272: Broken assertion in ClassLoaderData::remove_handle
coleenp
parents: 49401
diff changeset
   263
  }
58fdb6c2a274 8199272: Broken assertion in ClassLoaderData::remove_handle
coleenp
parents: 49401
diff changeset
   264
  return false;
58fdb6c2a274 8199272: Broken assertion in ClassLoaderData::remove_handle
coleenp
parents: 49401
diff changeset
   265
}
58fdb6c2a274 8199272: Broken assertion in ClassLoaderData::remove_handle
coleenp
parents: 49401
diff changeset
   266
#endif // PRODUCT
58fdb6c2a274 8199272: Broken assertion in ClassLoaderData::remove_handle
coleenp
parents: 49401
diff changeset
   267
55603
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 54847
diff changeset
   268
void ClassLoaderData::clear_claim(int claim) {
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 54847
diff changeset
   269
  for (;;) {
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 54847
diff changeset
   270
    int old_claim = Atomic::load(&_claim);
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 54847
diff changeset
   271
    if ((old_claim & claim) == 0) {
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 54847
diff changeset
   272
      return;
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 54847
diff changeset
   273
    }
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 54847
diff changeset
   274
    int new_claim = old_claim & ~claim;
59252
623722a6aeb9 8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents: 59247
diff changeset
   275
    if (Atomic::cmpxchg(&_claim, old_claim, new_claim) == old_claim) {
55603
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 54847
diff changeset
   276
      return;
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 54847
diff changeset
   277
    }
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 54847
diff changeset
   278
  }
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 54847
diff changeset
   279
}
3868dde58ebb 8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents: 54847
diff changeset
   280
52141
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51962
diff changeset
   281
bool ClassLoaderData::try_claim(int claim) {
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51962
diff changeset
   282
  for (;;) {
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51962
diff changeset
   283
    int old_claim = Atomic::load(&_claim);
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51962
diff changeset
   284
    if ((old_claim & claim) == claim) {
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51962
diff changeset
   285
      return false;
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51962
diff changeset
   286
    }
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51962
diff changeset
   287
    int new_claim = old_claim | claim;
59252
623722a6aeb9 8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents: 59247
diff changeset
   288
    if (Atomic::cmpxchg(&_claim, old_claim, new_claim) == old_claim) {
52141
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51962
diff changeset
   289
      return true;
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51962
diff changeset
   290
    }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   291
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   292
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   293
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   294
// Unsafe anonymous classes have their own ClassLoaderData that is marked to keep alive
38014
8731fa11f766 8152949: Jigsaw crash when Klass in _fixup_module_field_list is unloaded
lfoltan
parents: 37415
diff changeset
   295
// while the class is being parsed, and if the class appears on the module fixup list.
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   296
// Due to the uniqueness that no other class shares the unsafe anonymous class' name or
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   297
// ClassLoaderData, no other non-GC thread has knowledge of the unsafe anonymous class while
38014
8731fa11f766 8152949: Jigsaw crash when Klass in _fixup_module_field_list is unloaded
lfoltan
parents: 37415
diff changeset
   298
// it is being defined, therefore _keep_alive is not volatile or atomic.
8731fa11f766 8152949: Jigsaw crash when Klass in _fixup_module_field_list is unloaded
lfoltan
parents: 37415
diff changeset
   299
void ClassLoaderData::inc_keep_alive() {
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   300
  if (is_unsafe_anonymous()) {
54343
6a1406c718ec 8221643: Tighten up assert(_keep_alive >= 0) in CLD::inc_keep_alive
zgu
parents: 52852
diff changeset
   301
    assert(_keep_alive > 0, "Invalid keep alive increment count");
40358
48774f26918a 8162553: Crash in class unloading due to null CLD having a zero _keep_alive value
lfoltan
parents: 40339
diff changeset
   302
    _keep_alive++;
48774f26918a 8162553: Crash in class unloading due to null CLD having a zero _keep_alive value
lfoltan
parents: 40339
diff changeset
   303
  }
38014
8731fa11f766 8152949: Jigsaw crash when Klass in _fixup_module_field_list is unloaded
lfoltan
parents: 37415
diff changeset
   304
}
8731fa11f766 8152949: Jigsaw crash when Klass in _fixup_module_field_list is unloaded
lfoltan
parents: 37415
diff changeset
   305
8731fa11f766 8152949: Jigsaw crash when Klass in _fixup_module_field_list is unloaded
lfoltan
parents: 37415
diff changeset
   306
void ClassLoaderData::dec_keep_alive() {
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   307
  if (is_unsafe_anonymous()) {
40358
48774f26918a 8162553: Crash in class unloading due to null CLD having a zero _keep_alive value
lfoltan
parents: 40339
diff changeset
   308
    assert(_keep_alive > 0, "Invalid keep alive decrement count");
48774f26918a 8162553: Crash in class unloading due to null CLD having a zero _keep_alive value
lfoltan
parents: 40339
diff changeset
   309
    _keep_alive--;
48774f26918a 8162553: Crash in class unloading due to null CLD having a zero _keep_alive value
lfoltan
parents: 40339
diff changeset
   310
  }
38014
8731fa11f766 8152949: Jigsaw crash when Klass in _fixup_module_field_list is unloaded
lfoltan
parents: 37415
diff changeset
   311
}
8731fa11f766 8152949: Jigsaw crash when Klass in _fixup_module_field_list is unloaded
lfoltan
parents: 37415
diff changeset
   312
52141
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51962
diff changeset
   313
void ClassLoaderData::oops_do(OopClosure* f, int claim_value, bool clear_mod_oops) {
de6dc206a92b 8210330: Make CLD claiming allow multiple claim bits
eosterlund
parents: 51962
diff changeset
   314
  if (claim_value != ClassLoaderData::_claim_none && !try_claim(claim_value)) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   315
    return;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   316
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   317
47580
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   318
  // Only clear modified_oops after the ClassLoaderData is claimed.
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   319
  if (clear_mod_oops) {
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   320
    clear_modified_oops();
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   321
  }
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   322
44084
501b6d07e6dd 8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents: 43410
diff changeset
   323
  _handles.oops_do(f);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   324
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   325
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   326
void ClassLoaderData::classes_do(KlassClosure* klass_closure) {
47634
6a0c42c40cd1 8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents: 47580
diff changeset
   327
  // Lock-free access requires load_acquire
59247
56bf71d64d51 8234562: Move OrderAccess::release_store*/load_acquire to Atomic
stefank
parents: 58375
diff changeset
   328
  for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   329
    klass_closure->do_klass(k);
16352
1ff72c6eaa70 8007725: NPG: Klass::restore_unshareable_info() triggers assert(k->java_mirror() == NULL)
coleenp
parents: 15437
diff changeset
   330
    assert(k != k->next_link(), "no loops!");
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   331
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   332
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   333
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17119
diff changeset
   334
void ClassLoaderData::classes_do(void f(Klass * const)) {
47634
6a0c42c40cd1 8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents: 47580
diff changeset
   335
  // Lock-free access requires load_acquire
59247
56bf71d64d51 8234562: Move OrderAccess::release_store*/load_acquire to Atomic
stefank
parents: 58375
diff changeset
   336
  for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17119
diff changeset
   337
    f(k);
42639
762117d57d05 8170672: Event-based tracing to support classloader instances
mgronlun
parents: 41727
diff changeset
   338
    assert(k != k->next_link(), "no loops!");
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17119
diff changeset
   339
  }
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17119
diff changeset
   340
}
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17119
diff changeset
   341
23526
6851d341ad52 8037970: make PrintMethodData a diagnostic options
roland
parents: 22905
diff changeset
   342
void ClassLoaderData::methods_do(void f(Method*)) {
47634
6a0c42c40cd1 8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents: 47580
diff changeset
   343
  // Lock-free access requires load_acquire
59247
56bf71d64d51 8234562: Move OrderAccess::release_store*/load_acquire to Atomic
stefank
parents: 58375
diff changeset
   344
  for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
46380
4a51438196cf 8026985: Rewrite SystemDictionary::classes_do and Dictionary::classes_do to use KlassClosure
coleenp
parents: 46338
diff changeset
   345
    if (k->is_instance_klass() && InstanceKlass::cast(k)->is_loaded()) {
23526
6851d341ad52 8037970: make PrintMethodData a diagnostic options
roland
parents: 22905
diff changeset
   346
      InstanceKlass::cast(k)->methods_do(f);
6851d341ad52 8037970: make PrintMethodData a diagnostic options
roland
parents: 22905
diff changeset
   347
    }
6851d341ad52 8037970: make PrintMethodData a diagnostic options
roland
parents: 22905
diff changeset
   348
  }
6851d341ad52 8037970: make PrintMethodData a diagnostic options
roland
parents: 22905
diff changeset
   349
}
6851d341ad52 8037970: make PrintMethodData a diagnostic options
roland
parents: 22905
diff changeset
   350
21183
e148e499e5cd 8024423: JVMTI: GetLoadedClasses doesn't enumerate anonymous classes
farvidsson
parents: 20282
diff changeset
   351
void ClassLoaderData::loaded_classes_do(KlassClosure* klass_closure) {
47634
6a0c42c40cd1 8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents: 47580
diff changeset
   352
  // Lock-free access requires load_acquire
59247
56bf71d64d51 8234562: Move OrderAccess::release_store*/load_acquire to Atomic
stefank
parents: 58375
diff changeset
   353
  for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
21183
e148e499e5cd 8024423: JVMTI: GetLoadedClasses doesn't enumerate anonymous classes
farvidsson
parents: 20282
diff changeset
   354
    // Do not filter ArrayKlass oops here...
33611
9abd65805e19 8139203: Consistent naming for klass type predicates
coleenp
parents: 33105
diff changeset
   355
    if (k->is_array_klass() || (k->is_instance_klass() && InstanceKlass::cast(k)->is_loaded())) {
51962
628909466216 8210926: vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/TestDescription.java failed with JVMTI_ERROR_INVALID_CLASS in CDS mode
jiangli
parents: 51959
diff changeset
   356
#ifdef ASSERT
628909466216 8210926: vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/TestDescription.java failed with JVMTI_ERROR_INVALID_CLASS in CDS mode
jiangli
parents: 51959
diff changeset
   357
      oop m = k->java_mirror();
628909466216 8210926: vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/TestDescription.java failed with JVMTI_ERROR_INVALID_CLASS in CDS mode
jiangli
parents: 51959
diff changeset
   358
      assert(m != NULL, "NULL mirror");
628909466216 8210926: vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/TestDescription.java failed with JVMTI_ERROR_INVALID_CLASS in CDS mode
jiangli
parents: 51959
diff changeset
   359
      assert(m->is_a(SystemDictionary::Class_klass()), "invalid mirror");
628909466216 8210926: vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/TestDescription.java failed with JVMTI_ERROR_INVALID_CLASS in CDS mode
jiangli
parents: 51959
diff changeset
   360
#endif
21183
e148e499e5cd 8024423: JVMTI: GetLoadedClasses doesn't enumerate anonymous classes
farvidsson
parents: 20282
diff changeset
   361
      klass_closure->do_klass(k);
e148e499e5cd 8024423: JVMTI: GetLoadedClasses doesn't enumerate anonymous classes
farvidsson
parents: 20282
diff changeset
   362
    }
e148e499e5cd 8024423: JVMTI: GetLoadedClasses doesn't enumerate anonymous classes
farvidsson
parents: 20282
diff changeset
   363
  }
e148e499e5cd 8024423: JVMTI: GetLoadedClasses doesn't enumerate anonymous classes
farvidsson
parents: 20282
diff changeset
   364
}
e148e499e5cd 8024423: JVMTI: GetLoadedClasses doesn't enumerate anonymous classes
farvidsson
parents: 20282
diff changeset
   365
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   366
void ClassLoaderData::classes_do(void f(InstanceKlass*)) {
47634
6a0c42c40cd1 8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents: 47580
diff changeset
   367
  // Lock-free access requires load_acquire
59247
56bf71d64d51 8234562: Move OrderAccess::release_store*/load_acquire to Atomic
stefank
parents: 58375
diff changeset
   368
  for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
33611
9abd65805e19 8139203: Consistent naming for klass type predicates
coleenp
parents: 33105
diff changeset
   369
    if (k->is_instance_klass()) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   370
      f(InstanceKlass::cast(k));
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   371
    }
16352
1ff72c6eaa70 8007725: NPG: Klass::restore_unshareable_info() triggers assert(k->java_mirror() == NULL)
coleenp
parents: 15437
diff changeset
   372
    assert(k != k->next_link(), "no loops!");
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   373
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   374
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   375
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   376
void ClassLoaderData::modules_do(void f(ModuleEntry*)) {
38937
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   377
  assert_locked_or_safepoint(Module_lock);
46387
c46632622b17 8176472: Lazily create ModuleEntryTable
rprotacio
parents: 46380
diff changeset
   378
  if (_unnamed_module != NULL) {
c46632622b17 8176472: Lazily create ModuleEntryTable
rprotacio
parents: 46380
diff changeset
   379
    f(_unnamed_module);
c46632622b17 8176472: Lazily create ModuleEntryTable
rprotacio
parents: 46380
diff changeset
   380
  }
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   381
  if (_modules != NULL) {
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   382
    for (int i = 0; i < _modules->table_size(); i++) {
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   383
      for (ModuleEntry* entry = _modules->bucket(i);
46420
227f72691ac1 8179235: PackageEntryTables should be created eagerly
hseigel
parents: 46387
diff changeset
   384
           entry != NULL;
227f72691ac1 8179235: PackageEntryTables should be created eagerly
hseigel
parents: 46387
diff changeset
   385
           entry = entry->next()) {
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   386
        f(entry);
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   387
      }
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   388
    }
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   389
  }
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   390
}
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   391
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   392
void ClassLoaderData::packages_do(void f(PackageEntry*)) {
46420
227f72691ac1 8179235: PackageEntryTables should be created eagerly
hseigel
parents: 46387
diff changeset
   393
  assert_locked_or_safepoint(Module_lock);
227f72691ac1 8179235: PackageEntryTables should be created eagerly
hseigel
parents: 46387
diff changeset
   394
  if (_packages != NULL) {
227f72691ac1 8179235: PackageEntryTables should be created eagerly
hseigel
parents: 46387
diff changeset
   395
    for (int i = 0; i < _packages->table_size(); i++) {
227f72691ac1 8179235: PackageEntryTables should be created eagerly
hseigel
parents: 46387
diff changeset
   396
      for (PackageEntry* entry = _packages->bucket(i);
227f72691ac1 8179235: PackageEntryTables should be created eagerly
hseigel
parents: 46387
diff changeset
   397
           entry != NULL;
227f72691ac1 8179235: PackageEntryTables should be created eagerly
hseigel
parents: 46387
diff changeset
   398
           entry = entry->next()) {
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   399
        f(entry);
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   400
      }
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   401
    }
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   402
  }
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   403
}
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   404
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   405
void ClassLoaderData::record_dependency(const Klass* k) {
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34257
diff changeset
   406
  assert(k != NULL, "invariant");
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34257
diff changeset
   407
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   408
  ClassLoaderData * const from_cld = this;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   409
  ClassLoaderData * const to_cld = k->class_loader_data();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   410
48860
5bce1b7e7800 8190359: Reduce the number of recorded klass dependencies
hseigel
parents: 48811
diff changeset
   411
  // Do not need to record dependency if the dependency is to a class whose
5bce1b7e7800 8190359: Reduce the number of recorded klass dependencies
hseigel
parents: 48811
diff changeset
   412
  // class loader data is never freed.  (i.e. the dependency's class loader
5bce1b7e7800 8190359: Reduce the number of recorded klass dependencies
hseigel
parents: 48811
diff changeset
   413
  // is one of the three builtin class loaders and the dependency is not
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   414
  // unsafe anonymous.)
48860
5bce1b7e7800 8190359: Reduce the number of recorded klass dependencies
hseigel
parents: 48811
diff changeset
   415
  if (to_cld->is_permanent_class_loader_data()) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   416
    return;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   417
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   418
14588
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   419
  oop to;
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   420
  if (to_cld->is_unsafe_anonymous()) {
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   421
    // Just return if an unsafe anonymous class is attempting to record a dependency
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   422
    // to itself.  (Note that every unsafe anonymous class has its own unique class
48860
5bce1b7e7800 8190359: Reduce the number of recorded klass dependencies
hseigel
parents: 48811
diff changeset
   423
    // loader data.)
5bce1b7e7800 8190359: Reduce the number of recorded klass dependencies
hseigel
parents: 48811
diff changeset
   424
    if (to_cld == from_cld) {
5bce1b7e7800 8190359: Reduce the number of recorded klass dependencies
hseigel
parents: 48811
diff changeset
   425
      return;
5bce1b7e7800 8190359: Reduce the number of recorded klass dependencies
hseigel
parents: 48811
diff changeset
   426
    }
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   427
    // Unsafe anonymous class dependencies are through the mirror.
14588
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   428
    to = k->java_mirror();
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   429
  } else {
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   430
    to = to_cld->class_loader();
48860
5bce1b7e7800 8190359: Reduce the number of recorded klass dependencies
hseigel
parents: 48811
diff changeset
   431
    oop from = from_cld->class_loader();
14588
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   432
48860
5bce1b7e7800 8190359: Reduce the number of recorded klass dependencies
hseigel
parents: 48811
diff changeset
   433
    // Just return if this dependency is to a class with the same or a parent
5bce1b7e7800 8190359: Reduce the number of recorded klass dependencies
hseigel
parents: 48811
diff changeset
   434
    // class_loader.
58177
4932dce35882 8230841: Remove oopDesc::equals()
pliden
parents: 55603
diff changeset
   435
    if (from == to || java_lang_ClassLoader::isAncestor(from, to)) {
48860
5bce1b7e7800 8190359: Reduce the number of recorded klass dependencies
hseigel
parents: 48811
diff changeset
   436
      return; // this class loader is in the parent list, no need to add it.
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   437
    }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   438
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   439
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   440
  // It's a dependency we won't find through GC, add it.
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   441
  if (!_handles.contains(to)) {
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   442
    NOT_PRODUCT(Atomic::inc(&_dependency_count));
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   443
    LogTarget(Trace, class, loader, data) lt;
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   444
    if (lt.is_enabled()) {
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   445
      ResourceMark rm;
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   446
      LogStream ls(lt);
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   447
      ls.print("adding dependency from ");
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   448
      print_value_on(&ls);
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   449
      ls.print(" to ");
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   450
      to_cld->print_value_on(&ls);
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   451
      ls.cr();
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   452
    }
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   453
    Handle dependency(Thread::current(), to);
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   454
    add_handle(dependency);
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   455
    // Added a potentially young gen oop to the ClassLoaderData
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   456
    record_modified_oops();
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   457
  }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   458
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   459
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34257
diff changeset
   460
void ClassLoaderData::add_class(Klass* k, bool publicize /* true */) {
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34257
diff changeset
   461
  {
54623
1126f0607c70 8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents: 54343
diff changeset
   462
    MutexLocker ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34257
diff changeset
   463
    Klass* old_value = _klasses;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34257
diff changeset
   464
    k->set_next_link(old_value);
38937
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   465
    // Link the new item into the list, making sure the linked class is stable
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   466
    // since the list can be walked without a lock
59247
56bf71d64d51 8234562: Move OrderAccess::release_store*/load_acquire to Atomic
stefank
parents: 58375
diff changeset
   467
    Atomic::release_store(&_klasses, k);
48884
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   468
    if (k->is_array_klass()) {
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   469
      ClassLoaderDataGraph::inc_array_classes(1);
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   470
    } else {
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   471
      ClassLoaderDataGraph::inc_instance_classes(1);
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   472
    }
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34257
diff changeset
   473
  }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   474
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   475
  if (publicize) {
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   476
    LogTarget(Trace, class, loader, data) lt;
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   477
    if (lt.is_enabled()) {
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   478
      ResourceMark rm;
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   479
      LogStream ls(lt);
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   480
      ls.print("Adding k: " PTR_FORMAT " %s to ", p2i(k), k->external_name());
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   481
      print_value_on(&ls);
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   482
      ls.cr();
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   483
    }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   484
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   485
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   486
49738
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
   487
void ClassLoaderData::initialize_holder(Handle loader_or_mirror) {
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
   488
  if (loader_or_mirror() != NULL) {
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
   489
    assert(_holder.is_null(), "never replace holders");
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
   490
    _holder = WeakHandle<vm_class_loader_data>::create(loader_or_mirror);
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
   491
  }
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
   492
}
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
   493
38937
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   494
// Remove a klass from the _klasses list for scratch_class during redefinition
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   495
// or parsed class in the case of an error.
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   496
void ClassLoaderData::remove_class(Klass* scratch_class) {
52587
6cd56deebb0d 8213092: Add more runtime locks for concurrent class unloading
coleenp
parents: 52141
diff changeset
   497
  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   498
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   499
  // Adjust global class iterator.
51959
db0c3952de52 8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents: 51887
diff changeset
   500
  ClassLoaderDataGraph::adjust_saved_class(scratch_class);
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   501
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   502
  Klass* prev = NULL;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   503
  for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   504
    if (k == scratch_class) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   505
      if (prev == NULL) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   506
        _klasses = k->next_link();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   507
      } else {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   508
        Klass* next = k->next_link();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   509
        prev->set_next_link(next);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   510
      }
48884
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   511
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   512
      if (k->is_array_klass()) {
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   513
        ClassLoaderDataGraph::dec_array_classes(1);
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   514
      } else {
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   515
        ClassLoaderDataGraph::dec_instance_classes(1);
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   516
      }
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   517
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   518
      return;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   519
    }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   520
    prev = k;
16352
1ff72c6eaa70 8007725: NPG: Klass::restore_unshareable_info() triggers assert(k->java_mirror() == NULL)
coleenp
parents: 15437
diff changeset
   521
    assert(k != k->next_link(), "no loops!");
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   522
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   523
  ShouldNotReachHere();   // should have found this class!!
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   524
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   525
14588
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   526
void ClassLoaderData::unload() {
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   527
  _unloading = true;
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   528
51338
aa3bfacc912c 8208677: Move inner metaspace cleaning out of class unloading
coleenp
parents: 51334
diff changeset
   529
  LogTarget(Trace, class, loader, data) lt;
46701
f559541c0daa 8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents: 46464
diff changeset
   530
  if (lt.is_enabled()) {
14588
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   531
    ResourceMark rm;
46701
f559541c0daa 8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents: 46464
diff changeset
   532
    LogStream ls(lt);
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   533
    ls.print("unload");
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   534
    print_value_on(&ls);
46701
f559541c0daa 8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents: 46464
diff changeset
   535
    ls.cr();
14588
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   536
  }
38635
e15e221b60a0 8135322: ConstantPool::release_C_heap_structures not run in some circumstances
aeriksso
parents: 38151
diff changeset
   537
48395
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   538
  // Some items on the _deallocate_list need to free their C heap structures
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   539
  // if they are not already on the _klasses list.
51338
aa3bfacc912c 8208677: Move inner metaspace cleaning out of class unloading
coleenp
parents: 51334
diff changeset
   540
  free_deallocate_list_C_heap_structures();
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   541
51887
32161fbea3fe 8210856: Move InstanceKlass DependencyContext cleaning to SystemDictionary::do_unloading()
coleenp
parents: 51747
diff changeset
   542
  // Clean up class dependencies and tell serviceability tools
32161fbea3fe 8210856: Move InstanceKlass DependencyContext cleaning to SystemDictionary::do_unloading()
coleenp
parents: 51747
diff changeset
   543
  // these classes are unloading.  Must be called
50219
4ab066d71956 8202669: Intermittent crash in ClassLoadingService::compute_class_size()
coleenp
parents: 50113
diff changeset
   544
  // after erroneous classes are released.
51887
32161fbea3fe 8210856: Move InstanceKlass DependencyContext cleaning to SystemDictionary::do_unloading()
coleenp
parents: 51747
diff changeset
   545
  classes_do(InstanceKlass::unload_class);
50219
4ab066d71956 8202669: Intermittent crash in ClassLoadingService::compute_class_size()
coleenp
parents: 50113
diff changeset
   546
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   547
  // Clean up global class iterator for compiler
51959
db0c3952de52 8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents: 51887
diff changeset
   548
  ClassLoaderDataGraph::adjust_saved_class(this);
14588
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   549
}
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   550
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   551
ModuleEntryTable* ClassLoaderData::modules() {
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   552
  // Lazily create the module entry table at first request.
47634
6a0c42c40cd1 8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents: 47580
diff changeset
   553
  // Lock-free access requires load_acquire.
59247
56bf71d64d51 8234562: Move OrderAccess::release_store*/load_acquire to Atomic
stefank
parents: 58375
diff changeset
   554
  ModuleEntryTable* modules = Atomic::load_acquire(&_modules);
38937
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   555
  if (modules == NULL) {
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   556
    MutexLocker m1(Module_lock);
38937
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   557
    // Check if _modules got allocated while we were waiting for this lock.
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   558
    if ((modules = _modules) == NULL) {
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   559
      modules = new ModuleEntryTable(ModuleEntryTable::_moduletable_entry_size);
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   560
38937
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   561
      {
54623
1126f0607c70 8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents: 54343
diff changeset
   562
        MutexLocker m1(metaspace_lock(), Mutex::_no_safepoint_check_flag);
38937
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   563
        // Ensure _modules is stable, since it is examined without a lock
59247
56bf71d64d51 8234562: Move OrderAccess::release_store*/load_acquire to Atomic
stefank
parents: 58375
diff changeset
   564
        Atomic::release_store(&_modules, modules);
38937
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   565
      }
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   566
    }
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   567
  }
38937
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   568
  return modules;
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   569
}
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   570
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   571
const int _boot_loader_dictionary_size    = 1009;
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   572
const int _default_loader_dictionary_size = 107;
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   573
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   574
Dictionary* ClassLoaderData::create_dictionary() {
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   575
  assert(!is_unsafe_anonymous(), "unsafe anonymous class loader data do not have a dictionary");
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   576
  int size;
47774
69c081ca110a 8184765: Dynamically resize SystemDictionary
gziemski
parents: 47634
diff changeset
   577
  bool resizable = false;
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   578
  if (_the_null_class_loader_data == NULL) {
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   579
    size = _boot_loader_dictionary_size;
47774
69c081ca110a 8184765: Dynamically resize SystemDictionary
gziemski
parents: 47634
diff changeset
   580
    resizable = true;
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   581
  } else if (class_loader()->is_a(SystemDictionary::reflect_DelegatingClassLoader_klass())) {
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   582
    size = 1;  // there's only one class in relection class loader and no initiated classes
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   583
  } else if (is_system_class_loader_data()) {
47774
69c081ca110a 8184765: Dynamically resize SystemDictionary
gziemski
parents: 47634
diff changeset
   584
    size = _boot_loader_dictionary_size;
69c081ca110a 8184765: Dynamically resize SystemDictionary
gziemski
parents: 47634
diff changeset
   585
    resizable = true;
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   586
  } else {
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   587
    size = _default_loader_dictionary_size;
47774
69c081ca110a 8184765: Dynamically resize SystemDictionary
gziemski
parents: 47634
diff changeset
   588
    resizable = true;
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   589
  }
51523
73523d329966 8208061: runtime/LoadClass/TestResize.java fails with "Load factor too high" when running in CDS mode.
jiangli
parents: 51471
diff changeset
   590
  if (!DynamicallyResizeSystemDictionaries || DumpSharedSpaces) {
47774
69c081ca110a 8184765: Dynamically resize SystemDictionary
gziemski
parents: 47634
diff changeset
   591
    resizable = false;
69c081ca110a 8184765: Dynamically resize SystemDictionary
gziemski
parents: 47634
diff changeset
   592
  }
69c081ca110a 8184765: Dynamically resize SystemDictionary
gziemski
parents: 47634
diff changeset
   593
  return new Dictionary(this, size, resizable);
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   594
}
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   595
49479
5865398439d4 8197844: JVMTI GetLoadedClasses should use the Access API
coleenp
parents: 49403
diff changeset
   596
// Tell the GC to keep this klass alive while iterating ClassLoaderDataGraph
49738
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
   597
oop ClassLoaderData::holder_phantom() const {
49479
5865398439d4 8197844: JVMTI GetLoadedClasses should use the Access API
coleenp
parents: 49403
diff changeset
   598
  // A klass that was previously considered dead can be looked up in the
5865398439d4 8197844: JVMTI GetLoadedClasses should use the Access API
coleenp
parents: 49403
diff changeset
   599
  // CLD/SD, and its _java_mirror or _class_loader can be stored in a root
5865398439d4 8197844: JVMTI GetLoadedClasses should use the Access API
coleenp
parents: 49403
diff changeset
   600
  // or a reachable object making it alive again. The SATB part of G1 needs
5865398439d4 8197844: JVMTI GetLoadedClasses should use the Access API
coleenp
parents: 49403
diff changeset
   601
  // to get notified about this potential resurrection, otherwise the marking
5865398439d4 8197844: JVMTI GetLoadedClasses should use the Access API
coleenp
parents: 49403
diff changeset
   602
  // might not find the object.
49738
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
   603
  if (!_holder.is_null()) {  // NULL class_loader
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
   604
    return _holder.resolve();
49479
5865398439d4 8197844: JVMTI GetLoadedClasses should use the Access API
coleenp
parents: 49403
diff changeset
   605
  } else {
5865398439d4 8197844: JVMTI GetLoadedClasses should use the Access API
coleenp
parents: 49403
diff changeset
   606
    return NULL;
5865398439d4 8197844: JVMTI GetLoadedClasses should use the Access API
coleenp
parents: 49403
diff changeset
   607
  }
5865398439d4 8197844: JVMTI GetLoadedClasses should use the Access API
coleenp
parents: 49403
diff changeset
   608
}
5865398439d4 8197844: JVMTI GetLoadedClasses should use the Access API
coleenp
parents: 49403
diff changeset
   609
51682
a30461a359f5 8210321: Create NO_KEEPALIVE CLD holder accessor
eosterlund
parents: 51608
diff changeset
   610
// Let the GC read the holder without keeping it alive.
a30461a359f5 8210321: Create NO_KEEPALIVE CLD holder accessor
eosterlund
parents: 51608
diff changeset
   611
oop ClassLoaderData::holder_no_keepalive() const {
a30461a359f5 8210321: Create NO_KEEPALIVE CLD holder accessor
eosterlund
parents: 51608
diff changeset
   612
  if (!_holder.is_null()) {  // NULL class_loader
a30461a359f5 8210321: Create NO_KEEPALIVE CLD holder accessor
eosterlund
parents: 51608
diff changeset
   613
    return _holder.peek();
a30461a359f5 8210321: Create NO_KEEPALIVE CLD holder accessor
eosterlund
parents: 51608
diff changeset
   614
  } else {
a30461a359f5 8210321: Create NO_KEEPALIVE CLD holder accessor
eosterlund
parents: 51608
diff changeset
   615
    return NULL;
a30461a359f5 8210321: Create NO_KEEPALIVE CLD holder accessor
eosterlund
parents: 51608
diff changeset
   616
  }
a30461a359f5 8210321: Create NO_KEEPALIVE CLD holder accessor
eosterlund
parents: 51608
diff changeset
   617
}
a30461a359f5 8210321: Create NO_KEEPALIVE CLD holder accessor
eosterlund
parents: 51608
diff changeset
   618
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   619
// Unloading support
49738
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
   620
bool ClassLoaderData::is_alive() const {
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   621
  bool alive = keep_alive()         // null class loader and incomplete unsafe anonymous klasses.
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   622
      || (_holder.peek() != NULL);  // and not cleaned by the GC weak handle processing.
22900
e699fc9dc806 8035412: Cleanup ClassLoaderData::is_alive
stefank
parents: 22201
diff changeset
   623
14588
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   624
  return alive;
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   625
}
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   626
48884
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   627
class ReleaseKlassClosure: public KlassClosure {
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   628
private:
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   629
  size_t  _instance_class_released;
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   630
  size_t  _array_class_released;
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   631
public:
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   632
  ReleaseKlassClosure() : _instance_class_released(0), _array_class_released(0) { }
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   633
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   634
  size_t instance_class_released() const { return _instance_class_released; }
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   635
  size_t array_class_released()    const { return _array_class_released;    }
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   636
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   637
  void do_klass(Klass* k) {
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   638
    if (k->is_array_klass()) {
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   639
      _array_class_released ++;
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   640
    } else {
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   641
      assert(k->is_instance_klass(), "Must be");
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   642
      _instance_class_released ++;
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   643
      InstanceKlass::release_C_heap_structures(InstanceKlass::cast(k));
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   644
    }
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   645
  }
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   646
};
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   647
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   648
ClassLoaderData::~ClassLoaderData() {
17075
b53332c50aba 8011803: release_C_heap_structures is never called for anonymous classes.
coleenp
parents: 16684
diff changeset
   649
  // Release C heap structures for all the classes.
48884
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   650
  ReleaseKlassClosure cl;
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   651
  classes_do(&cl);
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   652
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   653
  ClassLoaderDataGraph::dec_array_classes(cl.array_class_released());
7e17b00dc245 8196923: [REDO] NMT: Report array class count in NMT summary
zgu
parents: 48874
diff changeset
   654
  ClassLoaderDataGraph::dec_instance_classes(cl.instance_class_released());
17075
b53332c50aba 8011803: release_C_heap_structures is never called for anonymous classes.
coleenp
parents: 16684
diff changeset
   655
49738
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
   656
  // Release the WeakHandle
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
   657
  _holder.release();
a7bc87a63dd8 8198313: Wrap holder object for ClassLoaderData in a WeakHandle
coleenp
parents: 49658
diff changeset
   658
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   659
  // Release C heap allocated hashtable for all the packages.
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   660
  if (_packages != NULL) {
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   661
    // Destroy the table itself
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   662
    delete _packages;
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   663
    _packages = NULL;
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   664
  }
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   665
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   666
  // Release C heap allocated hashtable for all the modules.
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   667
  if (_modules != NULL) {
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   668
    // Destroy the table itself
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   669
    delete _modules;
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   670
    _modules = NULL;
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   671
  }
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   672
46729
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   673
  // Release C heap allocated hashtable for the dictionary
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   674
  if (_dictionary != NULL) {
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   675
    // Destroy the table itself
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   676
    delete _dictionary;
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   677
    _dictionary = NULL;
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   678
  }
c62d2e8b2728 7133093: Improve system dictionary performance
coleenp
parents: 46701
diff changeset
   679
46387
c46632622b17 8176472: Lazily create ModuleEntryTable
rprotacio
parents: 46380
diff changeset
   680
  if (_unnamed_module != NULL) {
c46632622b17 8176472: Lazily create ModuleEntryTable
rprotacio
parents: 46380
diff changeset
   681
    _unnamed_module->delete_unnamed_module();
c46632622b17 8176472: Lazily create ModuleEntryTable
rprotacio
parents: 46380
diff changeset
   682
    _unnamed_module = NULL;
c46632622b17 8176472: Lazily create ModuleEntryTable
rprotacio
parents: 46380
diff changeset
   683
  }
c46632622b17 8176472: Lazily create ModuleEntryTable
rprotacio
parents: 46380
diff changeset
   684
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   685
  // release the metaspace
49401
0c71baee49a7 8199431: Split up class Metaspace into a static and a non-static part
stuefe
parents: 49393
diff changeset
   686
  ClassLoaderMetaspace *m = _metaspace;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   687
  if (m != NULL) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   688
    _metaspace = NULL;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   689
    delete m;
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   690
  }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   691
  // Clear all the JNI handles for methods
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   692
  // These aren't deallocated and are going to look like a leak, but that's
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   693
  // needed because we can't really get rid of jmethodIDs because we don't
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   694
  // know when native code is going to stop using them.  The spec says that
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   695
  // they're "invalid" but existing programs likely rely on their being
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   696
  // NULL after class unloading.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   697
  if (_jmethod_ids != NULL) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   698
    Method::clear_jmethod_ids(this);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   699
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   700
  // Delete lock
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   701
  delete _metaspace_lock;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   702
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   703
  // Delete free list
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   704
  if (_deallocate_list != NULL) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   705
    delete _deallocate_list;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   706
  }
51747
9bf5205655ee 8210559: ClassLoaderData Symbols can leak
coleenp
parents: 51698
diff changeset
   707
9bf5205655ee 8210559: ClassLoaderData Symbols can leak
coleenp
parents: 51698
diff changeset
   708
  // Decrement refcounts of Symbols if created.
9bf5205655ee 8210559: ClassLoaderData Symbols can leak
coleenp
parents: 51698
diff changeset
   709
  if (_name != NULL) {
9bf5205655ee 8210559: ClassLoaderData Symbols can leak
coleenp
parents: 51698
diff changeset
   710
    _name->decrement_refcount();
9bf5205655ee 8210559: ClassLoaderData Symbols can leak
coleenp
parents: 51698
diff changeset
   711
  }
9bf5205655ee 8210559: ClassLoaderData Symbols can leak
coleenp
parents: 51698
diff changeset
   712
  if (_name_and_id != NULL) {
9bf5205655ee 8210559: ClassLoaderData Symbols can leak
coleenp
parents: 51698
diff changeset
   713
    _name_and_id->decrement_refcount();
9bf5205655ee 8210559: ClassLoaderData Symbols can leak
coleenp
parents: 51698
diff changeset
   714
  }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   715
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   716
48871
120d6893f32f 8190235: Clarify ClassLoaderData::is_*_class_loader_data() method implementations
hseigel
parents: 48860
diff changeset
   717
// Returns true if this class loader data is for the app class loader
120d6893f32f 8190235: Clarify ClassLoaderData::is_*_class_loader_data() method implementations
hseigel
parents: 48860
diff changeset
   718
// or a user defined system class loader.  (Note that the class loader
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   719
// 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
   720
bool ClassLoaderData::is_system_class_loader_data() const {
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
   721
  return SystemDictionary::is_system_class_loader(class_loader());
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
   722
}
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
   723
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
   724
// 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: 51415
diff changeset
   725
// (Note that the class loader data may be unsafe anonymous.)
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   726
bool ClassLoaderData::is_platform_class_loader_data() const {
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   727
  return SystemDictionary::is_platform_class_loader(class_loader());
16617
6235d2c7549f 7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents: 16352
diff changeset
   728
}
6235d2c7549f 7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents: 16352
diff changeset
   729
48871
120d6893f32f 8190235: Clarify ClassLoaderData::is_*_class_loader_data() method implementations
hseigel
parents: 48860
diff changeset
   730
// Returns true if the class loader for this class loader data is one of
120d6893f32f 8190235: Clarify ClassLoaderData::is_*_class_loader_data() method implementations
hseigel
parents: 48860
diff changeset
   731
// the 3 builtin (boot application/system or platform) class loaders,
120d6893f32f 8190235: Clarify ClassLoaderData::is_*_class_loader_data() method implementations
hseigel
parents: 48860
diff changeset
   732
// including a user-defined system class loader.  Note that if the class
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   733
// loader data is for an unsafe anonymous class then it may get freed by a GC
48871
120d6893f32f 8190235: Clarify ClassLoaderData::is_*_class_loader_data() method implementations
hseigel
parents: 48860
diff changeset
   734
// even if its class loader is one of these loaders.
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
   735
bool ClassLoaderData::is_builtin_class_loader_data() const {
48871
120d6893f32f 8190235: Clarify ClassLoaderData::is_*_class_loader_data() method implementations
hseigel
parents: 48860
diff changeset
   736
  return (is_boot_class_loader_data() ||
46271
979ebd346ecf 8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents: 42639
diff changeset
   737
          SystemDictionary::is_system_class_loader(class_loader()) ||
979ebd346ecf 8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents: 42639
diff changeset
   738
          SystemDictionary::is_platform_class_loader(class_loader()));
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
   739
}
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
   740
48860
5bce1b7e7800 8190359: Reduce the number of recorded klass dependencies
hseigel
parents: 48811
diff changeset
   741
// Returns true if this class loader data is a class loader data
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   742
// that is not ever freed by a GC.  It must be the CLD for one of the builtin
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   743
// class loaders and not the CLD for an unsafe anonymous class.
48860
5bce1b7e7800 8190359: Reduce the number of recorded klass dependencies
hseigel
parents: 48811
diff changeset
   744
bool ClassLoaderData::is_permanent_class_loader_data() const {
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   745
  return is_builtin_class_loader_data() && !is_unsafe_anonymous();
48860
5bce1b7e7800 8190359: Reduce the number of recorded klass dependencies
hseigel
parents: 48811
diff changeset
   746
}
5bce1b7e7800 8190359: Reduce the number of recorded klass dependencies
hseigel
parents: 48811
diff changeset
   747
49401
0c71baee49a7 8199431: Split up class Metaspace into a static and a non-static part
stuefe
parents: 49393
diff changeset
   748
ClassLoaderMetaspace* ClassLoaderData::metaspace_non_null() {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   749
  // If the metaspace has not been allocated, create a new one.  Might want
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   750
  // to create smaller arena for Reflection class loaders also.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   751
  // The reason for the delayed allocation is because some class loaders are
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   752
  // simply for delegating with no metadata of their own.
47634
6a0c42c40cd1 8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents: 47580
diff changeset
   753
  // Lock-free access requires load_acquire.
59247
56bf71d64d51 8234562: Move OrderAccess::release_store*/load_acquire to Atomic
stefank
parents: 58375
diff changeset
   754
  ClassLoaderMetaspace* metaspace = Atomic::load_acquire(&_metaspace);
38937
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   755
  if (metaspace == NULL) {
54623
1126f0607c70 8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents: 54343
diff changeset
   756
    MutexLocker ml(_metaspace_lock,  Mutex::_no_safepoint_check_flag);
38937
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   757
    // Check if _metaspace got allocated while we were waiting for this lock.
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   758
    if ((metaspace = _metaspace) == NULL) {
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   759
      if (this == the_null_class_loader_data()) {
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   760
        assert (class_loader() == NULL, "Must be");
49401
0c71baee49a7 8199431: Split up class Metaspace into a static and a non-static part
stuefe
parents: 49393
diff changeset
   761
        metaspace = new ClassLoaderMetaspace(_metaspace_lock, Metaspace::BootMetaspaceType);
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   762
      } else if (is_unsafe_anonymous()) {
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   763
        metaspace = new ClassLoaderMetaspace(_metaspace_lock, Metaspace::UnsafeAnonymousMetaspaceType);
38937
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   764
      } else if (class_loader()->is_a(SystemDictionary::reflect_DelegatingClassLoader_klass())) {
49401
0c71baee49a7 8199431: Split up class Metaspace into a static and a non-static part
stuefe
parents: 49393
diff changeset
   765
        metaspace = new ClassLoaderMetaspace(_metaspace_lock, Metaspace::ReflectionMetaspaceType);
38937
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   766
      } else {
49401
0c71baee49a7 8199431: Split up class Metaspace into a static and a non-static part
stuefe
parents: 49393
diff changeset
   767
        metaspace = new ClassLoaderMetaspace(_metaspace_lock, Metaspace::StandardMetaspaceType);
15086
2bfd799e9147 8005082: NPG: Add specialized Metachunk sizes for reflection and anonymous classloaders
jmasa
parents: 14838
diff changeset
   768
      }
38937
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   769
      // Ensure _metaspace is stable, since it is examined without a lock
59247
56bf71d64d51 8234562: Move OrderAccess::release_store*/load_acquire to Atomic
stefank
parents: 58375
diff changeset
   770
      Atomic::release_store(&_metaspace, metaspace);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   771
    }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   772
  }
38937
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   773
  return metaspace;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   774
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   775
46961
c9094b1e5f87 8186088: ConstantPoolCache::_resolved_references is not a JNIHandle
coleenp
parents: 46746
diff changeset
   776
OopHandle ClassLoaderData::add_handle(Handle h) {
54623
1126f0607c70 8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents: 54343
diff changeset
   777
  MutexLocker ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
47580
96392e113a0a 8186777: Make Klass::_java_mirror an OopHandle
coleenp
parents: 47216
diff changeset
   778
  record_modified_oops();
46961
c9094b1e5f87 8186088: ConstantPoolCache::_resolved_references is not a JNIHandle
coleenp
parents: 46746
diff changeset
   779
  return OopHandle(_handles.add(h()));
31046
d01ad7a0ecb0 8081320: Backout JDK-8059340: ConstantPool::_resolved_references is missing in heap dump
vlivanov
parents: 31041
diff changeset
   780
}
d01ad7a0ecb0 8081320: Backout JDK-8059340: ConstantPool::_resolved_references is missing in heap dump
vlivanov
parents: 31041
diff changeset
   781
47095
9d21da6fe729 8181170: resolved_references array leaks for RedefineClasses
coleenp
parents: 46961
diff changeset
   782
void ClassLoaderData::remove_handle(OopHandle h) {
48395
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   783
  assert(!is_unloading(), "Do not remove a handle for a CLD that is unloading");
47095
9d21da6fe729 8181170: resolved_references array leaks for RedefineClasses
coleenp
parents: 46961
diff changeset
   784
  oop* ptr = h.ptr_raw();
9d21da6fe729 8181170: resolved_references array leaks for RedefineClasses
coleenp
parents: 46961
diff changeset
   785
  if (ptr != NULL) {
49403
58fdb6c2a274 8199272: Broken assertion in ClassLoaderData::remove_handle
coleenp
parents: 49401
diff changeset
   786
    assert(_handles.owner_of(ptr), "Got unexpected handle " PTR_FORMAT, p2i(ptr));
50803
45c1fde86050 8205559: Remove IN_CONCURRENT_ROOT Access decorator
kbarrett
parents: 50759
diff changeset
   787
    NativeAccess<>::oop_store(ptr, oop(NULL));
47095
9d21da6fe729 8181170: resolved_references array leaks for RedefineClasses
coleenp
parents: 46961
diff changeset
   788
  }
9d21da6fe729 8181170: resolved_references array leaks for RedefineClasses
coleenp
parents: 46961
diff changeset
   789
}
9d21da6fe729 8181170: resolved_references array leaks for RedefineClasses
coleenp
parents: 46961
diff changeset
   790
46961
c9094b1e5f87 8186088: ConstantPoolCache::_resolved_references is not a JNIHandle
coleenp
parents: 46746
diff changeset
   791
void ClassLoaderData::init_handle_locked(OopHandle& dest, Handle h) {
54623
1126f0607c70 8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents: 54343
diff changeset
   792
  MutexLocker ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
46961
c9094b1e5f87 8186088: ConstantPoolCache::_resolved_references is not a JNIHandle
coleenp
parents: 46746
diff changeset
   793
  if (dest.resolve() != NULL) {
c9094b1e5f87 8186088: ConstantPoolCache::_resolved_references is not a JNIHandle
coleenp
parents: 46746
diff changeset
   794
    return;
c9094b1e5f87 8186088: ConstantPoolCache::_resolved_references is not a JNIHandle
coleenp
parents: 46746
diff changeset
   795
  } else {
c9094b1e5f87 8186088: ConstantPoolCache::_resolved_references is not a JNIHandle
coleenp
parents: 46746
diff changeset
   796
    dest = _handles.add(h());
c9094b1e5f87 8186088: ConstantPoolCache::_resolved_references is not a JNIHandle
coleenp
parents: 46746
diff changeset
   797
  }
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   798
}
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35917
diff changeset
   799
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   800
// Add this metadata pointer to be freed when it's safe.  This is only during
51338
aa3bfacc912c 8208677: Move inner metaspace cleaning out of class unloading
coleenp
parents: 51334
diff changeset
   801
// a safepoint which checks if handles point to this metadata field.
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   802
void ClassLoaderData::add_to_deallocate_list(Metadata* m) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   803
  // Metadata in shared region isn't deleted.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   804
  if (!m->is_shared()) {
54623
1126f0607c70 8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents: 54343
diff changeset
   805
    MutexLocker ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   806
    if (_deallocate_list == NULL) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   807
      _deallocate_list = new (ResourceObj::C_HEAP, mtClass) GrowableArray<Metadata*>(100, true);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   808
    }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   809
    _deallocate_list->append_if_missing(m);
51338
aa3bfacc912c 8208677: Move inner metaspace cleaning out of class unloading
coleenp
parents: 51334
diff changeset
   810
    log_debug(class, loader, data)("deallocate added for %s", m->print_value_string());
aa3bfacc912c 8208677: Move inner metaspace cleaning out of class unloading
coleenp
parents: 51334
diff changeset
   811
    ClassLoaderDataGraph::set_should_clean_deallocate_lists();
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   812
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   813
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   814
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   815
// Deallocate free metadata on the free list.  How useful the PermGen was!
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   816
void ClassLoaderData::free_deallocate_list() {
52587
6cd56deebb0d 8213092: Add more runtime locks for concurrent class unloading
coleenp
parents: 52141
diff changeset
   817
  // This must be called at a safepoint because it depends on metadata walking at
6cd56deebb0d 8213092: Add more runtime locks for concurrent class unloading
coleenp
parents: 52141
diff changeset
   818
  // safepoint cleanup time.
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   819
  assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
48395
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   820
  assert(!is_unloading(), "only called for ClassLoaderData that are not unloading");
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   821
  if (_deallocate_list == NULL) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   822
    return;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   823
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   824
  // Go backwards because this removes entries that are freed.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   825
  for (int i = _deallocate_list->length() - 1; i >= 0; i--) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   826
    Metadata* m = _deallocate_list->at(i);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   827
    if (!m->on_stack()) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   828
      _deallocate_list->remove_at(i);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   829
      // There are only three types of metadata that we deallocate directly.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   830
      // Cast them so they can be used by the template function.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   831
      if (m->is_method()) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   832
        MetadataFactory::free_metadata(this, (Method*)m);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   833
      } else if (m->is_constantPool()) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   834
        MetadataFactory::free_metadata(this, (ConstantPool*)m);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   835
      } else if (m->is_klass()) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   836
        MetadataFactory::free_metadata(this, (InstanceKlass*)m);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   837
      } else {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   838
        ShouldNotReachHere();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   839
      }
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 29081
diff changeset
   840
    } else {
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 29081
diff changeset
   841
      // Metadata is alive.
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 29081
diff changeset
   842
      // If scratch_class is on stack then it shouldn't be on this list!
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 29081
diff changeset
   843
      assert(!m->is_klass() || !((InstanceKlass*)m)->is_scratch_class(),
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 29081
diff changeset
   844
             "scratch classes on this list should be dead");
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 29081
diff changeset
   845
      // Also should assert that other metadata on the list was found in handles.
51338
aa3bfacc912c 8208677: Move inner metaspace cleaning out of class unloading
coleenp
parents: 51334
diff changeset
   846
      // Some cleaning remains.
aa3bfacc912c 8208677: Move inner metaspace cleaning out of class unloading
coleenp
parents: 51334
diff changeset
   847
      ClassLoaderDataGraph::set_should_clean_deallocate_lists();
aa3bfacc912c 8208677: Move inner metaspace cleaning out of class unloading
coleenp
parents: 51334
diff changeset
   848
    }
aa3bfacc912c 8208677: Move inner metaspace cleaning out of class unloading
coleenp
parents: 51334
diff changeset
   849
  }
aa3bfacc912c 8208677: Move inner metaspace cleaning out of class unloading
coleenp
parents: 51334
diff changeset
   850
}
aa3bfacc912c 8208677: Move inner metaspace cleaning out of class unloading
coleenp
parents: 51334
diff changeset
   851
48395
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   852
// This is distinct from free_deallocate_list.  For class loader data that are
48405
5f1c30b80554 8193622: JFR test TestUnloadingEventClass.java times out intermittently
coleenp
parents: 48395
diff changeset
   853
// unloading, this frees the C heap memory for items on the list, and unlinks
5f1c30b80554 8193622: JFR test TestUnloadingEventClass.java times out intermittently
coleenp
parents: 48395
diff changeset
   854
// scratch or error classes so that unloading events aren't triggered for these
5f1c30b80554 8193622: JFR test TestUnloadingEventClass.java times out intermittently
coleenp
parents: 48395
diff changeset
   855
// classes. The metadata is removed with the unloading metaspace.
5f1c30b80554 8193622: JFR test TestUnloadingEventClass.java times out intermittently
coleenp
parents: 48395
diff changeset
   856
// There isn't C heap memory allocated for methods, so nothing is done for them.
51338
aa3bfacc912c 8208677: Move inner metaspace cleaning out of class unloading
coleenp
parents: 51334
diff changeset
   857
void ClassLoaderData::free_deallocate_list_C_heap_structures() {
52587
6cd56deebb0d 8213092: Add more runtime locks for concurrent class unloading
coleenp
parents: 52141
diff changeset
   858
  assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
48395
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   859
  assert(is_unloading(), "only called for ClassLoaderData that are unloading");
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   860
  if (_deallocate_list == NULL) {
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   861
    return;
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   862
  }
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   863
  // Go backwards because this removes entries that are freed.
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   864
  for (int i = _deallocate_list->length() - 1; i >= 0; i--) {
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   865
    Metadata* m = _deallocate_list->at(i);
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   866
    _deallocate_list->remove_at(i);
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   867
    if (m->is_constantPool()) {
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   868
      ((ConstantPool*)m)->release_C_heap_structures();
48405
5f1c30b80554 8193622: JFR test TestUnloadingEventClass.java times out intermittently
coleenp
parents: 48395
diff changeset
   869
    } else if (m->is_klass()) {
5f1c30b80554 8193622: JFR test TestUnloadingEventClass.java times out intermittently
coleenp
parents: 48395
diff changeset
   870
      InstanceKlass* ik = (InstanceKlass*)m;
5f1c30b80554 8193622: JFR test TestUnloadingEventClass.java times out intermittently
coleenp
parents: 48395
diff changeset
   871
      // also releases ik->constants() C heap memory
5f1c30b80554 8193622: JFR test TestUnloadingEventClass.java times out intermittently
coleenp
parents: 48395
diff changeset
   872
      InstanceKlass::release_C_heap_structures(ik);
5f1c30b80554 8193622: JFR test TestUnloadingEventClass.java times out intermittently
coleenp
parents: 48395
diff changeset
   873
      // Remove the class so unloading events aren't triggered for
5f1c30b80554 8193622: JFR test TestUnloadingEventClass.java times out intermittently
coleenp
parents: 48395
diff changeset
   874
      // this class (scratch or error class) in do_unloading().
5f1c30b80554 8193622: JFR test TestUnloadingEventClass.java times out intermittently
coleenp
parents: 48395
diff changeset
   875
      remove_class(ik);
48395
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   876
    }
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   877
  }
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   878
}
919780ab7acc 8193053: jvm crash by G1CMBitMapClosure::do_addr
coleenp
parents: 47774
diff changeset
   879
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   880
// These CLDs are to contain unsafe anonymous classes used for JSR292
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   881
ClassLoaderData* ClassLoaderData::unsafe_anonymous_class_loader_data(Handle loader) {
14588
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   882
  // Add a new class loader data to the graph.
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   883
  return ClassLoaderDataGraph::add(loader, true);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   884
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   885
50634
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   886
// Caller needs ResourceMark
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   887
// If the class loader's _name has not been explicitly set, the class loader's
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   888
// qualified class name is returned.
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   889
const char* ClassLoaderData::loader_name() const {
50634
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   890
   if (_class_loader_klass == NULL) {
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   891
     return BOOTSTRAP_LOADER_NAME;
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   892
   } else if (_name != NULL) {
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   893
     return _name->as_C_string();
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   894
   } else {
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   895
     return _class_loader_klass->external_name();
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   896
   }
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   897
}
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   898
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   899
// Caller needs ResourceMark
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   900
// Format of the _name_and_id is as follows:
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   901
//   If the defining loader has a name explicitly set then '<loader-name>' @<id>
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   902
//   If the defining loader has no name then <qualified-class-name> @<id>
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   903
//   If built-in loader, then omit '@<id>' as there is only one instance.
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   904
const char* ClassLoaderData::loader_name_and_id() const {
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   905
  if (_class_loader_klass == NULL) {
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   906
    return "'" BOOTSTRAP_LOADER_NAME "'";
50759
00c4edaf2017 8205509: assert(_name_and_id != 0LL) failed: encountered a class loader null name and id
lfoltan
parents: 50634
diff changeset
   907
  } else if (_name_and_id != NULL) {
00c4edaf2017 8205509: assert(_name_and_id != 0LL) failed: encountered a class loader null name and id
lfoltan
parents: 50634
diff changeset
   908
    return _name_and_id->as_C_string();
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   909
  } else {
50759
00c4edaf2017 8205509: assert(_name_and_id != 0LL) failed: encountered a class loader null name and id
lfoltan
parents: 50634
diff changeset
   910
    // May be called in a race before _name_and_id is initialized.
00c4edaf2017 8205509: assert(_name_and_id != 0LL) failed: encountered a class loader null name and id
lfoltan
parents: 50634
diff changeset
   911
    return _class_loader_klass->external_name();
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   912
  }
14588
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   913
}
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
   914
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   915
void ClassLoaderData::print_value_on(outputStream* out) const {
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 49818
diff changeset
   916
  if (!is_unloading() && class_loader() != NULL) {
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   917
    out->print("loader data: " INTPTR_FORMAT " for instance ", p2i(this));
50634
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   918
    class_loader()->print_value_on(out);  // includes loader_name_and_id() and address of class loader instance
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   919
  } else {
50634
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   920
    // loader data: 0xsomeaddr of 'bootstrap'
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   921
    out->print("loader data: " INTPTR_FORMAT " of %s", p2i(this), loader_name_and_id());
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   922
  }
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   923
  if (is_unsafe_anonymous()) {
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   924
    out->print(" unsafe anonymous");
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   925
  }
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   926
}
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   927
54807
33fe50b6d707 8223626: move print() functions to cpp files
coleenp
parents: 54623
diff changeset
   928
void ClassLoaderData::print_value() const { print_value_on(tty); }
33fe50b6d707 8223626: move print() functions to cpp files
coleenp
parents: 54623
diff changeset
   929
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   930
#ifndef PRODUCT
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   931
void ClassLoaderData::print_on(outputStream* out) const {
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   932
  out->print("ClassLoaderData CLD: " PTR_FORMAT ", loader: " PTR_FORMAT ", loader_klass: %s {",
50634
c349d409262a 8202605: Standardize on ClassLoaderData::loader_name() throughout the VM to obtain a class loader's name
lfoltan
parents: 50599
diff changeset
   933
              p2i(this), p2i(_class_loader.ptr_raw()), loader_name_and_id());
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   934
  if (is_unsafe_anonymous()) out->print(" unsafe anonymous");
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   935
  if (claimed()) out->print(" claimed");
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   936
  if (is_unloading()) out->print(" unloading");
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   937
  out->print(" metaspace: " INTPTR_FORMAT, p2i(metaspace_or_null()));
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   938
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   939
  if (_jmethod_ids != NULL) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   940
    Method::print_jmethod_ids(this, out);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   941
  }
49348
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   942
  out->print(" handles count %d", _handles.count());
fde3feaaa4ed 8198926: Move ClassLoaderData::_dependencies to ClassLoaderData::_handles
coleenp
parents: 49041
diff changeset
   943
  out->print(" dependencies %d", _dependency_count);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   944
  out->print_cr("}");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   945
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   946
#endif // PRODUCT
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   947
54807
33fe50b6d707 8223626: move print() functions to cpp files
coleenp
parents: 54623
diff changeset
   948
void ClassLoaderData::print() const { print_on(tty); }
33fe50b6d707 8223626: move print() functions to cpp files
coleenp
parents: 54623
diff changeset
   949
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   950
void ClassLoaderData::verify() {
38937
2bf3c37c4841 8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents: 38635
diff changeset
   951
  assert_locked_or_safepoint(_metaspace_lock);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   952
  oop cl = class_loader();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   953
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   954
  guarantee(this == class_loader_data(cl) || is_unsafe_anonymous(), "Must be the same");
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51415
diff changeset
   955
  guarantee(cl != NULL || this == ClassLoaderData::the_null_class_loader_data() || is_unsafe_anonymous(), "must be");
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   956
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   957
  // Verify the integrity of the allocated space.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   958
  if (metaspace_or_null() != NULL) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   959
    metaspace_or_null()->verify();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   960
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   961
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   962
  for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   963
    guarantee(k->class_loader_data() == this, "Must be the same");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   964
    k->verify();
16352
1ff72c6eaa70 8007725: NPG: Klass::restore_unshareable_info() triggers assert(k->java_mirror() == NULL)
coleenp
parents: 15437
diff changeset
   965
    assert(k != k->next_link(), "no loops!");
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   966
  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   967
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
   968
22794
f1c014ad3754 8027146: Class loading verification failure if GC occurs in Universe::flush_dependents_on
coleenp
parents: 22201
diff changeset
   969
bool ClassLoaderData::contains_klass(Klass* klass) {
47634
6a0c42c40cd1 8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents: 47580
diff changeset
   970
  // Lock-free access requires load_acquire
59247
56bf71d64d51 8234562: Move OrderAccess::release_store*/load_acquire to Atomic
stefank
parents: 58375
diff changeset
   971
  for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
22794
f1c014ad3754 8027146: Class loading verification failure if GC occurs in Universe::flush_dependents_on
coleenp
parents: 22201
diff changeset
   972
    if (k == klass) return true;
f1c014ad3754 8027146: Class loading verification failure if GC occurs in Universe::flush_dependents_on
coleenp
parents: 22201
diff changeset
   973
  }
f1c014ad3754 8027146: Class loading verification failure if GC occurs in Universe::flush_dependents_on
coleenp
parents: 22201
diff changeset
   974
  return false;
f1c014ad3754 8027146: Class loading verification failure if GC occurs in Universe::flush_dependents_on
coleenp
parents: 22201
diff changeset
   975
}