mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8064701: Some CDS optimizations should be disabled if bootclasspath is modified by JVMTI
Added API to track bootclasspath modification Reviewed-by: jiangli, dholmes, minqi
This commit is contained in:
parent
ae592ef688
commit
ef64d5393d
4 changed files with 39 additions and 1 deletions
|
@ -64,6 +64,7 @@
|
|||
#endif // INCLUDE_NMT
|
||||
|
||||
#include "compiler/compileBroker.hpp"
|
||||
#include "jvmtifiles/jvmtiEnv.hpp"
|
||||
#include "runtime/compilationPolicy.hpp"
|
||||
|
||||
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
|
||||
|
@ -113,6 +114,31 @@ WB_ENTRY(jboolean, WB_IsClassAlive(JNIEnv* env, jobject target, jstring name))
|
|||
return closure.found();
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(void, WB_AddToBootstrapClassLoaderSearch(JNIEnv* env, jobject o, jstring segment)) {
|
||||
#if INCLUDE_JVMTI
|
||||
ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI
|
||||
const char* seg = env->GetStringUTFChars(segment, NULL);
|
||||
JvmtiEnv* jvmti_env = JvmtiEnv::create_a_jvmti(JVMTI_VERSION);
|
||||
jvmtiError err = jvmti_env->AddToBootstrapClassLoaderSearch(seg);
|
||||
assert(err == JVMTI_ERROR_NONE, "must not fail");
|
||||
env->ReleaseStringUTFChars(segment, seg);
|
||||
#endif
|
||||
}
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(void, WB_AddToSystemClassLoaderSearch(JNIEnv* env, jobject o, jstring segment)) {
|
||||
#if INCLUDE_JVMTI
|
||||
ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI
|
||||
const char* seg = env->GetStringUTFChars(segment, NULL);
|
||||
JvmtiEnv* jvmti_env = JvmtiEnv::create_a_jvmti(JVMTI_VERSION);
|
||||
jvmtiError err = jvmti_env->AddToSystemClassLoaderSearch(seg);
|
||||
assert(err == JVMTI_ERROR_NONE, "must not fail");
|
||||
env->ReleaseStringUTFChars(segment, seg);
|
||||
#endif
|
||||
}
|
||||
WB_END
|
||||
|
||||
|
||||
WB_ENTRY(jlong, WB_GetCompressedOopsMaxHeapSize(JNIEnv* env, jobject o)) {
|
||||
return (jlong)Arguments::max_heap_for_compressed_oops();
|
||||
}
|
||||
|
@ -1102,6 +1128,10 @@ static JNINativeMethod methods[] = {
|
|||
CC"(Ljava/lang/String;[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
|
||||
(void*) &WB_ParseCommandLine
|
||||
},
|
||||
{CC"addToBootstrapClassLoaderSearch", CC"(Ljava/lang/String;)V",
|
||||
(void*)&WB_AddToBootstrapClassLoaderSearch},
|
||||
{CC"addToSystemClassLoaderSearch", CC"(Ljava/lang/String;)V",
|
||||
(void*)&WB_AddToSystemClassLoaderSearch},
|
||||
{CC"getCompressedOopsMaxHeapSize", CC"()J",
|
||||
(void*)&WB_GetCompressedOopsMaxHeapSize},
|
||||
{CC"printHeapSizes", CC"()V", (void*)&WB_PrintHeapSizes },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue