summaryrefslogtreecommitdiff
path: root/rts/win32
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-05-09 19:25:11 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-05-30 06:07:31 -0400
commit3d96016926cc88506db416f87b6e4b68a3a0d25f (patch)
treece9a9aa570c78b76d70ca769379ff71abf92851e /rts/win32
parent1449435c7bf1075f5cd11098d8c98b99f8fe150a (diff)
downloadhaskell-3d96016926cc88506db416f87b6e4b68a3a0d25f.tar.gz
rts: Drop compatibility shims for Windows Vista
We can now assume that the thread and processor group interfaces are available.
Diffstat (limited to 'rts/win32')
-rw-r--r--rts/win32/OSThreads.c56
1 files changed, 5 insertions, 51 deletions
diff --git a/rts/win32/OSThreads.c b/rts/win32/OSThreads.c
index 0942382da2..fe35f35e82 100644
--- a/rts/win32/OSThreads.c
+++ b/rts/win32/OSThreads.c
@@ -252,17 +252,6 @@ forkOS_createThread ( HsStablePtr entry )
(unsigned*)&pId) == 0);
}
-#if defined(x86_64_HOST_ARCH)
-/* We still support Windows Vista, so we can't depend on it
- and must manually resolve these. */
-typedef DWORD(WINAPI *GetItemCountProc)(WORD);
-typedef DWORD(WINAPI *GetGroupCountProc)(void);
-typedef BOOL(WINAPI *SetThreadGroupAffinityProc)(HANDLE, const GROUP_AFFINITY*, PGROUP_AFFINITY);
-#if !defined(ALL_PROCESSOR_GROUPS)
-#define ALL_PROCESSOR_GROUPS 0xffff
-#endif
-#endif
-
void freeThreadingResources (void)
{
if (cpuGroupCache)
@@ -310,13 +299,6 @@ getNumberOfProcessorsGroups (void)
#if defined(x86_64_HOST_ARCH)
if (!n_groups)
{
- /* We still support Windows Vista. Which means we can't rely
- on the API being available. So we'll have to resolve manually. */
- HMODULE kernel = GetModuleHandleW(L"kernel32");
-
- GetGroupCountProc GetActiveProcessorGroupCount
- = (GetGroupCountProc)(void*)
- GetProcAddress(kernel, "GetActiveProcessorGroupCount");
n_groups = GetActiveProcessorGroupCount();
IF_DEBUG(scheduler, debugBelch("[*] Number of processor groups detected: %u\n", n_groups));
@@ -346,21 +328,10 @@ getProcessorsDistribution (void)
cpuGroupDistCache = malloc(n_groups * sizeof(uint8_t));
memset(cpuGroupDistCache, MAXIMUM_PROCESSORS, n_groups * sizeof(uint8_t));
- /* We still support Windows Vista. Which means we can't rely
- on the API being available. So we'll have to resolve manually. */
- HMODULE kernel = GetModuleHandleW(L"kernel32");
-
- GetItemCountProc GetActiveProcessorCount
- = (GetItemCountProc)(void*)
- GetProcAddress(kernel, "GetActiveProcessorCount");
-
- if (GetActiveProcessorCount)
+ for (int i = 0; i < n_groups; i++)
{
- for (int i = 0; i < n_groups; i++)
- {
- cpuGroupDistCache[i] = GetActiveProcessorCount(i);
- IF_DEBUG(scheduler, debugBelch("[*] Number of active processors in group %u detected: %u\n", i, cpuGroupDistCache[i]));
- }
+ cpuGroupDistCache[i] = GetActiveProcessorCount(i);
+ IF_DEBUG(scheduler, debugBelch("[*] Number of active processors in group %u detected: %u\n", i, cpuGroupDistCache[i]));
}
}
@@ -449,14 +420,7 @@ getNumberOfProcessors (void)
static uint32_t nproc = 0;
#if defined(x86_64_HOST_ARCH)
- /* We still support Windows Vista. Which means we can't rely
- on the API being available. So we'll have to resolve manually. */
- HMODULE kernel = GetModuleHandleW(L"kernel32");
-
- GetItemCountProc GetActiveProcessorCount
- = (GetItemCountProc)(void*)
- GetProcAddress(kernel, "GetActiveProcessorCount");
- if (GetActiveProcessorCount && !nproc)
+ if (!nproc)
{
nproc = GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
@@ -517,21 +481,11 @@ setThreadAffinity (uint32_t n, uint32_t m) // cap N of M
mask[group] |= 1 << ix;
}
-#if defined(x86_64_HOST_ARCH)
- /* We still support Windows Vista. Which means we can't rely
- on the API being available. So we'll have to resolve manually. */
- HMODULE kernel = GetModuleHandleW(L"kernel32");
-
- SetThreadGroupAffinityProc SetThreadGroupAffinity
- = (SetThreadGroupAffinityProc)(void*)
- GetProcAddress(kernel, "SetThreadGroupAffinity");
-#endif
-
for (i = 0; i < n_groups; i++)
{
#if defined(x86_64_HOST_ARCH)
// If we support the new API, use it.
- if (mask[i] > 0 && SetThreadGroupAffinity)
+ if (mask[i] > 0)
{
GROUP_AFFINITY hGroup;
ZeroMemory(&hGroup, sizeof(hGroup));