From ef54af39883e76c80a3e012ed91b90973da51bb4 Mon Sep 17 00:00:00 2001
From: Aleksey Shipilev <shade@openjdk.org>
Date: Thu, 15 Aug 2024 16:45:43 +0000
Subject: [PATCH] 8338444: Shenandoah: Remove ShenandoahHumongousThreshold
 tunable

Reviewed-by: rkennke, wkemper, ysr
---
 .../share/gc/shenandoah/shenandoahAsserts.cpp |   2 +-
 .../gc/shenandoah/shenandoahController.cpp    |   4 +-
 .../share/gc/shenandoah/shenandoahFreeSet.cpp |   5 +-
 .../share/gc/shenandoah/shenandoahFreeSet.hpp |   4 +-
 .../gc/shenandoah/shenandoahHeapRegion.cpp    |  14 +-
 .../gc/shenandoah/shenandoahHeapRegion.hpp    |  14 +-
 .../gc/shenandoah/shenandoahInitLogger.cpp    |   1 -
 .../gc/shenandoah/shenandoah_globals.hpp      |   7 -
 .../gc/shenandoah/TestHumongousThreshold.java | 131 ------------------
 .../options/TestHumongousThresholdArgs.java   |  72 ----------
 10 files changed, 12 insertions(+), 242 deletions(-)
 delete mode 100644 test/hotspot/jtreg/gc/shenandoah/TestHumongousThreshold.java
 delete mode 100644 test/hotspot/jtreg/gc/shenandoah/options/TestHumongousThresholdArgs.java

diff --git a/src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp b/src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp
index 5215aa749ae..5abd7b805f9 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp
@@ -283,7 +283,7 @@ void ShenandoahAsserts::assert_in_correct_region(void* interior_loc, oop obj, co
   }
 
   size_t alloc_size = obj->size();
-  if (alloc_size > ShenandoahHeapRegion::humongous_threshold_words()) {
+  if (ShenandoahHeapRegion::requires_humongous(alloc_size)) {
     size_t idx = r->index();
     size_t num_regions = ShenandoahHeapRegion::required_regions(alloc_size * HeapWordSize);
     for (size_t i = idx; i < idx + num_regions; i++) {
diff --git a/src/hotspot/share/gc/shenandoah/shenandoahController.cpp b/src/hotspot/share/gc/shenandoah/shenandoahController.cpp
index 6d6d21c4066..effa4a8f1fc 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahController.cpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahController.cpp
@@ -57,7 +57,7 @@ void ShenandoahController::handle_alloc_failure(ShenandoahAllocRequest& req, boo
   ShenandoahHeap* heap = ShenandoahHeap::heap();
 
   assert(current()->is_Java_thread(), "expect Java thread here");
-  bool is_humongous = req.size() > ShenandoahHeapRegion::humongous_threshold_words();
+  bool is_humongous = ShenandoahHeapRegion::requires_humongous(req.size());
 
   if (try_set_alloc_failure_gc(is_humongous)) {
     // Only report the first allocation failure
@@ -80,7 +80,7 @@ void ShenandoahController::handle_alloc_failure(ShenandoahAllocRequest& req, boo
 
 void ShenandoahController::handle_alloc_failure_evac(size_t words) {
   ShenandoahHeap* heap = ShenandoahHeap::heap();
-  bool is_humongous = (words > ShenandoahHeapRegion::region_size_words());
+  bool is_humongous = ShenandoahHeapRegion::requires_humongous(words);
 
   if (try_set_alloc_failure_gc(is_humongous)) {
     // Only report the first allocation failure
diff --git a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp
index b47bb109031..3dfc6a79665 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp
@@ -1308,7 +1308,7 @@ void ShenandoahFreeSet::log_status() {
 
 HeapWord* ShenandoahFreeSet::allocate(ShenandoahAllocRequest& req, bool& in_new_region) {
   shenandoah_assert_heaplocked();
-  if (req.size() > ShenandoahHeapRegion::humongous_threshold_words()) {
+  if (ShenandoahHeapRegion::requires_humongous(req.size())) {
     switch (req.type()) {
       case ShenandoahAllocRequest::_alloc_shared:
       case ShenandoahAllocRequest::_alloc_shared_gc:
@@ -1317,8 +1317,7 @@ HeapWord* ShenandoahFreeSet::allocate(ShenandoahAllocRequest& req, bool& in_new_
       case ShenandoahAllocRequest::_alloc_gclab:
       case ShenandoahAllocRequest::_alloc_tlab:
         in_new_region = false;
-        assert(false, "Trying to allocate TLAB larger than the humongous threshold: " SIZE_FORMAT " > " SIZE_FORMAT,
-               req.size(), ShenandoahHeapRegion::humongous_threshold_words());
+        assert(false, "Trying to allocate TLAB in humongous region: " SIZE_FORMAT, req.size());
         return nullptr;
       default:
         ShouldNotReachHere();
diff --git a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp
index 1975174b784..e4e2bb4d6e6 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp
@@ -277,14 +277,14 @@ private:
   // While holding the heap lock, allocate memory for a single object or LAB  which is to be entirely contained
   // within a single HeapRegion as characterized by req.
   //
-  // Precondition: req.size() <= ShenandoahHeapRegion::humongous_threshold_words().
+  // Precondition: !ShenandoahHeapRegion::requires_humongous(req.size())
   HeapWord* allocate_single(ShenandoahAllocRequest& req, bool& in_new_region);
 
   // While holding the heap lock, allocate memory for a humongous object which spans one or more regions that
   // were previously empty.  Regions that represent humongous objects are entirely dedicated to the humongous
   // object.  No other objects are packed into these regions.
   //
-  // Precondition: req.size() > ShenandoahHeapRegion::humongous_threshold_words().
+  // Precondition: ShenandoahHeapRegion::requires_humongous(req.size())
   HeapWord* allocate_contiguous(ShenandoahAllocRequest& req);
 
   // Change region r from the Mutator partition to the GC's Collector partition.  This requires that the region is entirely empty.
diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp
index 8a94b20670a..eceed8dbe43 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp
@@ -51,8 +51,6 @@ size_t ShenandoahHeapRegion::RegionSizeBytesShift = 0;
 size_t ShenandoahHeapRegion::RegionSizeWordsShift = 0;
 size_t ShenandoahHeapRegion::RegionSizeBytesMask = 0;
 size_t ShenandoahHeapRegion::RegionSizeWordsMask = 0;
-size_t ShenandoahHeapRegion::HumongousThresholdBytes = 0;
-size_t ShenandoahHeapRegion::HumongousThresholdWords = 0;
 size_t ShenandoahHeapRegion::MaxTLABSizeBytes = 0;
 size_t ShenandoahHeapRegion::MaxTLABSizeWords = 0;
 
@@ -598,18 +596,8 @@ size_t ShenandoahHeapRegion::setup_sizes(size_t max_heap_size) {
   RegionCount = align_up(max_heap_size, RegionSizeBytes) / RegionSizeBytes;
   guarantee(RegionCount >= MIN_NUM_REGIONS, "Should have at least minimum regions");
 
-  guarantee(HumongousThresholdWords == 0, "we should only set it once");
-  HumongousThresholdWords = RegionSizeWords * ShenandoahHumongousThreshold / 100;
-  HumongousThresholdWords = align_down(HumongousThresholdWords, MinObjAlignment);
-  assert (HumongousThresholdWords <= RegionSizeWords, "sanity");
-
-  guarantee(HumongousThresholdBytes == 0, "we should only set it once");
-  HumongousThresholdBytes = HumongousThresholdWords * HeapWordSize;
-  assert (HumongousThresholdBytes <= RegionSizeBytes, "sanity");
-
   guarantee(MaxTLABSizeWords == 0, "we should only set it once");
-  MaxTLABSizeWords = MIN2(RegionSizeWords, HumongousThresholdWords);
-  MaxTLABSizeWords = align_down(MaxTLABSizeWords, MinObjAlignment);
+  MaxTLABSizeWords = align_down(RegionSizeWords, MinObjAlignment);
 
   guarantee(MaxTLABSizeBytes == 0, "we should only set it once");
   MaxTLABSizeBytes = MaxTLABSizeWords * HeapWordSize;
diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp
index c5763608582..c34c4c232e4 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp
@@ -217,8 +217,6 @@ private:
   static size_t RegionSizeWordsShift;
   static size_t RegionSizeBytesMask;
   static size_t RegionSizeWordsMask;
-  static size_t HumongousThresholdBytes;
-  static size_t HumongousThresholdWords;
   static size_t MaxTLABSizeBytes;
   static size_t MaxTLABSizeWords;
 
@@ -261,6 +259,10 @@ public:
     return (bytes + ShenandoahHeapRegion::region_size_bytes() - 1) >> ShenandoahHeapRegion::region_size_bytes_shift();
   }
 
+  inline static bool requires_humongous(size_t words) {
+    return words > ShenandoahHeapRegion::RegionSizeWords;
+  }
+
   inline static size_t region_count() {
     return ShenandoahHeapRegion::RegionCount;
   }
@@ -313,14 +315,6 @@ public:
     return (jint)ShenandoahHeapRegion::RegionSizeWordsShift;
   }
 
-  inline static size_t humongous_threshold_bytes() {
-    return ShenandoahHeapRegion::HumongousThresholdBytes;
-  }
-
-  inline static size_t humongous_threshold_words() {
-    return ShenandoahHeapRegion::HumongousThresholdWords;
-  }
-
   inline static size_t max_tlab_size_bytes() {
     return ShenandoahHeapRegion::MaxTLABSizeBytes;
   }
diff --git a/src/hotspot/share/gc/shenandoah/shenandoahInitLogger.cpp b/src/hotspot/share/gc/shenandoah/shenandoahInitLogger.cpp
index db5a68d584e..baf95a5bdf7 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahInitLogger.cpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahInitLogger.cpp
@@ -43,7 +43,6 @@ void ShenandoahInitLogger::print_heap() {
   log_info(gc, init)("Heap Region Count: " SIZE_FORMAT, ShenandoahHeapRegion::region_count());
   log_info(gc, init)("Heap Region Size: " EXACTFMT, EXACTFMTARGS(ShenandoahHeapRegion::region_size_bytes()));
   log_info(gc, init)("TLAB Size Max: " EXACTFMT, EXACTFMTARGS(ShenandoahHeapRegion::max_tlab_size_bytes()));
-  log_info(gc, init)("Humongous Object Threshold: " EXACTFMT, EXACTFMTARGS(ShenandoahHeapRegion::humongous_threshold_bytes()));
 }
 
 void ShenandoahInitLogger::print_gc_specific() {
diff --git a/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp b/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp
index 87702afe98e..c66e5839d58 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp
@@ -49,13 +49,6 @@
           "With automatic region sizing, the regions would be at most "     \
           "this large.")                                                    \
                                                                             \
-  product(intx, ShenandoahHumongousThreshold, 100, EXPERIMENTAL,            \
-          "Humongous objects are allocated in separate regions. "           \
-          "This setting defines how large the object should be to be "      \
-          "deemed humongous. Value is in  percents of heap region size. "   \
-          "This also caps the maximum TLAB size.")                          \
-          range(1, 100)                                                     \
-                                                                            \
   product(ccstr, ShenandoahGCMode, "satb",                                  \
           "GC mode to use.  Among other things, this defines which "        \
           "barriers are in in use. Possible values are:"                    \
diff --git a/test/hotspot/jtreg/gc/shenandoah/TestHumongousThreshold.java b/test/hotspot/jtreg/gc/shenandoah/TestHumongousThreshold.java
deleted file mode 100644
index 845a6617ebd..00000000000
--- a/test/hotspot/jtreg/gc/shenandoah/TestHumongousThreshold.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2017, 2018, Red Hat, Inc. 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.
- *
- */
-
-/*
- * @test id=default
- * @key randomness
- * @requires vm.gc.Shenandoah
- * @library /test/lib
- *
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:+ShenandoahVerify
- *                   TestHumongousThreshold
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=50
- *                   TestHumongousThreshold
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=90
- *                   TestHumongousThreshold
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=99
- *                   TestHumongousThreshold
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=100
- *                   TestHumongousThreshold
- *
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:-UseTLAB -XX:+ShenandoahVerify
- *                   TestHumongousThreshold
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:-UseTLAB -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=50
- *                   TestHumongousThreshold
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:-UseTLAB -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=90
- *                   TestHumongousThreshold
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:-UseTLAB -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=99
- *                   TestHumongousThreshold
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:-UseTLAB -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=100
- *                   TestHumongousThreshold
- *
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:ShenandoahHumongousThreshold=90 -XX:ShenandoahGCHeuristics=aggressive
- *                   TestHumongousThreshold
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:-UseTLAB -XX:ShenandoahHumongousThreshold=90 -XX:ShenandoahGCHeuristics=aggressive
- *                   TestHumongousThreshold
- */
-
-/*
- * @test id=16b
- * @key randomness
- * @requires vm.gc.Shenandoah
- * @requires vm.bits == "64"
- * @library /test/lib
- *
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify
- *                   TestHumongousThreshold
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=50
- *                   TestHumongousThreshold
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=90
- *                   TestHumongousThreshold
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=99
- *                   TestHumongousThreshold
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=100
- *                   TestHumongousThreshold
- *
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:-UseTLAB -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify
- *                   TestHumongousThreshold
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:-UseTLAB -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=50
- *                   TestHumongousThreshold
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:-UseTLAB -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=90
- *                   TestHumongousThreshold
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:-UseTLAB -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=99
- *                   TestHumongousThreshold
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx1g
- *                   -XX:-UseTLAB -XX:ObjectAlignmentInBytes=16 -XX:+ShenandoahVerify -XX:ShenandoahHumongousThreshold=100
- *                   TestHumongousThreshold
- */
-
-import java.util.Random;
-import jdk.test.lib.Utils;
-
-public class TestHumongousThreshold {
-
-    static final long TARGET_MB = Long.getLong("target", 20_000); // 20 Gb allocation
-
-    static volatile Object sink;
-
-    public static void main(String[] args) throws Exception {
-        final int min = 0;
-        final int max = 384 * 1024;
-        long count = TARGET_MB * 1024 * 1024 / (16 + 4 * (min + (max - min) / 2));
-
-        Random r = Utils.getRandomInstance();
-        for (long c = 0; c < count; c++) {
-            sink = new int[min + r.nextInt(max - min)];
-        }
-    }
-
-}
diff --git a/test/hotspot/jtreg/gc/shenandoah/options/TestHumongousThresholdArgs.java b/test/hotspot/jtreg/gc/shenandoah/options/TestHumongousThresholdArgs.java
deleted file mode 100644
index 47d4115ce74..00000000000
--- a/test/hotspot/jtreg/gc/shenandoah/options/TestHumongousThresholdArgs.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2017, 2018, Red Hat, Inc. 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.
- *
- */
-
-/*
- * @test
- * @summary Test that Shenandoah humongous threshold args are checked
- * @requires vm.gc.Shenandoah
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- * @run driver TestHumongousThresholdArgs
- */
-
-import jdk.test.lib.process.ProcessTools;
-import jdk.test.lib.process.OutputAnalyzer;
-
-public class TestHumongousThresholdArgs {
-    public static void main(String[] args) throws Exception {
-        {
-            OutputAnalyzer output = ProcessTools.executeLimitedTestJava(
-                    "-Xmx128m",
-                    "-XX:+UnlockExperimentalVMOptions",
-                    "-XX:+UseShenandoahGC",
-                    "-version");
-            output.shouldHaveExitValue(0);
-        }
-
-        int[] valid = new int[] {1, 10, 50, 90, 100};
-        int[] invalid = new int[] {-100, -1, 0, 101, 1000};
-
-        for (int v : valid) {
-            OutputAnalyzer output = ProcessTools.executeLimitedTestJava(
-                    "-Xmx128m",
-                    "-XX:+UnlockExperimentalVMOptions",
-                    "-XX:+UseShenandoahGC",
-                    "-XX:ShenandoahHumongousThreshold=" + v,
-                    "-version");
-            output.shouldHaveExitValue(0);
-        }
-
-        for (int v : invalid) {
-            OutputAnalyzer output = ProcessTools.executeLimitedTestJava(
-                    "-Xmx128m",
-                    "-XX:+UnlockExperimentalVMOptions",
-                    "-XX:+UseShenandoahGC",
-                    "-XX:ShenandoahHumongousThreshold=" + v,
-                    "-version");
-            output.shouldHaveExitValue(1);
-        }
-    }
-}