jdk/src/share/demo/jvmti/hprof/hprof_event.c
changeset 20823 ddd111318407
parent 14342 8435a30053c1
child 23010 6dadb192ad81
equal deleted inserted replaced
20822:2552851d9562 20823:ddd111318407
   193     TlsIndex tls_index;
   193     TlsIndex tls_index;
   194     jint     *pstatus;
   194     jint     *pstatus;
   195 
   195 
   196     HPROF_ASSERT(env!=NULL);
   196     HPROF_ASSERT(env!=NULL);
   197     HPROF_ASSERT(thread!=NULL);
   197     HPROF_ASSERT(thread!=NULL);
   198     HPROF_ASSERT(cnum!=0 && cnum!=gdata->tracker_cnum);
   198     if (cnum == 0 || cnum == gdata->tracker_cnum) {
       
   199         jclass newExcCls = (*env)->FindClass(env, "java/lang/IllegalArgumentException");
       
   200         (*env)->ThrowNew(env, newExcCls, "Illegal cnum.");
       
   201 
       
   202         return;
       
   203     }
   199 
   204 
   200     /* Prevent recursion into any BCI function for this thread (pstatus). */
   205     /* Prevent recursion into any BCI function for this thread (pstatus). */
   201     if ( tls_get_tracker_status(env, thread, JNI_FALSE,
   206     if ( tls_get_tracker_status(env, thread, JNI_FALSE,
   202              &pstatus, &tls_index, NULL, NULL) == 0 ) {
   207              &pstatus, &tls_index, NULL, NULL) == 0 ) {
   203         jmethodID     method;
   208         jmethodID     method;
   204 
   209 
   205         (*pstatus) = 1;
   210         (*pstatus) = 1;
   206         method      = class_get_methodID(env, cnum, mnum);
   211         method      = class_get_methodID(env, cnum, mnum);
   207         HPROF_ASSERT(method!=NULL);
   212         if (method != NULL) {
   208         tls_push_method(tls_index, method);
   213             tls_push_method(tls_index, method);
       
   214         }
       
   215 
   209         (*pstatus) = 0;
   216         (*pstatus) = 0;
   210     }
   217     }
   211 }
   218 }
   212 
   219 
   213 /* Handle tracking of an exception catch */
   220 /* Handle tracking of an exception catch */
   246     TlsIndex tls_index;
   253     TlsIndex tls_index;
   247     jint     *pstatus;
   254     jint     *pstatus;
   248 
   255 
   249     HPROF_ASSERT(env!=NULL);
   256     HPROF_ASSERT(env!=NULL);
   250     HPROF_ASSERT(thread!=NULL);
   257     HPROF_ASSERT(thread!=NULL);
   251     HPROF_ASSERT(cnum!=0 && cnum!=gdata->tracker_cnum);
   258 
       
   259     if (cnum == 0 || cnum == gdata->tracker_cnum) {
       
   260         jclass newExcCls = (*env)->FindClass(env, "java/lang/IllegalArgumentException");
       
   261         (*env)->ThrowNew(env, newExcCls, "Illegal cnum.");
       
   262 
       
   263         return;
       
   264     }
   252 
   265 
   253     /* Prevent recursion into any BCI function for this thread (pstatus). */
   266     /* Prevent recursion into any BCI function for this thread (pstatus). */
   254     if ( tls_get_tracker_status(env, thread, JNI_FALSE,
   267     if ( tls_get_tracker_status(env, thread, JNI_FALSE,
   255              &pstatus, &tls_index, NULL, NULL) == 0 ) {
   268              &pstatus, &tls_index, NULL, NULL) == 0 ) {
   256         jmethodID     method;
   269         jmethodID     method;
   257 
   270 
   258         (*pstatus) = 1;
   271         (*pstatus) = 1;
   259         method      = class_get_methodID(env, cnum, mnum);
   272         method      = class_get_methodID(env, cnum, mnum);
   260         HPROF_ASSERT(method!=NULL);
   273         if (method != NULL) {
   261         tls_pop_method(tls_index, thread, method);
   274             tls_pop_method(tls_index, thread, method);
       
   275         }
       
   276 
   262         (*pstatus) = 0;
   277         (*pstatus) = 0;
   263     }
   278     }
   264 }
   279 }
   265 
   280 
   266 /* Handle a class prepare (should have been already loaded) */
   281 /* Handle a class prepare (should have been already loaded) */