src/hotspot/share/memory/metaspaceClosure.hpp
author iklam
Wed, 13 Nov 2019 16:36:54 -0800
changeset 59070 22ee476cc664
parent 54927 1512d88b24c6
permissions -rw-r--r--
8231610: Relocate the CDS archive if it cannot be mapped to the requested address Reviewed-by: jiangli, coleenp, ccheung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52631
diff changeset
     2
 * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
     4
 *
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
     7
 * published by the Free Software Foundation.
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
     8
 *
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    13
 * accompanied this code).
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    14
 *
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    18
 *
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    21
 * questions.
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    22
 *
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    23
 */
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52631
diff changeset
    25
#ifndef SHARE_MEMORY_METASPACECLOSURE_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52631
diff changeset
    26
#define SHARE_MEMORY_METASPACECLOSURE_HPP
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    27
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    28
#include "logging/log.hpp"
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    29
#include "memory/allocation.hpp"
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    30
#include "oops/array.hpp"
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    31
#include "utilities/growableArray.hpp"
52631
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents: 47216
diff changeset
    32
#include "utilities/hashtable.inline.hpp"
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    33
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    34
// The metadata hierarchy is separate from the oop hierarchy
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    35
  class MetaspaceObj;        // no C++ vtable
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    36
//class   Array;             // no C++ vtable
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    37
  class   Annotations;       // no C++ vtable
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    38
  class   ConstantPoolCache; // no C++ vtable
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    39
  class   ConstMethod;       // no C++ vtable
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    40
  class   MethodCounters;    // no C++ vtable
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    41
  class   Symbol;            // no C++ vtable
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    42
  class   Metadata;          // has C++ vtable (so do all subclasses)
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    43
  class     ConstantPool;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    44
  class     MethodData;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    45
  class     Method;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    46
  class     Klass;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    47
  class       InstanceKlass;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    48
  class         InstanceMirrorKlass;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    49
  class         InstanceClassLoaderKlass;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    50
  class         InstanceRefKlass;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    51
  class       ArrayKlass;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    52
  class         ObjArrayKlass;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    53
  class         TypeArrayKlass;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    54
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    55
// class MetaspaceClosure --
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    56
//
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    57
// This class is used for iterating the objects in the HotSpot Metaspaces. It
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    58
// provides an API to walk all the reachable objects starting from a set of
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    59
// root references (such as all Klass'es in the SystemDictionary).
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    60
//
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    61
// Currently it is used for compacting the CDS archive by eliminate temporary
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    62
// objects allocated during archive creation time. See ArchiveCompactor in
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    63
// metaspaceShared.cpp for an example.
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    64
//
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    65
// To support MetaspaceClosure, each subclass of MetaspaceObj must provide
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    66
// a method of the type void metaspace_pointers_do(MetaspaceClosure*). This method
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    67
// should call MetaspaceClosure::push() on every pointer fields of this
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    68
// class that points to a MetaspaceObj. See Annotations::metaspace_pointers_do()
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    69
// for an example.
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    70
class MetaspaceClosure {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    71
public:
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    72
  enum Writability {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    73
    _writable,
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    74
    _not_writable,
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    75
    _default
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    76
  };
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    77
59070
22ee476cc664 8231610: Relocate the CDS archive if it cannot be mapped to the requested address
iklam
parents: 54927
diff changeset
    78
  enum SpecialRef {
22ee476cc664 8231610: Relocate the CDS archive if it cannot be mapped to the requested address
iklam
parents: 54927
diff changeset
    79
    _method_entry_ref
22ee476cc664 8231610: Relocate the CDS archive if it cannot be mapped to the requested address
iklam
parents: 54927
diff changeset
    80
  };
22ee476cc664 8231610: Relocate the CDS archive if it cannot be mapped to the requested address
iklam
parents: 54927
diff changeset
    81
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    82
  // class MetaspaceClosure::Ref --
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    83
  //
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    84
  // MetaspaceClosure can be viewed as a very simple type of copying garbage
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    85
  // collector. For it to function properly, it requires each subclass of
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    86
  // MetaspaceObj to provide two methods:
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    87
  //
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    88
  //  size_t size();                                 -- to determine how much data to copy
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    89
  //  void metaspace_pointers_do(MetaspaceClosure*); -- to locate all the embedded pointers
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    90
  //
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    91
  // Calling these methods would be trivial if these two were virtual methods.
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    92
  // However, to save space, MetaspaceObj has NO vtable. The vtable is introduced
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    93
  // only in the Metadata class.
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    94
  //
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    95
  // To work around the lack of a vtable, we use Ref class with templates
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    96
  // (see ObjectRef, PrimitiveArrayRef and PointerArrayRef)
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    97
  // so that we can statically discover the type of a object. The use of Ref
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    98
  // depends on the fact that:
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
    99
  //
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   100
  // [1] We don't use polymorphic pointers for MetaspaceObj's that are not subclasses
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   101
  //     of Metadata. I.e., we don't do this:
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   102
  //     class Klass {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   103
  //         MetaspaceObj *_obj;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   104
  //         Array<int>* foo() { return (Array<int>*)_obj; }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   105
  //         Symbol*     bar() { return (Symbol*)    _obj; }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   106
  //
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   107
  // [2] All Array<T> dimensions are statically declared.
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   108
  class Ref : public CHeapObj<mtInternal> {
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   109
    Writability _writability;
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   110
    Ref* _next;
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   111
    // Noncopyable.
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   112
    Ref(const Ref&);
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   113
    Ref& operator=(const Ref&);
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   114
  protected:
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   115
    virtual void** mpp() const = 0;
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   116
    Ref(Writability w) : _writability(w), _next(NULL) {}
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   117
  public:
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   118
    virtual bool not_null() const = 0;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   119
    virtual int size() const = 0;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   120
    virtual void metaspace_pointers_do(MetaspaceClosure *it) const = 0;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   121
    virtual void metaspace_pointers_do_at(MetaspaceClosure *it, address new_loc) const = 0;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   122
    virtual MetaspaceObj::Type msotype() const = 0;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   123
    virtual bool is_read_only_by_default() const = 0;
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   124
    virtual ~Ref() {}
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   125
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   126
    address obj() const {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   127
      // In some rare cases (see CPSlot in constantPool.hpp) we store some flags in the lowest
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   128
      // 2 bits of a MetaspaceObj pointer. Unmask these when manipulating the pointer.
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   129
      uintx p = (uintx)*mpp();
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   130
      return (address)(p & (~FLAG_MASK));
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   131
    }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   132
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   133
    address* addr() const {
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   134
      return (address*)mpp();
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   135
    }
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   136
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   137
    void update(address new_loc) const;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   138
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   139
    Writability writability() const { return _writability; };
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   140
    void set_next(Ref* n)           { _next = n; }
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   141
    Ref* next() const               { return _next; }
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   142
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   143
  private:
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   144
    static const uintx FLAG_MASK = 0x03;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   145
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   146
    int flag_bits() const {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   147
      uintx p = (uintx)*mpp();
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   148
      return (int)(p & FLAG_MASK);
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   149
    }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   150
  };
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   151
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   152
private:
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   153
  // -------------------------------------------------- ObjectRef
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   154
  template <class T> class ObjectRef : public Ref {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   155
    T** _mpp;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   156
    T* dereference() const {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   157
      return *_mpp;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   158
    }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   159
  protected:
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   160
    virtual void** mpp() const {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   161
      return (void**)_mpp;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   162
    }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   163
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   164
  public:
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   165
    ObjectRef(T** mpp, Writability w) : Ref(w), _mpp(mpp) {}
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   166
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   167
    virtual bool is_read_only_by_default() const { return T::is_read_only_by_default(); }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   168
    virtual bool not_null()                const { return dereference() != NULL; }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   169
    virtual int size()                     const { return dereference()->size(); }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   170
    virtual MetaspaceObj::Type msotype()   const { return dereference()->type(); }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   171
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   172
    virtual void metaspace_pointers_do(MetaspaceClosure *it) const {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   173
      dereference()->metaspace_pointers_do(it);
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   174
    }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   175
    virtual void metaspace_pointers_do_at(MetaspaceClosure *it, address new_loc) const {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   176
      ((T*)new_loc)->metaspace_pointers_do(it);
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   177
    }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   178
  };
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   179
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   180
  // -------------------------------------------------- PrimitiveArrayRef
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   181
  template <class T> class PrimitiveArrayRef : public Ref {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   182
    Array<T>** _mpp;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   183
    Array<T>* dereference() const {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   184
      return *_mpp;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   185
    }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   186
  protected:
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   187
    virtual void** mpp() const {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   188
      return (void**)_mpp;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   189
    }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   190
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   191
  public:
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   192
    PrimitiveArrayRef(Array<T>** mpp, Writability w) : Ref(w), _mpp(mpp) {}
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   193
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   194
    // all Arrays are read-only by default
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   195
    virtual bool is_read_only_by_default() const { return true; }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   196
    virtual bool not_null()                const { return dereference() != NULL;  }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   197
    virtual int size()                     const { return dereference()->size(); }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   198
    virtual MetaspaceObj::Type msotype()   const { return MetaspaceObj::array_type(sizeof(T)); }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   199
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   200
    virtual void metaspace_pointers_do(MetaspaceClosure *it) const {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   201
      Array<T>* array = dereference();
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   202
      log_trace(cds)("Iter(PrimitiveArray): %p [%d]", array, array->length());
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   203
    }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   204
    virtual void metaspace_pointers_do_at(MetaspaceClosure *it, address new_loc) const {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   205
      Array<T>* array = (Array<T>*)new_loc;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   206
      log_trace(cds)("Iter(PrimitiveArray): %p [%d]", array, array->length());
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   207
    }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   208
  };
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   209
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   210
  // -------------------------------------------------- PointerArrayRef
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   211
  template <class T> class PointerArrayRef : public Ref {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   212
    Array<T*>** _mpp;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   213
    Array<T*>* dereference() const {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   214
      return *_mpp;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   215
    }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   216
  protected:
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   217
    virtual void** mpp() const {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   218
      return (void**)_mpp;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   219
    }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   220
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   221
  public:
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   222
    PointerArrayRef(Array<T*>** mpp, Writability w) : Ref(w), _mpp(mpp) {}
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   223
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   224
    // all Arrays are read-only by default
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   225
    virtual bool is_read_only_by_default() const { return true; }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   226
    virtual bool not_null()                const { return dereference() != NULL; }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   227
    virtual int size()                     const { return dereference()->size(); }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   228
    virtual MetaspaceObj::Type msotype()   const { return MetaspaceObj::array_type(sizeof(T*)); }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   229
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   230
    virtual void metaspace_pointers_do(MetaspaceClosure *it) const {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   231
      metaspace_pointers_do_at_impl(it, dereference());
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   232
    }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   233
    virtual void metaspace_pointers_do_at(MetaspaceClosure *it, address new_loc) const {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   234
      metaspace_pointers_do_at_impl(it, (Array<T*>*)new_loc);
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   235
    }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   236
  private:
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   237
    void metaspace_pointers_do_at_impl(MetaspaceClosure *it, Array<T*>* array) const {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   238
      log_trace(cds)("Iter(ObjectArray): %p [%d]", array, array->length());
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   239
      for (int i = 0; i < array->length(); i++) {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   240
        T** mpp = array->adr_at(i);
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   241
        it->push(mpp);
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   242
      }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   243
    }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   244
  };
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   245
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   246
  // If recursion is too deep, save the Refs in _pending_refs, and push them later using
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   247
  // MetaspaceClosure::finish()
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   248
  static const int MAX_NEST_LEVEL = 5;
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   249
  Ref* _pending_refs;
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   250
  int _nest_level;
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   251
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   252
  void push_impl(Ref* ref);
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   253
  void do_push(Ref* ref);
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   254
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   255
public:
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   256
  MetaspaceClosure(): _pending_refs(NULL), _nest_level(0) {}
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   257
  ~MetaspaceClosure();
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   258
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   259
  void finish();
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   260
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   261
  // returns true if we want to keep iterating the pointers embedded inside <ref>
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   262
  virtual bool do_ref(Ref* ref, bool read_only) = 0;
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   263
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   264
  // When you do:
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   265
  //     void MyType::metaspace_pointers_do(MetaspaceClosure* it) {
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   266
  //       it->push(_my_field)
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   267
  //
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   268
  // C++ will try to match the "most specific" template function. This one will
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   269
  // will be matched if possible (if mpp is an Array<> of any pointer type).
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   270
  template <typename T> void push(Array<T*>** mpp, Writability w = _default) {
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   271
    push_impl(new PointerArrayRef<T>(mpp, w));
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   272
  }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   273
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   274
  // If the above function doesn't match (mpp is an Array<>, but T is not a pointer type), then
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   275
  // this is the second choice.
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   276
  template <typename T> void push(Array<T>** mpp, Writability w = _default) {
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   277
    push_impl(new PrimitiveArrayRef<T>(mpp, w));
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   278
  }
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   279
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   280
  // If the above function doesn't match (mpp is not an Array<> type), then
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   281
  // this will be matched by default.
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   282
  template <class T> void push(T** mpp, Writability w = _default) {
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   283
    push_impl(new ObjectRef<T>(mpp, w));
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   284
  }
59070
22ee476cc664 8231610: Relocate the CDS archive if it cannot be mapped to the requested address
iklam
parents: 54927
diff changeset
   285
22ee476cc664 8231610: Relocate the CDS archive if it cannot be mapped to the requested address
iklam
parents: 54927
diff changeset
   286
  template <class T> void push_method_entry(T** mpp, intptr_t* p) {
22ee476cc664 8231610: Relocate the CDS archive if it cannot be mapped to the requested address
iklam
parents: 54927
diff changeset
   287
    push_special(_method_entry_ref, new ObjectRef<T>(mpp, _default), (intptr_t*)p);
22ee476cc664 8231610: Relocate the CDS archive if it cannot be mapped to the requested address
iklam
parents: 54927
diff changeset
   288
  }
22ee476cc664 8231610: Relocate the CDS archive if it cannot be mapped to the requested address
iklam
parents: 54927
diff changeset
   289
22ee476cc664 8231610: Relocate the CDS archive if it cannot be mapped to the requested address
iklam
parents: 54927
diff changeset
   290
  // This is for tagging special pointers that are not a reference to MetaspaceObj. It's currently
22ee476cc664 8231610: Relocate the CDS archive if it cannot be mapped to the requested address
iklam
parents: 54927
diff changeset
   291
  // used to mark the method entry points in Method/ConstMethod.
22ee476cc664 8231610: Relocate the CDS archive if it cannot be mapped to the requested address
iklam
parents: 54927
diff changeset
   292
  virtual void push_special(SpecialRef type, Ref* obj, intptr_t* p) {
22ee476cc664 8231610: Relocate the CDS archive if it cannot be mapped to the requested address
iklam
parents: 54927
diff changeset
   293
    assert(type == _method_entry_ref, "only special type allowed for now");
22ee476cc664 8231610: Relocate the CDS archive if it cannot be mapped to the requested address
iklam
parents: 54927
diff changeset
   294
  }
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   295
};
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   296
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   297
// This is a special MetaspaceClosure that visits each unique MetaspaceObj once.
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   298
class UniqueMetaspaceClosure : public MetaspaceClosure {
52631
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents: 47216
diff changeset
   299
  static const int INITIAL_TABLE_SIZE = 15889;
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents: 47216
diff changeset
   300
  static const int MAX_TABLE_SIZE     = 1000000;
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents: 47216
diff changeset
   301
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   302
  // Do not override. Returns true if we are discovering ref->obj() for the first time.
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   303
  virtual bool do_ref(Ref* ref, bool read_only);
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   304
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   305
public:
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   306
  // Gets called the first time we discover an object.
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 53244
diff changeset
   307
  virtual bool do_unique_ref(Ref* ref, bool read_only) = 0;
52631
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents: 47216
diff changeset
   308
  UniqueMetaspaceClosure() : _has_been_visited(INITIAL_TABLE_SIZE) {}
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents: 47216
diff changeset
   309
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   310
private:
52631
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents: 47216
diff changeset
   311
  KVHashtable<address, bool, mtInternal> _has_been_visited;
46746
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   312
};
ea379ebb9447 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
diff changeset
   313
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52631
diff changeset
   314
#endif // SHARE_MEMORY_METASPACECLOSURE_HPP