--- old/src/share/vm/prims/whitebox.cpp 2016-03-02 13:19:44.893474136 +0100 +++ new/src/share/vm/prims/whitebox.cpp 2016-03-02 13:19:44.785474131 +0100 @@ -30,6 +30,7 @@ #include "classfile/stringTable.hpp" #include "code/codeCache.hpp" #include "compiler/methodMatcher.hpp" +#include "compiler/directivesParser.hpp" #include "jvmtifiles/jvmtiEnv.hpp" #include "memory/metadataFactory.hpp" #include "memory/metaspaceShared.hpp" @@ -1502,6 +1503,22 @@ } } +WB_ENTRY(jboolean, WB_AddCompilerDirective(JNIEnv* env, jobject o, jstring compDirect)) + char* tmpstr = NULL; + { + // can't be in VM when we call JNI + ThreadToNativeFromVM ttnfv(thread); + const char* dirstr = env->GetStringUTFChars(compDirect, NULL); + tmpstr = strdup(dirstr); + env->ReleaseStringUTFChars(compDirect, dirstr); + } + return (jboolean) DirectivesParser::parse_string(tmpstr, tty);; +WB_END + +WB_ENTRY(void, WB_RemoveCompilerDirective(JNIEnv* env, jobject o)) + DirectivesStack::pop(); +WB_END + #define CC (char*) static JNINativeMethod methods[] = { @@ -1677,6 +1694,9 @@ {CC"isShared", CC"(Ljava/lang/Object;)Z", (void*)&WB_IsShared }, {CC"areSharedStringsIgnored", CC"()Z", (void*)&WB_AreSharedStringsIgnored }, {CC"clearInlineCaches", CC"()V", (void*)&WB_ClearInlineCaches }, + {CC"addCompilerDirective", CC"(Ljava/lang/String;)Z", + (void*)&WB_AddCompilerDirective }, + {CC"removeCompilerDirective", CC"()V", (void*)&WB_RemoveCompilerDirective }, }; #undef CC