Inline YieldProcessor on Linux (dotnet/coreclr#12058)
authorXiangyang (Mark) Guo <xiangyang.guo@intel.com>
Mon, 5 Jun 2017 17:16:27 +0000 (10:16 -0700)
committerJan Kotas <jkotas@microsoft.com>
Mon, 5 Jun 2017 17:16:27 +0000 (10:16 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/be28ab1ad1159f784254e4a77e2fe9cd99dc34c8

src/coreclr/src/dlls/mscordac/mscordac_unixexports.src
src/coreclr/src/pal/inc/pal.h
src/coreclr/src/pal/src/arch/amd64/processor.cpp
src/coreclr/src/pal/src/arch/arm/processor.cpp
src/coreclr/src/pal/src/arch/arm64/processor.cpp
src/coreclr/src/pal/src/arch/i386/processor.cpp

index b467ece..7bb1c87 100644 (file)
@@ -175,7 +175,6 @@ WaitForSingleObject
 WaitForSingleObjectEx
 WideCharToMultiByte
 WriteFile
-YieldProcessor
 
 nativeStringResourceTable_mscorrc_debug
 _ZN25NativeExceptionHolderBase4PushEv
index 0f470d9..2d703e8 100644 (file)
@@ -4560,11 +4560,22 @@ MemoryBarrier(
     __sync_synchronize();
 }
 
+EXTERN_C
 PALIMPORT
+inline
 VOID
 PALAPI
 YieldProcessor(
-    VOID);
+    VOID)
+{
+#if defined(_X86_) || defined(_AMD64_)
+    __asm__ __volatile__(
+        "rep\n"
+        "nop");
+#else
+    return;
+#endif
+}
 
 PALIMPORT
 DWORD
index 0ab7992..a520111 100644 (file)
@@ -23,27 +23,6 @@ Abstract:
 
 /*++
 Function:
-YieldProcessor
-
-The YieldProcessor function signals to the processor to give resources
-to threads that are waiting for them. This macro is only effective on
-processors that support technology allowing multiple threads running
-on a single processor, such as Intel's Hyper-Threading technology.
-
---*/
-void
-PALAPI
-YieldProcessor(
-    VOID)
-{
-    __asm__ __volatile__ (
-        "rep\n"
-        "nop"
-    );
-}
-
-/*++
-Function:
 XmmYmmStateSupport
 
 Check if OS has enabled both XMM and YMM state support
index f41caff..7993212 100644 (file)
@@ -20,23 +20,3 @@ Abstract:
 --*/
 
 #include "pal/palinternal.h"
-
-/*++
-Function:
-YieldProcessor
-
-The YieldProcessor function signals to the processor to give resources
-to threads that are waiting for them. This macro is only effective on
-processors that support technology allowing multiple threads running
-on a single processor, such as Intel's Hyper-Threading technology.
-
---*/
-void
-PALAPI
-YieldProcessor(
-    VOID)
-{
-       // Pretty sure ARM has no useful function here?
-    return;
-}
-
index 6c7851a..4c47210 100644 (file)
@@ -20,22 +20,3 @@ Abstract:
 --*/
 
 #include "pal/palinternal.h"
-
-/*++
-Function:
-YieldProcessor
-
-The YieldProcessor function signals to the processor to give resources
-to threads that are waiting for them. This macro is only effective on
-processors that support technology allowing multiple threads running
-on a single processor, such as Intel's Hyper-Threading technology.
-
---*/
-void
-PALAPI
-YieldProcessor(
-    VOID)
-{
-    return;
-}
-
index 4fd3a4a..e1c8de1 100644 (file)
@@ -20,25 +20,3 @@ Abstract:
 --*/
 
 #include "pal/palinternal.h"
-
-/*++
-Function:
-YieldProcessor
-
-The YieldProcessor function signals to the processor to give resources
-to threads that are waiting for them. This macro is only effective on
-processors that support technology allowing multiple threads running
-on a single processor, such as Intel's Hyper-Threading technology.
-
---*/
-void
-PALAPI
-YieldProcessor(
-    VOID)
-{
-    __asm__ __volatile__ (
-        "rep\n"
-        "nop"
-    );
-}
-