8151259: [TESTBUG] nsk/jvmti/RedefineClasses/redefclass030 fails with "unexpected values of outer fields of the class" when running with -Xcomp
authorcjplummer
Wed, 25 Jul 2018 13:15:36 -0700
changeset 51242 f6c70dedae1a
parent 51241 ec6d5843068a
child 51243 9e04723f53c7
8151259: [TESTBUG] nsk/jvmti/RedefineClasses/redefclass030 fails with "unexpected values of outer fields of the class" when running with -Xcomp Summary: do a better job of handling compilations before execution Reviewed-by: sspitsyn, amenkov
test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028.java
test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.c
test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029.java
test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.c
test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030.java
test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.c
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028.java	Wed Jul 25 15:38:37 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028.java	Wed Jul 25 13:15:36 2018 -0700
@@ -129,8 +129,9 @@
         status = checkStatus(status);
 
         boolean isRedefinitionStarted = waitForRedefinitionStarted();
+        boolean isRedefinitionCompleted = false;
         if (isRedefinitionStarted) {
-            waitForRedefinitionCompleted();
+            isRedefinitionCompleted = waitForRedefinitionCompleted();
         }
 
         log.display("waiting for auxiliary thread ...\n");
@@ -144,7 +145,7 @@
         }
 
         // CR 6604375: check whether class redefinition occurred
-        if (isRedefinitionStarted) {
+        if (isRedefinitionCompleted) {
             // verify results
             checkOuterFields(0, 1);
             checkOuterFields(1, 2);
@@ -166,23 +167,26 @@
             --iterationsLeft;
             safeSleep(SLEEP_MS);
         }
-        log.complain("Redefinition not started. Maybe running with -Xcomp. Test ignored.");
+        log.complain("Redefinition not started. May need more time for -Xcomp.");
+        status = Consts.TEST_FAILED;
         return false;
     }
 
-    private void waitForRedefinitionCompleted() {
+    private boolean waitForRedefinitionCompleted() {
         final int SLEEP_MS = 20;
         int iterationsLeft = 10000 / SLEEP_MS;
         while (iterationsLeft >= 0) {
             // Check if new code has changed fields.
             if (prStOuterFl[1] == 2 && prStOuterFl[2] == 2) {
                 log.display("Redefinition completed.");
-                return;
+                return true;
             }
             --iterationsLeft;
             safeSleep(SLEEP_MS);
         }
-        log.complain("Redefinition not completed.");
+        log.complain("Redefinition not completed. May need more time for -Xcomp.");
+        status = Consts.TEST_FAILED;
+        return false;
     }
 
     private void checkOuterFields(int index, int expValue) {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.c	Wed Jul 25 15:38:37 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.c	Wed Jul 25 13:15:36 2018 -0700
@@ -66,6 +66,7 @@
         (JNIEnv *jni_env, jclass cls)
 {
     if (fire == 1) {
+        NSK_DISPLAY0("isRedefinitionOccurred is called: fired!\n");
         return JNI_TRUE;
     } else {
         return JNI_FALSE;
@@ -76,7 +77,10 @@
 JNIEXPORT void JNICALL Java_nsk_jvmti_RedefineClasses_redefclass028_notifyNativeAgent
         (JNIEnv *jni_env, jclass cls)
 {
-    enteredHotMethod = 1;
+    if (enteredHotMethod == 0) {
+        NSK_DISPLAY0("notifyNativeAgent is called\n");
+        enteredHotMethod = 1;
+    }
 }
 
 /** pass bytecode to native agent for redefinition **/
@@ -103,11 +107,11 @@
         nsk_jvmti_setFailStatus();
         return;
     }
-    NSK_DISPLAY5("\tmethod: name=\"%s\" signature=\"%s\"\n\
-\tcompiled code size=%d\n\
-\tstarting native address=0x%p\n\
-\tnumber of address location map entries=%d\n",
-        name, sig, code_size, code_addr, map_length);
+    NSK_DISPLAY5("\tmethod: name=\"%s\" signature=\"%s\"\n"
+                 "\tcompiled code size=%d\n"
+                 "\tstarting native address=0x%p\n"
+                 "\tnumber of address location map entries=%d\n",
+                 name, sig, code_size, code_addr, map_length);
 
     if ((strcmp(name, expHSMethod) == 0) &&
             (strcmp(sig, expHSSignature) == 0)) {
@@ -118,8 +122,7 @@
             hsMethodID = method;
             fire = 1;
         } else {
-            NSK_DISPLAY0("Compilation occured before method execution");
-            fire = -1;
+            NSK_DISPLAY0("Compilation occured before method execution. Ignoring.\n");
         }
     }
 }
@@ -174,9 +177,9 @@
         THREAD_sleep(1);
         tries++;
         if (tries > MAX_ATTEMPTS) {
-            printf("WARNING: CompiledMethodLoad event is still not received for \"%s\" after %d attempts\n\
-\tThe test has no results\n\n",
-                expHSMethod, MAX_ATTEMPTS);
+            printf("WARNING: CompiledMethodLoad event is still not received for \"%s\" after %d attempts\n"
+                   "\tThe test has no results\n\n",
+                   expHSMethod, MAX_ATTEMPTS);
             nsk_jvmti_resumeSync();
             exit(95 + PASSED);
         }
@@ -184,43 +187,37 @@
 
     NSK_DISPLAY0("agentProc: hotspot method compiled\n\n");
 
-    // CR 6604375: check whether it is appropriate to perform redefinition
-    if (fire == 1) {
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
-                        jvmti_env, hsMethodID, &decl_cls))) {
-            nsk_jvmti_setFailStatus();
-            nsk_jvmti_resumeSync();
-            return;
-        }
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
-                        jvmti_env, decl_cls, &cls_sig, NULL))) {
-            nsk_jvmti_setFailStatus();
-            nsk_jvmti_resumeSync();
-            return;
-        }
-        else
-            NSK_DISPLAY1("agentProc: hotspot method class signature: \"%s\"\n\n",
-                    cls_sig);
+    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
+                                        jvmti_env, hsMethodID, &decl_cls))) {
+        nsk_jvmti_setFailStatus();
+        nsk_jvmti_resumeSync();
+        return;
+    }
+    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
+                                        jvmti_env, decl_cls, &cls_sig, NULL))) {
+        nsk_jvmti_setFailStatus();
+        nsk_jvmti_resumeSync();
+        return;
+    } else {
+        NSK_DISPLAY1("agentProc: hotspot method class signature: \"%s\"\n\n",
+                     cls_sig);
+    }
 
-        /* fill the structure jvmtiClassDefinition */
-        classDef.klass = decl_cls;
-        classDef.class_byte_count = bytesCount;
-        classDef.class_bytes = (unsigned char*) clsBytes;
+    /* fill the structure jvmtiClassDefinition */
+    classDef.klass = decl_cls;
+    classDef.class_byte_count = bytesCount;
+    classDef.class_bytes = (unsigned char*) clsBytes;
 
-        NSK_DISPLAY1("agentProc: >>>>>>>> Invoke RedefineClasses():\n\
-                \tnew class byte count=%d\n",
-                classDef.class_byte_count);
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses,
-                        jvmti, 1, &classDef))) {
-            nsk_jvmti_setFailStatus();
-            nsk_jvmti_resumeSync();
-            return;
-        }
-        NSK_DISPLAY0("agentProc: <<<<<<<< RedefineClasses() is successfully done\n");
-    } else {
-        // fire == -1
-        NSK_DISPLAY0("agentProc: \"hot\" method wasn't executed. Don't perform redefinition\n");
+    NSK_DISPLAY1("agentProc: >>>>>>>> Invoke RedefineClasses():\n"
+                 "\tnew class byte count=%d\n",
+                 classDef.class_byte_count);
+    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses,
+                                        jvmti, 1, &classDef))) {
+        nsk_jvmti_setFailStatus();
+        nsk_jvmti_resumeSync();
+        return;
     }
+    NSK_DISPLAY0("agentProc: <<<<<<<< RedefineClasses() is successfully done\n");
 
     /* testing sync */
     NSK_DISPLAY1("agentProc: waiting for the debuggee finish for %d msecs...\n\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029.java	Wed Jul 25 15:38:37 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029.java	Wed Jul 25 13:15:36 2018 -0700
@@ -126,8 +126,9 @@
         status = checkStatus(status);
 
         boolean isRedefinitionStarted = waitForRedefinitionStarted();
+        boolean isRedefinitionCompleted = false;
         if (isRedefinitionStarted) {
-            waitForRedefinitionCompleted(redefCls);
+            isRedefinitionCompleted = waitForRedefinitionCompleted(redefCls);
         }
 
         log.display("waiting for auxiliary thread ...\n");
@@ -141,7 +142,7 @@
         }
 
         // CR 6604375: check whether class redefinition occurred
-        if (isRedefinitionStarted) {
+        if (isRedefinitionCompleted) {
             // verify results
             checkOuterFields(0, 1);
             checkOuterFields(1, 2);
@@ -163,23 +164,26 @@
             --iterationsLeft;
             safeSleep(SLEEP_MS);
         }
-        log.complain("Redefinition not started. Maybe running with -Xcomp. Test ignored.");
+        log.complain("Redefinition not started. May need more time for -Xcomp.");
+        status = Consts.TEST_FAILED;
         return false;
     }
 
-    private void waitForRedefinitionCompleted(RedefClass redefCls) {
+    private boolean waitForRedefinitionCompleted(RedefClass redefCls) {
         final int SLEEP_MS = 20;
         int iterationsLeft = 10000 / SLEEP_MS;
         while (iterationsLeft >= 0) {
             // Check if new code has changed fields.
             if (prStOuterFl[1] == 2 && prStOuterFl[2] == 2 && redefCls.prInnerFl == 1) {
                 log.display("Redefinition completed.");
-                return;
+                return true;
             }
             --iterationsLeft;
             safeSleep(SLEEP_MS);
         }
-        log.complain("Redefinition not completed.");
+        log.complain("Redefinition not completed. May need more time for -Xcomp.");
+        status = Consts.TEST_FAILED;
+        return false;
     }
 
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.c	Wed Jul 25 15:38:37 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.c	Wed Jul 25 13:15:36 2018 -0700
@@ -65,9 +65,8 @@
 JNIEXPORT jboolean JNICALL Java_nsk_jvmti_RedefineClasses_redefclass029_isRedefinitionOccurred
         (JNIEnv *jni_env, jclass cls)
 {
-    NSK_DISPLAY0("isRedefinitionOccurred is called\n");
-
     if (fire == 1) {
+        NSK_DISPLAY0("isRedefinitionOccurred is called: fired!\n");
         return JNI_TRUE;
     } else {
         return JNI_FALSE;
@@ -78,8 +77,10 @@
 JNIEXPORT void JNICALL Java_nsk_jvmti_RedefineClasses_redefclass029_notifyNativeAgent
         (JNIEnv *jni_env, jclass cls)
 {
-    NSK_DISPLAY0("notifyNativeAgent is called\n");
-    enteredHotMethod = 1;
+    if (enteredHotMethod == 0) {
+        NSK_DISPLAY0("notifyNativeAgent is called\n");
+        enteredHotMethod = 1;
+    }
 }
 
 JNIEXPORT void JNICALL Java_nsk_jvmti_RedefineClasses_redefclass029_storeClassBytes
@@ -105,11 +106,11 @@
         nsk_jvmti_setFailStatus();
         return;
     }
-    NSK_DISPLAY5("\tmethod: name=\"%s\" signature=\"%s\"\n\
-\tcompiled code size=%d\n\
-\tstarting native address=0x%p\n\
-\tnumber of address location map entries=%d\n",
-        name, sig, code_size, code_addr, map_length);
+    NSK_DISPLAY5("\tmethod: name=\"%s\" signature=\"%s\"\n"
+                 "\tcompiled code size=%d\n"
+                 "\tstarting native address=0x%p\n"
+                 "\tnumber of address location map entries=%d\n",
+                 name, sig, code_size, code_addr, map_length);
 
     if ((strcmp(name, expHSMethod) == 0) &&
             (strcmp(sig, expHSSignature) == 0)) {
@@ -120,8 +121,7 @@
             hsMethodID = method;
             fire = 1;
         } else {
-            NSK_DISPLAY0("Compilation occured before method execution");
-            fire = -1;
+            NSK_DISPLAY0("Compilation occured before method execution. Ignoring.\n");
         }
     }
 }
@@ -176,9 +176,9 @@
         THREAD_sleep(1);
         tries++;
         if (tries > MAX_ATTEMPTS) {
-            printf("WARNING: CompiledMethodLoad event is still not received for \"%s\" after %d attempts\n\
-\tThe test has no results\n\n",
-                expHSMethod, MAX_ATTEMPTS);
+            printf("WARNING: CompiledMethodLoad event is still not received for \"%s\" after %d attempts\n"
+                   "\tThe test has no results\n\n",
+                   expHSMethod, MAX_ATTEMPTS);
             nsk_jvmti_resumeSync();
             exit(95 + PASSED);
         }
@@ -186,43 +186,37 @@
 
     NSK_DISPLAY0("agentProc: hotspot method compiled\n\n");
 
-    // CR 6604375: check whether it is appropriate to perform redefinition
-    if (fire == 1) {
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
-                        jvmti_env, hsMethodID, &decl_cls))) {
-            nsk_jvmti_setFailStatus();
-            nsk_jvmti_resumeSync();
-            return;
-        }
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
-                        jvmti_env, decl_cls, &cls_sig, NULL))) {
-            nsk_jvmti_setFailStatus();
-            nsk_jvmti_resumeSync();
-            return;
-        }
-        else
-            NSK_DISPLAY1("agentProc: hotspot method class signature: \"%s\"\n\n",
-                    cls_sig);
+    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
+                                        jvmti_env, hsMethodID, &decl_cls))) {
+        nsk_jvmti_setFailStatus();
+        nsk_jvmti_resumeSync();
+        return;
+    }
+    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
+                                        jvmti_env, decl_cls, &cls_sig, NULL))) {
+        nsk_jvmti_setFailStatus();
+        nsk_jvmti_resumeSync();
+        return;
+    } else {
+        NSK_DISPLAY1("agentProc: hotspot method class signature: \"%s\"\n\n",
+                     cls_sig);
+    }
 
-        /* fill the structure jvmtiClassDefinition */
-        classDef.klass = decl_cls;
-        classDef.class_byte_count = bytesCount;
-        classDef.class_bytes = (unsigned char*) clsBytes;
+    /* fill the structure jvmtiClassDefinition */
+    classDef.klass = decl_cls;
+    classDef.class_byte_count = bytesCount;
+    classDef.class_bytes = (unsigned char*) clsBytes;
 
-        NSK_DISPLAY1("agentProc: >>>>>>>> Invoke RedefineClasses():\n\
-                \tnew class byte count=%d\n",
-                classDef.class_byte_count);
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses,
-                        jvmti, 1, &classDef))) {
-            nsk_jvmti_setFailStatus();
-            nsk_jvmti_resumeSync();
-            return;
-        }
-        NSK_DISPLAY0("agentProc: <<<<<<<< RedefineClasses() is successfully done\n");
-    } else {
-        // fire == -1
-        NSK_DISPLAY0("agentProc: \"hot\" method wasn't executed. Don't perform redefinition\n");
+    NSK_DISPLAY1("agentProc: >>>>>>>> Invoke RedefineClasses():\n"
+                 "\tnew class byte count=%d\n",
+                 classDef.class_byte_count);
+    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses,
+                                        jvmti, 1, &classDef))) {
+      nsk_jvmti_setFailStatus();
+      nsk_jvmti_resumeSync();
+      return;
     }
+    NSK_DISPLAY0("agentProc: <<<<<<<< RedefineClasses() is successfully done\n");
 
     /* testing sync */
     NSK_DISPLAY1("agentProc: waiting for the debuggee finish for %d msecs...\n\n",
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030.java	Wed Jul 25 15:38:37 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030.java	Wed Jul 25 13:15:36 2018 -0700
@@ -125,8 +125,9 @@
         status = checkStatus(status);
 
         boolean isRedefinitionStarted = waitForRedefinitionStarted();
+        boolean isRedefinitionCompleted = false;
         if (isRedefinitionStarted) {
-            waitForRedefinitionCompleted(redefClsWrapper);
+            isRedefinitionCompleted = waitForRedefinitionCompleted(redefClsWrapper);
         }
 
         log.display("waiting for auxiliary thread ...\n");
@@ -140,7 +141,7 @@
         }
 
         // CR 6604375: check whether class redefinition occurred
-        if (isRedefinitionStarted) {
+        if (isRedefinitionCompleted) {
             // verify results
             checkOuterOuterFields(0, 2);
             checkOuterOuterFields(1, 2);
@@ -162,23 +163,26 @@
             --iterationsLeft;
             safeSleep(SLEEP_MS);
         }
-        log.complain("Redefinition not started. Maybe running with -Xcomp. Test ignored.");
+        log.complain("Redefinition not started. May need more time for -Xcomp.");
+        status = Consts.TEST_FAILED;
         return false;
     }
 
-    private void waitForRedefinitionCompleted(RedefClassWrapper redefClsWrapper) {
+    private boolean waitForRedefinitionCompleted(RedefClassWrapper redefClsWrapper) {
         final int SLEEP_MS = 20;
         int iterationsLeft = 10000 / SLEEP_MS;
         while (iterationsLeft >= 0) {
             // Check if new code has changed fields.
             if (prStOuterOuterFl[0] == 2 && prStOuterOuterFl[1] == 2 && redefClsWrapper.prOuterFl[1] == 2) {
                 log.display("Redefinition completed.");
-                return;
+                return true;
             }
             --iterationsLeft;
             safeSleep(SLEEP_MS);
         }
-        log.complain("Redefinition not completed.");
+        log.complain("Redefinition not completed. May need more time for -Xcomp.");
+        status = Consts.TEST_FAILED;
+        return false;
     }
 
     private void checkOuterOuterFields(int index, int expValue) {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.c	Wed Jul 25 15:38:37 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.c	Wed Jul 25 13:15:36 2018 -0700
@@ -65,9 +65,8 @@
 JNIEXPORT jboolean JNICALL Java_nsk_jvmti_RedefineClasses_redefclass030_isRedefinitionOccurred
         (JNIEnv *jni_env, jclass cls)
 {
-    NSK_DISPLAY0("isRedefinitionOccurred is called\n");
-
     if (fire == 1) {
+        NSK_DISPLAY0("isRedefinitionOccurred is called: fired!\n");
         return JNI_TRUE;
     } else {
         return JNI_FALSE;
@@ -78,8 +77,10 @@
 JNIEXPORT void JNICALL Java_nsk_jvmti_RedefineClasses_redefclass030_notifyNativeAgent
         (JNIEnv *jni_env, jclass cls)
 {
-    NSK_DISPLAY0("notifyNativeAgent is called\n");
-    enteredHotMethod = 1;
+    if (enteredHotMethod == 0) {
+        NSK_DISPLAY0("notifyNativeAgent is called\n");
+        enteredHotMethod = 1;
+    }
 }
 
 /** pass bytecode to native agent for redefinition **/
@@ -106,11 +107,11 @@
         nsk_jvmti_setFailStatus();
         return;
     }
-    NSK_DISPLAY5("\tmethod: name=\"%s\" signature=\"%s\"\n\
-\tcompiled code size=%d\n\
-\tstarting native address=0x%p\n\
-\tnumber of address location map entries=%d\n",
-        name, sig, code_size, code_addr, map_length);
+    NSK_DISPLAY5("\tmethod: name=\"%s\" signature=\"%s\"\n"
+                 "\tcompiled code size=%d\n"
+                 "\tstarting native address=0x%p\n"
+                 "\tnumber of address location map entries=%d\n",
+                 name, sig, code_size, code_addr, map_length);
 
     if ((strcmp(name, expHSMethod) == 0) &&
             (strcmp(sig, expHSSignature) == 0)) {
@@ -121,8 +122,7 @@
             hsMethodID = method;
             fire = 1;
         } else {
-            NSK_DISPLAY0("Compilation occured before method execution");
-            fire = -1;
+            NSK_DISPLAY0("Compilation occured before method execution. Ignoring.\n");
         }
     }
 }
@@ -177,9 +177,9 @@
         THREAD_sleep(1);
         tries++;
         if (tries > MAX_ATTEMPTS) {
-            printf("WARNING: CompiledMethodLoad event is still not received for \"%s\" after %d attempts\n\
-\tThe test has no results\n\n",
-                expHSMethod, MAX_ATTEMPTS);
+            printf("WARNING: CompiledMethodLoad event is still not received for \"%s\" after %d attempts\n"
+                   "\tThe test has no results\n\n",
+                   expHSMethod, MAX_ATTEMPTS);
             nsk_jvmti_resumeSync();
             exit(95 + PASSED);
         }
@@ -187,43 +187,37 @@
 
     NSK_DISPLAY0("agentProc: hotspot method compiled\n\n");
 
-    // CR 6604375: check whether it is appropriate to perform redefinition
-    if (fire == 1) {
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
-                        jvmti_env, hsMethodID, &decl_cls))) {
-            nsk_jvmti_setFailStatus();
-            nsk_jvmti_resumeSync();
-            return;
-        }
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
-                        jvmti_env, decl_cls, &cls_sig, NULL))) {
-            nsk_jvmti_setFailStatus();
-            nsk_jvmti_resumeSync();
-            return;
-        }
-        else
-            NSK_DISPLAY1("agentProc: hotspot method class signature: \"%s\"\n\n",
-                    cls_sig);
+    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
+                                        jvmti_env, hsMethodID, &decl_cls))) {
+        nsk_jvmti_setFailStatus();
+        nsk_jvmti_resumeSync();
+        return;
+    }
+    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
+                                        jvmti_env, decl_cls, &cls_sig, NULL))) {
+        nsk_jvmti_setFailStatus();
+        nsk_jvmti_resumeSync();
+        return;
+    } else {
+      NSK_DISPLAY1("agentProc: hotspot method class signature: \"%s\"\n\n",
+                   cls_sig);
+    }
 
-        /* fill the structure jvmtiClassDefinition */
-        classDef.klass = decl_cls;
-        classDef.class_byte_count = bytesCount;
-        classDef.class_bytes = (unsigned char*) clsBytes;
+    /* fill the structure jvmtiClassDefinition */
+    classDef.klass = decl_cls;
+    classDef.class_byte_count = bytesCount;
+    classDef.class_bytes = (unsigned char*) clsBytes;
 
-        NSK_DISPLAY1("agentProc: >>>>>>>> Invoke RedefineClasses():\n\
-                \tnew class byte count=%d\n",
-                classDef.class_byte_count);
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses,
-                        jvmti, 1, &classDef))) {
-            nsk_jvmti_setFailStatus();
-            nsk_jvmti_resumeSync();
-            return;
-        }
-        NSK_DISPLAY0("agentProc: <<<<<<<< RedefineClasses() is successfully done\n");
-    } else {
-        // fire == -1
-        NSK_DISPLAY0("agentProc: \"hot\" method wasn't executed. Don't perform redefinition\n");
+    NSK_DISPLAY1("agentProc: >>>>>>>> Invoke RedefineClasses():\n"
+                 "\tnew class byte count=%d\n",
+                 classDef.class_byte_count);
+    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses,
+                                        jvmti, 1, &classDef))) {
+      nsk_jvmti_setFailStatus();
+      nsk_jvmti_resumeSync();
+      return;
     }
+    NSK_DISPLAY0("agentProc: <<<<<<<< RedefineClasses() is successfully done\n");
 
     /* testing sync */
     NSK_DISPLAY1("agentProc: waiting for the debuggee finish for %d msecs...\n\n",