|
89 | 89 | import com.oracle.svm.core.heap.VMOperationInfos; |
90 | 90 | import com.oracle.svm.core.jdk.StackTraceUtils; |
91 | 91 | import com.oracle.svm.core.jdk.UninterruptibleUtils; |
92 | | -import com.oracle.svm.core.jfr.HasJfrSupport; |
93 | 92 | import com.oracle.svm.core.locks.VMMutex; |
94 | 93 | import com.oracle.svm.core.log.Log; |
95 | 94 | import com.oracle.svm.core.memory.NativeMemory; |
|
110 | 109 |
|
111 | 110 | import jdk.graal.compiler.api.replacements.Fold; |
112 | 111 | import jdk.graal.compiler.core.common.SuppressFBWarnings; |
113 | | -import jdk.internal.event.ThreadSleepEvent; |
114 | 112 | import jdk.internal.misc.Unsafe; |
115 | 113 |
|
116 | 114 | /** |
@@ -983,37 +981,20 @@ static void unpark(Thread thread) { |
983 | 981 | } |
984 | 982 |
|
985 | 983 | /** |
986 | | - * Sleeps for the given number of nanoseconds, dealing with JFR events, wakups and |
987 | | - * interruptions. |
| 984 | + * Sleeps for the given number of nanoseconds, dealing with early wake-ups and interruptions. |
988 | 985 | */ |
989 | 986 | static void sleep(long nanos) throws InterruptedException { |
990 | 987 | assert !isCurrentThreadVirtual(); |
991 | | - if (HasJfrSupport.get() && ThreadSleepEvent.isTurnedOn()) { |
992 | | - ThreadSleepEvent event = new ThreadSleepEvent(); |
993 | | - try { |
994 | | - event.time = nanos; |
995 | | - event.begin(); |
996 | | - sleep0(nanos); |
997 | | - } finally { |
998 | | - event.commit(); |
999 | | - } |
1000 | | - } else { |
1001 | | - sleep0(nanos); |
1002 | | - } |
1003 | | - } |
1004 | | - |
1005 | | - /** Sleep for the given number of nanoseconds, dealing with early wakeups and interruptions. */ |
1006 | | - static void sleep0(long nanos) throws InterruptedException { |
1007 | 988 | if (nanos < 0) { |
1008 | 989 | throw new IllegalArgumentException("Timeout value is negative"); |
1009 | 990 | } |
1010 | | - sleep1(nanos); |
| 991 | + sleep0(nanos); |
1011 | 992 | if (Thread.interrupted()) { // clears the interrupted flag as required of Thread.sleep() |
1012 | 993 | throw new InterruptedException(); |
1013 | 994 | } |
1014 | 995 | } |
1015 | 996 |
|
1016 | | - private static void sleep1(long durationNanos) { |
| 997 | + private static void sleep0(long durationNanos) { |
1017 | 998 | VMOperationControl.guaranteeOkayToBlock("[PlatformThreads.sleep(long): Should not sleep when it is not okay to block.]"); |
1018 | 999 | Thread thread = currentThread.get(); |
1019 | 1000 | Parker sleepEvent = getCurrentThreadData().ensureSleepParker(); |
|
0 commit comments