54 return JNI_FALSE; |
54 return JNI_FALSE; |
55 } |
55 } |
56 |
56 |
57 classDef.klass = clazzToRedefine; |
57 classDef.klass = clazzToRedefine; |
58 if (!NSK_JNI_VERIFY(env, |
58 if (!NSK_JNI_VERIFY(env, |
59 (classDef.class_byte_count = /* jsize */ NSK_CPP_STUB2(GetArrayLength, env, bytecodeArray)) > 0)) { |
59 (classDef.class_byte_count = /* jsize */ env->GetArrayLength(bytecodeArray)) > 0)) { |
60 return JNI_FALSE; |
60 return JNI_FALSE; |
61 } |
61 } |
62 |
62 |
63 if (!NSK_JNI_VERIFY(env, |
63 if (!NSK_JNI_VERIFY(env, |
64 (classDef.class_bytes = (const unsigned char *) /* jbyte* */ NSK_CPP_STUB3(GetByteArrayElements, env, bytecodeArray, NULL)) != NULL)) { |
64 (classDef.class_bytes = (const unsigned char *) /* jbyte* */ env->GetByteArrayElements(bytecodeArray, NULL)) != NULL)) { |
65 return JNI_FALSE; |
65 return JNI_FALSE; |
66 } |
66 } |
67 |
67 |
68 if (!NSK_JVMTI_VERIFY( |
68 if (!NSK_JVMTI_VERIFY( |
69 NSK_CPP_STUB3(RedefineClasses, test_jvmti, 1, &classDef))) { |
69 test_jvmti->RedefineClasses(1, &classDef))) { |
70 result = JNI_FALSE; |
70 result = JNI_FALSE; |
71 } |
71 } |
72 |
72 |
73 // Need to cleanup reference to byte[] whether RedefineClasses succeeded or not |
73 // Need to cleanup reference to byte[] whether RedefineClasses succeeded or not |
74 if (!NSK_JNI_VERIFY_VOID(env, |
74 if (!NSK_JNI_VERIFY_VOID(env, |
75 NSK_CPP_STUB4(ReleaseByteArrayElements, env, bytecodeArray, (jbyte*)classDef.class_bytes, JNI_ABORT))) { |
75 env->ReleaseByteArrayElements(bytecodeArray, (jbyte*)classDef.class_bytes, JNI_ABORT))) { |
76 return JNI_FALSE; |
76 return JNI_FALSE; |
77 } |
77 } |
78 |
78 |
79 return result; |
79 return result; |
80 } |
80 } |
89 nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) |
89 nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) |
90 return JNI_ERR; |
90 return JNI_ERR; |
91 |
91 |
92 memset(&caps, 0, sizeof(jvmtiCapabilities)); |
92 memset(&caps, 0, sizeof(jvmtiCapabilities)); |
93 caps.can_redefine_classes = 1; |
93 caps.can_redefine_classes = 1; |
94 if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, |
94 if (!NSK_JVMTI_VERIFY(test_jvmti->AddCapabilities(&caps))) |
95 test_jvmti, &caps))) |
|
96 return JNI_ERR; |
95 return JNI_ERR; |
97 |
96 |
98 if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, |
97 if (!NSK_JVMTI_VERIFY(test_jvmti->GetCapabilities(&caps))) |
99 test_jvmti, &caps))) |
|
100 return JNI_ERR; |
98 return JNI_ERR; |
101 |
99 |
102 if (!caps.can_redefine_classes) |
100 if (!caps.can_redefine_classes) |
103 printf("Warning: RedefineClasses is not implemented\n"); |
101 printf("Warning: RedefineClasses is not implemented\n"); |
104 |
102 |