src/hotspot/share/classfile/systemDictionaryShared.hpp
author lfoltan
Mon, 21 Oct 2019 13:13:16 -0400
changeset 58722 cba8afa5cfed
parent 58542 94fe833a244b
child 58679 9c3209ff7550
child 59070 22ee476cc664
permissions -rw-r--r--
8231844: Enhance type signature characters in classfile_constants.h and improve the JVM to use type signature characters more consistently Summary: Increase the use of type signature constants instead of hard coded characters within the JVM. Reviewed-by: coleenp, dholmes, fparain Contributed-by: lois.foltan@oracle.com, john.r.rose@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26135
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52514
diff changeset
     2
 * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
26135
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
     4
 *
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
     7
 * published by the Free Software Foundation.
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
     8
 *
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    13
 * accompanied this code).
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    14
 *
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    18
 *
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    21
 * questions.
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    22
 *
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    23
 */
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52514
diff changeset
    25
#ifndef SHARE_CLASSFILE_SYSTEMDICTIONARYSHARED_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52514
diff changeset
    26
#define SHARE_CLASSFILE_SYSTEMDICTIONARYSHARED_HPP
26135
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    27
48138
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    28
#include "oops/klass.hpp"
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    29
#include "classfile/dictionary.hpp"
54347
235883996bc7 8221698: Remove redundant includes from popular header files
iklam
parents: 53884
diff changeset
    30
#include "classfile/packageEntry.hpp"
26135
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
    31
#include "classfile/systemDictionary.hpp"
48138
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    32
#include "memory/filemap.hpp"
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    33
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    34
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    35
/*===============================================================================
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    36
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    37
    Handling of the classes in the AppCDS archive
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    38
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    39
    To ensure safety and to simplify the implementation, archived classes are
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
    40
    "segregated" into 2 types. The following rules describe how they
48138
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    41
    are stored and looked up.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    42
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    43
[1] Category of archived classes
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    44
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
    45
    There are 2 disjoint groups of classes stored in the AppCDS archive:
48138
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    46
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    47
    BUILTIN:              These classes may be defined ONLY by the BOOT/PLATFORM/APP
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    48
                          loaders.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    49
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    50
    UNREGISTERED:         These classes may be defined ONLY by a ClassLoader
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    51
                          instance that's not listed above (using fingerprint matching)
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    52
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    53
[2] How classes from different categories are specified in the classlist:
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    54
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    55
    Starting from JDK9, each class in the classlist may be specified with
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    56
    these keywords: "id", "super", "interfaces", "loader" and "source".
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    57
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    58
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    59
    BUILTIN               Only the "id" keyword may be (optionally) specified. All other
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    60
                          keywords are forbidden.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    61
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    62
                          The named class is looked up from the jimage and from
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    63
                          Xbootclasspath/a and CLASSPATH.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    64
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    65
    UNREGISTERED:         The "id", "super", and "source" keywords must all be
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    66
                          specified.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    67
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    68
                          The "interfaces" keyword must be specified if the class implements
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    69
                          one or more local interfaces. The "interfaces" keyword must not be
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    70
                          specified if the class does not implement local interfaces.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    71
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    72
                          The named class is looked up from the location specified in the
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    73
                          "source" keyword.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    74
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    75
    Example classlist:
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    76
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    77
    # BUILTIN
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    78
    java/lang/Object id: 0
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    79
    java/lang/Cloneable id: 1
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    80
    java/lang/String
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    81
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    82
    # UNREGISTERED
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    83
    Bar id: 3 super: 0 interfaces: 1 source: /foo.jar
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    84
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    85
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
    86
[3] Identifying the category of archived classes
48138
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    87
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    88
    BUILTIN:              (C->shared_classpath_index() >= 0)
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
    89
    UNREGISTERED:         (C->shared_classpath_index() == UNREGISTERED_INDEX (-9999))
48138
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    90
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    91
[4] Lookup of archived classes at run time:
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    92
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    93
    (a) BUILTIN loaders:
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    94
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
    95
        search _builtin_dictionary
48138
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    96
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    97
    (b) UNREGISTERED loaders:
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
    98
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
    99
        search _unregistered_dictionary for an entry that matches the
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   100
        (name, clsfile_len, clsfile_crc32).
48138
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   101
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   102
===============================================================================*/
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   103
#define UNREGISTERED_INDEX -9999
34257
4be3504cc03b 8140802: Clean up and refactor of class loading code for CDS
iklam
parents: 26135
diff changeset
   104
4be3504cc03b 8140802: Clean up and refactor of class loading code for CDS
iklam
parents: 26135
diff changeset
   105
class ClassFileStream;
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   106
class DumpTimeSharedClassInfo;
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   107
class DumpTimeSharedClassTable;
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   108
class RunTimeSharedClassInfo;
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   109
class RunTimeSharedDictionary;
26135
82b516c550f7 8046070: Class Data Sharing clean up and refactoring
iklam
parents:
diff changeset
   110
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   111
class SystemDictionaryShared: public SystemDictionary {
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   112
  friend class ExcludeDumpTimeSharedClasses;
48138
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   113
public:
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   114
  enum {
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   115
    FROM_FIELD_IS_PROTECTED = 1 << 0,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   116
    FROM_IS_ARRAY           = 1 << 1,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   117
    FROM_IS_OBJECT          = 1 << 2
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   118
  };
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   119
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   120
private:
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   121
  // These _shared_xxxs arrays are used to initialize the java.lang.Package and
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   122
  // java.security.ProtectionDomain objects associated with each shared class.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   123
  //
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   124
  // See SystemDictionaryShared::init_security_info for more info.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   125
  static objArrayOop _shared_protection_domains;
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   126
  static objArrayOop _shared_jar_urls;
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   127
  static objArrayOop _shared_jar_manifests;
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   128
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   129
  static InstanceKlass* load_shared_class_for_builtin_loader(
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   130
                                               Symbol* class_name,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   131
                                               Handle class_loader,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   132
                                               TRAPS);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   133
  static Handle get_package_name(Symbol*  class_name, TRAPS);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   134
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   135
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   136
  // Package handling:
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   137
  //
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   138
  // 1. For named modules in the runtime image
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   139
  //    BOOT classes: Reuses the existing JVM_GetSystemPackage(s) interfaces
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   140
  //                  to get packages in named modules for shared classes.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   141
  //                  Package for non-shared classes in named module is also
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   142
  //                  handled using JVM_GetSystemPackage(s).
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   143
  //
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   144
  //    APP  classes: VM calls ClassLoaders.AppClassLoader::definePackage(String, Module)
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   145
  //                  to define package for shared app classes from named
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   146
  //                  modules.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   147
  //
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   148
  //    PLATFORM  classes: VM calls ClassLoaders.PlatformClassLoader::definePackage(String, Module)
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   149
  //                  to define package for shared platform classes from named
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   150
  //                  modules.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   151
  //
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   152
  // 2. For unnamed modules
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   153
  //    BOOT classes: Reuses the existing JVM_GetSystemPackage(s) interfaces to
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   154
  //                  get packages for shared boot classes in unnamed modules.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   155
  //
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   156
  //    APP  classes: VM calls ClassLoaders.AppClassLoader::defineOrCheckPackage()
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   157
  //                  with with the manifest and url from archived data.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   158
  //
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   159
  //    PLATFORM  classes: No package is defined.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   160
  //
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   161
  // The following two define_shared_package() functions are used to define
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   162
  // package for shared APP and PLATFORM classes.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   163
  static void define_shared_package(Symbol*  class_name,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   164
                                    Handle class_loader,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   165
                                    Handle manifest,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   166
                                    Handle url,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   167
                                    TRAPS);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   168
  static void define_shared_package(Symbol* class_name,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   169
                                    Handle class_loader,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   170
                                    ModuleEntry* mod_entry,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   171
                                    TRAPS);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   172
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   173
  static Handle get_shared_jar_manifest(int shared_path_index, TRAPS);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   174
  static Handle get_shared_jar_url(int shared_path_index, TRAPS);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   175
  static Handle get_protection_domain_from_classloader(Handle class_loader,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   176
                                                       Handle url, TRAPS);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   177
  static Handle get_shared_protection_domain(Handle class_loader,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   178
                                             int shared_path_index,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   179
                                             Handle url,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   180
                                             TRAPS);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   181
  static Handle get_shared_protection_domain(Handle class_loader,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   182
                                             ModuleEntry* mod, TRAPS);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   183
  static Handle init_security_info(Handle class_loader, InstanceKlass* ik, TRAPS);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   184
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   185
  static void atomic_set_array_index(objArrayOop array, int index, oop o) {
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   186
    // Benign race condition:  array.obj_at(index) may already be filled in.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   187
    // The important thing here is that all threads pick up the same result.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   188
    // It doesn't matter which racing thread wins, as long as only one
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   189
    // result is used by all threads, and all future queries.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   190
    array->atomic_compare_exchange_oop(index, o, NULL);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   191
  }
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   192
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   193
  static oop shared_protection_domain(int index);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   194
  static void atomic_set_shared_protection_domain(int index, oop pd) {
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   195
    atomic_set_array_index(_shared_protection_domains, index, pd);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   196
  }
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   197
  static void allocate_shared_protection_domain_array(int size, TRAPS);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   198
  static oop shared_jar_url(int index);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   199
  static void atomic_set_shared_jar_url(int index, oop url) {
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   200
    atomic_set_array_index(_shared_jar_urls, index, url);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   201
  }
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   202
  static void allocate_shared_jar_url_array(int size, TRAPS);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   203
  static oop shared_jar_manifest(int index);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   204
  static void atomic_set_shared_jar_manifest(int index, oop man) {
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   205
    atomic_set_array_index(_shared_jar_manifests, index, man);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   206
  }
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   207
  static void allocate_shared_jar_manifest_array(int size, TRAPS);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   208
  static InstanceKlass* acquire_class_for_current_thread(
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   209
                                 InstanceKlass *ik,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   210
                                 Handle class_loader,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   211
                                 Handle protection_domain,
53884
1a7b57d02107 8218751: Do not store original classfiles inside the CDS archive
iklam
parents: 53244
diff changeset
   212
                                 const ClassFileStream* cfs,
48138
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   213
                                 TRAPS);
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   214
  static DumpTimeSharedClassInfo* find_or_allocate_info_for(InstanceKlass* k);
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   215
  static void write_dictionary(RunTimeSharedDictionary* dictionary,
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   216
                               bool is_builtin,
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   217
                               bool is_static_archive = true);
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   218
  static bool is_jfr_event_class(InstanceKlass *k);
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   219
  static void warn_excluded(InstanceKlass* k, const char* reason);
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   220
  static bool should_be_excluded(InstanceKlass* k);
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   221
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   222
  DEBUG_ONLY(static bool _no_class_loading_should_happen;)
48138
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   223
public:
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   224
  static InstanceKlass* find_builtin_class(Symbol* class_name);
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   225
58542
94fe833a244b 8232071: Avoid shared dictionary lookup when the class name is not shared
iklam
parents: 58499
diff changeset
   226
  static const RunTimeSharedClassInfo* find_record(RunTimeSharedDictionary* static_dict,
94fe833a244b 8232071: Avoid shared dictionary lookup when the class name is not shared
iklam
parents: 58499
diff changeset
   227
                                                   RunTimeSharedDictionary* dynamic_dict,
94fe833a244b 8232071: Avoid shared dictionary lookup when the class name is not shared
iklam
parents: 58499
diff changeset
   228
                                                   Symbol* name);
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   229
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   230
  static bool has_platform_or_app_classes();
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   231
48138
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   232
  // Called by PLATFORM/APP loader only
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43410
diff changeset
   233
  static InstanceKlass* find_or_load_shared_class(Symbol* class_name,
48138
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   234
                                               Handle class_loader,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   235
                                               TRAPS);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   236
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   237
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   238
  static void allocate_shared_data_arrays(int size, TRAPS);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   239
  static void oops_do(OopClosure* f);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   240
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   241
  // Check if sharing is supported for the class loader.
49824
e242740a92b8 8201556: Disallow reading oops in ClassLoaderData if unloading
coleenp
parents: 48138
diff changeset
   242
  static bool is_sharing_possible(ClassLoaderData* loader_data);
48138
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   243
  static bool is_shared_class_visible_for_classloader(InstanceKlass* ik,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   244
                                                      Handle class_loader,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   245
                                                      Symbol* pkg_name,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   246
                                                      PackageEntry* pkg_entry,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   247
                                                      ModuleEntry* mod_entry,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   248
                                                      TRAPS);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   249
  static PackageEntry* get_package_entry(Symbol* pkg,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   250
                                         ClassLoaderData *loader_data) {
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   251
    if (loader_data != NULL) {
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   252
      PackageEntryTable* pkgEntryTable = loader_data->packages();
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   253
      return pkgEntryTable->lookup_only(pkg);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   254
    }
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   255
    return NULL;
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 34666
diff changeset
   256
  }
34257
4be3504cc03b 8140802: Clean up and refactor of class loading code for CDS
iklam
parents: 26135
diff changeset
   257
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   258
  static bool add_unregistered_class(InstanceKlass* k, TRAPS);
51329
9c68699bebe5 8208999: Some use of Klass* should be replaced by InstanceKlass*
iklam
parents: 50152
diff changeset
   259
  static InstanceKlass* dump_time_resolve_super_or_fail(Symbol* child_name,
34257
4be3504cc03b 8140802: Clean up and refactor of class loading code for CDS
iklam
parents: 26135
diff changeset
   260
                                                Symbol* class_name,
4be3504cc03b 8140802: Clean up and refactor of class loading code for CDS
iklam
parents: 26135
diff changeset
   261
                                                Handle class_loader,
4be3504cc03b 8140802: Clean up and refactor of class loading code for CDS
iklam
parents: 26135
diff changeset
   262
                                                Handle protection_domain,
4be3504cc03b 8140802: Clean up and refactor of class loading code for CDS
iklam
parents: 26135
diff changeset
   263
                                                bool is_superclass,
48138
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   264
                                                TRAPS);
34257
4be3504cc03b 8140802: Clean up and refactor of class loading code for CDS
iklam
parents: 26135
diff changeset
   265
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   266
  static void init_dumptime_info(InstanceKlass* k) NOT_CDS_RETURN;
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   267
  static void remove_dumptime_info(InstanceKlass* k) NOT_CDS_RETURN;
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   268
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   269
  static Dictionary* boot_loader_dictionary() {
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   270
    return ClassLoaderData::the_null_class_loader_data()->dictionary();
34257
4be3504cc03b 8140802: Clean up and refactor of class loading code for CDS
iklam
parents: 26135
diff changeset
   271
  }
4be3504cc03b 8140802: Clean up and refactor of class loading code for CDS
iklam
parents: 26135
diff changeset
   272
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   273
  static void update_shared_entry(InstanceKlass* klass, int id);
51329
9c68699bebe5 8208999: Some use of Klass* should be replaced by InstanceKlass*
iklam
parents: 50152
diff changeset
   274
  static void set_shared_class_misc_info(InstanceKlass* k, ClassFileStream* cfs);
48138
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   275
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   276
  static InstanceKlass* lookup_from_stream(Symbol* class_name,
34257
4be3504cc03b 8140802: Clean up and refactor of class loading code for CDS
iklam
parents: 26135
diff changeset
   277
                                           Handle class_loader,
4be3504cc03b 8140802: Clean up and refactor of class loading code for CDS
iklam
parents: 26135
diff changeset
   278
                                           Handle protection_domain,
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34257
diff changeset
   279
                                           const ClassFileStream* st,
48138
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   280
                                           TRAPS);
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   281
  // "verification_constraints" are a set of checks performed by
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   282
  // VerificationType::is_reference_assignable_from when verifying a shared class during
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   283
  // dump time.
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   284
  //
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   285
  // With AppCDS, it is possible to override archived classes by calling
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   286
  // ClassLoader.defineClass() directly. SystemDictionary::load_shared_class() already
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   287
  // ensures that you cannot load a shared class if its super type(s) are changed. However,
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   288
  // we need an additional check to ensure that the verification_constraints did not change
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   289
  // between dump time and runtime.
51329
9c68699bebe5 8208999: Some use of Klass* should be replaced by InstanceKlass*
iklam
parents: 50152
diff changeset
   290
  static bool add_verification_constraint(InstanceKlass* k, Symbol* name,
39713
29ece76096cb 8150752: Share Class Data
iklam
parents: 39216
diff changeset
   291
                  Symbol* from_name, bool from_field_is_protected,
48138
78b2ecdd3c4b 8188791: Move AppCDS from closed repo to open repo
iklam
parents: 47216
diff changeset
   292
                  bool from_is_array, bool from_is_object) NOT_CDS_RETURN_(false);
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 43410
diff changeset
   293
  static void check_verification_constraints(InstanceKlass* klass,
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   294
                                             TRAPS) NOT_CDS_RETURN;
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   295
  static bool is_builtin(InstanceKlass* k) {
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   296
    return (k->shared_classpath_index() != UNREGISTERED_INDEX);
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   297
  }
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   298
  static void check_excluded_classes();
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   299
  static void validate_before_archiving(InstanceKlass* k);
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   300
  static bool is_excluded_class(InstanceKlass* k);
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   301
  static void dumptime_classes_do(class MetaspaceClosure* it);
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   302
  static size_t estimate_size_for_archive();
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   303
  static void write_to_archive(bool is_static_archive = true);
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   304
  static void serialize_dictionary_headers(class SerializeClosure* soc,
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   305
                                           bool is_static_archive = true);
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   306
  static void print() { return print_on(tty); }
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   307
  static void print_on(outputStream* st) NOT_CDS_RETURN;
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   308
  static void print_table_statistics(outputStream* st) NOT_CDS_RETURN;
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   309
  static bool empty_dumptime_table() NOT_CDS_RETURN_(true);
52514
f4e3900c8d08 8213346: Re-implement shared dictionary using CompactHashtable
iklam
parents: 52468
diff changeset
   310
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   311
  DEBUG_ONLY(static bool no_class_loading_should_happen() {return _no_class_loading_should_happen;})
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   312
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   313
#ifdef ASSERT
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   314
  class NoClassLoadingMark: public StackObj {
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   315
  public:
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   316
    NoClassLoadingMark() {
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   317
      assert(!_no_class_loading_should_happen, "must not be nested");
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   318
      _no_class_loading_should_happen = true;
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   319
    }
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   320
    ~NoClassLoadingMark() {
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   321
      _no_class_loading_should_happen = false;
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   322
    }
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   323
  };
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   324
#endif
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54807
diff changeset
   325
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents: 46729
diff changeset
   326
};
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents: 46729
diff changeset
   327
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52514
diff changeset
   328
#endif // SHARE_CLASSFILE_SYSTEMDICTIONARYSHARED_HPP