2018-07-08 12:43:05 -04:00
|
|
|
/*
|
2020-05-17 15:10:06 -07:00
|
|
|
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
|
2018-07-08 12:43:05 -04:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-01-10 15:13:51 -05:00
|
|
|
#ifndef SHARE_MEMORY_HEAPSHARED_HPP
|
|
|
|
#define SHARE_MEMORY_HEAPSHARED_HPP
|
2018-07-08 12:43:05 -04:00
|
|
|
|
2018-10-08 16:29:10 -07:00
|
|
|
#include "classfile/compactHashtable.hpp"
|
2020-08-27 22:24:28 -07:00
|
|
|
#include "classfile/javaClasses.hpp"
|
2018-07-08 12:43:05 -04:00
|
|
|
#include "classfile/systemDictionary.hpp"
|
2018-09-05 18:14:45 -07:00
|
|
|
#include "memory/allocation.hpp"
|
2018-11-03 15:40:19 -04:00
|
|
|
#include "memory/metaspaceShared.hpp"
|
2019-05-09 14:26:03 +02:00
|
|
|
#include "oops/compressedOops.hpp"
|
2018-07-08 12:43:05 -04:00
|
|
|
#include "oops/objArrayKlass.hpp"
|
|
|
|
#include "oops/oop.hpp"
|
2020-11-18 08:21:03 +00:00
|
|
|
#include "oops/oopHandle.hpp"
|
2018-07-08 12:43:05 -04:00
|
|
|
#include "oops/typeArrayKlass.hpp"
|
2018-08-14 09:59:37 -07:00
|
|
|
#include "utilities/bitMap.hpp"
|
2018-07-08 12:43:05 -04:00
|
|
|
#include "utilities/growableArray.hpp"
|
2018-09-05 18:14:45 -07:00
|
|
|
#include "utilities/resourceHash.hpp"
|
2018-07-08 12:43:05 -04:00
|
|
|
|
|
|
|
#if INCLUDE_CDS_JAVA_HEAP
|
2020-08-27 22:24:28 -07:00
|
|
|
class DumpedInternedStrings;
|
|
|
|
|
2018-11-03 15:40:19 -04:00
|
|
|
struct ArchivableStaticFieldInfo {
|
|
|
|
const char* klass_name;
|
|
|
|
const char* field_name;
|
|
|
|
InstanceKlass* klass;
|
|
|
|
int offset;
|
|
|
|
BasicType type;
|
|
|
|
};
|
|
|
|
|
2018-07-08 12:43:05 -04:00
|
|
|
// A dump time sub-graph info for Klass _k. It includes the entry points
|
|
|
|
// (static fields in _k's mirror) of the archived sub-graphs reachable
|
|
|
|
// from _k's mirror. It also contains a list of Klasses of the objects
|
|
|
|
// within the sub-graphs.
|
|
|
|
class KlassSubGraphInfo: public CHeapObj<mtClass> {
|
|
|
|
private:
|
|
|
|
// The class that contains the static field(s) as the entry point(s)
|
|
|
|
// of archived object sub-graph(s).
|
|
|
|
Klass* _k;
|
|
|
|
// A list of classes need to be loaded and initialized before the archived
|
|
|
|
// object sub-graphs can be accessed at runtime.
|
|
|
|
GrowableArray<Klass*>* _subgraph_object_klasses;
|
|
|
|
// A list of _k's static fields as the entry points of archived sub-graphs.
|
2018-11-03 15:40:19 -04:00
|
|
|
// For each entry field, it is a tuple of field_offset, field_value and
|
|
|
|
// is_closed_archive flag.
|
2020-11-18 08:21:03 +00:00
|
|
|
GrowableArray<int>* _subgraph_entry_fields;
|
2018-07-08 12:43:05 -04:00
|
|
|
|
2020-11-18 08:21:03 +00:00
|
|
|
// Does this KlassSubGraphInfo belong to the archived full module graph
|
2020-09-13 14:45:12 +00:00
|
|
|
bool _is_full_module_graph;
|
2020-11-18 08:21:03 +00:00
|
|
|
|
|
|
|
// Does this KlassSubGraphInfo references any classes that were loaded while
|
|
|
|
// JvmtiExport::is_early_phase()!=true. If so, this KlassSubGraphInfo cannot be
|
|
|
|
// used at runtime if JVMTI ClassFileLoadHook is enabled.
|
|
|
|
bool _has_non_early_klasses;
|
|
|
|
static bool is_non_early_klass(Klass* k);
|
|
|
|
|
2018-07-08 12:43:05 -04:00
|
|
|
public:
|
2020-09-13 14:45:12 +00:00
|
|
|
KlassSubGraphInfo(Klass* k, bool is_full_module_graph) :
|
2018-10-08 16:29:10 -07:00
|
|
|
_k(k), _subgraph_object_klasses(NULL),
|
2020-09-13 14:45:12 +00:00
|
|
|
_subgraph_entry_fields(NULL),
|
2020-11-18 08:21:03 +00:00
|
|
|
_is_full_module_graph(is_full_module_graph),
|
|
|
|
_has_non_early_klasses(false) {}
|
|
|
|
|
2018-07-08 12:43:05 -04:00
|
|
|
~KlassSubGraphInfo() {
|
|
|
|
if (_subgraph_object_klasses != NULL) {
|
|
|
|
delete _subgraph_object_klasses;
|
|
|
|
}
|
|
|
|
if (_subgraph_entry_fields != NULL) {
|
|
|
|
delete _subgraph_entry_fields;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Klass* klass() { return _k; }
|
|
|
|
GrowableArray<Klass*>* subgraph_object_klasses() {
|
|
|
|
return _subgraph_object_klasses;
|
|
|
|
}
|
2020-11-18 08:21:03 +00:00
|
|
|
GrowableArray<int>* subgraph_entry_fields() {
|
2018-07-08 12:43:05 -04:00
|
|
|
return _subgraph_entry_fields;
|
|
|
|
}
|
2018-11-03 15:40:19 -04:00
|
|
|
void add_subgraph_entry_field(int static_field_offset, oop v,
|
|
|
|
bool is_closed_archive);
|
2018-07-08 12:43:05 -04:00
|
|
|
void add_subgraph_object_klass(Klass *orig_k, Klass *relocated_k);
|
2018-09-05 18:14:45 -07:00
|
|
|
int num_subgraph_object_klasses() {
|
|
|
|
return _subgraph_object_klasses == NULL ? 0 :
|
|
|
|
_subgraph_object_klasses->length();
|
|
|
|
}
|
2020-09-13 14:45:12 +00:00
|
|
|
bool is_full_module_graph() const { return _is_full_module_graph; }
|
2020-11-18 08:21:03 +00:00
|
|
|
bool has_non_early_klasses() const { return _has_non_early_klasses; }
|
2018-07-08 12:43:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
// An archived record of object sub-graphs reachable from static
|
|
|
|
// fields within _k's mirror. The record is reloaded from the archive
|
|
|
|
// at runtime.
|
|
|
|
class ArchivedKlassSubGraphInfoRecord {
|
|
|
|
private:
|
|
|
|
Klass* _k;
|
2020-09-13 14:45:12 +00:00
|
|
|
bool _is_full_module_graph;
|
2020-11-18 08:21:03 +00:00
|
|
|
bool _has_non_early_klasses;
|
2018-07-08 12:43:05 -04:00
|
|
|
|
|
|
|
// contains pairs of field offset and value for each subgraph entry field
|
2020-11-18 08:21:03 +00:00
|
|
|
Array<int>* _entry_field_records;
|
2018-07-08 12:43:05 -04:00
|
|
|
|
|
|
|
// klasses of objects in archived sub-graphs referenced from the entry points
|
|
|
|
// (static fields) in the containing class
|
2018-09-05 18:14:45 -07:00
|
|
|
Array<Klass*>* _subgraph_object_klasses;
|
2018-07-08 12:43:05 -04:00
|
|
|
public:
|
|
|
|
ArchivedKlassSubGraphInfoRecord() :
|
2018-10-08 16:29:10 -07:00
|
|
|
_k(NULL), _entry_field_records(NULL), _subgraph_object_klasses(NULL) {}
|
2018-07-08 12:43:05 -04:00
|
|
|
void init(KlassSubGraphInfo* info);
|
2018-11-07 19:40:27 -08:00
|
|
|
Klass* klass() const { return _k; }
|
2020-11-18 08:21:03 +00:00
|
|
|
Array<int>* entry_field_records() const { return _entry_field_records; }
|
2018-11-07 19:40:27 -08:00
|
|
|
Array<Klass*>* subgraph_object_klasses() const { return _subgraph_object_klasses; }
|
2020-09-13 14:45:12 +00:00
|
|
|
bool is_full_module_graph() const { return _is_full_module_graph; }
|
2020-11-18 08:21:03 +00:00
|
|
|
bool has_non_early_klasses() const { return _has_non_early_klasses; }
|
2018-07-08 12:43:05 -04:00
|
|
|
};
|
|
|
|
#endif // INCLUDE_CDS_JAVA_HEAP
|
|
|
|
|
|
|
|
class HeapShared: AllStatic {
|
2018-09-05 18:14:45 -07:00
|
|
|
friend class VerifySharedOopClosure;
|
2018-07-08 12:43:05 -04:00
|
|
|
private:
|
2018-10-09 15:58:07 -04:00
|
|
|
|
2018-07-08 12:43:05 -04:00
|
|
|
#if INCLUDE_CDS_JAVA_HEAP
|
2018-11-03 15:40:19 -04:00
|
|
|
static bool _closed_archive_heap_region_mapped;
|
2018-10-09 15:58:07 -04:00
|
|
|
static bool _open_archive_heap_region_mapped;
|
|
|
|
static bool _archive_heap_region_fixed;
|
2020-08-27 22:24:28 -07:00
|
|
|
static DumpedInternedStrings *_dumped_interned_strings;
|
2018-10-09 15:58:07 -04:00
|
|
|
|
2020-08-27 22:24:28 -07:00
|
|
|
public:
|
2018-10-09 15:58:07 -04:00
|
|
|
static bool oop_equals(oop const& p1, oop const& p2) {
|
2019-09-17 09:51:02 +02:00
|
|
|
return p1 == p2;
|
2018-10-09 15:58:07 -04:00
|
|
|
}
|
|
|
|
static unsigned oop_hash(oop const& p);
|
2020-08-27 22:24:28 -07:00
|
|
|
static unsigned string_oop_hash(oop const& string) {
|
|
|
|
return java_lang_String::hash_code(string);
|
|
|
|
}
|
2018-10-09 15:58:07 -04:00
|
|
|
|
2020-08-27 22:24:28 -07:00
|
|
|
private:
|
2018-10-09 15:58:07 -04:00
|
|
|
typedef ResourceHashtable<oop, oop,
|
|
|
|
HeapShared::oop_hash,
|
|
|
|
HeapShared::oop_equals,
|
|
|
|
15889, // prime number
|
|
|
|
ResourceObj::C_HEAP> ArchivedObjectCache;
|
|
|
|
static ArchivedObjectCache* _archived_object_cache;
|
2018-07-08 12:43:05 -04:00
|
|
|
|
2018-10-08 16:29:10 -07:00
|
|
|
static bool klass_equals(Klass* const& p1, Klass* const& p2) {
|
|
|
|
return primitive_equals<Klass*>(p1, p2);
|
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned klass_hash(Klass* const& klass) {
|
2020-05-17 15:10:06 -07:00
|
|
|
// Generate deterministic hashcode even if SharedBaseAddress is changed due to ASLR.
|
|
|
|
return primitive_hash<address>(address(klass) - SharedBaseAddress);
|
2018-10-08 16:29:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
class DumpTimeKlassSubGraphInfoTable
|
|
|
|
: public ResourceHashtable<Klass*, KlassSubGraphInfo,
|
|
|
|
HeapShared::klass_hash,
|
|
|
|
HeapShared::klass_equals,
|
|
|
|
137, // prime number
|
|
|
|
ResourceObj::C_HEAP> {
|
|
|
|
public:
|
|
|
|
int _count;
|
|
|
|
};
|
|
|
|
|
2018-11-07 19:40:27 -08:00
|
|
|
public: // solaris compiler wants this for RunTimeKlassSubGraphInfoTable
|
|
|
|
inline static bool record_equals_compact_hashtable_entry(
|
|
|
|
const ArchivedKlassSubGraphInfoRecord* value, const Klass* key, int len_unused) {
|
2018-10-08 16:29:10 -07:00
|
|
|
return (value->klass() == key);
|
|
|
|
}
|
|
|
|
|
2018-11-07 19:40:27 -08:00
|
|
|
private:
|
|
|
|
typedef OffsetCompactHashtable<
|
2018-10-08 16:29:10 -07:00
|
|
|
const Klass*,
|
2018-11-07 19:40:27 -08:00
|
|
|
const ArchivedKlassSubGraphInfoRecord*,
|
2018-10-08 16:29:10 -07:00
|
|
|
record_equals_compact_hashtable_entry
|
|
|
|
> RunTimeKlassSubGraphInfoTable;
|
|
|
|
|
|
|
|
static DumpTimeKlassSubGraphInfoTable* _dump_time_subgraph_info_table;
|
|
|
|
static RunTimeKlassSubGraphInfoTable _run_time_subgraph_info_table;
|
2018-07-08 12:43:05 -04:00
|
|
|
|
2018-11-03 15:40:19 -04:00
|
|
|
static void check_closed_archive_heap_region_object(InstanceKlass* k,
|
|
|
|
Thread* THREAD);
|
|
|
|
|
|
|
|
static void archive_object_subgraphs(ArchivableStaticFieldInfo fields[],
|
|
|
|
int num,
|
|
|
|
bool is_closed_archive,
|
2020-09-13 14:45:12 +00:00
|
|
|
bool is_full_module_graph,
|
2018-11-03 15:40:19 -04:00
|
|
|
Thread* THREAD);
|
|
|
|
|
2018-07-08 12:43:05 -04:00
|
|
|
// Archive object sub-graph starting from the given static field
|
|
|
|
// in Klass k's mirror.
|
|
|
|
static void archive_reachable_objects_from_static_field(
|
2018-09-05 18:14:45 -07:00
|
|
|
InstanceKlass* k, const char* klass_name,
|
2018-11-03 15:40:19 -04:00
|
|
|
int field_offset, const char* field_name,
|
|
|
|
bool is_closed_archive, TRAPS);
|
|
|
|
|
2018-09-05 18:14:45 -07:00
|
|
|
static void verify_subgraph_from_static_field(
|
|
|
|
InstanceKlass* k, int field_offset) PRODUCT_RETURN;
|
|
|
|
static void verify_reachable_objects_from(oop obj, bool is_archived) PRODUCT_RETURN;
|
2018-11-03 15:40:19 -04:00
|
|
|
static void verify_subgraph_from(oop orig_obj) PRODUCT_RETURN;
|
2018-07-08 12:43:05 -04:00
|
|
|
|
2020-09-13 14:45:12 +00:00
|
|
|
static KlassSubGraphInfo* init_subgraph_info(Klass *k, bool is_full_module_graph);
|
2018-07-08 12:43:05 -04:00
|
|
|
static KlassSubGraphInfo* get_subgraph_info(Klass *k);
|
2018-08-14 09:59:37 -07:00
|
|
|
|
2018-11-03 15:40:19 -04:00
|
|
|
static void init_subgraph_entry_fields(ArchivableStaticFieldInfo fields[],
|
|
|
|
int num, Thread* THREAD);
|
|
|
|
|
2018-09-12 17:45:22 -07:00
|
|
|
// Used by decode_from_archive
|
2018-08-14 09:59:37 -07:00
|
|
|
static address _narrow_oop_base;
|
|
|
|
static int _narrow_oop_shift;
|
|
|
|
|
2018-09-05 18:14:45 -07:00
|
|
|
typedef ResourceHashtable<oop, bool,
|
|
|
|
HeapShared::oop_hash,
|
|
|
|
HeapShared::oop_equals,
|
|
|
|
15889, // prime number
|
|
|
|
ResourceObj::C_HEAP> SeenObjectsTable;
|
|
|
|
|
|
|
|
static SeenObjectsTable *_seen_objects_table;
|
|
|
|
|
2020-11-18 08:21:03 +00:00
|
|
|
static GrowableArrayCHeap<oop, mtClassShared>* _pending_roots;
|
|
|
|
static narrowOop _roots_narrow;
|
|
|
|
static OopHandle _roots;
|
|
|
|
|
2018-09-05 18:14:45 -07:00
|
|
|
static void init_seen_objects_table() {
|
|
|
|
assert(_seen_objects_table == NULL, "must be");
|
|
|
|
_seen_objects_table = new (ResourceObj::C_HEAP, mtClass)SeenObjectsTable();
|
|
|
|
}
|
|
|
|
static void delete_seen_objects_table() {
|
|
|
|
assert(_seen_objects_table != NULL, "must be");
|
|
|
|
delete _seen_objects_table;
|
|
|
|
_seen_objects_table = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Statistics (for one round of start_recording_subgraph ... done_recording_subgraph)
|
|
|
|
static int _num_new_walked_objs;
|
|
|
|
static int _num_new_archived_objs;
|
|
|
|
static int _num_old_recorded_klasses;
|
|
|
|
|
|
|
|
// Statistics (for all archived subgraphs)
|
|
|
|
static int _num_total_subgraph_recordings;
|
|
|
|
static int _num_total_walked_objs;
|
|
|
|
static int _num_total_archived_objs;
|
|
|
|
static int _num_total_recorded_klasses;
|
|
|
|
static int _num_total_verifications;
|
|
|
|
|
2020-09-13 14:45:12 +00:00
|
|
|
static void start_recording_subgraph(InstanceKlass *k, const char* klass_name,
|
|
|
|
bool is_full_module_graph);
|
2018-09-05 18:14:45 -07:00
|
|
|
static void done_recording_subgraph(InstanceKlass *k, const char* klass_name);
|
|
|
|
|
|
|
|
static bool has_been_seen_during_subgraph_recording(oop obj);
|
|
|
|
static void set_has_been_seen_during_subgraph_recording(oop obj);
|
2018-10-09 15:58:07 -04:00
|
|
|
|
2020-09-13 14:45:12 +00:00
|
|
|
static void check_module_oop(oop orig_module_obj);
|
2020-11-18 08:21:03 +00:00
|
|
|
static void copy_roots();
|
|
|
|
|
|
|
|
static void resolve_classes_for_subgraphs(ArchivableStaticFieldInfo fields[],
|
|
|
|
int num, TRAPS);
|
|
|
|
static void resolve_classes_for_subgraph_of(Klass* k, TRAPS);
|
|
|
|
static void clear_archived_roots_of(Klass* k);
|
|
|
|
static const ArchivedKlassSubGraphInfoRecord*
|
|
|
|
resolve_or_init_classes_for_subgraph_of(Klass* k, bool do_init, TRAPS);
|
|
|
|
static void resolve_or_init(Klass* k, bool do_init, TRAPS);
|
|
|
|
static void init_archived_fields_for(Klass* k, const ArchivedKlassSubGraphInfoRecord* record, TRAPS);
|
2018-10-09 15:58:07 -04:00
|
|
|
public:
|
2020-09-13 14:45:12 +00:00
|
|
|
static void reset_archived_object_states(TRAPS);
|
2018-10-09 15:58:07 -04:00
|
|
|
static void create_archived_object_cache() {
|
|
|
|
_archived_object_cache =
|
|
|
|
new (ResourceObj::C_HEAP, mtClass)ArchivedObjectCache();
|
|
|
|
}
|
|
|
|
static void destroy_archived_object_cache() {
|
|
|
|
delete _archived_object_cache;
|
|
|
|
_archived_object_cache = NULL;
|
|
|
|
}
|
|
|
|
static ArchivedObjectCache* archived_object_cache() {
|
|
|
|
return _archived_object_cache;
|
|
|
|
}
|
|
|
|
|
|
|
|
static oop find_archived_heap_object(oop obj);
|
|
|
|
static oop archive_heap_object(oop obj, Thread* THREAD);
|
|
|
|
|
|
|
|
static void archive_klass_objects(Thread* THREAD);
|
|
|
|
|
|
|
|
static void set_archive_heap_region_fixed() {
|
|
|
|
_archive_heap_region_fixed = true;
|
|
|
|
}
|
|
|
|
static bool archive_heap_region_fixed() {
|
|
|
|
return _archive_heap_region_fixed;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void archive_java_heap_objects(GrowableArray<MemRegion> *closed,
|
|
|
|
GrowableArray<MemRegion> *open);
|
|
|
|
static void copy_closed_archive_heap_objects(GrowableArray<MemRegion> * closed_archive);
|
|
|
|
static void copy_open_archive_heap_objects(GrowableArray<MemRegion> * open_archive);
|
2018-11-03 15:40:19 -04:00
|
|
|
|
|
|
|
static oop archive_reachable_objects_from(int level,
|
|
|
|
KlassSubGraphInfo* subgraph_info,
|
|
|
|
oop orig_obj,
|
|
|
|
bool is_closed_archive,
|
|
|
|
TRAPS);
|
|
|
|
|
|
|
|
static ResourceBitMap calculate_oopmap(MemRegion region);
|
2020-08-27 22:24:28 -07:00
|
|
|
static void add_to_dumped_interned_strings(oop string);
|
2020-11-18 08:21:03 +00:00
|
|
|
|
|
|
|
// We use the HeapShared::roots() array to make sure that objects stored in the
|
|
|
|
// archived heap regions are not prematurely collected. These roots include:
|
|
|
|
//
|
|
|
|
// - mirrors of classes that have not yet been loaded.
|
|
|
|
// - ConstantPool::resolved_references() of classes that have not yet been loaded.
|
|
|
|
// - ArchivedKlassSubGraphInfoRecords that have not been initialized
|
|
|
|
// - java.lang.Module objects that have not yet been added to the module graph
|
|
|
|
//
|
|
|
|
// When a mirror M becomes referenced by a newly loaded class K, M will be removed
|
|
|
|
// from HeapShared::roots() via clear_root(), and K will be responsible for
|
|
|
|
// keeping M alive.
|
|
|
|
//
|
|
|
|
// Other types of roots are also cleared similarly when they become referenced.
|
|
|
|
|
|
|
|
// Dump-time only. Returns the index of the root, which can be used at run time to read
|
|
|
|
// the root using get_root(index, ...).
|
|
|
|
static int append_root(oop obj);
|
|
|
|
|
|
|
|
// Dump-time and runtime
|
|
|
|
static objArrayOop roots();
|
|
|
|
static oop get_root(int index, bool clear=false);
|
|
|
|
|
|
|
|
// Run-time only
|
|
|
|
static void set_roots(narrowOop roots);
|
|
|
|
static void clear_root(int index);
|
2018-07-08 12:43:05 -04:00
|
|
|
#endif // INCLUDE_CDS_JAVA_HEAP
|
2018-10-09 15:58:07 -04:00
|
|
|
|
2018-07-08 12:43:05 -04:00
|
|
|
public:
|
2020-06-14 01:19:48 -07:00
|
|
|
static void run_full_gc_in_vm_thread() NOT_CDS_JAVA_HEAP_RETURN;
|
|
|
|
|
2018-10-09 15:58:07 -04:00
|
|
|
static bool is_heap_object_archiving_allowed() {
|
|
|
|
CDS_JAVA_HEAP_ONLY(return (UseG1GC && UseCompressedOops && UseCompressedClassPointers);)
|
|
|
|
NOT_CDS_JAVA_HEAP(return false;)
|
|
|
|
}
|
|
|
|
|
2018-11-03 15:40:19 -04:00
|
|
|
static bool is_heap_region(int idx) {
|
|
|
|
CDS_JAVA_HEAP_ONLY(return (idx >= MetaspaceShared::first_closed_archive_heap_region &&
|
2020-11-18 08:21:03 +00:00
|
|
|
idx <= MetaspaceShared::last_open_archive_heap_region);)
|
2018-11-03 15:40:19 -04:00
|
|
|
NOT_CDS_JAVA_HEAP_RETURN_(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void set_closed_archive_heap_region_mapped() {
|
2020-11-18 08:21:03 +00:00
|
|
|
CDS_JAVA_HEAP_ONLY(_closed_archive_heap_region_mapped = true;)
|
2018-11-03 15:40:19 -04:00
|
|
|
NOT_CDS_JAVA_HEAP_RETURN;
|
|
|
|
}
|
|
|
|
static bool closed_archive_heap_region_mapped() {
|
2020-11-18 08:21:03 +00:00
|
|
|
CDS_JAVA_HEAP_ONLY(return _closed_archive_heap_region_mapped;)
|
2018-11-03 15:40:19 -04:00
|
|
|
NOT_CDS_JAVA_HEAP_RETURN_(false);
|
|
|
|
}
|
2018-10-09 15:58:07 -04:00
|
|
|
static void set_open_archive_heap_region_mapped() {
|
2020-11-18 08:21:03 +00:00
|
|
|
CDS_JAVA_HEAP_ONLY(_open_archive_heap_region_mapped = true;)
|
2018-10-09 15:58:07 -04:00
|
|
|
NOT_CDS_JAVA_HEAP_RETURN;
|
|
|
|
}
|
|
|
|
static bool open_archive_heap_region_mapped() {
|
2020-11-18 08:21:03 +00:00
|
|
|
CDS_JAVA_HEAP_ONLY(return _open_archive_heap_region_mapped;)
|
2018-10-09 15:58:07 -04:00
|
|
|
NOT_CDS_JAVA_HEAP_RETURN_(false);
|
|
|
|
}
|
2020-11-18 08:21:03 +00:00
|
|
|
static bool is_mapped() {
|
|
|
|
return closed_archive_heap_region_mapped() && open_archive_heap_region_mapped();
|
|
|
|
}
|
2018-10-09 15:58:07 -04:00
|
|
|
|
|
|
|
static void fixup_mapped_heap_regions() NOT_CDS_JAVA_HEAP_RETURN;
|
|
|
|
|
|
|
|
inline static bool is_archived_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
|
|
|
|
|
2020-11-18 08:21:03 +00:00
|
|
|
static void resolve_classes(TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
|
2020-09-13 14:45:12 +00:00
|
|
|
static void initialize_from_archived_subgraph(Klass* k, TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
|
2018-07-08 12:43:05 -04:00
|
|
|
|
2018-08-14 09:59:37 -07:00
|
|
|
// NarrowOops stored in the CDS archive may use a different encoding scheme
|
2019-05-09 14:26:03 +02:00
|
|
|
// than CompressedOops::{base,shift} -- see FileMapInfo::map_heap_regions_impl.
|
2018-08-14 09:59:37 -07:00
|
|
|
// To decode them, do not use CompressedOops::decode_not_null. Use this
|
|
|
|
// function instead.
|
2018-09-12 17:45:22 -07:00
|
|
|
inline static oop decode_from_archive(narrowOop v) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
|
2018-08-14 09:59:37 -07:00
|
|
|
|
|
|
|
static void init_narrow_oop_decoding(address base, int shift) NOT_CDS_JAVA_HEAP_RETURN;
|
|
|
|
|
|
|
|
static void patch_archived_heap_embedded_pointers(MemRegion mem, address oopmap,
|
|
|
|
size_t oopmap_in_bits) NOT_CDS_JAVA_HEAP_RETURN;
|
|
|
|
|
2020-08-27 22:24:28 -07:00
|
|
|
static void init_for_dumping(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
|
2018-11-03 15:40:19 -04:00
|
|
|
static void init_subgraph_entry_fields(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
|
2018-10-08 16:29:10 -07:00
|
|
|
static void write_subgraph_info_table() NOT_CDS_JAVA_HEAP_RETURN;
|
|
|
|
static void serialize_subgraph_info_table_header(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
|
2018-07-08 12:43:05 -04:00
|
|
|
};
|
2020-08-27 22:24:28 -07:00
|
|
|
|
|
|
|
#if INCLUDE_CDS_JAVA_HEAP
|
|
|
|
class DumpedInternedStrings :
|
|
|
|
public ResourceHashtable<oop, bool,
|
|
|
|
HeapShared::string_oop_hash,
|
|
|
|
HeapShared::oop_equals,
|
|
|
|
15889, // prime number
|
|
|
|
ResourceObj::C_HEAP>
|
|
|
|
{};
|
|
|
|
#endif
|
|
|
|
|
2019-01-10 15:13:51 -05:00
|
|
|
#endif // SHARE_MEMORY_HEAPSHARED_HPP
|