< prev index next >

src/hotspot/share/prims/jvmtiEnvBase.cpp

Print this page
rev 47287 : Port 09.17.Thread_SMR_logging_update from JDK9 to JDK10
rev 47289 : eosterlund, stefank CR - refactor code into threadSMR.cpp and threadSMR.hpp
rev 47290 : eosterlund CR - need more inline fixes.
rev 47292 : stefank, coleenp CR - refactor most JavaThreadIterator usage to use JavaThreadIteratorWithHandle.


1260       // We got an error code so we don't have a JavaThread *, but
1261       // only return an error from here if we didn't get a valid
1262       // thread_oop.
1263       if (thread_oop == NULL) {
1264         set_result(err);
1265         return;
1266       }
1267       // We have a valid thread_oop.
1268     }
1269     fill_frames(jt, java_thread, thread_oop);
1270   }
1271   allocate_and_fill_stacks(_thread_count);
1272 }
1273 
1274 void
1275 VM_GetAllStackTraces::doit() {
1276   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
1277 
1278   ResourceMark rm;
1279   _final_thread_count = 0;
1280   {
1281     ThreadsListHandle tlh;
1282     JavaThreadIterator jti(tlh.list());
1283     for (JavaThread *jt = jti.first(); jt != NULL; jt = jti.next()) {
1284       oop thread_oop = jt->threadObj();
1285       if (thread_oop != NULL &&
1286           !jt->is_exiting() &&
1287           java_lang_Thread::is_alive(thread_oop) &&
1288           !jt->is_hidden_from_external_view()) {
1289         ++_final_thread_count;
1290         // Handle block of the calling thread is used to create local refs.
1291         fill_frames((jthread)JNIHandles::make_local(_calling_thread, thread_oop),
1292                     jt, thread_oop);
1293       }
1294     }
1295   }
1296   allocate_and_fill_stacks(_final_thread_count);
1297 }
1298 
1299 // Verifies that the top frame is a java frame in an expected state.
1300 // Deoptimizes frame if needed.
1301 // Checks that the frame method signature matches the return type (tos).
1302 // HandleMark must be defined in the caller only.
1303 // It is to keep a ret_ob_h handle alive after return to the caller.
1304 jvmtiError
1305 JvmtiEnvBase::check_top_frame(JavaThread* current_thread, JavaThread* java_thread,
1306                               jvalue value, TosState tos, Handle* ret_ob_h) {
1307   ResourceMark rm(current_thread);
1308 
1309   vframe *vf = vframeFor(java_thread, 0);
1310   NULL_CHECK(vf, JVMTI_ERROR_NO_MORE_FRAMES);
1311 
1312   javaVFrame *jvf = (javaVFrame*) vf;
1313   if (!vf->is_java_frame() || jvf->method()->is_native()) {
1314     return JVMTI_ERROR_OPAQUE_FRAME;
1315   }




1260       // We got an error code so we don't have a JavaThread *, but
1261       // only return an error from here if we didn't get a valid
1262       // thread_oop.
1263       if (thread_oop == NULL) {
1264         set_result(err);
1265         return;
1266       }
1267       // We have a valid thread_oop.
1268     }
1269     fill_frames(jt, java_thread, thread_oop);
1270   }
1271   allocate_and_fill_stacks(_thread_count);
1272 }
1273 
1274 void
1275 VM_GetAllStackTraces::doit() {
1276   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
1277 
1278   ResourceMark rm;
1279   _final_thread_count = 0;
1280   for (JavaThreadIteratorWithHandle jtiwh; JavaThread *jt = jtiwh.next(); ) {



1281     oop thread_oop = jt->threadObj();
1282     if (thread_oop != NULL &&
1283         !jt->is_exiting() &&
1284         java_lang_Thread::is_alive(thread_oop) &&
1285         !jt->is_hidden_from_external_view()) {
1286       ++_final_thread_count;
1287       // Handle block of the calling thread is used to create local refs.
1288       fill_frames((jthread)JNIHandles::make_local(_calling_thread, thread_oop),
1289                   jt, thread_oop);
1290     }
1291   }

1292   allocate_and_fill_stacks(_final_thread_count);
1293 }
1294 
1295 // Verifies that the top frame is a java frame in an expected state.
1296 // Deoptimizes frame if needed.
1297 // Checks that the frame method signature matches the return type (tos).
1298 // HandleMark must be defined in the caller only.
1299 // It is to keep a ret_ob_h handle alive after return to the caller.
1300 jvmtiError
1301 JvmtiEnvBase::check_top_frame(JavaThread* current_thread, JavaThread* java_thread,
1302                               jvalue value, TosState tos, Handle* ret_ob_h) {
1303   ResourceMark rm(current_thread);
1304 
1305   vframe *vf = vframeFor(java_thread, 0);
1306   NULL_CHECK(vf, JVMTI_ERROR_NO_MORE_FRAMES);
1307 
1308   javaVFrame *jvf = (javaVFrame*) vf;
1309   if (!vf->is_java_frame() || jvf->method()->is_native()) {
1310     return JVMTI_ERROR_OPAQUE_FRAME;
1311   }


< prev index next >