mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com> Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com> Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com> Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
This commit is contained in:
parent
36eee7c8c8
commit
5c58d27aac
853 changed files with 26124 additions and 82956 deletions
|
@ -245,6 +245,18 @@ static ObsoleteFlag obsolete_jvm_flags[] = {
|
|||
JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) },
|
||||
{ "AllowTransitionalJSR292", JDK_Version::jdk(7), JDK_Version::jdk(8) },
|
||||
{ "UseCompressedStrings", JDK_Version::jdk(7), JDK_Version::jdk(8) },
|
||||
{ "CMSPermGenPrecleaningEnabled", JDK_Version::jdk(8), JDK_Version::jdk(9) },
|
||||
{ "CMSTriggerPermRatio", JDK_Version::jdk(8), JDK_Version::jdk(9) },
|
||||
{ "CMSInitiatingPermOccupancyFraction", JDK_Version::jdk(8), JDK_Version::jdk(9) },
|
||||
{ "AdaptivePermSizeWeight", JDK_Version::jdk(8), JDK_Version::jdk(9) },
|
||||
{ "PermGenPadding", JDK_Version::jdk(8), JDK_Version::jdk(9) },
|
||||
{ "PermMarkSweepDeadRatio", JDK_Version::jdk(8), JDK_Version::jdk(9) },
|
||||
{ "PermSize", JDK_Version::jdk(8), JDK_Version::jdk(9) },
|
||||
{ "MaxPermSize", JDK_Version::jdk(8), JDK_Version::jdk(9) },
|
||||
{ "MinPermHeapExpansion", JDK_Version::jdk(8), JDK_Version::jdk(9) },
|
||||
{ "MaxPermHeapExpansion", JDK_Version::jdk(8), JDK_Version::jdk(9) },
|
||||
{ "CMSRevisitStackSize", JDK_Version::jdk(8), JDK_Version::jdk(9) },
|
||||
{ "PrintRevisitStats", JDK_Version::jdk(8), JDK_Version::jdk(9) },
|
||||
#ifdef PRODUCT
|
||||
{ "DesiredMethodLimit",
|
||||
JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) },
|
||||
|
@ -1086,9 +1098,6 @@ void Arguments::set_parnew_gc_flags() {
|
|||
}
|
||||
}
|
||||
if (UseParNewGC) {
|
||||
// CDS doesn't work with ParNew yet
|
||||
no_shared_spaces();
|
||||
|
||||
// By default YoungPLABSize and OldPLABSize are set to 4096 and 1024 respectively,
|
||||
// these settings are default for Parallel Scavenger. For ParNew+Tenured configuration
|
||||
// we set them to 1024 and 1024.
|
||||
|
@ -1332,10 +1341,10 @@ bool verify_object_alignment() {
|
|||
|
||||
inline uintx max_heap_for_compressed_oops() {
|
||||
// Avoid sign flip.
|
||||
if (OopEncodingHeapMax < MaxPermSize + os::vm_page_size()) {
|
||||
if (OopEncodingHeapMax < ClassMetaspaceSize + os::vm_page_size()) {
|
||||
return 0;
|
||||
}
|
||||
LP64_ONLY(return OopEncodingHeapMax - MaxPermSize - os::vm_page_size());
|
||||
LP64_ONLY(return OopEncodingHeapMax - ClassMetaspaceSize - os::vm_page_size());
|
||||
NOT_LP64(ShouldNotReachHere(); return 0);
|
||||
}
|
||||
|
||||
|
@ -1354,11 +1363,6 @@ bool Arguments::should_auto_select_low_pause_collector() {
|
|||
}
|
||||
|
||||
void Arguments::set_ergonomics_flags() {
|
||||
// Parallel GC is not compatible with sharing. If one specifies
|
||||
// that they want sharing explicitly, do not set ergonomics flags.
|
||||
if (DumpSharedSpaces || RequireSharedSpaces) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (os::is_server_class_machine()) {
|
||||
// If no other collector is requested explicitly,
|
||||
|
@ -1368,13 +1372,19 @@ void Arguments::set_ergonomics_flags() {
|
|||
!UseConcMarkSweepGC &&
|
||||
!UseG1GC &&
|
||||
!UseParNewGC &&
|
||||
!DumpSharedSpaces &&
|
||||
FLAG_IS_DEFAULT(UseParallelGC)) {
|
||||
if (should_auto_select_low_pause_collector()) {
|
||||
FLAG_SET_ERGO(bool, UseConcMarkSweepGC, true);
|
||||
} else {
|
||||
FLAG_SET_ERGO(bool, UseParallelGC, true);
|
||||
}
|
||||
}
|
||||
// Shared spaces work fine with other GCs but causes bytecode rewriting
|
||||
// to be disabled, which hurts interpreter performance and decreases
|
||||
// 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) {
|
||||
no_shared_spaces();
|
||||
}
|
||||
}
|
||||
|
@ -1402,8 +1412,22 @@ void Arguments::set_ergonomics_flags() {
|
|||
if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) {
|
||||
warning("Max heap size too large for Compressed Oops");
|
||||
FLAG_SET_DEFAULT(UseCompressedOops, false);
|
||||
FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
|
||||
}
|
||||
}
|
||||
// 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
|
||||
// The compiler is broken for this so turn it on when the compiler is fixed.
|
||||
// if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) {
|
||||
// FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true);
|
||||
// }
|
||||
}
|
||||
// Also checks that certain machines are slower with compressed oops
|
||||
// in vm_version initialization code.
|
||||
#endif // _LP64
|
||||
|
@ -1444,9 +1468,6 @@ void Arguments::set_parallel_gc_flags() {
|
|||
if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) {
|
||||
FLAG_SET_DEFAULT(MarkSweepDeadRatio, 1);
|
||||
}
|
||||
if (FLAG_IS_DEFAULT(PermMarkSweepDeadRatio)) {
|
||||
FLAG_SET_DEFAULT(PermMarkSweepDeadRatio, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (UseNUMA) {
|
||||
|
@ -1470,7 +1491,6 @@ void Arguments::set_g1_gc_flags() {
|
|||
FLAG_SET_DEFAULT(ParallelGCThreads,
|
||||
Abstract_VM_Version::parallel_worker_threads());
|
||||
}
|
||||
no_shared_spaces();
|
||||
|
||||
if (FLAG_IS_DEFAULT(MarkStackSize)) {
|
||||
FLAG_SET_DEFAULT(MarkStackSize, 128 * TASKQUEUE_SIZE);
|
||||
|
@ -1806,7 +1826,6 @@ bool Arguments::check_vm_args_consistency() {
|
|||
|
||||
status = status && verify_percentage(AdaptiveSizePolicyWeight,
|
||||
"AdaptiveSizePolicyWeight");
|
||||
status = status && verify_percentage(AdaptivePermSizeWeight, "AdaptivePermSizeWeight");
|
||||
status = status && verify_percentage(ThresholdTolerance, "ThresholdTolerance");
|
||||
status = status && verify_percentage(MinHeapFreeRatio, "MinHeapFreeRatio");
|
||||
status = status && verify_percentage(MaxHeapFreeRatio, "MaxHeapFreeRatio");
|
||||
|
@ -2385,13 +2404,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
|
|||
|
||||
// -Xshare:dump
|
||||
} else if (match_option(option, "-Xshare:dump", &tail)) {
|
||||
#ifdef TIERED
|
||||
FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true);
|
||||
set_mode_flags(_int); // Prevent compilation, which creates objects
|
||||
#elif defined(COMPILER2)
|
||||
vm_exit_during_initialization(
|
||||
"Dumping a shared archive is not supported on the Server JVM.", NULL);
|
||||
#elif defined(KERNEL)
|
||||
#if defined(KERNEL)
|
||||
vm_exit_during_initialization(
|
||||
"Dumping a shared archive is not supported on the Kernel JVM.", NULL);
|
||||
#else
|
||||
|
@ -2491,15 +2504,6 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
|
|||
// process space. The 64bit VM version of this function is a nop.
|
||||
initHeapSize = os::allocatable_physical_memory(initHeapSize);
|
||||
|
||||
// The perm gen is separate but contiguous with the
|
||||
// object heap (and is reserved with it) so subtract it
|
||||
// from the heap size.
|
||||
if (initHeapSize > MaxPermSize) {
|
||||
initHeapSize = initHeapSize - MaxPermSize;
|
||||
} else {
|
||||
warning("AggressiveHeap and MaxPermSize values may conflict");
|
||||
}
|
||||
|
||||
if (FLAG_IS_DEFAULT(MaxHeapSize)) {
|
||||
FLAG_SET_CMDLINE(uintx, MaxHeapSize, initHeapSize);
|
||||
FLAG_SET_CMDLINE(uintx, InitialHeapSize, initHeapSize);
|
||||
|
@ -2904,39 +2908,25 @@ void Arguments::set_shared_spaces_flags() {
|
|||
const bool must_share = DumpSharedSpaces || RequireSharedSpaces;
|
||||
const bool might_share = must_share || UseSharedSpaces;
|
||||
|
||||
// The string table is part of the shared archive so the size must match.
|
||||
if (!FLAG_IS_DEFAULT(StringTableSize)) {
|
||||
// Disable sharing.
|
||||
if (must_share) {
|
||||
warning("disabling shared archive %s because of non-default "
|
||||
"StringTableSize", DumpSharedSpaces ? "creation" : "use");
|
||||
}
|
||||
if (might_share) {
|
||||
FLAG_SET_DEFAULT(DumpSharedSpaces, false);
|
||||
FLAG_SET_DEFAULT(RequireSharedSpaces, false);
|
||||
FLAG_SET_DEFAULT(UseSharedSpaces, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Check whether class data sharing settings conflict with GC, compressed oops
|
||||
// or page size, and fix them up. Explicit sharing options override other
|
||||
// settings.
|
||||
const bool cannot_share = UseConcMarkSweepGC || CMSIncrementalMode ||
|
||||
UseG1GC || UseParNewGC || UseParallelGC || UseParallelOldGC ||
|
||||
UseCompressedOops || UseLargePages && FLAG_IS_CMDLINE(UseLargePages);
|
||||
// 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.
|
||||
// ??? UseLargePages might be okay now
|
||||
const bool cannot_share = UseCompressedOops ||
|
||||
(UseLargePages && FLAG_IS_CMDLINE(UseLargePages));
|
||||
if (cannot_share) {
|
||||
if (must_share) {
|
||||
warning("selecting serial gc and disabling large pages %s"
|
||||
warning("disabling large pages%s"
|
||||
"because of %s", "" LP64_ONLY("and compressed oops "),
|
||||
DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on");
|
||||
force_serial_gc();
|
||||
FLAG_SET_CMDLINE(bool, UseLargePages, false);
|
||||
LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedOops, false));
|
||||
LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedKlassPointers, false));
|
||||
} else {
|
||||
// Prefer compressed oops and large pages to class data sharing
|
||||
if (UseSharedSpaces && Verbose) {
|
||||
warning("turning off use of shared archive because of "
|
||||
"choice of garbage collector or large pages");
|
||||
warning("turning off use of shared archive because of large pages%s",
|
||||
"" LP64_ONLY(" and/or compressed oops"));
|
||||
}
|
||||
no_shared_spaces();
|
||||
}
|
||||
|
@ -2945,6 +2935,18 @@ void Arguments::set_shared_spaces_flags() {
|
|||
// there may not even be a shared archive to use.
|
||||
FLAG_SET_DEFAULT(UseLargePages, false);
|
||||
}
|
||||
|
||||
// Add 2M to any size for SharedReadOnlySize to get around the JPRT setting
|
||||
if (DumpSharedSpaces && !FLAG_IS_DEFAULT(SharedReadOnlySize)) {
|
||||
SharedReadOnlySize = 14*M;
|
||||
}
|
||||
|
||||
if (DumpSharedSpaces) {
|
||||
if (RequireSharedSpaces) {
|
||||
warning("cannot dump shared archive while using shared archive");
|
||||
}
|
||||
UseSharedSpaces = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Disable options not supported in this release, with a warning if they
|
||||
|
@ -3103,12 +3105,6 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
|
|||
}
|
||||
ScavengeRootsInCode = 1;
|
||||
}
|
||||
if (!JavaObjectsInPerm && ScavengeRootsInCode == 0) {
|
||||
if (!FLAG_IS_DEFAULT(ScavengeRootsInCode)) {
|
||||
warning("forcing ScavengeRootsInCode non-zero because JavaObjectsInPerm is false");
|
||||
}
|
||||
ScavengeRootsInCode = 1;
|
||||
}
|
||||
|
||||
if (PrintGCDetails) {
|
||||
// Turn on -verbose:gc options as well
|
||||
|
@ -3200,6 +3196,7 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
|
|||
FLAG_SET_DEFAULT(ProfileInterpreter, false);
|
||||
FLAG_SET_DEFAULT(UseBiasedLocking, false);
|
||||
LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false));
|
||||
LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedKlassPointers, false));
|
||||
#endif // CC_INTERP
|
||||
|
||||
#ifdef COMPILER2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue