< prev index next >

src/hotspot/share/prims/jvmtiEnvBase.cpp

Print this page
rev 50967 : 8206977: Minor improvements of runtime code.


1202     // get most state bits
1203     state = (jint)java_lang_Thread::get_thread_status(thread_oop);
1204   }
1205 
1206   if (thr != NULL) {    // add more state bits if there is a JavaThead to query
1207     // same as is_being_ext_suspended() but without locking
1208     if (thr->is_ext_suspended() || thr->is_external_suspend()) {
1209       state |= JVMTI_THREAD_STATE_SUSPENDED;
1210     }
1211     JavaThreadState jts = thr->thread_state();
1212     if (jts == _thread_in_native) {
1213       state |= JVMTI_THREAD_STATE_IN_NATIVE;
1214     }
1215     OSThread* osThread = thr->osthread();
1216     if (osThread != NULL && osThread->interrupted()) {
1217       state |= JVMTI_THREAD_STATE_INTERRUPTED;
1218     }
1219   }
1220   infop->state = state;
1221 
1222   if (thr != NULL || (state & JVMTI_THREAD_STATE_ALIVE) != 0) {
1223     infop->frame_buffer = NEW_RESOURCE_ARRAY(jvmtiFrameInfo, max_frame_count());
1224     env()->get_stack_trace(thr, 0, max_frame_count(),
1225                            infop->frame_buffer, &(infop->frame_count));
1226   } else {
1227     infop->frame_buffer = NULL;
1228     infop->frame_count = 0;
1229   }
1230   _frame_count_total += infop->frame_count;
1231 }
1232 
1233 // Based on the stack information in the linked list, allocate memory
1234 // block to return and fill it from the info in the linked list.
1235 void
1236 VM_GetMultipleStackTraces::allocate_and_fill_stacks(jint thread_count) {
1237   // do I need to worry about alignment issues?
1238   jlong alloc_size =  thread_count       * sizeof(jvmtiStackInfo)
1239                     + _frame_count_total * sizeof(jvmtiFrameInfo);
1240   env()->allocate(alloc_size, (unsigned char **)&_stack_info);
1241 
1242   // pointers to move through the newly allocated space as it is filled in




1202     // get most state bits
1203     state = (jint)java_lang_Thread::get_thread_status(thread_oop);
1204   }
1205 
1206   if (thr != NULL) {    // add more state bits if there is a JavaThead to query
1207     // same as is_being_ext_suspended() but without locking
1208     if (thr->is_ext_suspended() || thr->is_external_suspend()) {
1209       state |= JVMTI_THREAD_STATE_SUSPENDED;
1210     }
1211     JavaThreadState jts = thr->thread_state();
1212     if (jts == _thread_in_native) {
1213       state |= JVMTI_THREAD_STATE_IN_NATIVE;
1214     }
1215     OSThread* osThread = thr->osthread();
1216     if (osThread != NULL && osThread->interrupted()) {
1217       state |= JVMTI_THREAD_STATE_INTERRUPTED;
1218     }
1219   }
1220   infop->state = state;
1221 
1222   if (thr != NULL && (state & JVMTI_THREAD_STATE_ALIVE) != 0) {
1223     infop->frame_buffer = NEW_RESOURCE_ARRAY(jvmtiFrameInfo, max_frame_count());
1224     env()->get_stack_trace(thr, 0, max_frame_count(),
1225                            infop->frame_buffer, &(infop->frame_count));
1226   } else {
1227     infop->frame_buffer = NULL;
1228     infop->frame_count = 0;
1229   }
1230   _frame_count_total += infop->frame_count;
1231 }
1232 
1233 // Based on the stack information in the linked list, allocate memory
1234 // block to return and fill it from the info in the linked list.
1235 void
1236 VM_GetMultipleStackTraces::allocate_and_fill_stacks(jint thread_count) {
1237   // do I need to worry about alignment issues?
1238   jlong alloc_size =  thread_count       * sizeof(jvmtiStackInfo)
1239                     + _frame_count_total * sizeof(jvmtiFrameInfo);
1240   env()->allocate(alloc_size, (unsigned char **)&_stack_info);
1241 
1242   // pointers to move through the newly allocated space as it is filled in


< prev index next >