hotspot/src/share/vm/classfile/classLoaderData.inline.hpp
author mchung
Tue, 24 Nov 2015 14:59:17 -0800
changeset 34280 72bfaaffee36
parent 22234 da823d78ad65
child 35498 392b50de06c6
permissions -rw-r--r--
8143911: Reintegrate JEP 259: Stack-Walking API Reviewed-by: coleenp, dfuchs, bchristi, psandoz, sspitsyn Contributed-by: Mandy Chung <mandy.chung@oracle.com>, Brent Christian <brent.christian@oracle.com>, Daniel Fuchs <daniel.fuchs@oracle.com>, Hamlin Li <huaming.li@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
     1
/*
22234
da823d78ad65 8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents: 17107
diff changeset
     2
 * Copyright (c) 2011, 2013, 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
#include "classfile/classLoaderData.hpp"
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    26
#include "classfile/javaClasses.hpp"
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    27
15847
f9ce2cd20dee 8008549: NPG: SystemDictionary::find(...) unnecessarily keeps class loaders alive
stefank
parents: 14588
diff changeset
    28
inline ClassLoaderData* ClassLoaderData::class_loader_data_or_null(oop loader) {
f9ce2cd20dee 8008549: NPG: SystemDictionary::find(...) unnecessarily keeps class loaders alive
stefank
parents: 14588
diff changeset
    29
  if (loader == NULL) {
f9ce2cd20dee 8008549: NPG: SystemDictionary::find(...) unnecessarily keeps class loaders alive
stefank
parents: 14588
diff changeset
    30
    return ClassLoaderData::the_null_class_loader_data();
f9ce2cd20dee 8008549: NPG: SystemDictionary::find(...) unnecessarily keeps class loaders alive
stefank
parents: 14588
diff changeset
    31
  }
f9ce2cd20dee 8008549: NPG: SystemDictionary::find(...) unnecessarily keeps class loaders alive
stefank
parents: 14588
diff changeset
    32
  return java_lang_ClassLoader::loader_data(loader);
f9ce2cd20dee 8008549: NPG: SystemDictionary::find(...) unnecessarily keeps class loaders alive
stefank
parents: 14588
diff changeset
    33
}
f9ce2cd20dee 8008549: NPG: SystemDictionary::find(...) unnecessarily keeps class loaders alive
stefank
parents: 14588
diff changeset
    34
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    35
inline ClassLoaderData* ClassLoaderData::class_loader_data(oop loader) {
15847
f9ce2cd20dee 8008549: NPG: SystemDictionary::find(...) unnecessarily keeps class loaders alive
stefank
parents: 14588
diff changeset
    36
  ClassLoaderData* loader_data = class_loader_data_or_null(loader);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    37
  assert(loader_data != NULL, "Must be");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    38
  return loader_data;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    39
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    40
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    41
14588
8ec26d2d9339 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 13728
diff changeset
    42
inline ClassLoaderData *ClassLoaderDataGraph::find_or_create(Handle loader, TRAPS) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    43
  assert(loader() != NULL,"Must be a class loader");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    44
  // Gets the class loader data out of the java/lang/ClassLoader object, if non-null
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    45
  // it's already in the loader_data, so no need to add
17107
46fc21b30a1e 8011802: NPG: init_dependencies in class loader data graph can cause invalid CLD
mgerdin
parents: 15847
diff changeset
    46
  ClassLoaderData* loader_data= java_lang_ClassLoader::loader_data(loader());
46fc21b30a1e 8011802: NPG: init_dependencies in class loader data graph can cause invalid CLD
mgerdin
parents: 15847
diff changeset
    47
  if (loader_data) {
46fc21b30a1e 8011802: NPG: init_dependencies in class loader data graph can cause invalid CLD
mgerdin
parents: 15847
diff changeset
    48
     return loader_data;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    49
  }
17107
46fc21b30a1e 8011802: NPG: init_dependencies in class loader data graph can cause invalid CLD
mgerdin
parents: 15847
diff changeset
    50
  return ClassLoaderDataGraph::add(loader, false, THREAD);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff changeset
    51
}