提交 fbf892c1 编写于 作者: A andrew

8246223: Windows build fails after JDK-8227269

Summary: MSVC 2013 uses a modified variant of C90 and requires all declarations before statements
Reviewed-by: andrew
Contributed-by: NAlex Kashchenko <akashche@redhat.com>
上级 df49872c
...@@ -81,13 +81,14 @@ cbTrackingObjectFree(jvmtiEnv* jvmti_env, jlong tag) ...@@ -81,13 +81,14 @@ cbTrackingObjectFree(jvmtiEnv* jvmti_env, jlong tag)
struct bag * struct bag *
classTrack_processUnloads(JNIEnv *env) classTrack_processUnloads(JNIEnv *env)
{ {
struct bag* deleted;
debugMonitorEnter(classTrackLock); debugMonitorEnter(classTrackLock);
if (deletedSignatures == NULL) { if (deletedSignatures == NULL) {
// Class tracking not initialized, nobody's interested. // Class tracking not initialized, nobody's interested.
debugMonitorExit(classTrackLock); debugMonitorExit(classTrackLock);
return NULL; return NULL;
} }
struct bag* deleted = deletedSignatures; deleted = deletedSignatures;
deletedSignatures = bagCreateBag(sizeof(char*), 10); deletedSignatures = bagCreateBag(sizeof(char*), 10);
debugMonitorExit(classTrackLock); debugMonitorExit(classTrackLock);
return deleted; return deleted;
...@@ -101,6 +102,7 @@ classTrack_addPreparedClass(JNIEnv *env_unused, jclass klass) ...@@ -101,6 +102,7 @@ classTrack_addPreparedClass(JNIEnv *env_unused, jclass klass)
{ {
jvmtiError error; jvmtiError error;
jvmtiEnv* env = trackingEnv; jvmtiEnv* env = trackingEnv;
char* signature;
if (gdata && gdata->assertOn) { if (gdata && gdata->assertOn) {
// Check this is not already tagged. // Check this is not already tagged.
...@@ -112,7 +114,6 @@ classTrack_addPreparedClass(JNIEnv *env_unused, jclass klass) ...@@ -112,7 +114,6 @@ classTrack_addPreparedClass(JNIEnv *env_unused, jclass klass)
JDI_ASSERT(tag == NOT_TAGGED); JDI_ASSERT(tag == NOT_TAGGED);
} }
char* signature;
error = classSignature(klass, &signature, NULL); error = classSignature(klass, &signature, NULL);
if (error != JVMTI_ERROR_NONE) { if (error != JVMTI_ERROR_NONE) {
EXIT_ERROR(error,"signature"); EXIT_ERROR(error,"signature");
...@@ -127,14 +128,15 @@ classTrack_addPreparedClass(JNIEnv *env_unused, jclass klass) ...@@ -127,14 +128,15 @@ classTrack_addPreparedClass(JNIEnv *env_unused, jclass klass)
static jboolean static jboolean
setupEvents() setupEvents()
{ {
jvmtiError error;
jvmtiEventCallbacks cb;
jvmtiCapabilities caps; jvmtiCapabilities caps;
memset(&caps, 0, sizeof(caps)); memset(&caps, 0, sizeof(caps));
caps.can_generate_object_free_events = 1; caps.can_generate_object_free_events = 1;
jvmtiError error = JVMTI_FUNC_PTR(trackingEnv, AddCapabilities)(trackingEnv, &caps); error = JVMTI_FUNC_PTR(trackingEnv, AddCapabilities)(trackingEnv, &caps);
if (error != JVMTI_ERROR_NONE) { if (error != JVMTI_ERROR_NONE) {
return JNI_FALSE; return JNI_FALSE;
} }
jvmtiEventCallbacks cb;
memset(&cb, 0, sizeof(cb)); memset(&cb, 0, sizeof(cb));
cb.ObjectFree = cbTrackingObjectFree; cb.ObjectFree = cbTrackingObjectFree;
error = JVMTI_FUNC_PTR(trackingEnv, SetEventCallbacks)(trackingEnv, &cb, sizeof(cb)); error = JVMTI_FUNC_PTR(trackingEnv, SetEventCallbacks)(trackingEnv, &cb, sizeof(cb));
...@@ -154,6 +156,11 @@ setupEvents() ...@@ -154,6 +156,11 @@ setupEvents()
void void
classTrack_initialize(JNIEnv *env) classTrack_initialize(JNIEnv *env)
{ {
jint classCount;
jclass *classes;
jvmtiError error;
jint i;
deletedSignatures = NULL; deletedSignatures = NULL;
classTrackLock = debugMonitorCreate("Deleted class tag lock"); classTrackLock = debugMonitorCreate("Deleted class tag lock");
trackingEnv = getSpecialJvmti(); trackingEnv = getSpecialJvmti();
...@@ -166,11 +173,6 @@ classTrack_initialize(JNIEnv *env) ...@@ -166,11 +173,6 @@ classTrack_initialize(JNIEnv *env)
EXIT_ERROR(AGENT_ERROR_INTERNAL, "Unable to setup ObjectFree tracking"); EXIT_ERROR(AGENT_ERROR_INTERNAL, "Unable to setup ObjectFree tracking");
} }
jint classCount;
jclass *classes;
jvmtiError error;
jint i;
error = allLoadedClasses(&classes, &classCount); error = allLoadedClasses(&classes, &classCount);
if ( error == JVMTI_ERROR_NONE ) { if ( error == JVMTI_ERROR_NONE ) {
for (i = 0; i < classCount; i++) { for (i = 0; i < classCount; i++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册