src/hotspot/share/memory/heapShared.hpp
author jiangli
Tue, 09 Oct 2018 15:58:07 -0400
changeset 52062 8dbf1a13af49
parent 52047 7bc8b456e5ac
child 52402 72d4e10305b9
permissions -rw-r--r--
8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp Summary: Restructure and cleanup java heap object archiving code. Reviewed-by: coleenp, iklam
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
     1
/*
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
     4
 *
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
     7
 * published by the Free Software Foundation.
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
     8
 *
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    13
 * accompanied this code).
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    14
 *
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    18
 *
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    21
 * questions.
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    22
 *
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    23
 */
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    24
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    25
#ifndef SHARE_VM_MEMORY_HEAPSHARED_HPP
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    26
#define SHARE_VM_MEMORY_HEAPSHARED_HPP
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    27
52047
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
    28
#include "classfile/compactHashtable.hpp"
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    29
#include "classfile/systemDictionary.hpp"
51701
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
    30
#include "memory/allocation.hpp"
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    31
#include "memory/universe.hpp"
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    32
#include "oops/objArrayKlass.hpp"
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    33
#include "oops/oop.hpp"
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    34
#include "oops/typeArrayKlass.hpp"
51491
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
    35
#include "utilities/bitMap.hpp"
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    36
#include "utilities/growableArray.hpp"
51701
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
    37
#include "utilities/resourceHash.hpp"
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    38
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    39
#if INCLUDE_CDS_JAVA_HEAP
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    40
// A dump time sub-graph info for Klass _k. It includes the entry points
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    41
// (static fields in _k's mirror) of the archived sub-graphs reachable
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    42
// from _k's mirror. It also contains a list of Klasses of the objects
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    43
// within the sub-graphs.
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    44
class KlassSubGraphInfo: public CHeapObj<mtClass> {
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    45
 private:
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    46
  // The class that contains the static field(s) as the entry point(s)
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    47
  // of archived object sub-graph(s).
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    48
  Klass* _k;
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    49
  // A list of classes need to be loaded and initialized before the archived
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    50
  // object sub-graphs can be accessed at runtime.
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    51
  GrowableArray<Klass*>* _subgraph_object_klasses;
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    52
  // A list of _k's static fields as the entry points of archived sub-graphs.
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    53
  // For each entry field, it is a pair of field_offset and field_value.
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    54
  GrowableArray<juint>*  _subgraph_entry_fields;
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    55
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    56
 public:
52047
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
    57
  KlassSubGraphInfo(Klass* k) :
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
    58
    _k(k),  _subgraph_object_klasses(NULL),
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    59
    _subgraph_entry_fields(NULL) {}
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    60
  ~KlassSubGraphInfo() {
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    61
    if (_subgraph_object_klasses != NULL) {
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    62
      delete _subgraph_object_klasses;
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    63
    }
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    64
    if (_subgraph_entry_fields != NULL) {
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    65
      delete _subgraph_entry_fields;
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    66
    }
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    67
  };
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    68
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    69
  Klass* klass()            { return _k; }
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    70
  GrowableArray<Klass*>* subgraph_object_klasses() {
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    71
    return _subgraph_object_klasses;
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    72
  }
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    73
  GrowableArray<juint>*  subgraph_entry_fields() {
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    74
    return _subgraph_entry_fields;
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    75
  }
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    76
  void add_subgraph_entry_field(int static_field_offset, oop v);
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    77
  void add_subgraph_object_klass(Klass *orig_k, Klass *relocated_k);
51701
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
    78
  int num_subgraph_object_klasses() {
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
    79
    return _subgraph_object_klasses == NULL ? 0 :
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
    80
           _subgraph_object_klasses->length();
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
    81
  }
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    82
};
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    83
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    84
// An archived record of object sub-graphs reachable from static
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    85
// fields within _k's mirror. The record is reloaded from the archive
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    86
// at runtime.
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    87
class ArchivedKlassSubGraphInfoRecord {
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    88
 private:
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    89
  Klass* _k;
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    90
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    91
  // contains pairs of field offset and value for each subgraph entry field
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    92
  Array<juint>* _entry_field_records;
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    93
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    94
  // klasses of objects in archived sub-graphs referenced from the entry points
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    95
  // (static fields) in the containing class
51701
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
    96
  Array<Klass*>* _subgraph_object_klasses;
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    97
 public:
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
    98
  ArchivedKlassSubGraphInfoRecord() :
52047
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
    99
    _k(NULL), _entry_field_records(NULL), _subgraph_object_klasses(NULL) {}
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   100
  void init(KlassSubGraphInfo* info);
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   101
  Klass* klass() { return _k; }
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   102
  Array<juint>*  entry_field_records() { return _entry_field_records; }
51701
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   103
  Array<Klass*>* subgraph_object_klasses() { return _subgraph_object_klasses; }
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   104
};
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   105
#endif // INCLUDE_CDS_JAVA_HEAP
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   106
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   107
class HeapShared: AllStatic {
51701
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   108
  friend class VerifySharedOopClosure;
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   109
 private:
52062
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   110
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   111
#if INCLUDE_CDS_JAVA_HEAP
52062
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   112
  static bool _open_archive_heap_region_mapped;
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   113
  static bool _archive_heap_region_fixed;
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   114
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   115
  static bool oop_equals(oop const& p1, oop const& p2) {
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   116
    return oopDesc::equals(p1, p2);
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   117
  }
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   118
  static unsigned oop_hash(oop const& p);
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   119
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   120
  typedef ResourceHashtable<oop, oop,
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   121
      HeapShared::oop_hash,
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   122
      HeapShared::oop_equals,
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   123
      15889, // prime number
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   124
      ResourceObj::C_HEAP> ArchivedObjectCache;
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   125
  static ArchivedObjectCache* _archived_object_cache;
52047
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   126
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   127
  static bool klass_equals(Klass* const& p1, Klass* const& p2) {
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   128
    return primitive_equals<Klass*>(p1, p2);
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   129
  }
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   130
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   131
  static unsigned klass_hash(Klass* const& klass) {
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   132
    return primitive_hash<address>((address)klass);
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   133
  }
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   134
52047
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   135
  class DumpTimeKlassSubGraphInfoTable
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   136
    : public ResourceHashtable<Klass*, KlassSubGraphInfo,
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   137
                               HeapShared::klass_hash,
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   138
                               HeapShared::klass_equals,
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   139
                               137, // prime number
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   140
                               ResourceObj::C_HEAP> {
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   141
  public:
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   142
    int _count;
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   143
  };
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   144
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   145
  inline static ArchivedKlassSubGraphInfoRecord* read_record_from_compact_hashtable(address base_address, u4 offset) {
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   146
    return (ArchivedKlassSubGraphInfoRecord*)(base_address + offset);
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   147
  }
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   148
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   149
  inline static bool record_equals_compact_hashtable_entry(ArchivedKlassSubGraphInfoRecord* value, const Klass* key, int len_unused) {
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   150
    return (value->klass() == key);
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   151
  }
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   152
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   153
  typedef CompactHashtable<
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   154
    const Klass*,
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   155
    ArchivedKlassSubGraphInfoRecord*,
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   156
    read_record_from_compact_hashtable,
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   157
    record_equals_compact_hashtable_entry
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   158
    > RunTimeKlassSubGraphInfoTable;
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   159
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   160
  static DumpTimeKlassSubGraphInfoTable* _dump_time_subgraph_info_table;
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   161
  static RunTimeKlassSubGraphInfoTable _run_time_subgraph_info_table;
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   162
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   163
  // Archive object sub-graph starting from the given static field
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   164
  // in Klass k's mirror.
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   165
  static void archive_reachable_objects_from_static_field(
51701
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   166
    InstanceKlass* k, const char* klass_name,
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   167
    int field_offset, const char* field_name, TRAPS);
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   168
  static void verify_subgraph_from_static_field(
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   169
    InstanceKlass* k, int field_offset) PRODUCT_RETURN;
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   170
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   171
  static void verify_reachable_objects_from(oop obj, bool is_archived) PRODUCT_RETURN;
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   172
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   173
  static KlassSubGraphInfo* get_subgraph_info(Klass *k);
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   174
  static int num_of_subgraph_infos();
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   175
52047
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   176
  static void build_archived_subgraph_info_records(int num_records);
51491
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
   177
51720
b7bfd64e43a6 8210523: runtime/appcds/cacheObject/DifferentHeapSizes.java crash
iklam
parents: 51701
diff changeset
   178
  // Used by decode_from_archive
51491
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
   179
  static address _narrow_oop_base;
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
   180
  static int     _narrow_oop_shift;
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
   181
51701
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   182
  typedef ResourceHashtable<oop, bool,
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   183
      HeapShared::oop_hash,
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   184
      HeapShared::oop_equals,
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   185
      15889, // prime number
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   186
      ResourceObj::C_HEAP> SeenObjectsTable;
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   187
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   188
  static SeenObjectsTable *_seen_objects_table;
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   189
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   190
  static void init_seen_objects_table() {
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   191
    assert(_seen_objects_table == NULL, "must be");
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   192
    _seen_objects_table = new (ResourceObj::C_HEAP, mtClass)SeenObjectsTable();
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   193
  }
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   194
  static void delete_seen_objects_table() {
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   195
    assert(_seen_objects_table != NULL, "must be");
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   196
    delete _seen_objects_table;
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   197
    _seen_objects_table = NULL;
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   198
  }
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   199
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   200
  // Statistics (for one round of start_recording_subgraph ... done_recording_subgraph)
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   201
  static int _num_new_walked_objs;
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   202
  static int _num_new_archived_objs;
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   203
  static int _num_old_recorded_klasses;
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   204
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   205
  // Statistics (for all archived subgraphs)
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   206
  static int _num_total_subgraph_recordings;
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   207
  static int _num_total_walked_objs;
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   208
  static int _num_total_archived_objs;
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   209
  static int _num_total_recorded_klasses;
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   210
  static int _num_total_verifications;
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   211
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   212
  static void start_recording_subgraph(InstanceKlass *k, const char* klass_name);
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   213
  static void done_recording_subgraph(InstanceKlass *k, const char* klass_name);
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   214
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   215
  static bool has_been_seen_during_subgraph_recording(oop obj);
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   216
  static void set_has_been_seen_during_subgraph_recording(oop obj);
52062
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   217
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   218
 public:
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   219
  static void create_archived_object_cache() {
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   220
    _archived_object_cache =
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   221
      new (ResourceObj::C_HEAP, mtClass)ArchivedObjectCache();
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   222
  }
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   223
  static void destroy_archived_object_cache() {
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   224
    delete _archived_object_cache;
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   225
    _archived_object_cache = NULL;
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   226
  }
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   227
  static ArchivedObjectCache* archived_object_cache() {
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   228
    return _archived_object_cache;
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   229
  }
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   230
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   231
  static oop find_archived_heap_object(oop obj);
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   232
  static oop archive_heap_object(oop obj, Thread* THREAD);
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   233
  static oop materialize_archived_object(narrowOop v);
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   234
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   235
  static void archive_klass_objects(Thread* THREAD);
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   236
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   237
  static void set_archive_heap_region_fixed() {
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   238
    _archive_heap_region_fixed = true;
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   239
  }
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   240
  static bool archive_heap_region_fixed() {
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   241
    return _archive_heap_region_fixed;
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   242
  }
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   243
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   244
  static void archive_java_heap_objects(GrowableArray<MemRegion> *closed,
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   245
                                        GrowableArray<MemRegion> *open);
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   246
  static void copy_closed_archive_heap_objects(GrowableArray<MemRegion> * closed_archive);
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   247
  static void copy_open_archive_heap_objects(GrowableArray<MemRegion> * open_archive);
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   248
#endif // INCLUDE_CDS_JAVA_HEAP
52062
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   249
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   250
 public:
52062
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   251
  static bool is_heap_object_archiving_allowed() {
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   252
    CDS_JAVA_HEAP_ONLY(return (UseG1GC && UseCompressedOops && UseCompressedClassPointers);)
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   253
    NOT_CDS_JAVA_HEAP(return false;)
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   254
  }
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   255
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   256
  static void set_open_archive_heap_region_mapped() {
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   257
    CDS_JAVA_HEAP_ONLY(_open_archive_heap_region_mapped = true);
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   258
    NOT_CDS_JAVA_HEAP_RETURN;
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   259
  }
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   260
  static bool open_archive_heap_region_mapped() {
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   261
    CDS_JAVA_HEAP_ONLY(return _open_archive_heap_region_mapped);
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   262
    NOT_CDS_JAVA_HEAP_RETURN_(false);
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   263
  }
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   264
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   265
  static void fixup_mapped_heap_regions() NOT_CDS_JAVA_HEAP_RETURN;
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   266
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   267
  inline static bool is_archived_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   268
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   269
  static void archive_java_heap_objects() NOT_CDS_JAVA_HEAP_RETURN;
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   270
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   271
  static char* read_archived_subgraph_infos(char* buffer) NOT_CDS_JAVA_HEAP_RETURN_(buffer);
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   272
  static void write_archived_subgraph_infos() NOT_CDS_JAVA_HEAP_RETURN;
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   273
  static void initialize_from_archived_subgraph(Klass* k) NOT_CDS_JAVA_HEAP_RETURN;
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   274
51491
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
   275
  // NarrowOops stored in the CDS archive may use a different encoding scheme
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
   276
  // than Universe::narrow_oop_{base,shift} -- see FileMapInfo::map_heap_regions_impl.
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
   277
  // To decode them, do not use CompressedOops::decode_not_null. Use this
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
   278
  // function instead.
51720
b7bfd64e43a6 8210523: runtime/appcds/cacheObject/DifferentHeapSizes.java crash
iklam
parents: 51701
diff changeset
   279
  inline static oop decode_from_archive(narrowOop v) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
51491
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
   280
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
   281
  static void init_narrow_oop_decoding(address base, int shift) NOT_CDS_JAVA_HEAP_RETURN;
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
   282
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
   283
  static void patch_archived_heap_embedded_pointers(MemRegion mem, address  oopmap,
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
   284
                                                    size_t oopmap_in_bits) NOT_CDS_JAVA_HEAP_RETURN;
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
   285
51429
d9f6e3ee7fcb 8209545: Simplify HeapShared::archive_module_graph_objects
iklam
parents: 50951
diff changeset
   286
  static void init_archivable_static_fields(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
52062
8dbf1a13af49 8206009: Move CDS java heap object archiving code to heapShared.hpp and heapShared.cpp
jiangli
parents: 52047
diff changeset
   287
  static void archive_object_subgraphs(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
52047
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   288
  static void write_subgraph_info_table() NOT_CDS_JAVA_HEAP_RETURN;
7bc8b456e5ac 8210388: Use hash table to store archived subgraph_info records
iklam
parents: 51720
diff changeset
   289
  static void serialize_subgraph_info_table_header(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
51491
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
   290
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
   291
#if INCLUDE_CDS_JAVA_HEAP
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
   292
  static ResourceBitMap calculate_oopmap(MemRegion region);
51701
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   293
  static oop archive_reachable_objects_from(int level, KlassSubGraphInfo* subgraph_info, oop orig_obj, TRAPS);
9012aeaf993b 8210289: ArchivedKlassSubGraphInfoRecord is incomplete
iklam
parents: 51491
diff changeset
   294
  static void verify_subgraph_from(oop orig_obj) PRODUCT_RETURN;
51491
187c84a5efe1 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed
iklam
parents: 51429
diff changeset
   295
#endif
50951
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   296
};
b96466cdfc45 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
jiangli
parents:
diff changeset
   297
#endif // SHARE_VM_MEMORY_HEAPSHARED_HPP