Lines Matching defs:thread
49 #include "runtime/thread.hpp"
80 JvmtiJavaThreadEventTransition(JavaThread *thread) :
82 _transition(thread),
83 _hm(thread) {};
96 JvmtiThreadEventTransition(Thread *thread) : _rm(), _hm() {
97 if (thread->is_Java_thread()) {
98 _jthread = (JavaThread *)thread;
133 JvmtiEventMark(JavaThread *thread) : _thread(thread),
134 _jni_env(thread->jni_environment()) {
136 _hblock = thread->active_handles();
141 JvmtiThreadState *state = thread->jvmti_thread_state();
143 // Save current jvmti thread exception state.
152 JNIHandleBlock* old_handles = thread->active_handles();
153 JNIHandleBlock* new_handles = JNIHandleBlock::allocate_block(thread);
156 thread->set_active_handles(new_handles);
158 assert(thread == JavaThread::current(), "thread must be current!");
159 thread->frame_anchor()->make_walkable(thread);
181 // Restore the jvmti thread exception state.
211 JvmtiThreadEventMark(JavaThread *thread) :
212 JvmtiEventMark(thread) {
213 _jt = (jthread)(to_jobject(thread->threadObj()));
223 JvmtiClassEventMark(JavaThread *thread, klassOop klass) :
224 JvmtiThreadEventMark(thread) {
235 JvmtiMethodEventMark(JavaThread *thread, methodHandle method) :
236 JvmtiThreadEventMark(thread),
246 JvmtiLocationEventMark(JavaThread *thread, methodHandle method, address location) :
247 JvmtiMethodEventMark(thread, method),
257 JvmtiExceptionEventMark(JavaThread *thread, methodHandle method, address location, Handle exception) :
258 JvmtiLocationEventMark(thread, method, location),
271 JvmtiClassFileLoadEventMark(JavaThread *thread, Symbol* name,
272 Handle class_loader, Handle prot_domain, KlassHandle *class_being_redefined) : JvmtiThreadEventMark(thread) {
317 // thread on another processor can see the wrong count value and
334 // means that a thread on another processor can see the wrong
373 JavaThread* current_thread = (JavaThread*) ThreadLocalStorage::thread();
384 // not live, no thread to transition
438 JavaThread *thread = JavaThread::current();
439 JvmtiThreadEventMark jem(thread);
440 JvmtiJavaThreadEventTransition jet(thread);
461 JavaThread *thread = JavaThread::current();
462 JvmtiThreadEventMark jem(thread);
463 JvmtiJavaThreadEventTransition jet(thread);
481 JavaThread *thread = JavaThread::current();
482 JvmtiEventMark jem(thread);
483 JvmtiJavaThreadEventTransition jet(thread);
497 // Have to grab JVMTI thread state lock to be sure environment doesn't
553 // redefine and retransform will always set the thread state
689 JvmtiVMObjectAllocEventMark(JavaThread *thread, oop obj) : JvmtiClassEventMark(thread, oop_to_klassOop(obj)) {
705 JvmtiCompiledMethodLoadEventMark(JavaThread *thread, nmethod *nm, void* compile_info_ptr = NULL)
706 : JvmtiMethodEventMark(thread,methodHandle(thread, nm->method())) {
729 JvmtiMonitorEventMark(JavaThread *thread, oop object)
730 : JvmtiThreadEventMark(thread){
743 JavaThread* thread = JavaThread::current();
746 JvmtiTrace::safe_get_thread_name(thread)));
755 JvmtiTrace::safe_get_thread_name(thread), method));
757 ResourceMark rm(thread);
759 JvmtiEventMark jem(thread);
760 JvmtiJavaThreadEventTransition jet(thread);
774 void JvmtiExport::post_raw_breakpoint(JavaThread *thread, methodOop method, address location) {
775 HandleMark hm(thread);
776 methodHandle mh(thread, method);
778 JvmtiThreadState *state = thread->jvmti_thread_state();
783 JvmtiTrace::safe_get_thread_name(thread)));
788 ThreadState old_os_state = thread->osthread()->get_state();
789 thread->osthread()->set_state(BREAKPOINTED);
791 JvmtiTrace::safe_get_thread_name(thread),
797 JvmtiLocationEventMark jem(thread, mh, location);
798 JvmtiJavaThreadEventTransition jet(thread);
806 thread->osthread()->set_state(old_os_state);
855 void JvmtiExport::at_single_stepping_point(JavaThread *thread, methodOop method, address location) {
858 HandleMark hm(thread);
859 methodHandle mh(thread, method);
862 JvmtiThreadState *state = thread->jvmti_thread_state();
867 JvmtiTrace::safe_get_thread_name(thread)));
875 JvmtiExport::post_single_step(thread, mh(), location);
880 void JvmtiExport::expose_single_stepping(JavaThread *thread) {
881 JvmtiThreadState *state = thread->jvmti_thread_state();
888 bool JvmtiExport::hide_single_stepping(JavaThread *thread) {
889 JvmtiThreadState *state = thread->jvmti_thread_state();
898 void JvmtiExport::post_class_load(JavaThread *thread, klassOop klass) {
899 HandleMark hm(thread);
900 KlassHandle kh(thread, klass);
903 JvmtiTrace::safe_get_thread_name(thread)));
904 JvmtiThreadState* state = thread->jvmti_thread_state();
912 JvmtiTrace::safe_get_thread_name(thread),
916 JvmtiClassEventMark jem(thread, kh());
917 JvmtiJavaThreadEventTransition jet(thread);
927 void JvmtiExport::post_class_prepare(JavaThread *thread, klassOop klass) {
928 HandleMark hm(thread);
929 KlassHandle kh(thread, klass);
932 JvmtiTrace::safe_get_thread_name(thread)));
933 JvmtiThreadState* state = thread->jvmti_thread_state();
941 JvmtiTrace::safe_get_thread_name(thread),
945 JvmtiClassEventMark jem(thread, kh());
946 JvmtiJavaThreadEventTransition jet(thread);
956 Thread *thread = Thread::current();
957 HandleMark hm(thread);
958 KlassHandle kh(thread, klass);
962 assert(thread->is_VM_thread(), "wrong thread");
966 (JavaThread *)((VMThread *)thread)->vm_operation()->calling_thread();
980 // thread for which we are proxying.
1002 void JvmtiExport::post_thread_start(JavaThread *thread) {
1003 assert(thread->thread_state() == _thread_in_vm, "must be in vm state");
1006 JvmtiTrace::safe_get_thread_name(thread)));
1008 // do JVMTI thread initialization (if needed)
1009 JvmtiEventController::thread_started(thread);
1011 // Do not post thread start event for hidden java thread.
1013 !thread->is_hidden_from_external_view()) {
1018 JvmtiTrace::safe_get_thread_name(thread) ));
1020 JvmtiThreadEventMark jem(thread);
1021 JvmtiJavaThreadEventTransition jet(thread);
1032 void JvmtiExport::post_thread_end(JavaThread *thread) {
1034 JvmtiTrace::safe_get_thread_name(thread)));
1036 JvmtiThreadState *state = thread->jvmti_thread_state();
1041 // Do not post thread end event for hidden java thread.
1043 !thread->is_hidden_from_external_view()) {
1049 JvmtiTrace::safe_get_thread_name(thread) ));
1052 JvmtiThreadEventMark jem(thread);
1053 JvmtiJavaThreadEventTransition jet(thread);
1084 JavaThread *thread = JavaThread::current();
1085 JvmtiThreadEventMark jem(thread);
1086 JvmtiJavaThreadEventTransition jet(thread);
1096 void JvmtiExport::post_method_entry(JavaThread *thread, methodOop method, frame current_frame) {
1097 HandleMark hm(thread);
1098 methodHandle mh(thread, method);
1101 JvmtiTrace::safe_get_thread_name(thread),
1105 JvmtiThreadState* state = thread->jvmti_thread_state();
1107 // for any thread that actually wants method entry, interp_only_mode is set
1118 JvmtiTrace::safe_get_thread_name(thread),
1123 JvmtiMethodEventMark jem(thread, mh);
1124 JvmtiJavaThreadEventTransition jet(thread);
1134 void JvmtiExport::post_method_exit(JavaThread *thread, methodOop method, frame current_frame) {
1135 HandleMark hm(thread);
1136 methodHandle mh(thread, method);
1139 JvmtiTrace::safe_get_thread_name(thread),
1143 JvmtiThreadState *state = thread->jvmti_thread_state();
1145 // for any thread that actually wants method exit, interp_only_mode is set
1167 result = Handle(thread, oop_result);
1175 JvmtiTrace::safe_get_thread_name(thread),
1180 JvmtiMethodEventMark jem(thread, mh);
1182 value.l = JNIHandles::make_local(thread, result());
1184 JvmtiJavaThreadEventTransition jet(thread);
1201 // now check that this env/thread wants this event
1204 JvmtiTrace::safe_get_thread_name(thread),
1210 JvmtiMethodEventMark jem(thread, mh);
1211 JvmtiJavaThreadEventTransition jet(thread);
1229 void JvmtiExport::post_single_step(JavaThread *thread, methodOop method, address location) {
1230 HandleMark hm(thread);
1231 methodHandle mh(thread, method);
1233 JvmtiThreadState *state = thread->jvmti_thread_state();
1242 JvmtiTrace::safe_get_thread_name(thread),
1248 JvmtiLocationEventMark jem(thread, mh, location);
1249 JvmtiJavaThreadEventTransition jet(thread);
1262 void JvmtiExport::post_exception_throw(JavaThread *thread, methodOop method, address location, oop exception) {
1263 HandleMark hm(thread);
1264 methodHandle mh(thread, method);
1265 Handle exception_handle(thread, exception);
1267 JvmtiThreadState *state = thread->jvmti_thread_state();
1273 JvmtiTrace::safe_get_thread_name(thread)));
1282 JvmtiTrace::safe_get_thread_name(thread),
1288 JvmtiExceptionEventMark jem(thread, mh, location, exception_handle);
1295 vframeStream st(thread);
1298 methodHandle current_mh = methodHandle(thread, current_method);
1302 current_mh = methodHandle(thread, current_method);
1306 KlassHandle eh_klass(thread, exception_handle()->klass());
1310 exception_handle = KlassHandle(thread, PENDING_EXCEPTION);
1326 JvmtiJavaThreadEventTransition jet(thread);
1343 void JvmtiExport::notice_unwind_due_to_exception(JavaThread *thread, methodOop method, address location, oop exception, bool in_handler_frame) {
1344 HandleMark hm(thread);
1345 methodHandle mh(thread, method);
1346 Handle exception_handle(thread, exception);
1348 JvmtiThreadState *state = thread->jvmti_thread_state();
1354 JvmtiTrace::safe_get_thread_name(thread),
1369 JvmtiExport::post_method_exit(thread, method, thread->last_frame());
1389 JvmtiTrace::safe_get_thread_name(thread),
1395 JvmtiExceptionEventMark jem(thread, mh, location, exception_handle);
1396 JvmtiJavaThreadEventTransition jet(thread);
1409 oop JvmtiExport::jni_GetField_probe(JavaThread *thread, jobject jobj, oop obj,
1411 if (*((int *)get_field_access_count_addr()) > 0 && thread->has_last_Java_frame()) {
1415 post_field_access_by_jni(thread, obj, klass, fieldID, is_static);
1422 oop JvmtiExport::jni_GetField_probe_nh(JavaThread *thread, jobject jobj, oop obj,
1424 if (*((int *)get_field_access_count_addr()) > 0 && thread->has_last_Java_frame()) {
1430 post_field_access_by_jni(thread, obj, klass, fieldID, is_static);
1437 void JvmtiExport::post_field_access_by_jni(JavaThread *thread, oop obj,
1442 assert(thread->has_last_Java_frame(), "must be called with a Java context");
1453 HandleMark hm(thread);
1454 KlassHandle h_klass(thread, klass);
1459 h_obj = Handle(thread, obj);
1461 post_field_access(thread,
1462 thread->last_frame().interpreter_frame_method(),
1463 thread->last_frame().interpreter_frame_bcp(),
1467 void JvmtiExport::post_field_access(JavaThread *thread, methodOop method,
1470 HandleMark hm(thread);
1471 methodHandle mh(thread, method);
1473 JvmtiThreadState *state = thread->jvmti_thread_state();
1478 JvmtiTrace::safe_get_thread_name(thread)));
1483 JvmtiTrace::safe_get_thread_name(thread),
1489 JvmtiLocationEventMark jem(thread, mh, location);
1492 JvmtiJavaThreadEventTransition jet(thread);
1503 oop JvmtiExport::jni_SetField_probe(JavaThread *thread, jobject jobj, oop obj,
1506 if (*((int *)get_field_modification_count_addr()) > 0 && thread->has_last_Java_frame()) {
1510 post_field_modification_by_jni(thread, obj, klass, fieldID, is_static, sig_type, value);
1517 oop JvmtiExport::jni_SetField_probe_nh(JavaThread *thread, jobject jobj, oop obj,
1520 if (*((int *)get_field_modification_count_addr()) > 0 && thread->has_last_Java_frame()) {
1526 post_field_modification_by_jni(thread, obj, klass, fieldID, is_static, sig_type, value);
1533 void JvmtiExport::post_field_modification_by_jni(JavaThread *thread, oop obj,
1539 assert(thread->has_last_Java_frame(), "must be called with Java context");
1550 HandleMark hm(thread);
1556 h_obj = Handle(thread, obj);
1558 KlassHandle h_klass(thread, klass);
1559 post_field_modification(thread,
1560 thread->last_frame().interpreter_frame_method(),
1561 thread->last_frame().interpreter_frame_bcp(),
1565 void JvmtiExport::post_raw_field_modification(JavaThread *thread, methodOop method,
1612 value->l = (jobject)JNIHandles::make_local(thread, (oop)value->l);
1615 post_field_modification(thread, method, location, field_klass, object, field, sig_type, value);
1623 void JvmtiExport::post_field_modification(JavaThread *thread, methodOop method,
1627 HandleMark hm(thread);
1628 methodHandle mh(thread, method);
1630 JvmtiThreadState *state = thread->jvmti_thread_state();
1636 JvmtiTrace::safe_get_thread_name(thread)));
1643 JvmtiTrace::safe_get_thread_name(thread),
1649 JvmtiLocationEventMark jem(thread, mh, location);
1652 JvmtiJavaThreadEventTransition jet(thread);
1664 JavaThread* thread = JavaThread::current();
1665 assert(thread->thread_state() == _thread_in_vm, "must be in vm state");
1667 HandleMark hm(thread);
1668 methodHandle mh(thread, method);
1671 JvmtiTrace::safe_get_thread_name(thread)));
1678 JvmtiTrace::safe_get_thread_name(thread) ));
1680 JvmtiMethodEventMark jem(thread, mh);
1681 JvmtiJavaThreadEventTransition jet(thread);
1735 JavaThread* thread = JavaThread::current();
1739 JvmtiTrace::safe_get_thread_name(thread)));
1747 JvmtiTrace::safe_get_thread_name(thread),
1750 ResourceMark rm(thread);
1751 HandleMark hm(thread);
1756 JvmtiCompiledMethodLoadEventMark jem(thread, nm, inlinerecord);
1757 JvmtiJavaThreadEventTransition jet(thread);
1774 JavaThread* thread = JavaThread::current();
1777 JvmtiTrace::safe_get_thread_name(thread)));
1782 JvmtiTrace::safe_get_thread_name(thread), method));
1784 JvmtiEventMark jem(thread);
1785 JvmtiJavaThreadEventTransition jet(thread);
1798 JavaThread* thread = JavaThread::current();
1805 JvmtiTrace::safe_get_thread_name(thread)));
1811 JvmtiTrace::safe_get_thread_name(thread), name));
1812 JvmtiEventMark jem(thread);
1813 JvmtiJavaThreadEventTransition jet(thread);
1828 // It may not be safe to post the event from this thread. Defer all
1829 // postings to the service thread so that it can perform them in a safe
1844 JavaThread* thread = JavaThread::current();
1847 JvmtiTrace::safe_get_thread_name(thread)));
1851 JvmtiTrace::safe_get_thread_name(thread), name));
1852 JvmtiEventMark jem(thread);
1853 JvmtiJavaThreadEventTransition jet(thread);
1868 // state can only be NULL if the current thread is exiting which
1870 guarantee(state != NULL, "attempt to register stub via an exiting thread");
1878 Thread* thread = ThreadLocalStorage::thread();
1879 if (thread != NULL && thread->is_Java_thread()) {
1883 // jvmti thread state.
1884 JvmtiThreadState *state = ((JavaThread*)thread)->jvmti_thread_state();
1901 Thread *thread = Thread::current(); // this event is posted from VM-Thread.
1904 JvmtiTrace::safe_get_thread_name(thread)));
1910 JvmtiTrace::safe_get_thread_name(thread)));
1911 JvmtiThreadEventTransition jet(thread);
1922 Thread* thread = Thread::current(); // this event is posted from vm-thread.
1925 JvmtiTrace::safe_get_thread_name(thread)));
1931 JvmtiTrace::safe_get_thread_name(thread)));
1932 JvmtiThreadEventTransition jet(thread);
1943 Thread *thread = Thread::current();
1946 JvmtiTrace::safe_get_thread_name(thread)));
1952 JvmtiTrace::safe_get_thread_name(thread)));
1953 JvmtiThreadEventTransition jet(thread);
1963 void JvmtiExport::post_monitor_contended_enter(JavaThread *thread, ObjectMonitor *obj_mntr) {
1969 JvmtiThreadState *state = thread->jvmti_thread_state();
1974 HandleMark hm(thread);
1975 Handle h(thread, object);
1979 JvmtiTrace::safe_get_thread_name(thread)));
1986 JvmtiTrace::safe_get_thread_name(thread)));
1987 JvmtiMonitorEventMark jem(thread, h());
1989 JvmtiThreadEventTransition jet(thread);
1998 void JvmtiExport::post_monitor_contended_entered(JavaThread *thread, ObjectMonitor *obj_mntr) {
2004 JvmtiThreadState *state = thread->jvmti_thread_state();
2009 HandleMark hm(thread);
2010 Handle h(thread, object);
2014 JvmtiTrace::safe_get_thread_name(thread)));
2021 JvmtiTrace::safe_get_thread_name(thread)));
2022 JvmtiMonitorEventMark jem(thread, h());
2024 JvmtiThreadEventTransition jet(thread);
2033 void JvmtiExport::post_monitor_wait(JavaThread *thread, oop object,
2035 JvmtiThreadState *state = thread->jvmti_thread_state();
2040 HandleMark hm(thread);
2041 Handle h(thread, object);
2045 JvmtiTrace::safe_get_thread_name(thread)));
2052 JvmtiTrace::safe_get_thread_name(thread)));
2053 JvmtiMonitorEventMark jem(thread, h());
2055 JvmtiThreadEventTransition jet(thread);
2065 void JvmtiExport::post_monitor_waited(JavaThread *thread, ObjectMonitor *obj_mntr, jboolean timed_out) {
2071 JvmtiThreadState *state = thread->jvmti_thread_state();
2076 HandleMark hm(thread);
2077 Handle h(thread, object);
2081 JvmtiTrace::safe_get_thread_name(thread)));
2088 JvmtiTrace::safe_get_thread_name(thread)));
2089 JvmtiMonitorEventMark jem(thread, h());
2091 JvmtiThreadEventTransition jet(thread);
2102 void JvmtiExport::post_vm_object_alloc(JavaThread *thread, oop object) {
2104 JvmtiTrace::safe_get_thread_name(thread)));
2108 HandleMark hm(thread);
2109 Handle h(thread, object);
2114 JvmtiTrace::safe_get_thread_name(thread),
2117 JvmtiVMObjectAllocEventMark jem(thread, h());
2118 JvmtiJavaThreadEventTransition jet(thread);
2130 void JvmtiExport::cleanup_thread(JavaThread* thread) {
2131 assert(JavaThread::current() == thread, "thread is not current");
2134 if (thread->jvmti_thread_state() != NULL) {
2135 // This has to happen after the thread state is removed, which is
2138 JvmtiEventController::thread_ended(thread);
2247 // Setup current current thread for event collection.
2251 // state can only be NULL if the current thread is exiting which
2253 guarantee(state != NULL, "exiting thread called setup_jvmti_thread_state");
2263 // Unset current event collection in this thread and reset it with previous
2273 // this thread's jvmti state was created during the scope of
2281 // this thread's jvmti state was created during the scope of
2320 // Setup current thread to record vm allocated objects.
2392 Thread* thread = ThreadLocalStorage::thread();
2393 if (thread != NULL && thread->is_Java_thread()) {
2394 JavaThread* current_thread = (JavaThread*)thread;