8230707: JFR related tests are failing

Wed, 11 Sep 2019 12:06:33 +0200

author
jbachorik
date
Wed, 11 Sep 2019 12:06:33 +0200
changeset 9881
8a0aca5caca0
parent 9880
3549c2f110d2
child 9882
3dd83d893bfc

8230707: JFR related tests are failing
Reviewed-by: neugens

src/share/vm/prims/whitebox.cpp file | annotate | diff | comparison | revisions
src/share/vm/prims/whitebox.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/prims/whitebox.cpp	Thu Feb 14 15:17:03 2019 -0800
     1.2 +++ b/src/share/vm/prims/whitebox.cpp	Wed Sep 11 12:06:33 2019 +0200
     1.3 @@ -569,13 +569,53 @@
     1.4    return result;
     1.5  WB_END
     1.6  
     1.7 +bool WhiteBox::compile_method(Method* method, int comp_level, int bci, Thread* THREAD) {
     1.8 +  // Screen for unavailable/bad comp level or null method
     1.9 +  AbstractCompiler* comp = CompileBroker::compiler(comp_level);
    1.10 +  if (method == NULL) {
    1.11 +    tty->print_cr("WB error: request to compile NULL method");
    1.12 +    return false;
    1.13 +  }
    1.14 +  if (comp_level > MIN2((CompLevel) TieredStopAtLevel, CompLevel_highest_tier)) {
    1.15 +    tty->print_cr("WB error: invalid compilation level %d", comp_level);
    1.16 +    return false;
    1.17 +  }
    1.18 +  if (comp == NULL) {
    1.19 +    tty->print_cr("WB error: no compiler for requested compilation level %d", comp_level);
    1.20 +    return false;
    1.21 +  }
    1.22 +
    1.23 +  methodHandle mh(THREAD, method);
    1.24 +
    1.25 +  // Compile method and check result
    1.26 +  nmethod* nm = CompileBroker::compile_method(mh, bci, comp_level, mh, mh->invocation_count(), "Whitebox", THREAD);
    1.27 +  MutexLocker mu(Compile_lock);
    1.28 +  bool is_queued = mh->queued_for_compilation();
    1.29 +  if (is_queued || nm != NULL) {
    1.30 +    return true;
    1.31 +  }
    1.32 +  tty->print("WB error: failed to compile at level %d method ", comp_level);
    1.33 +  mh->print_short_name(tty);
    1.34 +  tty->cr();
    1.35 +  if (is_queued) {
    1.36 +    tty->print_cr("WB error: blocking compilation is still in queue!");
    1.37 +  }
    1.38 +  return false;
    1.39 +}
    1.40 +
    1.41  WB_ENTRY(jboolean, WB_EnqueueMethodForCompilation(JNIEnv* env, jobject o, jobject method, jint comp_level, jint bci))
    1.42    jmethodID jmid = reflected_method_to_jmid(thread, env, method);
    1.43    CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
    1.44 -  methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
    1.45 -  nmethod* nm = CompileBroker::compile_method(mh, bci, comp_level, mh, mh->invocation_count(), "WhiteBox", THREAD);
    1.46 -  MutexLockerEx mu(Compile_lock);
    1.47 -  return (mh->queued_for_compilation() || nm != NULL);
    1.48 +  return WhiteBox::compile_method(Method::checked_resolve_jmethod_id(jmid), comp_level, bci, THREAD);
    1.49 +WB_END
    1.50 +
    1.51 +WB_ENTRY(jboolean, WB_EnqueueInitializerForCompilation(JNIEnv* env, jobject o, jclass klass, jint comp_level))
    1.52 +  InstanceKlass* ik = InstanceKlass::cast(java_lang_Class::as_Klass(JNIHandles::resolve(klass)));
    1.53 +  Method* clinit = ik->class_initializer();
    1.54 +  if (clinit == NULL) {
    1.55 +    return false;
    1.56 +  }
    1.57 +  return WhiteBox::compile_method(clinit, comp_level, InvocationEntryBci, THREAD);
    1.58  WB_END
    1.59  
    1.60  class VM_WhiteBoxOperation : public VM_Operation {
    1.61 @@ -805,7 +845,6 @@
    1.62    }
    1.63  WB_END
    1.64  
    1.65 -
    1.66  WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString))
    1.67    ResourceMark rm(THREAD);
    1.68    int len;
    1.69 @@ -1042,6 +1081,11 @@
    1.70    VMThread::execute(&force_safepoint_op);
    1.71  WB_END
    1.72  
    1.73 +WB_ENTRY(jlong, WB_GetHeapAlignment(JNIEnv* env, jobject o))
    1.74 +    size_t alignment = Universe::heap()->collector_policy()->heap_alignment();
    1.75 +    return (jlong)alignment;
    1.76 +WB_END
    1.77 +
    1.78  //Some convenience methods to deal with objects from java
    1.79  int WhiteBox::offset_for_field(const char* field_name, oop object,
    1.80      Symbol* signature_symbol) {
    1.81 @@ -1156,6 +1200,7 @@
    1.82    {CC"getHeapOopSize",     CC"()I",                   (void*)&WB_GetHeapOopSize    },
    1.83    {CC"getVMPageSize",      CC"()I",                   (void*)&WB_GetVMPageSize     },
    1.84    {CC"getVMLargePageSize", CC"()J",                   (void*)&WB_GetVMLargePageSize},
    1.85 +  {CC"getHeapAlignment",   CC"()J",                   (void*)&WB_GetHeapAlignment  },
    1.86    {CC"isClassAlive0",      CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive      },
    1.87    {CC"classKnownToNotExist",
    1.88                             CC"(Ljava/lang/ClassLoader;Ljava/lang/String;)Z",(void*)&WB_ClassKnownToNotExist},
    1.89 @@ -1221,8 +1266,10 @@
    1.90        CC"(I)I",                                       (void*)&WB_GetCompileQueueSize},
    1.91    {CC"testSetForceInlineMethod",
    1.92        CC"(Ljava/lang/reflect/Executable;Z)Z",         (void*)&WB_TestSetForceInlineMethod},
    1.93 -  {CC"enqueueMethodForCompilation",
    1.94 +  {CC"enqueueMethodForCompilation0",
    1.95        CC"(Ljava/lang/reflect/Executable;II)Z",        (void*)&WB_EnqueueMethodForCompilation},
    1.96 +  {CC"enqueueInitializerForCompilation0",
    1.97 +      CC"(Ljava/lang/Class;I)Z",                      (void*)&WB_EnqueueInitializerForCompilation},
    1.98    {CC"clearMethodState",
    1.99        CC"(Ljava/lang/reflect/Executable;)V",          (void*)&WB_ClearMethodState},
   1.100    {CC"markMethodProfiled",
     2.1 --- a/src/share/vm/prims/whitebox.hpp	Thu Feb 14 15:17:03 2019 -0800
     2.2 +++ b/src/share/vm/prims/whitebox.hpp	Wed Sep 11 12:06:33 2019 +0200
     2.3 @@ -70,6 +70,7 @@
     2.4    static void register_methods(JNIEnv* env, jclass wbclass, JavaThread* thread,
     2.5      JNINativeMethod* method_array, int method_count);
     2.6    static void register_extended(JNIEnv* env, jclass wbclass, JavaThread* thread);
     2.7 +  static bool compile_method(Method* method, int comp_level, int bci, Thread* THREAD);
     2.8  };
     2.9  
    2.10  

mercurial