hotspot/src/share/vm/services/classLoadingService.cpp
author mockner
Wed, 03 Feb 2016 11:40:30 -0500
changeset 35917 463d67f86eaa
parent 33611 9abd65805e19
child 37248 11a660dbbb8e
permissions -rw-r--r--
8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging. Summary: TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData have been reimplemented using Unified logging. Reviewed-by: iklam, coleenp, dholmes, jiangli, hseigel, rprotacio Contributed-by: max.ockner@oracle.com, ioi.lam@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
35917
463d67f86eaa 8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents: 33611
diff changeset
     2
 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4576
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4576
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4576
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "classfile/systemDictionary.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "memory/allocation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "memory/universe.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "oops/oop.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "runtime/mutexLocker.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "services/classLoadingService.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#include "services/memoryService.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    33
#include "utilities/dtrace.hpp"
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13975
diff changeset
    34
#include "utilities/macros.hpp"
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents: 24424
diff changeset
    35
#include "utilities/defaultStream.hpp"
35917
463d67f86eaa 8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents: 33611
diff changeset
    36
#include "logging/log.hpp"
463d67f86eaa 8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents: 33611
diff changeset
    37
#include "logging/logConfiguration.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
#ifdef DTRACE_ENABLED
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
// Only bother with this argument setup if dtrace is available
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
10739
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 8921
diff changeset
    43
#define HOTSPOT_CLASS_unloaded HOTSPOT_CLASS_UNLOADED
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 8921
diff changeset
    44
#define HOTSPOT_CLASS_loaded HOTSPOT_CLASS_LOADED
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 8921
diff changeset
    45
#define DTRACE_CLASSLOAD_PROBE(type, clss, shared)  \
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 8921
diff changeset
    46
  {                                                 \
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 8921
diff changeset
    47
    char* data = NULL;                              \
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 8921
diff changeset
    48
    int len = 0;                                    \
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 8921
diff changeset
    49
    Symbol* name = (clss)->name();                  \
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 8921
diff changeset
    50
    if (name != NULL) {                             \
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 8921
diff changeset
    51
      data = (char*)name->bytes();                  \
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 8921
diff changeset
    52
      len = name->utf8_length();                    \
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 8921
diff changeset
    53
    }                                               \
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 8921
diff changeset
    54
    HOTSPOT_CLASS_##type( /* type = unloaded, loaded */ \
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 8921
diff changeset
    55
      data, len, (clss)->class_loader(), (shared)); \
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 8921
diff changeset
    56
  }
91935236600e 7098194: integrate macosx-port changes
dcubed
parents: 8921
diff changeset
    57
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
#else //  ndef DTRACE_ENABLED
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
#define DTRACE_CLASSLOAD_PROBE(type, clss, shared)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
13975
2f7431485cfa 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 13728
diff changeset
    64
#if INCLUDE_MANAGEMENT
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
// counters for classes loaded from class files
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
PerfCounter*    ClassLoadingService::_classes_loaded_count = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
PerfCounter*    ClassLoadingService::_classes_unloaded_count = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
PerfCounter*    ClassLoadingService::_classbytes_loaded = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
PerfCounter*    ClassLoadingService::_classbytes_unloaded = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
// counters for classes loaded from shared archive
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
PerfCounter*    ClassLoadingService::_shared_classes_loaded_count = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
PerfCounter*    ClassLoadingService::_shared_classes_unloaded_count = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
PerfCounter*    ClassLoadingService::_shared_classbytes_loaded = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
PerfCounter*    ClassLoadingService::_shared_classbytes_unloaded = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
PerfVariable*   ClassLoadingService::_class_methods_size = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
void ClassLoadingService::init() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  EXCEPTION_MARK;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  // These counters are for java.lang.management API support.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  // They are created even if -XX:-UsePerfData is set and in
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  // that case, they will be allocated on C heap.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  _classes_loaded_count =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
                 PerfDataManager::create_counter(JAVA_CLS, "loadedClasses",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
                                                 PerfData::U_Events, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  _classes_unloaded_count =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
                 PerfDataManager::create_counter(JAVA_CLS, "unloadedClasses",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
                                                 PerfData::U_Events, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  _shared_classes_loaded_count =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
                 PerfDataManager::create_counter(JAVA_CLS, "sharedLoadedClasses",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
                                                 PerfData::U_Events, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  _shared_classes_unloaded_count =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
                 PerfDataManager::create_counter(JAVA_CLS, "sharedUnloadedClasses",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
                                                 PerfData::U_Events, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  if (UsePerfData) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    _classbytes_loaded =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
                 PerfDataManager::create_counter(SUN_CLS, "loadedBytes",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
                                                 PerfData::U_Bytes, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    _classbytes_unloaded =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
                 PerfDataManager::create_counter(SUN_CLS, "unloadedBytes",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
                                                 PerfData::U_Bytes, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
    _shared_classbytes_loaded =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
                 PerfDataManager::create_counter(SUN_CLS, "sharedLoadedBytes",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
                                                 PerfData::U_Bytes, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    _shared_classbytes_unloaded =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
                 PerfDataManager::create_counter(SUN_CLS, "sharedUnloadedBytes",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
                                                 PerfData::U_Bytes, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
    _class_methods_size =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
                 PerfDataManager::create_variable(SUN_CLS, "methodBytes",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
                                                  PerfData::U_Bytes, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10739
diff changeset
   121
void ClassLoadingService::notify_class_unloaded(InstanceKlass* k) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  DTRACE_CLASSLOAD_PROBE(unloaded, k, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  // Classes that can be unloaded must be non-shared
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  _classes_unloaded_count->inc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  if (UsePerfData) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    // add the class size
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    size_t size = compute_class_size(k);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
    _classbytes_unloaded->inc(size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    // Compute method size & subtract from running total.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
    // We are called during phase 1 of mark sweep, so it's
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10739
diff changeset
   133
    // still ok to iterate through Method*s here.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10739
diff changeset
   134
    Array<Method*>* methods = k->methods();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    for (int i = 0; i < methods->length(); i++) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10739
diff changeset
   136
      _class_methods_size->inc(-methods->at(i)->size());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
35917
463d67f86eaa 8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents: 33611
diff changeset
   140
  if (log_is_enabled(Info, classunload)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
    ResourceMark rm;
35917
463d67f86eaa 8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents: 33611
diff changeset
   142
    log_info(classunload)("unloading class %s " INTPTR_FORMAT , k->external_name(), p2i(k));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10739
diff changeset
   146
void ClassLoadingService::notify_class_loaded(InstanceKlass* k, bool shared_class) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  DTRACE_CLASSLOAD_PROBE(loaded, k, shared_class);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  PerfCounter* classes_counter = (shared_class ? _shared_classes_loaded_count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
                                               : _classes_loaded_count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  // increment the count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  classes_counter->inc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  if (UsePerfData) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
    PerfCounter* classbytes_counter = (shared_class ? _shared_classbytes_loaded
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
                                                    : _classbytes_loaded);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
    // add the class size
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
    size_t size = compute_class_size(k);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
    classbytes_counter->inc(size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10739
diff changeset
   162
size_t ClassLoadingService::compute_class_size(InstanceKlass* k) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10739
diff changeset
   163
  // lifted from ClassStatistics.do_class(Klass* k)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  size_t class_size = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10739
diff changeset
   167
  class_size += k->size();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
33611
9abd65805e19 8139203: Consistent naming for klass type predicates
coleenp
parents: 33105
diff changeset
   169
  if (k->is_instance_klass()) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
    class_size += k->methods()->size();
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10739
diff changeset
   171
    // FIXME: Need to count the contents of methods
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
    class_size += k->constants()->size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
    class_size += k->local_interfaces()->size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
    class_size += k->transitive_interfaces()->size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
    // We do not have to count implementors, since we only store one!
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10739
diff changeset
   176
    // FIXME: How should these be accounted for, now when they have moved.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 10739
diff changeset
   177
    //class_size += k->fields()->size();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  return class_size * oopSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
bool ClassLoadingService::set_verbose(bool verbose) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  MutexLocker m(Management_lock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  // verbose will be set to the previous value
35917
463d67f86eaa 8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents: 33611
diff changeset
   185
  if (verbose) {
463d67f86eaa 8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents: 33611
diff changeset
   186
    LogConfiguration::parse_log_arguments("stdout", "classload=info", NULL, NULL, NULL);
463d67f86eaa 8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents: 33611
diff changeset
   187
  } else {
463d67f86eaa 8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents: 33611
diff changeset
   188
    LogConfiguration::parse_log_arguments("stdout", "classload=off", NULL, NULL, NULL);
463d67f86eaa 8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents: 33611
diff changeset
   189
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  reset_trace_class_unloading();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  return verbose;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
// Caller to this function must own Management_lock
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
void ClassLoadingService::reset_trace_class_unloading() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  assert(Management_lock->owned_by_self(), "Must own the Management_lock");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  bool value = MemoryService::get_verbose() || ClassLoadingService::get_verbose();
35917
463d67f86eaa 8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents: 33611
diff changeset
   198
  if (value) {
463d67f86eaa 8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents: 33611
diff changeset
   199
    LogConfiguration::parse_log_arguments("stdout", "classunload=info", NULL, NULL, NULL);
463d67f86eaa 8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents: 33611
diff changeset
   200
  } else {
463d67f86eaa 8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents: 33611
diff changeset
   201
    LogConfiguration::parse_log_arguments("stdout", "classunload=off", NULL, NULL, NULL);
463d67f86eaa 8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents: 33611
diff changeset
   202
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
GrowableArray<KlassHandle>* LoadedClassesEnumerator::_loaded_classes = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
Thread* LoadedClassesEnumerator::_current_thread = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
LoadedClassesEnumerator::LoadedClassesEnumerator(Thread* cur_thread) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  assert(cur_thread == Thread::current(), "Check current thread");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  int init_size = ClassLoadingService::loaded_class_count();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  _klass_handle_array = new GrowableArray<KlassHandle>(init_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  // For consistency of the loaded classes, grab the SystemDictionary lock
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  MutexLocker sd_mutex(SystemDictionary_lock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  // Set _loaded_classes and _current_thread and begin enumerating all classes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  // Only one thread will do the enumeration at a time.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  // These static variables are needed and they are used by the static method
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  // add_loaded_class called from classes_do().
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  _loaded_classes = _klass_handle_array;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  _current_thread = cur_thread;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  SystemDictionary::classes_do(&add_loaded_class);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  // FIXME: Exclude array klasses for now
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  // Universe::basic_type_classes_do(&add_loaded_class);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
}
13975
2f7431485cfa 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 13728
diff changeset
   229
2f7431485cfa 7189254: Change makefiles for more flexibility to override defaults
jprovino
parents: 13728
diff changeset
   230
#endif // INCLUDE_MANAGEMENT