aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Ioi Lam <iklam@openjdk.org> 2021-03-26 03:37:14 +0000
committerGravatar Ioi Lam <iklam@openjdk.org> 2021-03-26 03:37:14 +0000
commit41657b15ac8322cc109d7f6105873ae388e48ff3 (patch)
tree799d2452c62e25b4b8e86de2d64f0e0fa102a4cd
parentfe8ef3223d3ef93c822980c84e01afabd046d399 (diff)
downloadjdk-41657b15ac8322cc109d7f6105873ae388e48ff3.tar.gz
jdk-41657b15ac8322cc109d7f6105873ae388e48ff3.zip
8261551: Remove special CDS handling in Metaspace::allocate
Reviewed-by: minqi, dholmes, stuefe
-rw-r--r--src/hotspot/share/memory/metaspace.cpp7
-rw-r--r--src/hotspot/share/memory/metaspaceShared.cpp3
-rw-r--r--src/hotspot/share/memory/metaspaceShared.hpp2
-rw-r--r--src/hotspot/share/runtime/thread.cpp2
-rw-r--r--test/hotspot/jtreg/runtime/cds/MaxMetaspaceSize.java4
5 files changed, 6 insertions, 12 deletions
diff --git a/src/hotspot/share/memory/metaspace.cpp b/src/hotspot/share/memory/metaspace.cpp
index d5b46a6dc74..7d79c96bdaa 100644
--- a/src/hotspot/share/memory/metaspace.cpp
+++ b/src/hotspot/share/memory/metaspace.cpp
@@ -822,13 +822,6 @@ MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
}
if (result == NULL) {
- if (DumpSharedSpaces) {
- // CDS dumping keeps loading classes, so if we hit an OOM we probably will keep hitting OOM.
- // We should abort to avoid generating a potentially bad archive.
- vm_exit_during_cds_dumping(err_msg("Failed allocating metaspace object type %s of size " SIZE_FORMAT ". CDS dump aborted.",
- MetaspaceObj::type_name(type), word_size * BytesPerWord),
- err_msg("Please increase MaxMetaspaceSize (currently " SIZE_FORMAT " bytes).", MaxMetaspaceSize));
- }
report_metadata_oome(loader_data, word_size, type, mdtype, THREAD);
assert(HAS_PENDING_EXCEPTION, "sanity");
return NULL;
diff --git a/src/hotspot/share/memory/metaspaceShared.cpp b/src/hotspot/share/memory/metaspaceShared.cpp
index 5cf3bd45862..30f2c5ad44a 100644
--- a/src/hotspot/share/memory/metaspaceShared.cpp
+++ b/src/hotspot/share/memory/metaspaceShared.cpp
@@ -612,7 +612,8 @@ void MetaspaceShared::prepare_for_dumping() {
// Preload classes from a list, populate the shared spaces and dump to a
// file.
-void MetaspaceShared::preload_and_dump(TRAPS) {
+void MetaspaceShared::preload_and_dump() {
+ EXCEPTION_MARK;
ResourceMark rm(THREAD);
preload_and_dump_impl(THREAD);
if (HAS_PENDING_EXCEPTION) {
diff --git a/src/hotspot/share/memory/metaspaceShared.hpp b/src/hotspot/share/memory/metaspaceShared.hpp
index f3ec9952b73..1ccd58bb185 100644
--- a/src/hotspot/share/memory/metaspaceShared.hpp
+++ b/src/hotspot/share/memory/metaspaceShared.hpp
@@ -77,7 +77,7 @@ class MetaspaceShared : AllStatic {
};
static void prepare_for_dumping() NOT_CDS_RETURN;
- static void preload_and_dump(TRAPS) NOT_CDS_RETURN;
+ static void preload_and_dump() NOT_CDS_RETURN;
private:
static void preload_and_dump_impl(TRAPS) NOT_CDS_RETURN;
diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp
index 231bfe3b3cf..b7007ff09e2 100644
--- a/src/hotspot/share/runtime/thread.cpp
+++ b/src/hotspot/share/runtime/thread.cpp
@@ -3413,7 +3413,7 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
#endif
if (DumpSharedSpaces) {
- MetaspaceShared::preload_and_dump(CHECK_JNI_ERR);
+ MetaspaceShared::preload_and_dump();
ShouldNotReachHere();
}
diff --git a/test/hotspot/jtreg/runtime/cds/MaxMetaspaceSize.java b/test/hotspot/jtreg/runtime/cds/MaxMetaspaceSize.java
index dadfd84ba6b..cbae5d22e3c 100644
--- a/test/hotspot/jtreg/runtime/cds/MaxMetaspaceSize.java
+++ b/test/hotspot/jtreg/runtime/cds/MaxMetaspaceSize.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@ public class MaxMetaspaceSize {
processArgs.add("-XX:MaxMetaspaceSize=1m");
}
- String msg = "Failed allocating metaspace object";
+ String msg = "OutOfMemoryError: Metaspace";
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(processArgs);
CDSTestUtils.executeAndLog(pb, "dump").shouldContain(msg).shouldHaveExitValue(1);
}