Skip to content

Commit c33fa55

Browse files
committed
8274235: -Xshare:dump should not call vm_direct_exit
Reviewed-by: iklam, dholmes
1 parent 59980ac commit c33fa55

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/hotspot/share/cds/archiveBuilder.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ address ArchiveBuilder::reserve_buffer() {
329329
ReservedSpace rs(buffer_size, MetaspaceShared::core_region_alignment(), os::vm_page_size());
330330
if (!rs.is_reserved()) {
331331
log_error(cds)("Failed to reserve " SIZE_FORMAT " bytes of output buffer.", buffer_size);
332-
vm_direct_exit(0);
332+
os::_exit(0);
333333
}
334334

335335
// buffer_bottom is the lowest address of the 2 core regions (rw, ro) when
@@ -379,7 +379,7 @@ address ArchiveBuilder::reserve_buffer() {
379379
log_error(cds)("my_archive_requested_top = " INTPTR_FORMAT, p2i(my_archive_requested_top));
380380
log_error(cds)("SharedBaseAddress (" INTPTR_FORMAT ") is too high. "
381381
"Please rerun java -Xshare:dump with a lower value", p2i(_requested_static_archive_bottom));
382-
vm_direct_exit(0);
382+
os::_exit(0);
383383
}
384384

385385
if (DumpSharedSpaces) {

src/hotspot/share/cds/heapShared.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,9 @@ oop HeapShared::archive_object(oop obj) {
351351
log_error(cds, heap)(
352352
"Cannot allocate space for object " PTR_FORMAT " in archived heap region",
353353
p2i(obj));
354-
vm_direct_exit(-1,
355-
err_msg("Out of memory. Please run with a larger Java heap, current MaxHeapSize = "
356-
SIZE_FORMAT "M", MaxHeapSize/M));
354+
log_error(cds)("Out of memory. Please run with a larger Java heap, current MaxHeapSize = "
355+
SIZE_FORMAT "M", MaxHeapSize/M);
356+
os::_exit(-1);
357357
}
358358
return archived_oop;
359359
}
@@ -1165,7 +1165,7 @@ oop HeapShared::archive_reachable_objects_from(int level,
11651165
// these objects that are referenced (directly or indirectly) by static fields.
11661166
ResourceMark rm;
11671167
log_error(cds, heap)("Cannot archive object of class %s", orig_obj->klass()->external_name());
1168-
vm_direct_exit(1);
1168+
os::_exit(1);
11691169
}
11701170

11711171
// java.lang.Class instances cannot be included in an archived object sub-graph. We only support
@@ -1175,7 +1175,7 @@ oop HeapShared::archive_reachable_objects_from(int level,
11751175
// object that is referenced (directly or indirectly) by static fields.
11761176
if (java_lang_Class::is_instance(orig_obj)) {
11771177
log_error(cds, heap)("(%d) Unknown java.lang.Class object is in the archived sub-graph", level);
1178-
vm_direct_exit(1);
1178+
os::_exit(1);
11791179
}
11801180

11811181
oop archived_obj = find_archived_heap_object(orig_obj);
@@ -1211,7 +1211,7 @@ oop HeapShared::archive_reachable_objects_from(int level,
12111211
// We don't know how to handle an object that has been archived, but some of its reachable
12121212
// objects cannot be archived. Bail out for now. We might need to fix this in the future if
12131213
// we have a real use case.
1214-
vm_direct_exit(1);
1214+
os::_exit(1);
12151215
}
12161216
}
12171217

src/hotspot/share/cds/metaspaceShared.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ void VM_PopulateDumpSharedSpace::doit() {
582582
// There may be pending VM operations. We have changed some global states
583583
// (such as vmClasses::_klasses) that may cause these VM operations
584584
// to fail. For safety, forget these operations and exit the VM directly.
585-
vm_direct_exit(0);
585+
os::_exit(0);
586586
}
587587

588588
class CollectCLDClosure : public CLDClosure {

0 commit comments

Comments
 (0)