Skip to content

Commit

Permalink
8326957: Implement JEP 474: ZGC: Generational Mode by Default
Browse files Browse the repository at this point in the history
Reviewed-by: stefank, eosterlund
  • Loading branch information
xmas92 committed May 14, 2024
1 parent 7ce4a13 commit 4ba7447
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shared/gc_globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
product(bool, UseZGC, false, \
"Use the Z garbage collector") \
\
product(bool, ZGenerational, false, \
product(bool, ZGenerational, true, \
"Use the generational version of ZGC") \
\
product(bool, UseShenandoahGC, false, \
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/gc/x/xArguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ void XArguments::initialize_heap_flags_and_sizes() {
}

void XArguments::initialize() {
warning("Non-generational ZGC is deprecated.");

// Check mark stack size
const size_t mark_stack_space_limit = XAddressSpaceLimit::mark_stack();
if (ZMarkStackSpaceLimit > mark_stack_space_limit) {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/x/xInitialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ XInitialize::XInitialize(XBarrierSet* barrier_set) {
log_info(gc, init)("Version: %s (%s)",
VM_Version::vm_release(),
VM_Version::jdk_debug_level());
log_info(gc, init)("Using legacy single-generation mode");
log_info(gc, init)("Using deprecated non-generational mode");

// Early initialization
XAddress::initialize();
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/runtime/arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ static SpecialFlag const special_jvm_flags[] = {
// --- Non-alias flags - sorted by obsolete_in then expired_in:
{ "AllowRedefinitionToAddDeleteMethods", JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() },
{ "FlightRecorder", JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() },
{ "ZGenerational", JDK_Version::jdk(23), JDK_Version::undefined(), JDK_Version::undefined() },
{ "DumpSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() },
{ "DynamicDumpSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() },
{ "RequireSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() },
Expand Down
50 changes: 50 additions & 0 deletions test/hotspot/jtreg/gc/x/TestDeprecated.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (c) 2024, 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.
*/

package gc.x;

/*
* @test TestDeprecated
* @requires vm.gc.ZSinglegen
* @summary Test ZGenerational Deprecated
* @library /test/lib
* @run driver gc.x.TestDeprecated
*/

import java.util.LinkedList;
import jdk.test.lib.process.ProcessTools;

public class TestDeprecated {
static class Test {
public static void main(String[] args) throws Exception {}
}
public static void main(String[] args) throws Exception {
ProcessTools.executeLimitedTestJava("-XX:+UseZGC",
"-XX:-ZGenerational",
"-Xlog:gc+init",
Test.class.getName())
.shouldContain("Option ZGenerational was deprecated")
.shouldContain("Using deprecated non-generational mode")
.shouldHaveExitValue(0);
}
}
51 changes: 51 additions & 0 deletions test/hotspot/jtreg/gc/z/TestDefault.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2024, 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.
*/

package gc.z;

/*
* @test TestDefault
* @requires vm.gc.ZGenerational
* @summary Test that ZGC Generational Mode is Default
* @library /test/lib
* @run driver gc.z.TestDefault
*/

import java.util.LinkedList;
import jdk.test.lib.process.ProcessTools;

public class TestDefault {
static class Test {
public static void main(String[] args) throws Exception {}
}
public static void main(String[] args) throws Exception {
ProcessTools.executeLimitedTestJava("-XX:+UseZGC",
"-Xlog:gc+init",
Test.class.getName())
.shouldNotContain("Option ZGenerational was deprecated")
.shouldNotContain("Using deprecated non-generational mode")
.shouldContain("GC Workers for Old Generation")
.shouldContain("GC Workers for Young Generation")
.shouldHaveExitValue(0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class VMDeprecatedOptions {
{"PreserveAllAnnotations", "true"},
{"AllowRedefinitionToAddDeleteMethods", "true"},
{"UseEmptySlotsInSupers", "true"},
{"ZGenerational", "false"},

// deprecated alias flags (see also aliased_jvm_flags):
{"CreateMinidumpOnCrash", "false"}
Expand Down

1 comment on commit 4ba7447

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.