src/share/vm/prims/whitebox.cpp

Print this page

        

*** 47,56 **** --- 47,57 ---- #ifdef INCLUDE_NMT #include "services/memTracker.hpp" #endif // INCLUDE_NMT #include "compiler/compileBroker.hpp" + #include "runtime/compilationPolicy.hpp" bool WhiteBox::_used = false; WB_ENTRY(jlong, WB_GetObjectAddress(JNIEnv* env, jobject o, jobject obj)) return (jlong)(void*)JNIHandles::resolve(obj);
*** 211,225 **** return JNI_FALSE; } return (code->is_alive() && !code->is_marked_for_deoptimization()); WB_END ! WB_ENTRY(jboolean, WB_IsMethodCompilable(JNIEnv* env, jobject o, jobject method)) jmethodID jmid = reflected_method_to_jmid(thread, env, method); MutexLockerEx mu(Compile_lock); methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid)); ! return !mh->is_not_compilable(); WB_END WB_ENTRY(jboolean, WB_IsMethodQueuedForCompilation(JNIEnv* env, jobject o, jobject method)) jmethodID jmid = reflected_method_to_jmid(thread, env, method); MutexLockerEx mu(Compile_lock); --- 212,226 ---- return JNI_FALSE; } return (code->is_alive() && !code->is_marked_for_deoptimization()); WB_END ! WB_ENTRY(jboolean, WB_IsMethodCompilable(JNIEnv* env, jobject o, jobject method, jint comp_level)) jmethodID jmid = reflected_method_to_jmid(thread, env, method); MutexLockerEx mu(Compile_lock); methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid)); ! return CompilationPolicy::can_be_compiled(mh, comp_level); WB_END WB_ENTRY(jboolean, WB_IsMethodQueuedForCompilation(JNIEnv* env, jobject o, jobject method)) jmethodID jmid = reflected_method_to_jmid(thread, env, method); MutexLockerEx mu(Compile_lock);
*** 252,261 **** --- 253,309 ---- WB_ENTRY(jint, WB_GetCompileQueuesSize(JNIEnv* env, jobject o)) return CompileBroker::queue_size(CompLevel_full_optimization) /* C2 */ + CompileBroker::queue_size(CompLevel_full_profile) /* C1 */; WB_END + WB_ENTRY(jboolean, WB_SetForceInlineMethod(JNIEnv* env, jobject o, jobject method, jboolean value)) + jmethodID jmid = reflected_method_to_jmid(thread, env, method); + methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid)); + bool result = mh->force_inline(); + mh->set_force_inline(value == JNI_TRUE); + return result; + WB_END + + WB_ENTRY(jboolean, WB_EnqueueMethodForCompilation(JNIEnv* env, jobject o, jobject method, jint comp_level)) + jmethodID jmid = reflected_method_to_jmid(thread, env, method); + methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid)); + nmethod* nm = CompileBroker::compile_method(mh, InvocationEntryBci, comp_level, mh, mh->invocation_count(), "WhiteBox", THREAD); + MutexLockerEx mu(Compile_lock); + return (mh->queued_for_compilation() || nm != NULL); + WB_END + + WB_ENTRY(void, WB_ClearMethodState(JNIEnv* env, jobject o, jobject method)) + jmethodID jmid = reflected_method_to_jmid(thread, env, method); + methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid)); + MutexLockerEx mu(Compile_lock); + MethodData* mdo = mh->method_data(); + + if (mdo != NULL) { + mdo->init(); + ResourceMark rm; + int arg_count = mdo->method()->size_of_parameters(); + for (int i = 0; i < arg_count; i++) { + mdo->set_arg_modified(i, 0); + } + } + + mh->backedge_counter()->init(); + mh->invocation_counter()->init(); + mh->set_interpreter_invocation_count(0); + mh->set_interpreter_throwout_count(0); + mh->clear_not_c1_compilable(); + mh->clear_not_c2_compilable(); + mh->clear_not_c2_osr_compilable(); + NOT_PRODUCT(mh->set_compiled_invocation_count(0)); + + #ifdef TIERED + mh->set_rate(0.0F); + mh->set_prev_event_count(0); + mh->set_prev_time(0); + #endif + WB_END + //Some convenience methods to deal with objects from java int WhiteBox::offset_for_field(const char* field_name, oop object, Symbol* signature_symbol) { assert(field_name != NULL && strlen(field_name) > 0, "Field name not valid"); Thread* THREAD = Thread::current();
*** 329,339 **** {CC"deoptimizeAll", CC"()V", (void*)&WB_DeoptimizeAll }, {CC"deoptimizeMethod", CC"(Ljava/lang/reflect/Method;)I", (void*)&WB_DeoptimizeMethod }, {CC"isMethodCompiled", CC"(Ljava/lang/reflect/Method;)Z", (void*)&WB_IsMethodCompiled }, ! {CC"isMethodCompilable", CC"(Ljava/lang/reflect/Method;)Z", (void*)&WB_IsMethodCompilable}, {CC"isMethodQueuedForCompilation", CC"(Ljava/lang/reflect/Method;)Z", (void*)&WB_IsMethodQueuedForCompilation}, {CC"makeMethodNotCompilable", CC"(Ljava/lang/reflect/Method;)V", (void*)&WB_MakeMethodNotCompilable}, --- 377,387 ---- {CC"deoptimizeAll", CC"()V", (void*)&WB_DeoptimizeAll }, {CC"deoptimizeMethod", CC"(Ljava/lang/reflect/Method;)I", (void*)&WB_DeoptimizeMethod }, {CC"isMethodCompiled", CC"(Ljava/lang/reflect/Method;)Z", (void*)&WB_IsMethodCompiled }, ! {CC"isMethodCompilable", CC"(Ljava/lang/reflect/Method;I)Z", (void*)&WB_IsMethodCompilable}, {CC"isMethodQueuedForCompilation", CC"(Ljava/lang/reflect/Method;)Z", (void*)&WB_IsMethodQueuedForCompilation}, {CC"makeMethodNotCompilable", CC"(Ljava/lang/reflect/Method;)V", (void*)&WB_MakeMethodNotCompilable},
*** 341,350 **** --- 389,404 ---- CC"(Ljava/lang/reflect/Method;Z)Z", (void*)&WB_SetDontInlineMethod}, {CC"getMethodCompilationLevel", CC"(Ljava/lang/reflect/Method;)I", (void*)&WB_GetMethodCompilationLevel}, {CC"getCompileQueuesSize", CC"()I", (void*)&WB_GetCompileQueuesSize}, + {CC"setForceInlineMethod", + CC"(Ljava/lang/reflect/Method;Z)Z", (void*)&WB_SetForceInlineMethod}, + {CC"enqueueMethodForCompilation", + CC"(Ljava/lang/reflect/Method;I)Z", (void*)&WB_EnqueueMethodForCompilation}, + {CC"clearMethodState", + CC"(Ljava/lang/reflect/Method;)V", (void*)&WB_ClearMethodState}, }; #undef CC JVM_ENTRY(void, JVM_RegisterWhiteBoxMethods(JNIEnv* env, jclass wbclass))