Skip to content

Commit 0b8fb39

Browse files
committed
8381829: Obsolete AggressiveHeap
1 parent 7a11bdd commit 0b8fb39

5 files changed

Lines changed: 8 additions & 226 deletions

File tree

src/hotspot/share/gc/shared/gc_globals.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,6 @@
256256
"before pushing a continuation entry") \
257257
range(1, INT_MAX/2) \
258258
\
259-
product(bool, AggressiveHeap, false, \
260-
"(Deprecated) Optimize heap options for long-running memory " \
261-
"intensive apps") \
262-
\
263259
product(size_t, ErgoHeapSizeLimit, 0, \
264260
"Maximum ergonomically set heap size (in bytes); zero means use " \
265261
"(System RAM) * MaxRAMPercentage / 100") \

src/hotspot/share/runtime/arguments.cpp

Lines changed: 2 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,6 @@ static SpecialFlag const special_jvm_flags[] = {
536536
#ifdef _LP64
537537
{ "UseCompressedClassPointers", JDK_Version::jdk(25), JDK_Version::jdk(27), JDK_Version::undefined() },
538538
#endif
539-
{ "AggressiveHeap", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
540539
// --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
541540
{ "CreateMinidumpOnCrash", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
542541

@@ -556,6 +555,7 @@ static SpecialFlag const special_jvm_flags[] = {
556555
{ "AlwaysActAsServerClassMachine", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
557556
{ "UseXMMForArrayCopy", JDK_Version::undefined(), JDK_Version::jdk(27), JDK_Version::jdk(28) },
558557
{ "UseNewLongLShift", JDK_Version::undefined(), JDK_Version::jdk(27), JDK_Version::jdk(28) },
558+
{ "AggressiveHeap", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
559559

560560
#ifdef ASSERT
561561
{ "DummyObsoleteTestFlag", JDK_Version::undefined(), JDK_Version::jdk(18), JDK_Version::undefined() },
@@ -1490,13 +1490,7 @@ jint Arguments::set_ergonomics_flags() {
14901490
}
14911491

14921492
size_t Arguments::limit_heap_by_allocatable_memory(size_t limit) {
1493-
// The AggressiveHeap check is a temporary workaround to avoid calling
1494-
// GCarguments::heap_virtual_to_physical_ratio() before a GC has been
1495-
// selected. This works because AggressiveHeap implies UseParallelGC
1496-
// where we know the ratio will be 1. Once the AggressiveHeap option is
1497-
// removed, this can be cleaned up.
1498-
size_t heap_virtual_to_physical_ratio = (AggressiveHeap ? 1 : GCConfig::arguments()->heap_virtual_to_physical_ratio());
1499-
size_t fraction = MaxVirtMemFraction * heap_virtual_to_physical_ratio;
1493+
size_t fraction = MaxVirtMemFraction * GCConfig::arguments()->heap_virtual_to_physical_ratio();
15001494
size_t max_allocatable = os::commit_memory_limit();
15011495

15021496
return MIN2(limit, max_allocatable / fraction);
@@ -1627,107 +1621,6 @@ void Arguments::set_heap_size() {
16271621
}
16281622
}
16291623

1630-
// This option inspects the machine and attempts to set various
1631-
// parameters to be optimal for long-running, memory allocation
1632-
// intensive jobs. It is intended for machines with large
1633-
// amounts of cpu and memory.
1634-
jint Arguments::set_aggressive_heap_flags() {
1635-
// initHeapSize is needed since _initial_heap_size is 4 bytes on a 32 bit
1636-
// VM, but we may not be able to represent the total physical memory
1637-
// available (like having 8gb of memory on a box but using a 32bit VM).
1638-
// Thus, we need to make sure we're using a julong for intermediate
1639-
// calculations.
1640-
julong initHeapSize;
1641-
physical_memory_size_type phys_mem = os::physical_memory();
1642-
julong total_memory = static_cast<julong>(phys_mem);
1643-
1644-
if (total_memory < (julong) 256 * M) {
1645-
jio_fprintf(defaultStream::error_stream(),
1646-
"You need at least 256mb of memory to use -XX:+AggressiveHeap\n");
1647-
vm_exit(1);
1648-
}
1649-
1650-
// The heap size is half of available memory, or (at most)
1651-
// all of possible memory less 160mb (leaving room for the OS
1652-
// when using ISM). This is the maximum; because adaptive sizing
1653-
// is turned on below, the actual space used may be smaller.
1654-
1655-
initHeapSize = MIN2(total_memory / (julong) 2,
1656-
total_memory - (julong) 160 * M);
1657-
1658-
initHeapSize = limit_heap_by_allocatable_memory(initHeapSize);
1659-
1660-
if (FLAG_IS_DEFAULT(MaxHeapSize)) {
1661-
if (FLAG_SET_CMDLINE(MaxHeapSize, initHeapSize) != JVMFlag::SUCCESS) {
1662-
return JNI_EINVAL;
1663-
}
1664-
if (FLAG_SET_CMDLINE(InitialHeapSize, initHeapSize) != JVMFlag::SUCCESS) {
1665-
return JNI_EINVAL;
1666-
}
1667-
if (FLAG_SET_CMDLINE(MinHeapSize, initHeapSize) != JVMFlag::SUCCESS) {
1668-
return JNI_EINVAL;
1669-
}
1670-
}
1671-
if (FLAG_IS_DEFAULT(NewSize)) {
1672-
// Make the young generation 3/8ths of the total heap.
1673-
if (FLAG_SET_CMDLINE(NewSize,
1674-
((julong) MaxHeapSize / (julong) 8) * (julong) 3) != JVMFlag::SUCCESS) {
1675-
return JNI_EINVAL;
1676-
}
1677-
if (FLAG_SET_CMDLINE(MaxNewSize, NewSize) != JVMFlag::SUCCESS) {
1678-
return JNI_EINVAL;
1679-
}
1680-
}
1681-
1682-
#if !defined(_ALLBSD_SOURCE) && !defined(AIX) // UseLargePages is not yet supported on BSD and AIX.
1683-
FLAG_SET_DEFAULT(UseLargePages, true);
1684-
#endif
1685-
1686-
// Increase some data structure sizes for efficiency
1687-
if (FLAG_SET_CMDLINE(ResizeTLAB, false) != JVMFlag::SUCCESS) {
1688-
return JNI_EINVAL;
1689-
}
1690-
if (FLAG_SET_CMDLINE(TLABSize, 256 * K) != JVMFlag::SUCCESS) {
1691-
return JNI_EINVAL;
1692-
}
1693-
1694-
// See the OldPLABSize comment below, but replace 'after promotion'
1695-
// with 'after copying'. YoungPLABSize is the size of the survivor
1696-
// space per-gc-thread buffers. The default is 4kw.
1697-
if (FLAG_SET_CMDLINE(YoungPLABSize, 256 * K) != JVMFlag::SUCCESS) { // Note: this is in words
1698-
return JNI_EINVAL;
1699-
}
1700-
1701-
// OldPLABSize is the size of the buffers in the old gen that
1702-
// UseParallelGC uses to promote live data that doesn't fit in the
1703-
// survivor spaces. At any given time, there's one for each gc thread.
1704-
// The default size is 1kw. These buffers are rarely used, since the
1705-
// survivor spaces are usually big enough. For specjbb, however, there
1706-
// are occasions when there's lots of live data in the young gen
1707-
// and we end up promoting some of it. We don't have a definite
1708-
// explanation for why bumping OldPLABSize helps, but the theory
1709-
// is that a bigger PLAB results in retaining something like the
1710-
// original allocation order after promotion, which improves mutator
1711-
// locality. A minor effect may be that larger PLABs reduce the
1712-
// number of PLAB allocation events during gc. The value of 8kw
1713-
// was arrived at by experimenting with specjbb.
1714-
if (FLAG_SET_CMDLINE(OldPLABSize, 8 * K) != JVMFlag::SUCCESS) { // Note: this is in words
1715-
return JNI_EINVAL;
1716-
}
1717-
1718-
// Enable parallel GC and adaptive generation sizing
1719-
if (FLAG_SET_CMDLINE(UseParallelGC, true) != JVMFlag::SUCCESS) {
1720-
return JNI_EINVAL;
1721-
}
1722-
1723-
// Encourage steady state memory management
1724-
if (FLAG_SET_CMDLINE(ThresholdTolerance, 100) != JVMFlag::SUCCESS) {
1725-
return JNI_EINVAL;
1726-
}
1727-
1728-
return JNI_OK;
1729-
}
1730-
17311624
// This must be called after ergonomics.
17321625
void Arguments::set_bytecode_flags() {
17331626
if (!RewriteBytecodes) {
@@ -2938,16 +2831,6 @@ jint Arguments::finalize_vm_init_args() {
29382831
return JNI_ERR;
29392832
}
29402833

2941-
// This must be done after all arguments have been processed
2942-
// and the container support has been initialized since AggressiveHeap
2943-
// relies on the amount of total memory available.
2944-
if (AggressiveHeap) {
2945-
jint result = set_aggressive_heap_flags();
2946-
if (result != JNI_OK) {
2947-
return result;
2948-
}
2949-
}
2950-
29512834
// CompileThresholdScaling == 0.0 is same as -Xint: Disable compilation (enable interpreter-only mode),
29522835
// but like -Xint, leave compilation thresholds unaffected.
29532836
// With tiered compilation disabled, setting CompileThreshold to 0 disables compilation as well.

src/hotspot/share/runtime/arguments.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,6 @@ class Arguments : AllStatic {
303303
// Aggressive optimization flags.
304304
static jint set_aggressive_opts_flags();
305305

306-
static jint set_aggressive_heap_flags();
307-
308306
// Argument parsing
309307
static bool parse_argument(const char* arg, JVMFlagOrigin origin);
310308
static bool process_argument(const char* arg, jboolean ignore_unrecognized, JVMFlagOrigin origin);

src/java.base/share/man/java.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2938,12 +2938,6 @@ they're used.
29382938
(`-XX:+UseParallelGC` or `-XX:+UseG1GC`). Other collectors employing multiple
29392939
threads always perform reference processing in parallel.
29402940

2941-
[`-XX:+AggressiveHeap`]{#-XX__AggressiveHeap}
2942-
: Enables Java heap optimization. This sets various parameters to be
2943-
optimal for long-running jobs with intensive memory allocation, based on
2944-
the configuration of the computer (RAM and CPU). By default, the option
2945-
is disabled and the heap sizes are configured less aggressively.
2946-
29472941
## Obsolete Java Options
29482942

29492943
These `java` options are still accepted but ignored, and a warning is issued
@@ -2976,6 +2970,12 @@ when they're used.
29762970
-XX:{+|-}UseJVMCICompiler
29772971
```
29782972

2973+
[`-XX:+AggressiveHeap`]{#-XX__AggressiveHeap}
2974+
: Enabled Java heap optimization. This set various parameters to be
2975+
optimal for long-running jobs with intensive memory allocation, based on
2976+
the configuration of the computer (RAM and CPU). By default, the option
2977+
was disabled and the heap sizes configured less aggressively.
2978+
29792979
## Removed Java Options
29802980

29812981
No documented java options have been removed in JDK @@VERSION_SPECIFICATION@@.

test/hotspot/jtreg/gc/arguments/TestAggressiveHeap.java

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)