Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8270803: Reduce CDS API verbosity #4834

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1080,16 +1080,16 @@ void ArchiveBuilder::write_archive(FileMapInfo* mapinfo,
bitmap_size_in_bytes);

if (closed_heap_regions != NULL) {
_total_closed_heap_region_size = mapinfo->write_archive_heap_regions(
_total_closed_heap_region_size = mapinfo->write_heap_regions(
closed_heap_regions,
closed_heap_oopmaps,
MetaspaceShared::first_closed_archive_heap_region,
MetaspaceShared::max_closed_archive_heap_region);
_total_open_heap_region_size = mapinfo->write_archive_heap_regions(
MetaspaceShared::first_closed_heap_region,
MetaspaceShared::max_closed_heap_region);
_total_open_heap_region_size = mapinfo->write_heap_regions(
open_heap_regions,
open_heap_oopmaps,
MetaspaceShared::first_open_archive_heap_region,
MetaspaceShared::max_open_archive_heap_region);
MetaspaceShared::first_open_heap_region,
MetaspaceShared::max_open_heap_region);
}

print_region_stats(mapinfo, closed_heap_regions, open_heap_regions);
@@ -1155,12 +1155,12 @@ void ArchiveBuilder::print_bitmap_region_stats(size_t size, size_t total_size) {
size, size/double(total_size)*100.0, size);
}

void ArchiveBuilder::print_heap_region_stats(GrowableArray<MemRegion> *heap_mem,
void ArchiveBuilder::print_heap_region_stats(GrowableArray<MemRegion>* regions,
const char *name, size_t total_size) {
int arr_len = heap_mem == NULL ? 0 : heap_mem->length();
int arr_len = regions == NULL ? 0 : regions->length();
for (int i = 0; i < arr_len; i++) {
char* start = (char*)heap_mem->at(i).start();
size_t size = heap_mem->at(i).byte_size();
char* start = (char*)regions->at(i).start();
size_t size = regions->at(i).byte_size();
char* top = start + size;
log_debug(cds)("%s%d space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [100.0%% used] at " INTPTR_FORMAT,
name, i, size, size/double(total_size)*100.0, size, p2i(start));
@@ -216,7 +216,7 @@ class ArchiveBuilder : public StackObj {
GrowableArray<MemRegion>* closed_heap_regions,
GrowableArray<MemRegion>* open_heap_regions);
void print_bitmap_region_stats(size_t size, size_t total_size);
void print_heap_region_stats(GrowableArray<MemRegion> *heap_mem,
void print_heap_region_stats(GrowableArray<MemRegion>* regions,
const char *name, size_t total_size);

// For global access.
@@ -307,12 +307,12 @@ void ReadClosure::do_tag(int tag) {

void ReadClosure::do_oop(oop *p) {
narrowOop o = CompressedOops::narrow_oop_cast(nextPtr());
if (CompressedOops::is_null(o) || !HeapShared::open_archive_heap_region_mapped()) {
if (CompressedOops::is_null(o) || !HeapShared::open_regions_mapped()) {
*p = NULL;
} else {
assert(HeapShared::is_heap_object_archiving_allowed(),
"Archived heap object is not allowed");
assert(HeapShared::open_archive_heap_region_mapped(),
assert(HeapShared::open_regions_mapped(),
"Open archive heap region is not mapped");
*p = HeapShared::decode_from_archive(o);
}

Large diffs are not rendered by default.

@@ -460,19 +460,19 @@ class FileMapInfo : public CHeapObj<mtInternal> {
GrowableArray<ArchiveHeapOopmapInfo>* closed_oopmaps,
GrowableArray<ArchiveHeapOopmapInfo>* open_oopmaps,
size_t &size_in_bytes);
size_t write_archive_heap_regions(GrowableArray<MemRegion> *heap_mem,
GrowableArray<ArchiveHeapOopmapInfo> *oopmaps,
int first_region_id, int max_num_regions);
size_t write_heap_regions(GrowableArray<MemRegion>* regions,
GrowableArray<ArchiveHeapOopmapInfo>* oopmaps,
int first_region_id, int max_num_regions);
void write_bytes(const void* buffer, size_t count);
void write_bytes_aligned(const void* buffer, size_t count);
size_t read_bytes(void* buffer, size_t count);
MapArchiveResult map_regions(int regions[], int num_regions, char* mapped_base_address, ReservedSpace rs);
void unmap_regions(int regions[], int num_regions);
void map_heap_regions() NOT_CDS_JAVA_HEAP_RETURN;
void fixup_mapped_heap_regions() NOT_CDS_JAVA_HEAP_RETURN;
void patch_archived_heap_embedded_pointers() NOT_CDS_JAVA_HEAP_RETURN;
void patch_archived_heap_embedded_pointers(MemRegion* ranges, int num_ranges,
int first_region_idx) NOT_CDS_JAVA_HEAP_RETURN;
void patch_heap_embedded_pointers() NOT_CDS_JAVA_HEAP_RETURN;
void patch_heap_embedded_pointers(MemRegion* regions, int num_regions,
int first_region_idx) NOT_CDS_JAVA_HEAP_RETURN;
bool has_heap_regions() NOT_CDS_JAVA_HEAP_RETURN_(false);
MemRegion get_heap_regions_range_with_current_oop_encoding_mode() NOT_CDS_JAVA_HEAP_RETURN_(MemRegion());
void unmap_region(int i);
@@ -570,10 +570,10 @@ class FileMapInfo : public CHeapObj<mtInternal> {
GrowableArray<const char*>* rp_array) NOT_CDS_RETURN_(false);
bool validate_boot_class_paths() NOT_CDS_RETURN_(false);
bool validate_app_class_paths(int shared_app_paths_len) NOT_CDS_RETURN_(false);
bool map_heap_data(MemRegion **heap_mem, int first, int max, int* num,
bool is_open = false) NOT_CDS_JAVA_HEAP_RETURN_(false);
bool map_heap_regions(int first, int max, bool is_open_archive,
MemRegion** regions_ret, int* num_regions_ret) NOT_CDS_JAVA_HEAP_RETURN_(false);
bool region_crc_check(char* buf, size_t size, int expected_crc) NOT_CDS_RETURN_(false);
void dealloc_archive_heap_regions(MemRegion* regions, int num) NOT_CDS_JAVA_HEAP_RETURN;
void dealloc_heap_regions(MemRegion* regions, int num) NOT_CDS_JAVA_HEAP_RETURN;
void map_heap_regions_impl() NOT_CDS_JAVA_HEAP_RETURN;
char* map_bitmap_region();
MapArchiveResult map_region(int i, intx addr_delta, char* mapped_base_address, ReservedSpace rs);
@@ -67,9 +67,8 @@

#if INCLUDE_CDS_JAVA_HEAP

bool HeapShared::_closed_archive_heap_region_mapped = false;
bool HeapShared::_open_archive_heap_region_mapped = false;
bool HeapShared::_archive_heap_region_fixed = false;
bool HeapShared::_closed_regions_mapped = false;
bool HeapShared::_open_regions_mapped = false;
address HeapShared::_narrow_oop_base;
int HeapShared::_narrow_oop_shift;
DumpedInternedStrings *HeapShared::_dumped_interned_strings = NULL;
@@ -122,10 +121,9 @@ OopHandle HeapShared::_roots;
// Java heap object archiving support
//
////////////////////////////////////////////////////////////////
void HeapShared::fixup_mapped_heap_regions() {
void HeapShared::fixup_mapped_regions() {
FileMapInfo *mapinfo = FileMapInfo::current_info();
mapinfo->fixup_mapped_heap_regions();
set_archive_heap_region_fixed();
if (is_mapped()) {
_roots = OopHandle(Universe::vm_global(), decode_from_archive(_roots_narrow));
if (!MetaspaceShared::use_full_module_graph()) {
@@ -213,7 +211,7 @@ objArrayOop HeapShared::roots() {

void HeapShared::set_roots(narrowOop roots) {
assert(UseSharedSpaces, "runtime only");
assert(open_archive_heap_region_mapped(), "must be");
assert(open_regions_mapped(), "must be");
_roots_narrow = roots;
}

@@ -238,7 +236,7 @@ oop HeapShared::get_root(int index, bool clear) {
void HeapShared::clear_root(int index) {
assert(index >= 0, "sanity");
assert(UseSharedSpaces, "must be");
if (open_archive_heap_region_mapped()) {
if (open_regions_mapped()) {
if (log_is_enabled(Debug, cds, heap)) {
oop old = roots()->obj_at(index);
log_debug(cds, heap)("Clearing root %d: was " PTR_FORMAT, index, p2i(old));
@@ -247,7 +245,7 @@ void HeapShared::clear_root(int index) {
}
}

oop HeapShared::archive_heap_object(oop obj) {
oop HeapShared::archive_object(oop obj) {
assert(DumpSharedSpaces, "dump-time only");

oop ao = find_archived_heap_object(obj);
@@ -333,8 +331,8 @@ void HeapShared::run_full_gc_in_vm_thread() {
}
}

void HeapShared::archive_java_heap_objects(GrowableArray<MemRegion>* closed,
GrowableArray<MemRegion>* open) {
void HeapShared::archive_objects(GrowableArray<MemRegion>* closed_regions,
GrowableArray<MemRegion>* open_regions) {

G1HeapVerifier::verify_ready_for_archiving();

@@ -347,19 +345,18 @@ void HeapShared::archive_java_heap_objects(GrowableArray<MemRegion>* closed,
log_info(cds)("Heap range = [" PTR_FORMAT " - " PTR_FORMAT "]",
p2i(CompressedOops::begin()), p2i(CompressedOops::end()));
log_info(cds)("Dumping objects to closed archive heap region ...");
copy_closed_archive_heap_objects(closed);
copy_closed_objects(closed_regions);

log_info(cds)("Dumping objects to open archive heap region ...");
copy_open_archive_heap_objects(open);
copy_open_objects(open_regions);

destroy_archived_object_cache();
}

G1HeapVerifier::verify_archive_regions();
}

void HeapShared::copy_closed_archive_heap_objects(
GrowableArray<MemRegion> * closed_archive) {
void HeapShared::copy_closed_objects(GrowableArray<MemRegion>* closed_regions) {
assert(is_heap_object_archiving_allowed(), "Cannot archive java heap objects");

G1CollectedHeap::heap()->begin_archive_alloc_range();
@@ -372,12 +369,11 @@ void HeapShared::copy_closed_archive_heap_objects(
true /* is_closed_archive */,
false /* is_full_module_graph */);

G1CollectedHeap::heap()->end_archive_alloc_range(closed_archive,
G1CollectedHeap::heap()->end_archive_alloc_range(closed_regions,
os::vm_allocation_granularity());
}

void HeapShared::copy_open_archive_heap_objects(
GrowableArray<MemRegion> * open_archive) {
void HeapShared::copy_open_objects(GrowableArray<MemRegion>* open_regions) {
assert(is_heap_object_archiving_allowed(), "Cannot archive java heap objects");

G1CollectedHeap::heap()->begin_archive_alloc_range(true /* open */);
@@ -400,7 +396,7 @@ void HeapShared::copy_open_archive_heap_objects(

copy_roots();

G1CollectedHeap::heap()->end_archive_alloc_range(open_archive,
G1CollectedHeap::heap()->end_archive_alloc_range(open_regions,
os::vm_allocation_granularity());
}

@@ -908,7 +904,7 @@ class WalkOopAndArchiveClosure: public BasicOopIterateClosure {
}
};

void HeapShared::check_closed_archive_heap_region_object(InstanceKlass* k) {
void HeapShared::check_closed_region_object(InstanceKlass* k) {
// Check fields in the object
for (JavaFieldStream fs(k); !fs.done(); fs.next()) {
if (!fs.access_flags().is_static()) {
@@ -990,7 +986,7 @@ oop HeapShared::archive_reachable_objects_from(int level,
bool record_klasses_only = (archived_obj != NULL);
if (archived_obj == NULL) {
++_num_new_archived_objs;
archived_obj = archive_heap_object(orig_obj);
archived_obj = archive_object(orig_obj);
if (archived_obj == NULL) {
// Skip archiving the sub-graph referenced from the current entry field.
ResourceMark rm;
@@ -1031,7 +1027,7 @@ oop HeapShared::archive_reachable_objects_from(int level,
subgraph_info, orig_obj, archived_obj);
orig_obj->oop_iterate(&walker);
if (is_closed_archive && orig_k->is_instance_klass()) {
check_closed_archive_heap_region_object(InstanceKlass::cast(orig_k));
check_closed_region_object(InstanceKlass::cast(orig_k));
}
return archived_obj;
}
@@ -1433,8 +1429,10 @@ class PatchEmbeddedPointers: public BitMapClosure {
}
};

void HeapShared::patch_archived_heap_embedded_pointers(MemRegion region, address oopmap,
size_t oopmap_size_in_bits) {
// Patch all the non-null pointers that are embedded in the archived heap objects
// in this region
void HeapShared::patch_embedded_pointers(MemRegion region, address oopmap,
size_t oopmap_size_in_bits) {
BitMapView bm((BitMap::bm_word_t*)oopmap, oopmap_size_in_bits);

#ifndef PRODUCT
@@ -143,9 +143,8 @@ class HeapShared: AllStatic {
private:

#if INCLUDE_CDS_JAVA_HEAP
static bool _closed_archive_heap_region_mapped;
static bool _open_archive_heap_region_mapped;
static bool _archive_heap_region_fixed;
static bool _closed_regions_mapped;
static bool _open_regions_mapped;
static DumpedInternedStrings *_dumped_interned_strings;

public:
@@ -200,7 +199,7 @@ class HeapShared: AllStatic {
static DumpTimeKlassSubGraphInfoTable* _dump_time_subgraph_info_table;
static RunTimeKlassSubGraphInfoTable _run_time_subgraph_info_table;

static void check_closed_archive_heap_region_object(InstanceKlass* k);
static void check_closed_region_object(InstanceKlass* k);

static void archive_object_subgraphs(ArchivableStaticFieldInfo fields[],
int num,
@@ -297,21 +296,14 @@ class HeapShared: AllStatic {
}

static oop find_archived_heap_object(oop obj);
static oop archive_heap_object(oop obj);
static oop archive_object(oop obj);

static void archive_klass_objects();

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);
static void archive_objects(GrowableArray<MemRegion>* closed_regions,
GrowableArray<MemRegion>* open_regions);
static void copy_closed_objects(GrowableArray<MemRegion>* closed_regions);
static void copy_open_objects(GrowableArray<MemRegion>* open_regions);

static oop archive_reachable_objects_from(int level,
KlassSubGraphInfo* subgraph_info,
@@ -357,32 +349,32 @@ class HeapShared: AllStatic {
}

static bool is_heap_region(int idx) {
CDS_JAVA_HEAP_ONLY(return (idx >= MetaspaceShared::first_closed_archive_heap_region &&
idx <= MetaspaceShared::last_open_archive_heap_region);)
CDS_JAVA_HEAP_ONLY(return (idx >= MetaspaceShared::first_closed_heap_region &&
idx <= MetaspaceShared::last_open_heap_region);)
NOT_CDS_JAVA_HEAP_RETURN_(false);
}

static void set_closed_archive_heap_region_mapped() {
CDS_JAVA_HEAP_ONLY(_closed_archive_heap_region_mapped = true;)
static void set_closed_regions_mapped() {
CDS_JAVA_HEAP_ONLY(_closed_regions_mapped = true;)
NOT_CDS_JAVA_HEAP_RETURN;
}
static bool closed_archive_heap_region_mapped() {
CDS_JAVA_HEAP_ONLY(return _closed_archive_heap_region_mapped;)
static bool closed_regions_mapped() {
CDS_JAVA_HEAP_ONLY(return _closed_regions_mapped;)
NOT_CDS_JAVA_HEAP_RETURN_(false);
}
static void set_open_archive_heap_region_mapped() {
CDS_JAVA_HEAP_ONLY(_open_archive_heap_region_mapped = true;)
static void set_open_regions_mapped() {
CDS_JAVA_HEAP_ONLY(_open_regions_mapped = true;)
NOT_CDS_JAVA_HEAP_RETURN;
}
static bool open_archive_heap_region_mapped() {
CDS_JAVA_HEAP_ONLY(return _open_archive_heap_region_mapped;)
static bool open_regions_mapped() {
CDS_JAVA_HEAP_ONLY(return _open_regions_mapped;)
NOT_CDS_JAVA_HEAP_RETURN_(false);
}
static bool is_mapped() {
return closed_archive_heap_region_mapped() && open_archive_heap_region_mapped();
return closed_regions_mapped() && open_regions_mapped();
}

static void fixup_mapped_heap_regions() NOT_CDS_JAVA_HEAP_RETURN;
static void fixup_mapped_regions() NOT_CDS_JAVA_HEAP_RETURN;

inline static bool is_archived_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);

@@ -397,8 +389,8 @@ class HeapShared: AllStatic {

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;
static void patch_embedded_pointers(MemRegion region, address oopmap,
size_t oopmap_in_bits) NOT_CDS_JAVA_HEAP_RETURN;

static void init_for_dumping(TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
static void write_subgraph_info_table() NOT_CDS_JAVA_HEAP_RETURN;