mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8003424: Enable Class Data Sharing for CompressedOops
8016729: ObjectAlignmentInBytes=16 now forces the use of heap based compressed oops 8005933: The -Xshare:auto option is ignored for -server Move klass metaspace above the heap and support CDS with compressed klass ptrs. Reviewed-by: coleenp, kvn, mgerdin, tschatzl, stefank
This commit is contained in:
parent
9d372e7801
commit
4d91f4e69d
34 changed files with 876 additions and 552 deletions
|
@ -1393,10 +1393,8 @@ bool verify_object_alignment() {
|
|||
|
||||
inline uintx max_heap_for_compressed_oops() {
|
||||
// Avoid sign flip.
|
||||
if (OopEncodingHeapMax < ClassMetaspaceSize + os::vm_page_size()) {
|
||||
return 0;
|
||||
}
|
||||
LP64_ONLY(return OopEncodingHeapMax - ClassMetaspaceSize - os::vm_page_size());
|
||||
assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size");
|
||||
LP64_ONLY(return OopEncodingHeapMax - os::vm_page_size());
|
||||
NOT_LP64(ShouldNotReachHere(); return 0);
|
||||
}
|
||||
|
||||
|
@ -1448,6 +1446,35 @@ void Arguments::set_use_compressed_oops() {
|
|||
#endif // ZERO
|
||||
}
|
||||
|
||||
|
||||
// NOTE: set_use_compressed_klass_ptrs() must be called after calling
|
||||
// set_use_compressed_oops().
|
||||
void Arguments::set_use_compressed_klass_ptrs() {
|
||||
#ifndef ZERO
|
||||
#ifdef _LP64
|
||||
// UseCompressedOops must be on for UseCompressedKlassPointers to be on.
|
||||
if (!UseCompressedOops) {
|
||||
if (UseCompressedKlassPointers) {
|
||||
warning("UseCompressedKlassPointers requires UseCompressedOops");
|
||||
}
|
||||
FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
|
||||
} else {
|
||||
// Turn on UseCompressedKlassPointers too
|
||||
if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) {
|
||||
FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true);
|
||||
}
|
||||
// Check the ClassMetaspaceSize to make sure we use compressed klass ptrs.
|
||||
if (UseCompressedKlassPointers) {
|
||||
if (ClassMetaspaceSize > KlassEncodingMetaspaceMax) {
|
||||
warning("Class metaspace size is too large for UseCompressedKlassPointers");
|
||||
FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // _LP64
|
||||
#endif // !ZERO
|
||||
}
|
||||
|
||||
void Arguments::set_ergonomics_flags() {
|
||||
|
||||
if (os::is_server_class_machine()) {
|
||||
|
@ -1470,7 +1497,8 @@ void Arguments::set_ergonomics_flags() {
|
|||
// server performance. On server class machines, keep the default
|
||||
// off unless it is asked for. Future work: either add bytecode rewriting
|
||||
// at link time, or rewrite bytecodes in non-shared methods.
|
||||
if (!DumpSharedSpaces && !RequireSharedSpaces) {
|
||||
if (!DumpSharedSpaces && !RequireSharedSpaces &&
|
||||
(FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) {
|
||||
no_shared_spaces();
|
||||
}
|
||||
}
|
||||
|
@ -1478,33 +1506,11 @@ void Arguments::set_ergonomics_flags() {
|
|||
#ifndef ZERO
|
||||
#ifdef _LP64
|
||||
set_use_compressed_oops();
|
||||
// UseCompressedOops must be on for UseCompressedKlassPointers to be on.
|
||||
if (!UseCompressedOops) {
|
||||
if (UseCompressedKlassPointers) {
|
||||
warning("UseCompressedKlassPointers requires UseCompressedOops");
|
||||
}
|
||||
FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
|
||||
} else {
|
||||
// Turn on UseCompressedKlassPointers too
|
||||
if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) {
|
||||
FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true);
|
||||
}
|
||||
// Set the ClassMetaspaceSize to something that will not need to be
|
||||
// expanded, since it cannot be expanded.
|
||||
if (UseCompressedKlassPointers) {
|
||||
if (ClassMetaspaceSize > KlassEncodingMetaspaceMax) {
|
||||
warning("Class metaspace size is too large for UseCompressedKlassPointers");
|
||||
FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
|
||||
} else if (FLAG_IS_DEFAULT(ClassMetaspaceSize)) {
|
||||
// 100,000 classes seems like a good size, so 100M assumes around 1K
|
||||
// per klass. The vtable and oopMap is embedded so we don't have a fixed
|
||||
// size per klass. Eventually, this will be parameterized because it
|
||||
// would also be useful to determine the optimal size of the
|
||||
// systemDictionary.
|
||||
FLAG_SET_ERGO(uintx, ClassMetaspaceSize, 100*M);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set_use_compressed_klass_ptrs() must be called after calling
|
||||
// set_use_compressed_oops().
|
||||
set_use_compressed_klass_ptrs();
|
||||
|
||||
// Also checks that certain machines are slower with compressed oops
|
||||
// in vm_version initialization code.
|
||||
#endif // _LP64
|
||||
|
@ -2153,7 +2159,7 @@ bool Arguments::check_vm_args_consistency() {
|
|||
|
||||
status = status && verify_object_alignment();
|
||||
|
||||
status = status && verify_min_value(ClassMetaspaceSize, 1*M,
|
||||
status = status && verify_interval(ClassMetaspaceSize, 1*M, 3*G,
|
||||
"ClassMetaspaceSize");
|
||||
|
||||
status = status && verify_interval(MarkStackSizeMax,
|
||||
|
@ -3273,33 +3279,22 @@ jint Arguments::parse_options_environment_variable(const char* name, SysClassPat
|
|||
}
|
||||
|
||||
void Arguments::set_shared_spaces_flags() {
|
||||
#ifdef _LP64
|
||||
const bool must_share = DumpSharedSpaces || RequireSharedSpaces;
|
||||
|
||||
// CompressedOops cannot be used with CDS. The offsets of oopmaps and
|
||||
// static fields are incorrect in the archive. With some more clever
|
||||
// initialization, this restriction can probably be lifted.
|
||||
if (UseCompressedOops) {
|
||||
if (must_share) {
|
||||
warning("disabling compressed oops because of %s",
|
||||
DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on");
|
||||
FLAG_SET_CMDLINE(bool, UseCompressedOops, false);
|
||||
FLAG_SET_CMDLINE(bool, UseCompressedKlassPointers, false);
|
||||
} else {
|
||||
// Prefer compressed oops to class data sharing
|
||||
if (UseSharedSpaces && Verbose) {
|
||||
warning("turning off use of shared archive because of compressed oops");
|
||||
}
|
||||
no_shared_spaces();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (DumpSharedSpaces) {
|
||||
if (RequireSharedSpaces) {
|
||||
warning("cannot dump shared archive while using shared archive");
|
||||
}
|
||||
UseSharedSpaces = false;
|
||||
#ifdef _LP64
|
||||
if (!UseCompressedOops || !UseCompressedKlassPointers) {
|
||||
vm_exit_during_initialization(
|
||||
"Cannot dump shared archive when UseCompressedOops or UseCompressedKlassPointers is off.", NULL);
|
||||
}
|
||||
} else {
|
||||
// UseCompressedOops and UseCompressedKlassPointers must be on for UseSharedSpaces.
|
||||
if (!UseCompressedOops || !UseCompressedKlassPointers) {
|
||||
no_shared_spaces();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue