1 Star 0 Fork 80

佛系少年中二/openjdk-1.8.0

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
8232069-enable-shutdown-UseCompressedClassPointers-U.patch 26.71 KB
一键复制 编辑 原始数据 按行查看 历史
eapen 提交于 2023-01-11 10:00 . I69W1Y: Add feature and bug fix for 8u352
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
From bf7e5b40eab65acf8988a30c1530654db1f8cf07 Mon Sep 17 00:00:00 2001
From: eapen <zhangyipeng7@huawei.com>
Date: Fri, 30 Sep 2022 17:18:50 +0800
Subject: [PATCH 27/33] I68TO2: 8232069: enable shutdown UseCompressedClassPointers &&
UseCompressedOops when CDS
---
common/bin/compare.sh | 2 +-
hotspot/src/share/vm/memory/filemap.cpp | 12 ++
hotspot/src/share/vm/memory/filemap.hpp | 4 +
hotspot/src/share/vm/memory/metaspace.cpp | 42 +++--
hotspot/src/share/vm/runtime/arguments.cpp | 47 ++---
hotspot/src/share/vm/runtime/arguments.hpp | 2 +-
.../CDSCompressedKPtrsError.java | 93 ----------
.../appcds/CommandLineFlagComboNegative.java | 5 +-
.../appcds/TestCombinedCompressedFlags.java | 192 +++++++++++++++++++++
jdk/make/BuildJdk.gmk | 2 +
10 files changed, 253 insertions(+), 148 deletions(-)
delete mode 100644 hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrsError.java
create mode 100644 hotspot/test/runtime/appcds/TestCombinedCompressedFlags.java
diff --git a/common/bin/compare.sh b/common/bin/compare.sh
index a36464a..e6a3f67 100644
--- a/common/bin/compare.sh
+++ b/common/bin/compare.sh
@@ -290,7 +290,7 @@ compare_general_files() {
! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \
! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \
! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" \
- ! -name "classes.jsa" \
+ ! -name "classes.jsa" | -name "classes_nocoops.jsa" \
| $GREP -v "./bin/" | $SORT | $FILTER)
echo General files...
diff --git a/hotspot/src/share/vm/memory/filemap.cpp b/hotspot/src/share/vm/memory/filemap.cpp
index 0682cd6..0d21707 100644
--- a/hotspot/src/share/vm/memory/filemap.cpp
+++ b/hotspot/src/share/vm/memory/filemap.cpp
@@ -241,6 +241,8 @@ void FileMapInfo::FileMapHeader::populate(FileMapInfo* mapinfo, size_t alignment
_alignment = alignment;
_obj_alignment = ObjectAlignmentInBytes;
+ _compressed_oops = UseCompressedOops;
+ _compressed_class_ptrs = UseCompressedClassPointers;
if (!DynamicDumpSharedSpaces) {
_classpath_entry_table_size = mapinfo->_classpath_entry_table_size;
_classpath_entry_table = mapinfo->_classpath_entry_table;
@@ -987,6 +989,16 @@ bool FileMapInfo::FileMapHeader::validate() {
_obj_alignment, ObjectAlignmentInBytes);
return false;
}
+ if (PrintSharedSpaces) {
+ tty->print_cr("Archive was created with UseCompressedOops = %d, UseCompressedClassPointers = %d",
+ compressed_oops(), compressed_class_pointers());
+ }
+
+ if (compressed_oops() != UseCompressedOops || compressed_class_pointers() != UseCompressedClassPointers) {
+ FileMapInfo::fail_continue("Unable to use shared archive.\nThe saved state of UseCompressedOops and UseCompressedClassPointers is "
+ "different from runtime, CDS will be disabled.");
+ return false;
+ }
return true;
}
diff --git a/hotspot/src/share/vm/memory/filemap.hpp b/hotspot/src/share/vm/memory/filemap.hpp
index 27fff35..debfb50 100644
--- a/hotspot/src/share/vm/memory/filemap.hpp
+++ b/hotspot/src/share/vm/memory/filemap.hpp
@@ -105,6 +105,8 @@ public:
size_t _alignment; // how shared archive should be aligned
int _obj_alignment; // value of ObjectAlignmentInBytes
bool _is_default_jsa; // indicates whether is the default jsa file
+ bool _compressed_oops; // save the flag UseCompressedOops
+ bool _compressed_class_ptrs; // save the flag UseCompressedClassPointers
struct space_info {
int _crc; // crc checksum of the current space
@@ -156,6 +158,8 @@ public:
int compute_crc();
unsigned int magic() const { return _magic; }
const char* jvm_ident() const { return _jvm_ident; }
+ bool compressed_oops() const { return _compressed_oops; }
+ bool compressed_class_pointers() const { return _compressed_class_ptrs; }
};
// Fixme
diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp
index cf4a112..07bc47a 100644
--- a/hotspot/src/share/vm/memory/metaspace.cpp
+++ b/hotspot/src/share/vm/memory/metaspace.cpp
@@ -3634,25 +3634,33 @@ void Metaspace::global_initialize() {
}
#ifdef _LP64
- if (cds_total + compressed_class_space_size() > UnscaledClassSpaceMax) {
- vm_exit_during_initialization("Unable to dump shared archive.",
- err_msg("Size of archive (" SIZE_FORMAT ") + compressed class space ("
- SIZE_FORMAT ") == total (" SIZE_FORMAT ") is larger than compressed "
- "klass limit: " SIZE_FORMAT, cds_total, compressed_class_space_size(),
- cds_total + compressed_class_space_size(), UnscaledClassSpaceMax));
- }
+ if (UseCompressedClassPointers) {
+ if (cds_total + compressed_class_space_size() > UnscaledClassSpaceMax) {
+ vm_exit_during_initialization("Unable to dump shared archive.",
+ err_msg("Size of archive (" SIZE_FORMAT ") + compressed class space ("
+ SIZE_FORMAT ") == total (" SIZE_FORMAT ") is larger than compressed "
+ "klass limit: " SIZE_FORMAT, cds_total, compressed_class_space_size(),
+ cds_total + compressed_class_space_size(), UnscaledClassSpaceMax));
+ }
- // Set the compressed klass pointer base so that decoding of these pointers works
- // properly when creating the shared archive.
- assert(UseCompressedOops && UseCompressedClassPointers,
- "UseCompressedOops and UseCompressedClassPointers must be set");
- Universe::set_narrow_klass_base((address)_space_list->current_virtual_space()->bottom());
- if (TraceMetavirtualspaceAllocation && Verbose) {
- gclog_or_tty->print_cr("Setting_narrow_klass_base to Address: " PTR_FORMAT,
- _space_list->current_virtual_space()->bottom());
- }
+ // Set the compressed klass pointer base so that decoding of these pointers works
+ // properly when creating the shared archive.
+ assert(UseCompressedOops && UseCompressedClassPointers,
+ "UseCompressedOops and UseCompressedClassPointers must be set");
+ Universe::set_narrow_klass_base((address)_space_list->current_virtual_space()->bottom());
+ if (TraceMetavirtualspaceAllocation && Verbose) {
+ gclog_or_tty->print_cr("Setting_narrow_klass_base to Address: " PTR_FORMAT,
+ _space_list->current_virtual_space()->bottom());
+ }
- Universe::set_narrow_klass_shift(0);
+ Universe::set_narrow_klass_shift(0);
+ } else {
+ if (cds_total > UnscaledClassSpaceMax) {
+ vm_exit_during_initialization("Unable to dump shared archive.",
+ err_msg("Size of archive (" SIZE_FORMAT ") is larger than compressed "
+ "klass limit: " SIZE_FORMAT, cds_total, UnscaledClassSpaceMax));
+ }
+ }
#endif // _LP64
#endif // INCLUDE_CDS
} else {
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index fba3d4b..b0b5414 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -242,7 +242,9 @@ bool Arguments::init_shared_archive_paths() {
}
}
- if (SharedArchiveFile != NULL) {
+ if (SharedArchiveFile == NULL) {
+ SharedArchivePath = get_default_shared_archive_path();
+ } else {
int archives = num_archives(SharedArchiveFile);
if (is_dumping_archive()) {
if (archives > 1) {
@@ -4008,7 +4010,7 @@ jint Arguments::parse_options_environment_variable(const char* name, SysClassPat
return JNI_OK;
}
-void Arguments::set_shared_spaces_flags() {
+jint Arguments::set_shared_spaces_flags() {
if (DumpSharedSpaces) {
if (FailOverToOldVerifier) {
// Don't fall back to the old verifier on verification failure. If a
@@ -4022,22 +4024,16 @@ void Arguments::set_shared_spaces_flags() {
warning("cannot dump shared archive while using shared archive");
}
UseSharedSpaces = false;
-#ifdef _LP64
- if (!UseCompressedOops || !UseCompressedClassPointers) {
- vm_exit_during_initialization(
- "Cannot dump shared archive when UseCompressedOops or UseCompressedClassPointers is off.", NULL);
- }
- } else {
- if (!UseCompressedOops || !UseCompressedClassPointers) {
- no_shared_spaces("UseCompressedOops and UseCompressedClassPointers must be on for UseSharedSpaces.");
- }
-#endif
}
#if INCLUDE_CDS
// Initialize shared archive paths which could include both base and dynamic archive paths
- init_shared_archive_paths();
+ // This must be after set_ergonomics_flags() called so flag UseCompressedOops is set properly.
+ if(!init_shared_archive_paths()) {
+ return JNI_ENOMEM;
+ }
#endif // INCLUDE_CDS
+ return JNI_OK;
}
#if !INCLUDE_ALL_GCS
@@ -4065,25 +4061,14 @@ char* Arguments::get_default_shared_archive_path() {
const size_t len = jvm_path_len + file_sep_len + 20;
default_archive_path = NEW_C_HEAP_ARRAY(char, len, mtInternal);
if (default_archive_path != NULL) {
- jio_snprintf(default_archive_path, len, "%s%sclasses.jsa",
+ jio_snprintf(default_archive_path, len,
+ UseCompressedClassPointers ? "%s%sclasses.jsa" : "%s%sclasses_nocoops.jsa",
jvm_path, os::file_separator());
}
Arguments::set_is_default_jsa(true);
return default_archive_path;
}
-// Sharing support
-// Construct the path to the archive
-static char* get_shared_archive_path() {
- char *shared_archive_path;
- if (SharedArchiveFile == NULL) {
- shared_archive_path = Arguments::get_default_shared_archive_path();
- } else {
- shared_archive_path = os::strdup(SharedArchiveFile, mtInternal);
- }
- return shared_archive_path;
-}
-
#ifndef PRODUCT
// Determine whether LogVMOutput should be implicitly turned on.
@@ -4221,13 +4206,6 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
return result;
}
- // Call get_shared_archive_path() here, after possible SharedArchiveFile option got parsed.
- SharedArchivePath = get_shared_archive_path();
- if (SharedArchivePath == NULL) {
- return JNI_ENOMEM;
- }
-
-
// Set up VerifySharedSpaces
if (FLAG_IS_DEFAULT(VerifySharedSpaces) && SharedArchiveFile != NULL) {
VerifySharedSpaces = true;
@@ -4321,7 +4299,8 @@ jint Arguments::apply_ergo() {
// Set flags based on ergonomics.
set_ergonomics_flags();
- set_shared_spaces_flags();
+ jint result = set_shared_spaces_flags();
+ if (result != JNI_OK) return result;
#if defined(SPARC)
// BIS instructions require 'membar' instruction regardless of the number
diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp
index 65907eb..88741e8 100644
--- a/hotspot/src/share/vm/runtime/arguments.hpp
+++ b/hotspot/src/share/vm/runtime/arguments.hpp
@@ -343,7 +343,7 @@ class Arguments : AllStatic {
static void set_use_compressed_klass_ptrs();
static void select_gc();
static void set_ergonomics_flags();
- static void set_shared_spaces_flags();
+ static jint set_shared_spaces_flags();
// limits the given memory size by the maximum amount of memory this process is
// currently allowed to allocate or reserve.
static julong limit_by_allocatable_memory(julong size);
diff --git a/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrsError.java b/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrsError.java
deleted file mode 100644
index 05b4ac9..0000000
--- a/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrsError.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2013, 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
- * 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.
- */
-
-/*
- * @test
- * @bug 8003424
- * @summary Test that cannot use CDS if UseCompressedClassPointers is turned off.
- * @library /testlibrary
- * @run main CDSCompressedKPtrsError
- */
-
-import com.oracle.java.testlibrary.*;
-
-public class CDSCompressedKPtrsError {
- public static void main(String[] args) throws Exception {
- ProcessBuilder pb;
- if (Platform.is64bit()) {
- pb = ProcessTools.createJavaProcessBuilder(
- "-XX:+UseCompressedOops", "-XX:+UseCompressedClassPointers", "-XX:+UnlockDiagnosticVMOptions",
- "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:dump");
- OutputAnalyzer output = new OutputAnalyzer(pb.start());
- try {
- output.shouldContain("Loading classes to share");
- output.shouldHaveExitValue(0);
-
- pb = ProcessTools.createJavaProcessBuilder(
- "-XX:-UseCompressedClassPointers", "-XX:-UseCompressedOops",
- "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:on", "-version");
- output = new OutputAnalyzer(pb.start());
- output.shouldContain("Unable to use shared archive");
- output.shouldHaveExitValue(0);
-
- pb = ProcessTools.createJavaProcessBuilder(
- "-XX:-UseCompressedClassPointers", "-XX:+UseCompressedOops",
- "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:on", "-version");
- output = new OutputAnalyzer(pb.start());
- output.shouldContain("Unable to use shared archive");
- output.shouldHaveExitValue(0);
-
- pb = ProcessTools.createJavaProcessBuilder(
- "-XX:+UseCompressedClassPointers", "-XX:-UseCompressedOops",
- "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:on", "-version");
- output = new OutputAnalyzer(pb.start());
- output.shouldContain("Unable to use shared archive");
- output.shouldHaveExitValue(0);
-
- } catch (RuntimeException e) {
- output.shouldContain("Unable to use shared archive");
- output.shouldHaveExitValue(1);
- }
-
- // Test bad options with -Xshare:dump.
- pb = ProcessTools.createJavaProcessBuilder(
- "-XX:-UseCompressedOops", "-XX:+UseCompressedClassPointers", "-XX:+UnlockDiagnosticVMOptions",
- "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:dump");
- output = new OutputAnalyzer(pb.start());
- output.shouldContain("Cannot dump shared archive");
-
- pb = ProcessTools.createJavaProcessBuilder(
- "-XX:+UseCompressedOops", "-XX:-UseCompressedClassPointers", "-XX:+UnlockDiagnosticVMOptions",
- "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:dump");
- output = new OutputAnalyzer(pb.start());
- output.shouldContain("Cannot dump shared archive");
-
- pb = ProcessTools.createJavaProcessBuilder(
- "-XX:-UseCompressedOops", "-XX:-UseCompressedClassPointers", "-XX:+UnlockDiagnosticVMOptions",
- "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:dump");
- output = new OutputAnalyzer(pb.start());
- output.shouldContain("Cannot dump shared archive");
-
- }
- }
-}
diff --git a/hotspot/test/runtime/appcds/CommandLineFlagComboNegative.java b/hotspot/test/runtime/appcds/CommandLineFlagComboNegative.java
index 4fb965a..286893e 100644
--- a/hotspot/test/runtime/appcds/CommandLineFlagComboNegative.java
+++ b/hotspot/test/runtime/appcds/CommandLineFlagComboNegative.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, Huawei Technologies Co., Ltd. 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
@@ -64,9 +65,9 @@ public class CommandLineFlagComboNegative {
testTable.add( new TestVector("-XX:ObjectAlignmentInBytes=64", "-XX:ObjectAlignmentInBytes=32",
"An error has occurred while processing the shared archive file", 1) );
testTable.add( new TestVector("-XX:+UseCompressedOops", "-XX:-UseCompressedOops",
- "Class data sharing is inconsistent with other specified options", 1) );
+ "The saved state of UseCompressedOops and UseCompressedClassPointers is different from runtime, CDS will be disabled", 1) );
testTable.add( new TestVector("-XX:+UseCompressedClassPointers", "-XX:-UseCompressedClassPointers",
- "Class data sharing is inconsistent with other specified options", 1) );
+ "The saved state of UseCompressedOops and UseCompressedClassPointers is different from runtime, CDS will be disabled", 1) );
}
}
diff --git a/hotspot/test/runtime/appcds/TestCombinedCompressedFlags.java b/hotspot/test/runtime/appcds/TestCombinedCompressedFlags.java
new file mode 100644
index 0000000..6f0a3be
--- /dev/null
+++ b/hotspot/test/runtime/appcds/TestCombinedCompressedFlags.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, Huawei Technologies Co., Ltd. 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
+ * 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.
+ */
+
+/**
+ * @test
+ * @bug 8232069
+ * @summary Testing different combination of CompressedOops and CompressedClassPointers
+ * @requires (vm.gc=="null")
+ * @library /testlibrary
+ * @compile test-classes/Hello.java
+ * @run main/othervm TestCombinedCompressedFlags
+ */
+
+import com.oracle.java.testlibrary.Platform;
+import com.oracle.java.testlibrary.OutputAnalyzer;
+import java.util.List;
+import java.util.ArrayList;
+
+public class TestCombinedCompressedFlags {
+ public static String HELLO_STRING = "Hello World";
+ public static String EXEC_ABNORMAL_MSG = "Unable to use shared archive.";
+ public static final int PASS = 0;
+ public static final int FAIL = 1;
+
+ static class ConfArg {
+ public boolean useCompressedOops; // UseCompressedOops
+ public boolean useCompressedClassPointers; // UseCompressedClassPointers
+ public String msg;
+ public int code;
+ public ConfArg(boolean useCompressedOops, boolean useCompressedClassPointers, String msg, int code) {
+ this.useCompressedOops = useCompressedOops;
+ this.useCompressedClassPointers = useCompressedClassPointers;
+ this.msg = msg;
+ this.code = code;
+ }
+ }
+
+ static class RunArg {
+ public ConfArg dumpArg;
+ public List<ConfArg> execArgs;
+ public RunArg(ConfArg arg) {
+ dumpArg = arg;
+ initExecArgs();
+ }
+ private void initExecArgs() {
+ /* The combinations have four cases. Note COOP off, CCPTR must be off
+ * UseCompressedOops UseCompressedClassPointers Result
+ * 1.
+ * dump: on on
+ * test: on on Pass
+ * on off Fail
+ * off on Fail
+ * off off Fail
+ * 2.
+ * dump: on off
+ * test: on off Pass
+ * on on Fail
+ * off on Pass
+ * off off Fail
+ * 3.
+ * dump: off on
+ * test: off on Pass
+ * off off Pass
+ * on on Fail
+ * on off Fail
+ * 4.
+ * dump: off off
+ * test: off off Pass
+ * off on Pass
+ * on on Fail
+ * on off Fail
+ **/
+ execArgs = new ArrayList<ConfArg>();
+ if (dumpArg.useCompressedOops && dumpArg.useCompressedClassPointers) {
+ execArgs
+ .add(new ConfArg(true, true, HELLO_STRING, PASS));
+ execArgs
+ .add(new ConfArg(true, false, EXEC_ABNORMAL_MSG, FAIL));
+ execArgs
+ .add(new ConfArg(false, true, EXEC_ABNORMAL_MSG, FAIL));
+ execArgs
+ .add(new ConfArg(false, false, EXEC_ABNORMAL_MSG, FAIL));
+
+ } else if(dumpArg.useCompressedOops && !dumpArg.useCompressedClassPointers) {
+ execArgs
+ .add(new ConfArg(true, false, HELLO_STRING, PASS));
+ execArgs
+ .add(new ConfArg(true, true, EXEC_ABNORMAL_MSG, FAIL));
+ execArgs
+ .add(new ConfArg(false, true, EXEC_ABNORMAL_MSG, FAIL));
+ execArgs
+ .add(new ConfArg(false, false, EXEC_ABNORMAL_MSG, FAIL));
+
+ } else if (!dumpArg.useCompressedOops && dumpArg.useCompressedClassPointers) {
+ execArgs
+ .add(new ConfArg(false, false, HELLO_STRING, PASS));
+ execArgs
+ .add(new ConfArg(false, true, HELLO_STRING, PASS));
+ execArgs
+ .add(new ConfArg(true, true, EXEC_ABNORMAL_MSG, FAIL));
+ execArgs
+ .add(new ConfArg(true, false, EXEC_ABNORMAL_MSG, FAIL));
+ } else if (!dumpArg.useCompressedOops && !dumpArg.useCompressedClassPointers) {
+ execArgs
+ .add(new ConfArg(false, false, HELLO_STRING, PASS));
+ execArgs
+ .add(new ConfArg(false, true, HELLO_STRING, PASS));
+ execArgs
+ .add(new ConfArg(true, true, EXEC_ABNORMAL_MSG, FAIL));
+ execArgs
+ .add(new ConfArg(true, false, EXEC_ABNORMAL_MSG, FAIL));
+ }
+ }
+ }
+
+ public static String getCompressedOopsArg(boolean on) {
+ if (on) return "-XX:+UseCompressedOops";
+ else return "-XX:-UseCompressedOops";
+ }
+
+ public static String getCompressedClassPointersArg(boolean on) {
+ if (on) return "-XX:+UseCompressedClassPointers";
+ else return "-XX:-UseCompressedClassPointers";
+ }
+
+ public static List<RunArg> runList;
+
+ public static void configureRunArgs() {
+ runList = new ArrayList<RunArg>();
+ runList
+ .add(new RunArg(new ConfArg(true, true, null, PASS)));
+ runList
+ .add(new RunArg(new ConfArg(true, false, null, PASS)));
+ runList
+ .add(new RunArg(new ConfArg(false, true, null, PASS)));
+ runList
+ .add(new RunArg(new ConfArg(false, false, null, PASS)));
+ }
+
+ public static void main(String[] args) throws Exception {
+ if (!Platform.is64bit()) {
+ System.out.println("Test case not applicable on 32-bit platforms");
+ return;
+
+ }
+
+ String helloJar = JarBuilder.build("hello", "Hello");
+ configureRunArgs();
+ OutputAnalyzer out;
+ for (RunArg t: runList) {
+ out = TestCommon
+ .dump(helloJar,
+ new String[] {"Hello"},
+ getCompressedOopsArg(t.dumpArg.useCompressedOops),
+ getCompressedClassPointersArg(t.dumpArg.useCompressedClassPointers));
+ out.shouldContain("total : ");
+ out.shouldHaveExitValue(0);
+
+ for (ConfArg c : t.execArgs) {
+ out = TestCommon.exec(helloJar,
+ "-cp",
+ helloJar,
+ getCompressedOopsArg(c.useCompressedOops),
+ getCompressedClassPointersArg(c.useCompressedClassPointers),
+ "Hello");
+ out.shouldContain(c.msg);
+ out.shouldHaveExitValue(c.code);
+ }
+ }
+ }
+}
diff --git a/jdk/make/BuildJdk.gmk b/jdk/make/BuildJdk.gmk
index bb8ea8a..6707456 100644
--- a/jdk/make/BuildJdk.gmk
+++ b/jdk/make/BuildJdk.gmk
@@ -106,8 +106,10 @@ images:
ifeq ($(BUILD_CDS_ARCHIVE), true)
echo Creating CDS archive for jdk image
$(JDK_IMAGE_DIR)/bin/java -Xshare:dump -Xmx128M -Xms128M -XX:ParallelGCThreads=1 -Xint $(LOG_INFO)
+ $(JDK_IMAGE_DIR)/bin/java -Xshare:dump -Xmx128M -Xms128M -XX:ParallelGCThreads=1 -Xint -XX:-UseCompressedOops $(LOG_INFO)
echo Creating CDS archive for jre image
$(JRE_IMAGE_DIR)/bin/java -Xshare:dump -Xmx128M -Xms128M -XX:ParallelGCThreads=1 -Xint $(LOG_INFO)
+ $(JDK_IMAGE_DIR)/bin/java -Xshare:dump -Xmx128M -Xms128M -XX:ParallelGCThreads=1 -Xint -XX:-UseCompressedOops $(LOG_INFO)
endif
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Autistic_boyya/openjdk-1.8.0.git
git@gitee.com:Autistic_boyya/openjdk-1.8.0.git
Autistic_boyya
openjdk-1.8.0
openjdk-1.8.0
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891