src/hotspot/share/classfile/classLoader.inline.hpp
author ccheung
Wed, 02 Oct 2019 16:55:08 -0700
changeset 58447 319173c62caa
parent 54927 1512d88b24c6
child 59247 56bf71d64d51
permissions -rw-r--r--
8231606: _method_ordering is not set during CDS dynamic dump time Summary: Add the missing DynamicDumpSharedSpaces check in sort_methods(); replace the (DumpSharedSpaces || DynamicDumpSharedSpaces) with the Arguments::is_dumping_archive() function call. Reviewed-by: iklam, coleenp, jiangli
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49340
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50429
diff changeset
     2
 * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
49340
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
     4
 *
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
     7
 * published by the Free Software Foundation.
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
     8
 *
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    13
 * accompanied this code).
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    14
 *
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    18
 *
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    21
 * questions.
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    22
 *
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    23
 */
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50429
diff changeset
    25
#ifndef SHARE_CLASSFILE_CLASSLOADER_INLINE_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50429
diff changeset
    26
#define SHARE_CLASSFILE_CLASSLOADER_INLINE_HPP
49340
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    27
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    28
#include "classfile/classLoader.hpp"
50429
83aec1d357d4 8204301: Make OrderAccess functions available to hpp rather than inline.hpp files
coleenp
parents: 49340
diff changeset
    29
#include "runtime/orderAccess.hpp"
49340
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    30
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    31
// Next entry in class path
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    32
inline ClassPathEntry* ClassPathEntry::next() const { return OrderAccess::load_acquire(&_next); }
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    33
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    34
inline void ClassPathEntry::set_next(ClassPathEntry* next) {
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    35
  // may have unlocked readers, so ensure visibility.
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    36
  OrderAccess::release_store(&_next, next);
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    37
}
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    38
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    39
inline ClassPathEntry* ClassLoader::classpath_entry(int n) {
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    40
  assert(n >= 0, "sanity");
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    41
  if (n == 0) {
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    42
    assert(has_jrt_entry(), "No class path entry at 0 for exploded module builds");
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    43
    return ClassLoader::_jrt_entry;
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    44
  } else {
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    45
    // The java runtime image is always the first entry
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    46
    // in the FileMapInfo::_classpath_entry_table. Even though
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    47
    // the _jrt_entry is not included in the _first_append_entry
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    48
    // linked list, it must be accounted for when comparing the
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    49
    // class path vs. the shared archive class path.
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    50
    ClassPathEntry* e = ClassLoader::_first_append_entry;
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    51
    while (--n >= 1) {
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    52
      assert(e != NULL, "Not that many classpath entries.");
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    53
      e = e->next();
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    54
    }
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    55
    return e;
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    56
  }
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    57
}
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    58
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    59
#if INCLUDE_CDS
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    60
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    61
// Helper function used by CDS code to get the number of boot classpath
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    62
// entries during shared classpath setup time.
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    63
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    64
inline int ClassLoader::num_boot_classpath_entries() {
58447
319173c62caa 8231606: _method_ordering is not set during CDS dynamic dump time
ccheung
parents: 54927
diff changeset
    65
  Arguments::assert_is_dumping_archive();
49340
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    66
  assert(has_jrt_entry(), "must have a java runtime image");
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    67
  int num_entries = 1; // count the runtime image
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    68
  ClassPathEntry* e = ClassLoader::_first_append_entry;
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    69
  while (e != NULL) {
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    70
    num_entries ++;
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    71
    e = e->next();
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    72
  }
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    73
  return num_entries;
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    74
}
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    75
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    76
inline ClassPathEntry* ClassLoader::get_next_boot_classpath_entry(ClassPathEntry* e) {
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    77
  if (e == ClassLoader::_jrt_entry) {
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    78
    return ClassLoader::_first_append_entry;
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    79
  } else {
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    80
    return e->next();
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    81
  }
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    82
}
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    83
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    84
// Helper function used by CDS code to get the number of app classpath
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    85
// entries during shared classpath setup time.
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    86
inline int ClassLoader::num_app_classpath_entries() {
58447
319173c62caa 8231606: _method_ordering is not set during CDS dynamic dump time
ccheung
parents: 54927
diff changeset
    87
  Arguments::assert_is_dumping_archive();
49340
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    88
  int num_entries = 0;
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    89
  ClassPathEntry* e= ClassLoader::_app_classpath_entries;
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    90
  while (e != NULL) {
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    91
    num_entries ++;
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    92
    e = e->next();
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    93
  }
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    94
  return num_entries;
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    95
}
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    96
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    97
#endif // INCLUDE_CDS
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
diff changeset
    98
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50429
diff changeset
    99
#endif // SHARE_CLASSFILE_CLASSLOADER_INLINE_HPP