mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-06 22:20:47 +00:00
8217474: Remove WhiteBox.getConcurrentGCPhases()
Remove function and supporting infrastructure. Reviewed-by: shade, tschatzl
This commit is contained in:
parent
c94cdddbdd
commit
1fcbd0cd0d
@ -2323,10 +2323,6 @@ bool G1CollectedHeap::supports_concurrent_phase_control() const {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1369,7 +1369,6 @@ public:
|
||||
|
||||
// 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; }
|
||||
|
||||
@ -224,10 +224,6 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
@ -90,7 +90,6 @@ class G1ConcurrentMarkThread: public ConcurrentGCThread {
|
||||
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() {
|
||||
|
||||
@ -161,11 +161,6 @@ bool CollectedHeap::supports_concurrent_phase_control() const {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -534,12 +534,6 @@ class CollectedHeap : public CHeapObj<mtInternal> {
|
||||
// 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;
|
||||
|
||||
@ -394,32 +394,6 @@ WB_ENTRY(jboolean, WB_SupportsConcurrentGCPhaseControl(JNIEnv* env, jobject o))
|
||||
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 @@ static JNINativeMethod methods[] = {
|
||||
{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",
|
||||
|
||||
@ -30,66 +30,18 @@ package gc.concurrent_phase_control;
|
||||
*/
|
||||
|
||||
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<String> toSet(List<String> list, String which)
|
||||
throws Exception
|
||||
{
|
||||
Set<String> result = new HashSet<String>(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<String> expectedList = Arrays.asList(expectedPhases);
|
||||
List<String> actualList = Arrays.asList(actualPhases);
|
||||
|
||||
Set<String> expected = toSet(expectedList, "Expected");
|
||||
Set<String> 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;
|
||||
|
||||
@ -42,13 +42,6 @@ public class CheckUnsupported {
|
||||
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 {
|
||||
|
||||
@ -27,8 +27,7 @@ package gc.concurrent_phase_control;
|
||||
* @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 @@ import gc.concurrent_phase_control.CheckSupported;
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -402,11 +402,6 @@ public class WhiteBox {
|
||||
// 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.
|
||||
//
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user