Skip to content

Commit 9ca2453

Browse files
authored
Revert "Revert "Reduce CoreCLR PAL (#76832)" (#76860)"
This reverts commit 744fc9b.
1 parent d783bad commit 9ca2453

File tree

83 files changed

+115
-6819
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+115
-6819
lines changed

src/coreclr/dlls/mscordac/mscordac_unixexports.src

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ nativeStringResourceTable_mscorrc
9999
#CloseHandle
100100
#DebugBreak
101101
#DeleteCriticalSection
102-
#DeleteFileW
103102
#DuplicateHandle
104103
#EnterCriticalSection
105104
#FindClose
@@ -112,7 +111,6 @@ nativeStringResourceTable_mscorrc
112111
#FreeLibrary
113112
#FileTimeToSystemTime
114113
#GetACP
115-
#GetCurrentDirectoryW
116114
#GetCurrentProcess
117115
#GetCurrentProcessId
118116
#GetCurrentThreadId
@@ -141,7 +139,6 @@ nativeStringResourceTable_mscorrc
141139
#LoadLibraryExW
142140
#MapViewOfFile
143141
#MapViewOfFileEx
144-
#MoveFileExW
145142
#MultiByteToWideChar
146143
#OpenProcess
147144
#OutputDebugStringW

src/coreclr/ilasm/main.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,8 +846,16 @@ extern "C" int _cdecl wmain(int argc, _In_ WCHAR **argv)
846846
*pc = W('.');
847847
}
848848
wcscpy_s(pc+1,4,W("PDB"));
849-
#undef DeleteFileW
850-
DeleteFileW(wzOutputFilename);
849+
850+
#ifdef TARGET_WINDOWS
851+
_wremove(wzOutputFilename);
852+
#else
853+
MAKE_UTF8PTR_FROMWIDE_NOTHROW(szOutputFilename, wzOutputFilename);
854+
if (szOutputFilename != NULL)
855+
{
856+
remove(szOutputFilename);
857+
}
858+
#endif
851859
}
852860
if (exitval == 0)
853861
{

src/coreclr/inc/clrconfigvalues.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_DisableStarvationDetection, W("Thre
529529
RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_DebugBreakOnWorkerStarvation, W("ThreadPool_DebugBreakOnWorkerStarvation"), 0, "Breaks into the debugger if the ThreadPool detects work queue starvation")
530530
RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_EnableWorkerTracking, W("ThreadPool_EnableWorkerTracking"), 0, "Enables extra expensive tracking of how many workers threads are working simultaneously")
531531
#ifdef TARGET_ARM64
532-
// Spinning scheme is currently different on ARM64, see CLRLifoSemaphore::Wait(DWORD, UINT32, UINT32)
532+
// Spinning scheme is currently different on ARM64
533533
RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_UnfairSemaphoreSpinLimit, W("ThreadPool_UnfairSemaphoreSpinLimit"), 0x32, "Maximum number of spins per processor a thread pool worker thread performs before waiting for work")
534534
#else // !TARGET_ARM64
535535
RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_UnfairSemaphoreSpinLimit, W("ThreadPool_UnfairSemaphoreSpinLimit"), 0x46, "Maximum number of spins a thread pool worker thread performs before waiting for work")

src/coreclr/inc/holder.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,14 +1144,6 @@ typedef Wrapper<HANDLE, DoNothing<HANDLE>, VoidFindClose, (UINT_PTR) -1> FindHan
11441144

11451145
typedef Wrapper<void *, DoNothing, VoidUnmapViewOfFile> MapViewHolder;
11461146

1147-
#ifdef WszDeleteFile
1148-
// Deletes a file with the specified path. Do not use if you care about failures
1149-
// deleting the file, as failures are ignored by VoidDeleteFile.
1150-
FORCEINLINE void VoidDeleteFile(LPCWSTR wszFilePath) { WszDeleteFile(wszFilePath); }
1151-
typedef Wrapper<LPCWSTR, DoNothing<LPCWSTR>, VoidDeleteFile, NULL> DeleteFileHolder;
1152-
#endif // WszDeleteFile
1153-
1154-
11551147
//-----------------------------------------------------------------------------
11561148
// Misc holders
11571149
//-----------------------------------------------------------------------------

src/coreclr/inc/longfilepathwrappers.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ GetFileAttributesExWrapper(
3434
_In_ GET_FILEEX_INFO_LEVELS fInfoLevelId,
3535
_Out_writes_bytes_(sizeof(WIN32_FILE_ATTRIBUTE_DATA)) LPVOID lpFileInformation
3636
);
37-
BOOL
38-
DeleteFileWrapper(
39-
_In_ LPCWSTR lpFileName
40-
);
4137

4238
#ifndef HOST_UNIX
4339
BOOL
@@ -66,10 +62,6 @@ DWORD WINAPI GetTempPathWrapper(
6662
SString& lpBuffer
6763
);
6864

69-
DWORD WINAPI GetCurrentDirectoryWrapper(
70-
SString& lpBuffer
71-
);
72-
7365
DWORD
7466
GetModuleFileNameWrapper(
7567
_In_opt_ HMODULE hModule,

src/coreclr/inc/winwrap.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
#undef OpenSemaphore
7272
#undef CreateWaitableTimer
7373
#undef CreateFileMapping
74-
#undef OpenFileMapping
7574
#undef LoadLibrary
7675
#undef LoadLibraryEx
7776
#undef GetModuleFileName
@@ -92,19 +91,16 @@
9291
#undef GetSystemDirectory
9392
#undef GetTempPath
9493
#undef GetTempFileName
95-
#undef GetCurrentDirectory
9694
#undef GetFullPathName
9795
#undef CreateFile
9896
#undef GetFileAttributes
9997
#undef GetFileAttributesEx
100-
#undef DeleteFile
10198
#undef FindFirstFileEx
10299
#undef FindFirstFile
103100
#undef FindNextFile
104101
#undef CopyFile
105102
#undef CopyFileEx
106103
#undef MoveFile
107-
#undef MoveFileEx
108104
#undef CreateHardLink
109105
#undef CreateNamedPipe
110106
#undef WaitNamedPipe
@@ -143,7 +139,6 @@
143139
#define WszOpenEvent OpenEventW
144140
#define WszCreateWaitableTimer CreateWaitableTimerW
145141
#define WszCreateFileMapping CreateFileMappingW
146-
#define WszOpenFileMapping OpenFileMappingW
147142
#define WszGetModuleHandle GetModuleHandleW
148143
#define WszGetModuleHandleEx GetModuleHandleExW
149144
#define WszGetCommandLine GetCommandLineW
@@ -201,13 +196,11 @@
201196
#define WszCreateFile CreateFileWrapper
202197
#define WszGetFileAttributes GetFileAttributesWrapper
203198
#define WszGetFileAttributesEx GetFileAttributesExWrapper
204-
#define WszDeleteFile DeleteFileWrapper
205199

206200
//Can not use extended syntax
207201
#define WszGetFullPathName GetFullPathNameW
208202

209203
//Long Files will not work on these till redstone
210-
#define WszGetCurrentDirectory GetCurrentDirectoryWrapper
211204
#define WszGetTempPath GetTempPathWrapper
212205

213206
//APIS which have a buffer as an out parameter

src/coreclr/pal/inc/pal.h

Lines changed: 1 addition & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -672,35 +672,6 @@ CopyFileW(
672672
#define CopyFile CopyFileA
673673
#endif
674674

675-
PALIMPORT
676-
BOOL
677-
PALAPI
678-
DeleteFileW(
679-
IN LPCWSTR lpFileName);
680-
681-
#ifdef UNICODE
682-
#define DeleteFile DeleteFileW
683-
#else
684-
#define DeleteFile DeleteFileA
685-
#endif
686-
687-
#define MOVEFILE_REPLACE_EXISTING 0x00000001
688-
#define MOVEFILE_COPY_ALLOWED 0x00000002
689-
690-
PALIMPORT
691-
BOOL
692-
PALAPI
693-
MoveFileExW(
694-
IN LPCWSTR lpExistingFileName,
695-
IN LPCWSTR lpNewFileName,
696-
IN DWORD dwFlags);
697-
698-
#ifdef UNICODE
699-
#define MoveFileEx MoveFileExW
700-
#else
701-
#define MoveFileEx MoveFileExA
702-
#endif
703-
704675
typedef struct _WIN32_FIND_DATAA {
705676
DWORD dwFileAttributes;
706677
FILETIME ftCreationTime;
@@ -857,12 +828,6 @@ PALAPI
857828
GetStdHandle(
858829
IN DWORD nStdHandle);
859830

860-
PALIMPORT
861-
BOOL
862-
PALAPI
863-
SetEndOfFile(
864-
IN HANDLE hFile);
865-
866831
PALIMPORT
867832
DWORD
868833
PALAPI
@@ -988,19 +953,6 @@ GetTempPathA(
988953
#define GetTempPath GetTempPathA
989954
#endif
990955

991-
PALIMPORT
992-
DWORD
993-
PALAPI
994-
GetCurrentDirectoryW(
995-
IN DWORD nBufferLength,
996-
OUT LPWSTR lpBuffer);
997-
998-
#ifdef UNICODE
999-
#define GetCurrentDirectory GetCurrentDirectoryW
1000-
#else
1001-
#define GetCurrentDirectory GetCurrentDirectoryA
1002-
#endif
1003-
1004956
PALIMPORT
1005957
HANDLE
1006958
PALAPI
@@ -1123,11 +1075,6 @@ DWORD
11231075
PALAPI
11241076
GetCurrentProcessId();
11251077

1126-
PALIMPORT
1127-
DWORD
1128-
PALAPI
1129-
GetCurrentSessionId();
1130-
11311078
PALIMPORT
11321079
HANDLE
11331080
PALAPI
@@ -2601,16 +2548,6 @@ SetThreadPriority(
26012548
IN HANDLE hThread,
26022549
IN int nPriority);
26032550

2604-
PALIMPORT
2605-
BOOL
2606-
PALAPI
2607-
GetThreadTimes(
2608-
IN HANDLE hThread,
2609-
OUT LPFILETIME lpCreationTime,
2610-
OUT LPFILETIME lpExitTime,
2611-
OUT LPFILETIME lpKernelTime,
2612-
OUT LPFILETIME lpUserTime);
2613-
26142551
PALIMPORT
26152552
HRESULT
26162553
PALAPI
@@ -2733,9 +2670,7 @@ typedef struct _CRITICAL_SECTION {
27332670
PALIMPORT VOID PALAPI EnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
27342671
PALIMPORT VOID PALAPI LeaveCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
27352672
PALIMPORT VOID PALAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection);
2736-
PALIMPORT BOOL PALAPI InitializeCriticalSectionEx(LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount, DWORD Flags);
27372673
PALIMPORT VOID PALAPI DeleteCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
2738-
PALIMPORT BOOL PALAPI TryEnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
27392674

27402675
#define SEM_FAILCRITICALERRORS 0x0001
27412676
#define SEM_NOOPENFILEERRORBOX 0x8000
@@ -2790,16 +2725,6 @@ CreateFileMappingW(
27902725
#define FILE_MAP_ALL_ACCESS SECTION_ALL_ACCESS
27912726
#define FILE_MAP_COPY SECTION_QUERY
27922727

2793-
PALIMPORT
2794-
HANDLE
2795-
PALAPI
2796-
OpenFileMappingW(
2797-
IN DWORD dwDesiredAccess,
2798-
IN BOOL bInheritHandle,
2799-
IN LPCWSTR lpName);
2800-
2801-
#define OpenFileMapping OpenFileMappingW
2802-
28032728
typedef INT_PTR (PALAPI_NOEXPORT *FARPROC)();
28042729

28052730
PALIMPORT
@@ -3989,16 +3914,6 @@ PALAPI
39893914
GetSystemInfo(
39903915
OUT LPSYSTEM_INFO lpSystemInfo);
39913916

3992-
PALIMPORT
3993-
BOOL
3994-
PALAPI
3995-
CreatePipe(
3996-
OUT PHANDLE hReadPipe,
3997-
OUT PHANDLE hWritePipe,
3998-
IN LPSECURITY_ATTRIBUTES lpPipeAttributes,
3999-
IN DWORD nSize
4000-
);
4001-
40023917
//
40033918
// NUMA related APIs
40043919
//
@@ -4217,6 +4132,7 @@ PALIMPORT int __cdecl iswspace(wint_t);
42174132
PALIMPORT int __cdecl iswxdigit(wint_t);
42184133
PALIMPORT wint_t __cdecl towupper(wint_t);
42194134
PALIMPORT wint_t __cdecl towlower(wint_t);
4135+
PALIMPORT int remove(const char*);
42204136
#endif // PAL_STDCPP_COMPAT
42214137

42224138
/* _TRUNCATE */
@@ -4488,8 +4404,6 @@ PALIMPORT int __cdecl PAL_ferror(PAL_FILE *);
44884404
PALIMPORT PAL_FILE * __cdecl PAL_fopen(const char *, const char *);
44894405
PALIMPORT int __cdecl PAL_setvbuf(PAL_FILE *stream, char *, int, size_t);
44904406

4491-
PALIMPORT int __cdecl _getw(PAL_FILE *);
4492-
PALIMPORT int __cdecl _putw(int, PAL_FILE *);
44934407
PALIMPORT PAL_FILE * __cdecl _fdopen(int, const char *);
44944408
PALIMPORT PAL_FILE * __cdecl _wfopen(const WCHAR *, const WCHAR *);
44954409

@@ -4529,7 +4443,6 @@ PALIMPORT DLLEXPORT int * __cdecl PAL_errno(int caller);
45294443
#endif // PAL_STDCPP_COMPAT
45304444

45314445
PALIMPORT DLLEXPORT char * __cdecl getenv(const char *);
4532-
PALIMPORT DLLEXPORT int __cdecl _putenv(const char *);
45334446

45344447
#define ERANGE 34
45354448

src/coreclr/pal/inc/palprivate.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ PALAPI
3535
DeleteFileA(
3636
IN LPCSTR lpFileName);
3737

38-
PALIMPORT
39-
BOOL
40-
PALAPI
41-
MoveFileExA(
42-
IN LPCSTR lpExistingFileName,
43-
IN LPCSTR lpNewFileName,
44-
IN DWORD dwFlags);
45-
4638
PALIMPORT
4739
BOOL
4840
PALAPI
@@ -116,13 +108,6 @@ GetTempPathA(
116108
IN DWORD nBufferLength,
117109
OUT LPSTR lpBuffer);
118110

119-
PALIMPORT
120-
DWORD
121-
PALAPI
122-
GetCurrentDirectoryA(
123-
IN DWORD nBufferLength,
124-
OUT LPSTR lpBuffer);
125-
126111
PALIMPORT
127112
BOOL
128113
PALAPI
@@ -193,15 +178,6 @@ CompareFileTime(
193178
IN CONST FILETIME *lpFileTime1,
194179
IN CONST FILETIME *lpFileTime2);
195180

196-
/* These are from the <FCNTL.H> file in windows.
197-
They are needed for _open_osfhandle.*/
198-
#define _O_RDONLY 0x0000
199-
#define _O_APPEND 0x0008
200-
#define _O_TEXT 0x4000
201-
#define _O_BINARY 0x8000
202-
203-
PALIMPORT int __cdecl _open_osfhandle(INT_PTR, int);
204-
205181
#ifdef __cplusplus
206182
}
207183
#endif

0 commit comments

Comments
 (0)