comparison src/share/vm/prims/jvm.cpp @ 14380:e6195383bcaf

8034080: Remove the USDT1 dtrace code from Hotspot Reviewed-by: dholmes, coleenp
author sla
date Tue, 18 Feb 2014 09:15:40 +0100
parents 78fde43dc07d
children 28f281e8de1d
comparison
equal deleted inserted replaced
14379:c66479743828 14380:e6195383bcaf
80 # include "jvm_bsd.h" 80 # include "jvm_bsd.h"
81 #endif 81 #endif
82 82
83 #include <errno.h> 83 #include <errno.h>
84 84
85 #ifndef USDT2
86 HS_DTRACE_PROBE_DECL1(hotspot, thread__sleep__begin, long long);
87 HS_DTRACE_PROBE_DECL1(hotspot, thread__sleep__end, int);
88 HS_DTRACE_PROBE_DECL0(hotspot, thread__yield);
89 #endif /* !USDT2 */
90
91 /* 85 /*
92 NOTE about use of any ctor or function call that can trigger a safepoint/GC: 86 NOTE about use of any ctor or function call that can trigger a safepoint/GC:
93 such ctors and calls MUST NOT come between an oop declaration/init and its 87 such ctors and calls MUST NOT come between an oop declaration/init and its
94 usage because if objects are move this may cause various memory stomps, bus 88 usage because if objects are move this may cause various memory stomps, bus
95 errors and segfaults. Here is a cookbook for causing so called "naked oop 89 errors and segfaults. Here is a cookbook for causing so called "naked oop
3006 3000
3007 3001
3008 JVM_ENTRY(void, JVM_Yield(JNIEnv *env, jclass threadClass)) 3002 JVM_ENTRY(void, JVM_Yield(JNIEnv *env, jclass threadClass))
3009 JVMWrapper("JVM_Yield"); 3003 JVMWrapper("JVM_Yield");
3010 if (os::dont_yield()) return; 3004 if (os::dont_yield()) return;
3011 #ifndef USDT2
3012 HS_DTRACE_PROBE0(hotspot, thread__yield);
3013 #else /* USDT2 */
3014 HOTSPOT_THREAD_YIELD(); 3005 HOTSPOT_THREAD_YIELD();
3015 #endif /* USDT2 */ 3006
3016 // When ConvertYieldToSleep is off (default), this matches the classic VM use of yield. 3007 // When ConvertYieldToSleep is off (default), this matches the classic VM use of yield.
3017 // Critical for similar threading behaviour 3008 // Critical for similar threading behaviour
3018 if (ConvertYieldToSleep) { 3009 if (ConvertYieldToSleep) {
3019 os::sleep(thread, MinSleepInterval, false); 3010 os::sleep(thread, MinSleepInterval, false);
3020 } else { 3011 } else {
3036 3027
3037 // Save current thread state and restore it at the end of this block. 3028 // Save current thread state and restore it at the end of this block.
3038 // And set new thread state to SLEEPING. 3029 // And set new thread state to SLEEPING.
3039 JavaThreadSleepState jtss(thread); 3030 JavaThreadSleepState jtss(thread);
3040 3031
3041 #ifndef USDT2 3032 HOTSPOT_THREAD_SLEEP_BEGIN(millis);
3042 HS_DTRACE_PROBE1(hotspot, thread__sleep__begin, millis);
3043 #else /* USDT2 */
3044 HOTSPOT_THREAD_SLEEP_BEGIN(
3045 millis);
3046 #endif /* USDT2 */
3047 3033
3048 EventThreadSleep event; 3034 EventThreadSleep event;
3049 3035
3050 if (millis == 0) { 3036 if (millis == 0) {
3051 // When ConvertSleepToYield is on, this matches the classic VM implementation of 3037 // When ConvertSleepToYield is on, this matches the classic VM implementation of
3069 if (!HAS_PENDING_EXCEPTION) { 3055 if (!HAS_PENDING_EXCEPTION) {
3070 if (event.should_commit()) { 3056 if (event.should_commit()) {
3071 event.set_time(millis); 3057 event.set_time(millis);
3072 event.commit(); 3058 event.commit();
3073 } 3059 }
3074 #ifndef USDT2 3060 HOTSPOT_THREAD_SLEEP_END(1);
3075 HS_DTRACE_PROBE1(hotspot, thread__sleep__end,1); 3061
3076 #else /* USDT2 */
3077 HOTSPOT_THREAD_SLEEP_END(
3078 1);
3079 #endif /* USDT2 */
3080 // TODO-FIXME: THROW_MSG returns which means we will not call set_state() 3062 // TODO-FIXME: THROW_MSG returns which means we will not call set_state()
3081 // to properly restore the thread state. That's likely wrong. 3063 // to properly restore the thread state. That's likely wrong.
3082 THROW_MSG(vmSymbols::java_lang_InterruptedException(), "sleep interrupted"); 3064 THROW_MSG(vmSymbols::java_lang_InterruptedException(), "sleep interrupted");
3083 } 3065 }
3084 } 3066 }
3086 } 3068 }
3087 if (event.should_commit()) { 3069 if (event.should_commit()) {
3088 event.set_time(millis); 3070 event.set_time(millis);
3089 event.commit(); 3071 event.commit();
3090 } 3072 }
3091 #ifndef USDT2 3073 HOTSPOT_THREAD_SLEEP_END(0);
3092 HS_DTRACE_PROBE1(hotspot, thread__sleep__end,0);
3093 #else /* USDT2 */
3094 HOTSPOT_THREAD_SLEEP_END(
3095 0);
3096 #endif /* USDT2 */
3097 JVM_END 3074 JVM_END
3098 3075
3099 JVM_ENTRY(jobject, JVM_CurrentThread(JNIEnv* env, jclass threadClass)) 3076 JVM_ENTRY(jobject, JVM_CurrentThread(JNIEnv* env, jclass threadClass))
3100 JVMWrapper("JVM_CurrentThread"); 3077 JVMWrapper("JVM_CurrentThread");
3101 oop jthread = thread->threadObj(); 3078 oop jthread = thread->threadObj();