mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
8154096: Extend WhiteBox API with methods which retrieve from VM information about available GC
Reviewed-by: iignatyev, kbarrett
This commit is contained in:
parent
286b967574
commit
acc40d57ab
1 changed files with 47 additions and 1 deletions
|
@ -278,6 +278,49 @@ WB_ENTRY(jint, WB_StressVirtualSpaceResize(JNIEnv* env, jobject o,
|
||||||
(size_t) magnitude, (size_t) iterations);
|
(size_t) magnitude, (size_t) iterations);
|
||||||
WB_END
|
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_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_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_END
|
||||||
|
|
||||||
WB_ENTRY(jboolean, WB_isObjectInOldGen(JNIEnv* env, jobject o, jobject obj))
|
WB_ENTRY(jboolean, WB_isObjectInOldGen(JNIEnv* env, jobject o, jobject obj))
|
||||||
oop p = JNIHandles::resolve(obj);
|
oop p = JNIHandles::resolve(obj);
|
||||||
#if INCLUDE_ALL_GCS
|
#if INCLUDE_ALL_GCS
|
||||||
|
@ -1834,6 +1877,9 @@ static JNINativeMethod methods[] = {
|
||||||
{CC"addCompilerDirective", CC"(Ljava/lang/String;)I",
|
{CC"addCompilerDirective", CC"(Ljava/lang/String;)I",
|
||||||
(void*)&WB_AddCompilerDirective },
|
(void*)&WB_AddCompilerDirective },
|
||||||
{CC"removeCompilerDirective", CC"(I)V", (void*)&WB_RemoveCompilerDirective },
|
{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},
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef CC
|
#undef CC
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue