Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/hotspot/cpu/aarch64/c1_globals_aarch64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ define_pd_global(size_t, CodeCacheExpansionSize, 32*K );
define_pd_global(size_t, CodeCacheMinBlockLength, 1);
define_pd_global(size_t, CodeCacheMinimumUseSpace, 400*K);
define_pd_global(bool, NeverActAsServerClassMachine, true );
define_pd_global(uint64_t,MaxRAM, 1ULL*G);
define_pd_global(bool, CICompileOSR, true );
#endif // !COMPILER2
define_pd_global(bool, UseTypeProfile, false);
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/cpu/aarch64/c2_globals_aarch64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ define_pd_global(size_t, InitialCodeCacheSize, 2496*K); // Integral multip
define_pd_global(size_t, CodeCacheExpansionSize, 64*K);

// Ergonomics related flags
define_pd_global(uint64_t,MaxRAM, 128ULL*G);
define_pd_global(intx, RegisterCostAreaRatio, 16000);

// Peephole and CISC spilling both break the graph, and so makes the
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/cpu/arm/c1_globals_arm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ define_pd_global(size_t, CodeCacheExpansionSize, 32*K );
define_pd_global(size_t, CodeCacheMinBlockLength, 1);
define_pd_global(size_t, CodeCacheMinimumUseSpace, 400*K);
define_pd_global(bool, NeverActAsServerClassMachine, true);
define_pd_global(uint64_t, MaxRAM, 1ULL*G);
define_pd_global(bool, CICompileOSR, true );
#endif // COMPILER2
define_pd_global(bool, UseTypeProfile, false);
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/cpu/arm/c2_globals_arm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ define_pd_global(size_t, NonProfiledCodeHeapSize, 21*M);
define_pd_global(size_t, ProfiledCodeHeapSize, 22*M);
define_pd_global(size_t, NonNMethodCodeHeapSize, 5*M );
define_pd_global(size_t, CodeCacheExpansionSize, 64*K);

// Ergonomics related flags
define_pd_global(uint64_t, MaxRAM, 128ULL*G);
#else
// InitialCodeCacheSize derived from specjbb2000 run.
define_pd_global(size_t, InitialCodeCacheSize, 1536*K); // Integral multiple of CodeCacheExpansionSize
Expand All @@ -91,8 +88,6 @@ define_pd_global(size_t, NonProfiledCodeHeapSize, 13*M);
define_pd_global(size_t, ProfiledCodeHeapSize, 14*M);
define_pd_global(size_t, NonNMethodCodeHeapSize, 5*M );
define_pd_global(size_t, CodeCacheExpansionSize, 32*K);
// Ergonomics related flags
define_pd_global(uint64_t, MaxRAM, 4ULL*G);
#endif
define_pd_global(size_t, CodeCacheMinBlockLength, 6);
define_pd_global(size_t, CodeCacheMinimumUseSpace, 400*K);
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/cpu/ppc/c1_globals_ppc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ define_pd_global(size_t, CodeCacheMinBlockLength, 1);
define_pd_global(size_t, CodeCacheMinimumUseSpace, 400*K);
define_pd_global(bool, NeverActAsServerClassMachine, true);
define_pd_global(size_t, NewSizeThreadIncrease, 16*K);
define_pd_global(uint64_t, MaxRAM, 1ULL*G);
define_pd_global(size_t, InitialCodeCacheSize, 160*K);
#endif // !COMPILER2

Expand Down
1 change: 0 additions & 1 deletion src/hotspot/cpu/ppc/c2_globals_ppc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ define_pd_global(size_t, NonNMethodCodeHeapSize, 5*M );
define_pd_global(size_t, CodeCacheExpansionSize, 64*K);

// Ergonomics related flags
define_pd_global(uint64_t, MaxRAM, 128ULL*G);
define_pd_global(size_t, CodeCacheMinBlockLength, 6);
define_pd_global(size_t, CodeCacheMinimumUseSpace, 400*K);

Expand Down
1 change: 0 additions & 1 deletion src/hotspot/cpu/riscv/c1_globals_riscv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ define_pd_global(size_t, CodeCacheExpansionSize, 32*K );
define_pd_global(size_t, CodeCacheMinBlockLength, 1);
define_pd_global(size_t, CodeCacheMinimumUseSpace, 400*K);
define_pd_global(bool, NeverActAsServerClassMachine, true );
define_pd_global(uint64_t, MaxRAM, 1ULL*G);
define_pd_global(bool, CICompileOSR, true );
#endif // !COMPILER2
define_pd_global(bool, UseTypeProfile, false);
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/cpu/riscv/c2_globals_riscv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ define_pd_global(size_t, InitialCodeCacheSize, 2496*K); // Integral multip
define_pd_global(size_t, CodeCacheExpansionSize, 64*K);

// Ergonomics related flags
define_pd_global(uint64_t,MaxRAM, 128ULL*G);
define_pd_global(intx, RegisterCostAreaRatio, 16000);

// Peephole and CISC spilling both break the graph, and so makes the
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/cpu/s390/c1_globals_s390.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ define_pd_global(size_t, CodeCacheMinBlockLength, 1);
define_pd_global(size_t, CodeCacheMinimumUseSpace, 400*K);
define_pd_global(bool, NeverActAsServerClassMachine, true);
define_pd_global(size_t, NewSizeThreadIncrease, 16*K);
define_pd_global(uint64_t, MaxRAM, 1ULL*G);
define_pd_global(size_t, InitialCodeCacheSize, 160*K);
#endif // !COMPILER2

Expand Down
1 change: 0 additions & 1 deletion src/hotspot/cpu/s390/c2_globals_s390.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ define_pd_global(size_t, NonNMethodCodeHeapSize, 5*M);
define_pd_global(size_t, CodeCacheExpansionSize, 64*K);

// Ergonomics related flags
define_pd_global(uint64_t, MaxRAM, 128ULL*G);
define_pd_global(size_t, CodeCacheMinBlockLength, 4);
define_pd_global(size_t, CodeCacheMinimumUseSpace, 400*K);

Expand Down
1 change: 0 additions & 1 deletion src/hotspot/cpu/x86/c1_globals_x86.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ define_pd_global(size_t, CodeCacheExpansionSize, 32*K );
define_pd_global(size_t, CodeCacheMinBlockLength, 1 );
define_pd_global(size_t, CodeCacheMinimumUseSpace, 400*K);
define_pd_global(bool, NeverActAsServerClassMachine, true );
define_pd_global(uint64_t, MaxRAM, 1ULL*G);
define_pd_global(bool, CICompileOSR, true );
#endif // !COMPILER2
define_pd_global(bool, UseTypeProfile, false);
Expand Down
6 changes: 0 additions & 6 deletions src/hotspot/cpu/x86/c2_globals_x86.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,13 @@ define_pd_global(intx, LoopUnrollLimit, 60);
// InitialCodeCacheSize derived from specjbb2000 run.
define_pd_global(size_t, InitialCodeCacheSize, 2496*K); // Integral multiple of CodeCacheExpansionSize
define_pd_global(size_t, CodeCacheExpansionSize, 64*K);

// Ergonomics related flags
define_pd_global(uint64_t, MaxRAM, 128ULL*G);
#else
define_pd_global(intx, InteriorEntryAlignment, 4);
define_pd_global(size_t, NewSizeThreadIncrease, 4*K);
define_pd_global(intx, LoopUnrollLimit, 50); // Design center runs on 1.3.1
// InitialCodeCacheSize derived from specjbb2000 run.
define_pd_global(size_t, InitialCodeCacheSize, 2304*K); // Integral multiple of CodeCacheExpansionSize
define_pd_global(size_t, CodeCacheExpansionSize, 32*K);

// Ergonomics related flags
define_pd_global(uint64_t, MaxRAM, 4ULL*G);
#endif // AMD64
define_pd_global(intx, RegisterCostAreaRatio, 16000);

Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/os/windows/os_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4160,11 +4160,6 @@ void os::win32::initialize_system_info() {
}
_physical_memory = static_cast<physical_memory_size_type>(ms.ullTotalPhys);

if (FLAG_IS_DEFAULT(MaxRAM)) {
// Adjust MaxRAM according to the maximum virtual address space available.
FLAG_SET_DEFAULT(MaxRAM, MIN2(MaxRAM, (uint64_t) ms.ullTotalVirtual));
}

_is_windows_server = IsWindowsServer();

initialize_performance_counter();
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/share/compiler/compiler_globals_pd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,10 @@ define_pd_global(size_t, CodeCacheMinBlockLength, 1);
define_pd_global(size_t, CodeCacheMinimumUseSpace, 200*K);
#ifndef ZERO
define_pd_global(bool, NeverActAsServerClassMachine, true);
define_pd_global(uint64_t,MaxRAM, 1ULL*G);
#else
// Zero runs without compilers. Do not let this code to force
// the GC mode and default heap settings.
define_pd_global(bool, NeverActAsServerClassMachine, false);
define_pd_global(uint64_t,MaxRAM, 128ULL*G);
#endif
#define CI_COMPILER_COUNT 0
#else
Expand Down
5 changes: 3 additions & 2 deletions src/hotspot/share/gc/shared/gc_globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,9 @@
product(bool, AlwaysActAsServerClassMachine, false, \
"Always act like a server-class machine") \
\
product_pd(uint64_t, MaxRAM, \
"Real memory size (in bytes) used to set maximum heap size") \
product(uint64_t, MaxRAM, 0, \
"(Deprecated) Real memory size (in bytes) used to set maximum " \
"heap size") \
range(0, 0XFFFFFFFFFFFFFFFF) \
\
product(bool, AggressiveHeap, false, \
Expand Down
35 changes: 10 additions & 25 deletions src/hotspot/share/runtime/arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ static SpecialFlag const special_jvm_flags[] = {
{ "ParallelRefProcEnabled", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
{ "ParallelRefProcBalancingEnabled", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
{ "PSChunkLargeArrays", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
{ "MaxRAM", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
// --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
{ "CreateMinidumpOnCrash", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },

Expand Down Expand Up @@ -1511,44 +1512,28 @@ static size_t clamp_by_size_t_max(uint64_t value) {
}

void Arguments::set_heap_size() {
uint64_t physical_memory;

// Check if the user has configured any limit on the amount of RAM we may use.
bool has_ram_limit = !FLAG_IS_DEFAULT(MaxRAMPercentage) ||
!FLAG_IS_DEFAULT(MinRAMPercentage) ||
!FLAG_IS_DEFAULT(InitialRAMPercentage) ||
!FLAG_IS_DEFAULT(MaxRAM);

if (CompilerConfig::should_set_client_emulation_mode_flags() &&
FLAG_IS_DEFAULT(MaxRAM)) {
// Reduce the maximum available memory if client emulation mode is enabled.
FLAG_SET_DEFAULT(MaxRAM, 1ULL*G);
}

if (has_ram_limit) {
if (!FLAG_IS_DEFAULT(MaxRAM)) {
// The user has configured MaxRAM, use that instead of physical memory
// reported by the OS.
physical_memory = MaxRAM;
if (FLAG_IS_DEFAULT(MaxRAM)) {
if (CompilerConfig::should_set_client_emulation_mode_flags()) {
// Limit the available memory if client emulation mode is enabled.
FLAG_SET_ERGO(MaxRAM, 1ULL*G);
} else {
// The user has configured a limit, make sure MaxRAM reflects the physical
// memory limit that heap sizing takes into account.
physical_memory = os::physical_memory();
FLAG_SET_ERGO(MaxRAM, physical_memory);
// Use the available physical memory on the system.
FLAG_SET_ERGO(MaxRAM, os::physical_memory());
}
} else {
// If the user did not specify any limit, choose the lowest of the available
// physical memory and MaxRAM. MaxRAM is typically set to 128GB on 64-bit
// architecture.
physical_memory = MIN2(os::physical_memory(), MaxRAM);
}

// If the maximum heap size has not been set with -Xmx, then set it as
// fraction of the size of physical memory, respecting the maximum and
// minimum sizes of the heap.
if (FLAG_IS_DEFAULT(MaxHeapSize)) {
uint64_t min_memory = (uint64_t)(((double)physical_memory * MinRAMPercentage) / 100);
uint64_t max_memory = (uint64_t)(((double)physical_memory * MaxRAMPercentage) / 100);
uint64_t min_memory = (uint64_t)(((double)MaxRAM * MinRAMPercentage) / 100);
uint64_t max_memory = (uint64_t)(((double)MaxRAM * MaxRAMPercentage) / 100);

const size_t reasonable_min = clamp_by_size_t_max(min_memory);
size_t reasonable_max = clamp_by_size_t_max(max_memory);
Expand Down Expand Up @@ -1635,7 +1620,7 @@ void Arguments::set_heap_size() {
reasonable_minimum = limit_heap_by_allocatable_memory(reasonable_minimum);

if (InitialHeapSize == 0) {
uint64_t initial_memory = (uint64_t)(((double)physical_memory * InitialRAMPercentage) / 100);
uint64_t initial_memory = (uint64_t)(((double)MaxRAM * InitialRAMPercentage) / 100);
size_t reasonable_initial = clamp_by_size_t_max(initial_memory);
reasonable_initial = limit_heap_by_allocatable_memory(reasonable_initial);

Expand Down
38 changes: 19 additions & 19 deletions src/java.base/share/man/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -2566,25 +2566,6 @@ Java HotSpot VM.
: Sets the maximum size (in bytes) of the heap for the young generation
(nursery). The default value is set ergonomically.

`-XX:MaxRAM=`*size*
: Sets the maximum amount of memory that the JVM may use for the Java heap
before applying ergonomics heuristics. The default value is the maximum
amount of available memory to the JVM process or 128 GB, whichever is lower.

The maximum amount of available memory to the JVM process is the minimum
of the machine's physical memory and any constraints set by the environment
(e.g. container).

Specifying this option disables automatic use of compressed oops if
the combined result of this and other options influencing the maximum amount
of memory is larger than the range of memory addressable by compressed oops.
See `-XX:UseCompressedOops` for further information about compressed oops.

The following example shows how to set the maximum amount of available
memory for sizing the Java heap to 2 GB:

> `-XX:MaxRAM=2G`

`-XX:MaxRAMPercentage=`*percent*
: Sets the maximum amount of memory that the JVM may use for the Java heap
before applying ergonomics heuristics as a percentage of the maximum amount
Expand Down Expand Up @@ -2951,6 +2932,25 @@ they're used.
(`-XX:+UseParallelGC` or `-XX:+UseG1GC`). Other collectors employing multiple
threads always perform reference processing in parallel.

`-XX:MaxRAM=`*size*
: Sets the maximum amount of memory that the JVM may use for the Java heap
before applying ergonomics heuristics. The default value is the amount of
available memory to the JVM process.

The maximum amount of available memory to the JVM process is the minimum
of the machine's physical memory and any constraints set by the environment
(e.g. container).

Specifying this option disables automatic use of compressed oops if
the combined result of this and other options influencing the maximum amount
of memory is larger than the range of memory addressable by compressed oops.
See `-XX:UseCompressedOops` for further information about compressed oops.

The following example shows how to set the maximum amount of available
memory for sizing the Java heap to 2 GB:

> `-XX:MaxRAM=2G`

## Obsolete Java Options

These `java` options are still accepted but ignored, and a warning is issued
Expand Down