diff -r b786280276dc -r 2f1b308b4469 src/hotspot/share/prims/whitebox.cpp --- a/src/hotspot/share/prims/whitebox.cpp Wed Mar 28 11:38:47 2018 +0200 +++ b/src/hotspot/share/prims/whitebox.cpp Wed Mar 28 11:38:47 2018 +0200 @@ -32,6 +32,7 @@ #include "code/codeCache.hpp" #include "compiler/methodMatcher.hpp" #include "compiler/directivesParser.hpp" +#include "gc/shared/gcConfig.hpp" #include "gc/shared/genCollectedHeap.hpp" #include "jvmtifiles/jvmtiEnv.hpp" #include "memory/metadataFactory.hpp" @@ -312,47 +313,16 @@ (size_t) magnitude, (size_t) iterations); WB_END -static const jint serial_code = 1; -static const jint parallel_code = 2; -static const jint cms_code = 4; -static const jint g1_code = 8; - -WB_ENTRY(jint, WB_CurrentGC(JNIEnv* env, jobject o, jobject obj)) - if (UseSerialGC) { - return serial_code; - } else if (UseParallelGC || UseParallelOldGC) { - return parallel_code; - } if (UseConcMarkSweepGC) { - return cms_code; - } else if (UseG1GC) { - return g1_code; - } - ShouldNotReachHere(); - return 0; +WB_ENTRY(jboolean, WB_IsGCSupported(JNIEnv* env, jobject o, jint name)) + return GCConfig::is_gc_supported((CollectedHeap::Name)name); WB_END -WB_ENTRY(jint, WB_AllSupportedGC(JNIEnv* env, jobject o, jobject obj)) -#if INCLUDE_ALL_GCS - return serial_code | parallel_code | cms_code | g1_code; -#else - return serial_code; -#endif // INCLUDE_ALL_GCS +WB_ENTRY(jboolean, WB_IsGCSelected(JNIEnv* env, jobject o, jint name)) + return GCConfig::is_gc_selected((CollectedHeap::Name)name); WB_END -WB_ENTRY(jboolean, WB_GCSelectedByErgo(JNIEnv* env, jobject o, jobject obj)) - if (UseSerialGC) { - return FLAG_IS_ERGO(UseSerialGC); - } else if (UseParallelGC) { - return FLAG_IS_ERGO(UseParallelGC); - } else if (UseParallelOldGC) { - return FLAG_IS_ERGO(UseParallelOldGC); - } else if (UseConcMarkSweepGC) { - return FLAG_IS_ERGO(UseConcMarkSweepGC); - } else if (UseG1GC) { - return FLAG_IS_ERGO(UseG1GC); - } - ShouldNotReachHere(); - return false; +WB_ENTRY(jboolean, WB_IsGCSelectedErgonomically(JNIEnv* env, jobject o)) + return GCConfig::is_gc_selected_ergonomically(); WB_END WB_ENTRY(jboolean, WB_isObjectInOldGen(JNIEnv* env, jobject o, jobject obj)) @@ -2162,10 +2132,10 @@ {CC"handshakeWalkStack", CC"(Ljava/lang/Thread;Z)I", (void*)&WB_HandshakeWalkStack }, {CC"addCompilerDirective", CC"(Ljava/lang/String;)I", (void*)&WB_AddCompilerDirective }, - {CC"removeCompilerDirective", CC"(I)V", (void*)&WB_RemoveCompilerDirective }, - {CC"currentGC", CC"()I", (void*)&WB_CurrentGC}, - {CC"allSupportedGC", CC"()I", (void*)&WB_AllSupportedGC}, - {CC"gcSelectedByErgo", CC"()Z", (void*)&WB_GCSelectedByErgo}, + {CC"removeCompilerDirective", CC"(I)V", (void*)&WB_RemoveCompilerDirective }, + {CC"isGCSupported", CC"(I)Z", (void*)&WB_IsGCSupported}, + {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},