# HG changeset patch # User kbarrett # Date 1549403209 18000 # Node ID 82c95d4b61f08a5bc5f9374ba0783733acbaa5d1 # Parent 043ae846819f4cd86973fcb255b2994a2ab9da20 8217474: Remove WhiteBox.getConcurrentGCPhases() Summary: Remove function and supporting infrastructure. Reviewed-by: shade, tschatzl diff -r 043ae846819f -r 82c95d4b61f0 src/hotspot/share/gc/g1/g1CollectedHeap.cpp --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Tue Feb 05 15:12:13 2019 -0500 +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Tue Feb 05 16:46:49 2019 -0500 @@ -2323,10 +2323,6 @@ return true; } -const char* const* G1CollectedHeap::concurrent_phases() const { - return _cm_thread->concurrent_phases(); -} - bool G1CollectedHeap::request_concurrent_phase(const char* phase) { return _cm_thread->request_concurrent_phase(phase); } diff -r 043ae846819f -r 82c95d4b61f0 src/hotspot/share/gc/g1/g1CollectedHeap.hpp --- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp Tue Feb 05 15:12:13 2019 -0500 +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp Tue Feb 05 16:46:49 2019 -0500 @@ -1369,7 +1369,6 @@ // WhiteBox testing support. virtual bool supports_concurrent_phase_control() const; - virtual const char* const* concurrent_phases() const; virtual bool request_concurrent_phase(const char* phase); virtual WorkGang* get_safepoint_workers() { return _workers; } diff -r 043ae846819f -r 82c95d4b61f0 src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp --- a/src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp Tue Feb 05 15:12:13 2019 -0500 +++ b/src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp Tue Feb 05 16:46:49 2019 -0500 @@ -224,10 +224,6 @@ { } }; -const char* const* G1ConcurrentMarkThread::concurrent_phases() const { - return concurrent_phase_names; -} - bool G1ConcurrentMarkThread::request_concurrent_phase(const char* phase_name) { int phase = lookup_concurrent_phase(phase_name); if (phase < 0) return false; diff -r 043ae846819f -r 82c95d4b61f0 src/hotspot/share/gc/g1/g1ConcurrentMarkThread.hpp --- a/src/hotspot/share/gc/g1/g1ConcurrentMarkThread.hpp Tue Feb 05 15:12:13 2019 -0500 +++ b/src/hotspot/share/gc/g1/g1ConcurrentMarkThread.hpp Tue Feb 05 16:46:49 2019 -0500 @@ -90,7 +90,6 @@ bool during_cycle() { return !idle(); } // WhiteBox testing support. - const char* const* concurrent_phases() const; bool request_concurrent_phase(const char* phase); ConcurrentGCPhaseManager::Stack* phase_manager_stack() { diff -r 043ae846819f -r 82c95d4b61f0 src/hotspot/share/gc/shared/collectedHeap.cpp --- a/src/hotspot/share/gc/shared/collectedHeap.cpp Tue Feb 05 15:12:13 2019 -0500 +++ b/src/hotspot/share/gc/shared/collectedHeap.cpp Tue Feb 05 16:46:49 2019 -0500 @@ -161,11 +161,6 @@ return false; } -const char* const* CollectedHeap::concurrent_phases() const { - static const char* const result[] = { NULL }; - return result; -} - bool CollectedHeap::request_concurrent_phase(const char* phase) { return false; } diff -r 043ae846819f -r 82c95d4b61f0 src/hotspot/share/gc/shared/collectedHeap.hpp --- a/src/hotspot/share/gc/shared/collectedHeap.hpp Tue Feb 05 15:12:13 2019 -0500 +++ b/src/hotspot/share/gc/shared/collectedHeap.hpp Tue Feb 05 16:46:49 2019 -0500 @@ -534,12 +534,6 @@ // The default implementation returns false. virtual bool supports_concurrent_phase_control() const; - // Return a NULL terminated array of concurrent phase names provided - // by this collector. Supports Whitebox testing. These are the - // names recognized by request_concurrent_phase(). The default - // implementation returns an array of one NULL element. - virtual const char* const* concurrent_phases() const; - // Request the collector enter the indicated concurrent phase, and // wait until it does so. Supports WhiteBox testing. Only one // request may be active at a time. Phases are designated by name; diff -r 043ae846819f -r 82c95d4b61f0 src/hotspot/share/prims/whitebox.cpp --- a/src/hotspot/share/prims/whitebox.cpp Tue Feb 05 15:12:13 2019 -0500 +++ b/src/hotspot/share/prims/whitebox.cpp Tue Feb 05 16:46:49 2019 -0500 @@ -394,32 +394,6 @@ return Universe::heap()->supports_concurrent_phase_control(); WB_END -WB_ENTRY(jobjectArray, WB_GetConcurrentGCPhases(JNIEnv* env, jobject o)) - const char* const* phases = Universe::heap()->concurrent_phases(); - jint nphases = 0; - for ( ; phases[nphases] != NULL; ++nphases) ; - - ResourceMark rm(thread); - ThreadToNativeFromVM ttn(thread); - jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string()); - CHECK_JNI_EXCEPTION_(env, NULL); - - jobjectArray result = env->NewObjectArray(nphases, clazz, NULL); - CHECK_JNI_EXCEPTION_(env, NULL); - - // If push fails, return with pending exception. - if (env->PushLocalFrame(nphases) < 0) return NULL; - for (jint i = 0; i < nphases; ++i) { - jstring phase = env->NewStringUTF(phases[i]); - CHECK_JNI_EXCEPTION_(env, NULL); - env->SetObjectArrayElement(result, i, phase); - CHECK_JNI_EXCEPTION_(env, NULL); - } - env->PopLocalFrame(NULL); - - return result; -WB_END - WB_ENTRY(jboolean, WB_RequestConcurrentGCPhase(JNIEnv* env, jobject o, jstring name)) Handle h_name(THREAD, JNIHandles::resolve(name)); ResourceMark rm; @@ -2351,8 +2325,6 @@ {CC"isGCSelected", CC"(I)Z", (void*)&WB_IsGCSelected}, {CC"isGCSelectedErgonomically", CC"()Z", (void*)&WB_IsGCSelectedErgonomically}, {CC"supportsConcurrentGCPhaseControl", CC"()Z", (void*)&WB_SupportsConcurrentGCPhaseControl}, - {CC"getConcurrentGCPhases", CC"()[Ljava/lang/String;", - (void*)&WB_GetConcurrentGCPhases}, {CC"requestConcurrentGCPhase0", CC"(Ljava/lang/String;)Z", (void*)&WB_RequestConcurrentGCPhase}, {CC"checkLibSpecifiesNoexecstack", CC"(Ljava/lang/String;)Z", diff -r 043ae846819f -r 82c95d4b61f0 test/hotspot/jtreg/gc/concurrent_phase_control/CheckSupported.java --- a/test/hotspot/jtreg/gc/concurrent_phase_control/CheckSupported.java Tue Feb 05 15:12:13 2019 -0500 +++ b/test/hotspot/jtreg/gc/concurrent_phase_control/CheckSupported.java Tue Feb 05 16:46:49 2019 -0500 @@ -30,66 +30,18 @@ */ import sun.hotspot.WhiteBox; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; public class CheckSupported { private static final WhiteBox WB = WhiteBox.getWhiteBox(); - private static Set toSet(List list, String which) - throws Exception - { - Set result = new HashSet(list); - if (result.size() < list.size()) { - throw new RuntimeException(which + " phases contains duplicates"); - } - return result; - } - - private static void checkPhases(String[] expectedPhases) throws Exception { - String[] actualPhases = WB.getConcurrentGCPhases(); - - List expectedList = Arrays.asList(expectedPhases); - List actualList = Arrays.asList(actualPhases); - - Set expected = toSet(expectedList, "Expected"); - Set actual = toSet(actualList, "Actual"); - - expected.removeAll(actualList); - actual.removeAll(expectedList); - - boolean match = true; - if (!expected.isEmpty()) { - match = false; - System.out.println("Unexpected phases:"); - for (String s: expected) { - System.out.println(" " + s); - } - } - if (!actual.isEmpty()) { - match = false; - System.out.println("Expected but missing phases:"); - for (String s: actual) { - System.out.println(" " + s); - } - } - if (!match) { - throw new RuntimeException("Mismatch between expected and actual phases"); - } - } - - public static void check(String gcName, String[] phases) throws Exception { + public static void check(String gcName) throws Exception { // Verify supported. if (!WB.supportsConcurrentGCPhaseControl()) { throw new RuntimeException( gcName + " unexpectedly missing phase control support"); } - checkPhases(phases); - // Verify IllegalArgumentException thrown by request attempt // with unknown phase. boolean illegalArgumentThrown = false; diff -r 043ae846819f -r 82c95d4b61f0 test/hotspot/jtreg/gc/concurrent_phase_control/CheckUnsupported.java --- a/test/hotspot/jtreg/gc/concurrent_phase_control/CheckUnsupported.java Tue Feb 05 15:12:13 2019 -0500 +++ b/test/hotspot/jtreg/gc/concurrent_phase_control/CheckUnsupported.java Tue Feb 05 16:46:49 2019 -0500 @@ -42,13 +42,6 @@ gcName + " unexpectedly supports phase control"); } - // Verify phase sequence is empty. - String[] phases = WB.getConcurrentGCPhases(); - if (phases.length > 0) { - throw new RuntimeException( - gcName + " unexpectedly has non-empty phases"); - } - // Verify IllegalStateException thrown by request attempt. boolean illegalStateThrown = false; try { diff -r 043ae846819f -r 82c95d4b61f0 test/hotspot/jtreg/gc/concurrent_phase_control/TestConcurrentPhaseControlG1Basics.java --- a/test/hotspot/jtreg/gc/concurrent_phase_control/TestConcurrentPhaseControlG1Basics.java Tue Feb 05 15:12:13 2019 -0500 +++ b/test/hotspot/jtreg/gc/concurrent_phase_control/TestConcurrentPhaseControlG1Basics.java Tue Feb 05 16:46:49 2019 -0500 @@ -27,8 +27,7 @@ * @test TestConcurrentPhaseControlG1Basics * @bug 8169517 * @requires vm.gc.G1 - * @summary Verify G1 supports concurrent phase control and has the - * expected set of phases. + * @summary Verify G1 supports concurrent phase control. * @key gc * @modules java.base * @library /test/lib / @@ -45,22 +44,7 @@ public class TestConcurrentPhaseControlG1Basics { - private static final String[] phases = { - "ANY", - "IDLE", - "CONCURRENT_CYCLE", - "CLEAR_CLAIMED_MARKS", - "SCAN_ROOT_REGIONS", - "CONCURRENT_MARK", - "MARK_FROM_ROOTS", - "PRECLEAN", - "BEFORE_REMARK", - "REMARK", - "REBUILD_REMEMBERED_SETS", - "CLEANUP_FOR_NEXT_MARK", - }; - public static void main(String[] args) throws Exception { - CheckSupported.check("G1", phases); + CheckSupported.check("G1"); } } diff -r 043ae846819f -r 82c95d4b61f0 test/lib/sun/hotspot/WhiteBox.java --- a/test/lib/sun/hotspot/WhiteBox.java Tue Feb 05 15:12:13 2019 -0500 +++ b/test/lib/sun/hotspot/WhiteBox.java Tue Feb 05 16:46:49 2019 -0500 @@ -402,11 +402,6 @@ // always fail. public native boolean supportsConcurrentGCPhaseControl(); - // Returns an array of concurrent phase names provided by this - // collector. These are the names recognized by - // requestConcurrentGCPhase(). - public native String[] getConcurrentGCPhases(); - // Attempt to put the collector into the indicated concurrent phase, // and attempt to remain in that state until a new request is made. //