1.1 --- a/src/share/vm/runtime/thread.cpp Sun Oct 16 02:59:24 2011 -0700 1.2 +++ b/src/share/vm/runtime/thread.cpp Mon Oct 17 01:40:27 2011 -0400 1.3 @@ -110,6 +110,7 @@ 1.4 1.5 // Only bother with this argument setup if dtrace is available 1.6 1.7 +#ifndef USDT2 1.8 HS_DTRACE_PROBE_DECL(hotspot, vm__init__begin); 1.9 HS_DTRACE_PROBE_DECL(hotspot, vm__init__end); 1.10 HS_DTRACE_PROBE_DECL5(hotspot, thread__start, char*, intptr_t, 1.11 @@ -130,6 +131,26 @@ 1.12 java_lang_Thread::is_daemon((javathread)->threadObj())); \ 1.13 } 1.14 1.15 +#else /* USDT2 */ 1.16 + 1.17 +#define HOTSPOT_THREAD_PROBE_start HOTSPOT_THREAD_PROBE_START 1.18 +#define HOTSPOT_THREAD_PROBE_stop HOTSPOT_THREAD_PROBE_STOP 1.19 + 1.20 +#define DTRACE_THREAD_PROBE(probe, javathread) \ 1.21 + { \ 1.22 + ResourceMark rm(this); \ 1.23 + int len = 0; \ 1.24 + const char* name = (javathread)->get_thread_name(); \ 1.25 + len = strlen(name); \ 1.26 + HOTSPOT_THREAD_PROBE_##probe( /* probe = start, stop */ \ 1.27 + (char *) name, len, \ 1.28 + java_lang_Thread::thread_id((javathread)->threadObj()), \ 1.29 + (uintptr_t) (javathread)->osthread()->thread_id(), \ 1.30 + java_lang_Thread::is_daemon((javathread)->threadObj())); \ 1.31 + } 1.32 + 1.33 +#endif /* USDT2 */ 1.34 + 1.35 #else // ndef DTRACE_ENABLED 1.36 1.37 #define DTRACE_THREAD_PROBE(probe, javathread) 1.38 @@ -1328,7 +1349,7 @@ 1.39 DirtyCardQueueSet JavaThread::_dirty_card_queue_set; 1.40 #endif // !SERIALGC 1.41 1.42 -JavaThread::JavaThread(bool is_attaching) : 1.43 +JavaThread::JavaThread(bool is_attaching_via_jni) : 1.44 Thread() 1.45 #ifndef SERIALGC 1.46 , _satb_mark_queue(&_satb_mark_queue_set), 1.47 @@ -1336,7 +1357,11 @@ 1.48 #endif // !SERIALGC 1.49 { 1.50 initialize(); 1.51 - _is_attaching = is_attaching; 1.52 + if (is_attaching_via_jni) { 1.53 + _jni_attach_state = _attaching_via_jni; 1.54 + } else { 1.55 + _jni_attach_state = _not_attaching_via_jni; 1.56 + } 1.57 assert(_deferred_card_mark.is_empty(), "Default MemRegion ctor"); 1.58 } 1.59 1.60 @@ -1392,7 +1417,7 @@ 1.61 tty->print_cr("creating thread %p", this); 1.62 } 1.63 initialize(); 1.64 - _is_attaching = false; 1.65 + _jni_attach_state = _not_attaching_via_jni; 1.66 set_entry_point(entry_point); 1.67 // Create the native thread itself. 1.68 // %note runtime_23 1.69 @@ -1504,6 +1529,10 @@ 1.70 // Note: Due to JVM_StopThread we can have pending exceptions already! 1.71 if (!this->has_pending_exception() && 1.72 !java_lang_Thread::is_stillborn(this->threadObj())) { 1.73 + { 1.74 + ResourceMark rm(this); 1.75 + this->set_native_thread_name(this->get_thread_name()); 1.76 + } 1.77 HandleMark hm(this); 1.78 this->entry_point()(this, this); 1.79 } 1.80 @@ -2683,7 +2712,7 @@ 1.81 name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length(), buf, buflen); 1.82 } 1.83 } 1.84 - else if (is_attaching()) { // workaround for 6412693 - see 6404306 1.85 + else if (is_attaching_via_jni()) { // workaround for 6412693 - see 6404306 1.86 name_str = "<no-name - thread is attaching>"; 1.87 } 1.88 else { 1.89 @@ -3079,7 +3108,11 @@ 1.90 os::pause(); 1.91 } 1.92 1.93 +#ifndef USDT2 1.94 HS_DTRACE_PROBE(hotspot, vm__init__begin); 1.95 +#else /* USDT2 */ 1.96 + HOTSPOT_VM_INIT_BEGIN(); 1.97 +#endif /* USDT2 */ 1.98 1.99 // Record VM creation timing statistics 1.100 TraceVmCreationTime create_vm_timer; 1.101 @@ -3334,7 +3367,11 @@ 1.102 // debug stuff, that does not work until all basic classes have been initialized. 1.103 set_init_completed(); 1.104 1.105 +#ifndef USDT2 1.106 HS_DTRACE_PROBE(hotspot, vm__init__end); 1.107 +#else /* USDT2 */ 1.108 + HOTSPOT_VM_INIT_END(); 1.109 +#endif /* USDT2 */ 1.110 1.111 // record VM initialization completion time 1.112 Management::record_vm_init_completed();