1.1 --- a/src/share/vm/prims/whitebox.cpp Mon Jun 03 16:14:54 2019 +0100 1.2 +++ b/src/share/vm/prims/whitebox.cpp Wed Jun 05 03:07:31 2019 +0100 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -633,6 +633,25 @@ 1.11 } 1.12 WB_END 1.13 1.14 +WB_ENTRY(void, WB_MarkMethodProfiled(JNIEnv* env, jobject o, jobject method)) 1.15 + jmethodID jmid = reflected_method_to_jmid(thread, env, method); 1.16 + CHECK_JNI_EXCEPTION(env); 1.17 + methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid)); 1.18 + 1.19 + MethodData* mdo = mh->method_data(); 1.20 + if (mdo == NULL) { 1.21 + Method::build_interpreter_method_data(mh, CHECK_AND_CLEAR); 1.22 + mdo = mh->method_data(); 1.23 + } 1.24 + mdo->init(); 1.25 + InvocationCounter* icnt = mdo->invocation_counter(); 1.26 + InvocationCounter* bcnt = mdo->backedge_counter(); 1.27 + // set i-counter according to AdvancedThresholdPolicy::is_method_profiled 1.28 + // because SimpleThresholdPolicy::call_predicate_helper uses > in jdk8u, that's why we need to plus one. 1.29 + icnt->set(InvocationCounter::wait_for_compile, Tier4MinInvocationThreshold + 1); 1.30 + bcnt->set(InvocationCounter::wait_for_compile, Tier4CompileThreshold + 1); 1.31 +WB_END 1.32 + 1.33 template <typename T> 1.34 static bool GetVMFlag(JavaThread* thread, JNIEnv* env, jstring name, T* value, bool (*TAt)(const char*, T*)) { 1.35 if (name == NULL) { 1.36 @@ -1123,6 +1142,8 @@ 1.37 CC"(Ljava/lang/reflect/Executable;II)Z", (void*)&WB_EnqueueMethodForCompilation}, 1.38 {CC"clearMethodState", 1.39 CC"(Ljava/lang/reflect/Executable;)V", (void*)&WB_ClearMethodState}, 1.40 + {CC"markMethodProfiled", 1.41 + CC"(Ljava/lang/reflect/Executable;)V", (void*)&WB_MarkMethodProfiled}, 1.42 {CC"setBooleanVMFlag", CC"(Ljava/lang/String;Z)V",(void*)&WB_SetBooleanVMFlag}, 1.43 {CC"setIntxVMFlag", CC"(Ljava/lang/String;J)V",(void*)&WB_SetIntxVMFlag}, 1.44 {CC"setUintxVMFlag", CC"(Ljava/lang/String;J)V",(void*)&WB_SetUintxVMFlag},