Skip to content

Commit 539b8e5

Browse files
committed
Unify hardware feature detection between CoreCLR JIT and AOT
Follow up on dotnet#87865
1 parent a2ce877 commit 539b8e5

File tree

25 files changed

+192
-1447
lines changed

25 files changed

+192
-1447
lines changed

src/coreclr/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ include_directories("debug/inc/${ARCH_SOURCES_DIR}")
191191
include_directories("debug/inc/dump")
192192
include_directories("md/inc")
193193
include_directories("classlibnative/bcltype")
194-
include_directories("classlibnative/cryptography")
195194
include_directories("classlibnative/inc")
196195
include_directories("${GENERATED_INCLUDE_DIR}")
197196
include_directories("hosts/inc")

src/coreclr/classlibnative/bcltype/system.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include "array.h"
3131
#include "eepolicy.h"
3232

33-
33+
#include <minipal/cpuid.h>
3434

3535

3636
FCIMPL0(UINT32, SystemNative::GetTickCount)
@@ -50,8 +50,6 @@ FCIMPL0(UINT64, SystemNative::GetTickCount64)
5050
FCIMPLEND;
5151

5252

53-
54-
5553
extern "C" VOID QCALLTYPE Environment_Exit(INT32 exitcode)
5654
{
5755
QCALL_CONTRACT;

src/coreclr/gc/vxsort/isa_detection.cpp

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,6 @@ enum class SupportedISA
1919

2020
#if defined(TARGET_AMD64) && defined(TARGET_WINDOWS)
2121

22-
static DWORD64 GetEnabledXStateFeaturesHelper()
23-
{
24-
// On Windows we have an api(GetEnabledXStateFeatures) to check if AVX is supported
25-
typedef DWORD64(WINAPI* PGETENABLEDXSTATEFEATURES)();
26-
PGETENABLEDXSTATEFEATURES pfnGetEnabledXStateFeatures = NULL;
27-
28-
HMODULE hMod = LoadLibraryExW(L"kernel32.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
29-
if (hMod == NULL)
30-
return 0;
31-
32-
pfnGetEnabledXStateFeatures = (PGETENABLEDXSTATEFEATURES)GetProcAddress(hMod, "GetEnabledXStateFeatures");
33-
34-
if (pfnGetEnabledXStateFeatures == NULL)
35-
{
36-
return 0;
37-
}
38-
39-
DWORD64 FeatureMask = pfnGetEnabledXStateFeatures();
40-
41-
return FeatureMask;
42-
}
43-
4422
SupportedISA DetermineSupportedISA()
4523
{
4624
// register definitions to make the following code more readable
@@ -78,7 +56,7 @@ SupportedISA DetermineSupportedISA()
7856
DWORD64 xcr0 = _xgetbv(0);
7957

8058
// get OS XState info
81-
DWORD64 FeatureMask = GetEnabledXStateFeaturesHelper();
59+
DWORD64 FeatureMask = GetEnabledXStateFeatures();
8260

8361
// get processor extended feature flag info
8462
__cpuidex(reg, 7, 0);
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
add_library(coreclrminipal
2-
STATIC
1+
set(SOURCES
32
doublemapping.cpp
43
dn-u16.cpp
54
)
5+
6+
if(NOT CLR_CROSS_COMPONENTS_BUILD)
7+
list(APPEND SOURCES
8+
${CLR_SRC_NATIVE_DIR}/minipal/cpufeatures.c
9+
)
10+
endif()
11+
12+
add_library(coreclrminipal
13+
STATIC
14+
${SOURCES}
15+
)
16+
17+
include(${CLR_SRC_NATIVE_DIR}/minipal/configure.cmake)
18+
include_directories(${CMAKE_CURRENT_BINARY_DIR})
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1-
add_library(coreclrminipal
2-
STATIC
1+
set(SOURCES
32
doublemapping.cpp
43
dn-u16.cpp
54
)
5+
6+
if(NOT CLR_CROSS_COMPONENTS_BUILD)
7+
list(APPEND SOURCES
8+
${CLR_SRC_NATIVE_DIR}/minipal/cpufeatures.c
9+
)
10+
endif()
11+
12+
add_library(coreclrminipal
13+
STATIC
14+
${SOURCES}
15+
)

src/coreclr/nativeaot/Runtime/amd64/MemClrForGC.asm

Lines changed: 0 additions & 99 deletions
This file was deleted.

src/coreclr/nativeaot/Runtime/i386/MemClrForGC.asm

Lines changed: 0 additions & 148 deletions
This file was deleted.

0 commit comments

Comments
 (0)