8298614: Support CDS heap dumping for SerialGC and ParallelGC
Reviewed-by: dholmes, lmesnik, iklam
This commit is contained in:
parent
c9bee173d6
commit
d555f072b2
@ -88,7 +88,6 @@ void ArchiveHeapWriter::init() {
|
||||
_native_pointers = new GrowableArrayCHeap<NativePointerInfo, mtClassShared>(2048);
|
||||
_source_objs = new GrowableArrayCHeap<oop, mtClassShared>(10000);
|
||||
|
||||
guarantee(UseG1GC, "implementation limitation");
|
||||
guarantee(MIN_GC_REGION_ALIGNMENT <= G1HeapRegion::min_region_size_in_words() * HeapWordSize, "must be");
|
||||
}
|
||||
}
|
||||
@ -452,26 +451,30 @@ size_t ArchiveHeapWriter::copy_one_source_obj_to_buffer(oop src_obj) {
|
||||
|
||||
void ArchiveHeapWriter::set_requested_address(ArchiveHeapInfo* info) {
|
||||
assert(!info->is_used(), "only set once");
|
||||
assert(UseG1GC, "must be");
|
||||
address heap_end = (address)G1CollectedHeap::heap()->reserved().end();
|
||||
log_info(cds, heap)("Heap end = %p", heap_end);
|
||||
|
||||
size_t heap_region_byte_size = _buffer_used;
|
||||
assert(heap_region_byte_size > 0, "must archived at least one object!");
|
||||
|
||||
|
||||
if (UseCompressedOops) {
|
||||
_requested_bottom = align_down(heap_end - heap_region_byte_size, G1HeapRegion::GrainBytes);
|
||||
if (UseG1GC) {
|
||||
address heap_end = (address)G1CollectedHeap::heap()->reserved().end();
|
||||
log_info(cds, heap)("Heap end = %p", heap_end);
|
||||
_requested_bottom = align_down(heap_end - heap_region_byte_size, G1HeapRegion::GrainBytes);
|
||||
_requested_bottom = align_down(_requested_bottom, MIN_GC_REGION_ALIGNMENT);
|
||||
assert(is_aligned(_requested_bottom, G1HeapRegion::GrainBytes), "sanity");
|
||||
} else {
|
||||
_requested_bottom = align_up(CompressedOops::begin(), MIN_GC_REGION_ALIGNMENT);
|
||||
}
|
||||
} else {
|
||||
// We always write the objects as if the heap started at this address. This
|
||||
// makes the contents of the archive heap deterministic.
|
||||
//
|
||||
// Note that at runtime, the heap address is selected by the OS, so the archive
|
||||
// heap will not be mapped at 0x10000000, and the contents need to be patched.
|
||||
_requested_bottom = (address)NOCOOPS_REQUESTED_BASE;
|
||||
_requested_bottom = align_up((address)NOCOOPS_REQUESTED_BASE, MIN_GC_REGION_ALIGNMENT);
|
||||
}
|
||||
|
||||
assert(is_aligned(_requested_bottom, G1HeapRegion::GrainBytes), "sanity");
|
||||
assert(is_aligned(_requested_bottom, MIN_GC_REGION_ALIGNMENT), "sanity");
|
||||
|
||||
_requested_top = _requested_bottom + _buffer_used;
|
||||
|
||||
|
@ -471,11 +471,13 @@ void HeapShared::archive_objects(ArchiveHeapInfo *heap_info) {
|
||||
// Cache for recording where the archived objects are copied to
|
||||
create_archived_object_cache();
|
||||
|
||||
log_info(cds)("Heap range = [" PTR_FORMAT " - " PTR_FORMAT "]",
|
||||
UseCompressedOops ? p2i(CompressedOops::begin()) :
|
||||
p2i((address)G1CollectedHeap::heap()->reserved().start()),
|
||||
UseCompressedOops ? p2i(CompressedOops::end()) :
|
||||
p2i((address)G1CollectedHeap::heap()->reserved().end()));
|
||||
if (UseCompressedOops || UseG1GC) {
|
||||
log_info(cds)("Heap range = [" PTR_FORMAT " - " PTR_FORMAT "]",
|
||||
UseCompressedOops ? p2i(CompressedOops::begin()) :
|
||||
p2i((address)G1CollectedHeap::heap()->reserved().start()),
|
||||
UseCompressedOops ? p2i(CompressedOops::end()) :
|
||||
p2i((address)G1CollectedHeap::heap()->reserved().end()));
|
||||
}
|
||||
copy_objects();
|
||||
|
||||
CDSHeapVerifier::verify();
|
||||
|
@ -143,13 +143,13 @@ class HeapShared: AllStatic {
|
||||
friend class VerifySharedOopClosure;
|
||||
|
||||
public:
|
||||
// Can this VM write a heap region into the CDS archive? Currently only G1+compressed{oops,cp}
|
||||
// Can this VM write a heap region into the CDS archive? Currently only {G1|Parallel|Serial}+compressed_cp
|
||||
static bool can_write() {
|
||||
CDS_JAVA_HEAP_ONLY(
|
||||
if (_disable_writing) {
|
||||
return false;
|
||||
}
|
||||
return (UseG1GC && UseCompressedClassPointers);
|
||||
return (UseG1GC || UseParallelGC || UseSerialGC) && UseCompressedClassPointers;
|
||||
)
|
||||
NOT_CDS_JAVA_HEAP(return false;)
|
||||
}
|
||||
|
@ -108,9 +108,9 @@ public class IncompatibleOptions {
|
||||
testDump(1, "-XX:+UseZGC", "-XX:-UseCompressedOops", null, false);
|
||||
}
|
||||
|
||||
// incompatible GCs
|
||||
testDump(2, "-XX:+UseParallelGC", "", GC_WARNING, false);
|
||||
testDump(3, "-XX:+UseSerialGC", "", GC_WARNING, false);
|
||||
// Dump heap objects with ParallelGC and SerialGC
|
||||
testDump(2, "-XX:+UseParallelGC", "", "", false);
|
||||
testDump(3, "-XX:+UseSerialGC", "", "", false);
|
||||
|
||||
// Explicitly archive with compressed oops, run without.
|
||||
testDump(5, "-XX:+UseG1GC", "-XX:+UseCompressedOops", null, false);
|
||||
|
@ -27,6 +27,7 @@
|
||||
* @summary Use a shared string allocated in a humongous G1 region.
|
||||
* @comment -- the following implies that G1 is used (by command-line or by default)
|
||||
* @requires vm.cds.write.archived.java.heap
|
||||
* @requires vm.gc.G1
|
||||
*
|
||||
* @library /test/hotspot/jtreg/runtime/cds/appcds /test/lib
|
||||
* @build HelloString
|
||||
|
@ -96,7 +96,7 @@ public class SharedStringsUtils {
|
||||
|
||||
String appJar = TestCommon.getTestJar(TEST_JAR_NAME_FULL);
|
||||
String[] args =
|
||||
TestCommon.concat(extraOptions, "-XX:+UseCompressedOops", "-XX:+UseG1GC",
|
||||
TestCommon.concat(extraOptions, "-XX:+UseCompressedOops",
|
||||
"-XX:SharedArchiveConfigFile=" +
|
||||
TestCommon.getSourceFile(sharedDataFile));
|
||||
args = TestCommon.concat(childVMOptionsPrefix, args);
|
||||
@ -124,7 +124,7 @@ public class SharedStringsUtils {
|
||||
|
||||
String appJar = TestCommon.getTestJar(TEST_JAR_NAME_FULL);
|
||||
String[] args = TestCommon.concat(extraOptions,
|
||||
"-cp", appJar, "-XX:+UseCompressedOops", "-XX:+UseG1GC", className);
|
||||
"-cp", appJar, "-XX:+UseCompressedOops", className);
|
||||
args = TestCommon.concat(childVMOptionsPrefix, args);
|
||||
|
||||
OutputAnalyzer output = TestCommon.execAuto(args);
|
||||
@ -143,7 +143,7 @@ public class SharedStringsUtils {
|
||||
|
||||
String appJar = TestCommon.getTestJar(TEST_JAR_NAME_FULL);
|
||||
String[] args = TestCommon.concat(extraOptions,
|
||||
"-XX:+UseCompressedOops", "-XX:+UseG1GC", className);
|
||||
"-XX:+UseCompressedOops", className);
|
||||
args = TestCommon.concat(childVMOptionsPrefix, args);
|
||||
|
||||
OutputAnalyzer output = TestCommon.exec(appJar, args);
|
||||
|
Loading…
Reference in New Issue
Block a user