提交 ca99d298 编写于 作者: J jbachorik

8030115: [parfait] warnings from b119 for...

8030115: [parfait] warnings from b119 for jdk.src.share.native.sun.tracing.dtrace: JNI exception pending
Reviewed-by: dholmes, dsamersoff, sspitsyn
上级 fce237f4
...@@ -144,32 +144,34 @@ static void readInterfaceAttributes( ...@@ -144,32 +144,34 @@ static void readInterfaceAttributes(
env, provider, &(jvm_provider->argsAttributes)); env, provider, &(jvm_provider->argsAttributes));
} }
static void readProviderData( static int readProviderData(
JNIEnv* env, jobject provider, JVM_DTraceProvider* jvm_provider) { JNIEnv* env, jobject provider, JVM_DTraceProvider* jvm_provider) {
jmethodID mid; jmethodID mid;
jobjectArray probes; jobjectArray probes;
jsize i; jsize i;
jclass clazz = (*env)->GetObjectClass(env, provider); CHECK jclass clazz = (*env)->GetObjectClass(env, provider); CHECK_(0)
mid = (*env)->GetMethodID( mid = (*env)->GetMethodID(
env, clazz, "getProbes", "()[Lsun/tracing/dtrace/DTraceProbe;"); CHECK env, clazz, "getProbes", "()[Lsun/tracing/dtrace/DTraceProbe;"); CHECK_(0)
probes = (jobjectArray)(*env)->CallObjectMethod( probes = (jobjectArray)(*env)->CallObjectMethod(
env, provider, mid); CHECK env, provider, mid); CHECK_(0)
// Fill JVM structure, describing provider // Fill JVM structure, describing provider
jvm_provider->probe_count = (*env)->GetArrayLength(env, probes); CHECK jvm_provider->probe_count = (*env)->GetArrayLength(env, probes); CHECK_(0)
jvm_provider->probes = (JVM_DTraceProbe*)calloc( jvm_provider->probes = (JVM_DTraceProbe*)calloc(
jvm_provider->probe_count, sizeof(*jvm_provider->probes)); jvm_provider->probe_count, sizeof(*jvm_provider->probes));
mid = (*env)->GetMethodID( mid = (*env)->GetMethodID(
env, clazz, "getProviderName", "()Ljava/lang/String;"); CHECK env, clazz, "getProviderName", "()Ljava/lang/String;"); CHECK_(0)
jvm_provider->name = (jstring)(*env)->CallObjectMethod( jvm_provider->name = (jstring)(*env)->CallObjectMethod(
env, provider, mid); CHECK env, provider, mid); CHECK_(0)
readInterfaceAttributes(env, provider, jvm_provider); CHECK readInterfaceAttributes(env, provider, jvm_provider); CHECK_(0)
for (i = 0; i < jvm_provider->probe_count; ++i) { for (i = 0; i < jvm_provider->probe_count; ++i) {
jobject probe = (*env)->GetObjectArrayElement(env, probes, i); CHECK jobject probe = (*env)->GetObjectArrayElement(env, probes, i); CHECK_(0)
readProbeData(env, probe, &jvm_provider->probes[i]); CHECK readProbeData(env, probe, &jvm_provider->probes[i]); CHECK_(0)
} }
return 1;
} }
/* /*
...@@ -195,16 +197,24 @@ JNIEXPORT jlong JNICALL Java_sun_tracing_dtrace_JVM_activate0( ...@@ -195,16 +197,24 @@ JNIEXPORT jlong JNICALL Java_sun_tracing_dtrace_JVM_activate0(
jvm_providers = (JVM_DTraceProvider*)calloc( jvm_providers = (JVM_DTraceProvider*)calloc(
num_providers, sizeof(*jvm_providers)); num_providers, sizeof(*jvm_providers));
for (i = 0; i < num_providers; ++i) { int count = 0;
JVM_DTraceProvider* p = &(jvm_providers[i]); for (; count < num_providers; ++count) {
JVM_DTraceProvider* p = &(jvm_providers[count]);
jobject provider = (*env)->GetObjectArrayElement( jobject provider = (*env)->GetObjectArrayElement(
env, providers, i); env, providers, count);
readProviderData(env, provider, p); if ((*env)->ExceptionOccurred(env) ||
! readProviderData(env, provider, p)) {
// got an error, bail out!
break;
}
} }
handle = jvm_symbols->Activate( if (count == num_providers) {
env, JVM_TRACING_DTRACE_VERSION, moduleName, // all providers successfully loaded - get the handle
num_providers, jvm_providers); handle = jvm_symbols->Activate(
env, JVM_TRACING_DTRACE_VERSION, moduleName,
num_providers, jvm_providers);
}
for (i = 0; i < num_providers; ++i) { for (i = 0; i < num_providers; ++i) {
JVM_DTraceProvider* p = &(jvm_providers[i]); JVM_DTraceProvider* p = &(jvm_providers[i]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册