Skip to content

Commit

Permalink
Revert "Revert "Reduce CoreCLR PAL"" (#76972)
Browse files Browse the repository at this point in the history
* Revert "Revert "Reduce CoreCLR PAL (#76832)" (#76860)"

This reverts commit 744fc9b.

* Put back the _putenv since it is used by Mono
  • Loading branch information
janvorli authored Oct 13, 2022
1 parent e514819 commit e6f3aa9
Show file tree
Hide file tree
Showing 78 changed files with 115 additions and 6,427 deletions.
3 changes: 0 additions & 3 deletions src/coreclr/dlls/mscordac/mscordac_unixexports.src
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ nativeStringResourceTable_mscorrc
#CloseHandle
#DebugBreak
#DeleteCriticalSection
#DeleteFileW
#DuplicateHandle
#EnterCriticalSection
#FindClose
Expand All @@ -112,7 +111,6 @@ nativeStringResourceTable_mscorrc
#FreeLibrary
#FileTimeToSystemTime
#GetACP
#GetCurrentDirectoryW
#GetCurrentProcess
#GetCurrentProcessId
#GetCurrentThreadId
Expand Down Expand Up @@ -141,7 +139,6 @@ nativeStringResourceTable_mscorrc
#LoadLibraryExW
#MapViewOfFile
#MapViewOfFileEx
#MoveFileExW
#MultiByteToWideChar
#OpenProcess
#OutputDebugStringW
Expand Down
12 changes: 10 additions & 2 deletions src/coreclr/ilasm/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -846,8 +846,16 @@ extern "C" int _cdecl wmain(int argc, _In_ WCHAR **argv)
*pc = W('.');
}
wcscpy_s(pc+1,4,W("PDB"));
#undef DeleteFileW
DeleteFileW(wzOutputFilename);

#ifdef TARGET_WINDOWS
_wremove(wzOutputFilename);
#else
MAKE_UTF8PTR_FROMWIDE_NOTHROW(szOutputFilename, wzOutputFilename);
if (szOutputFilename != NULL)
{
remove(szOutputFilename);
}
#endif
}
if (exitval == 0)
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/inc/clrconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_DisableStarvationDetection, W("Thre
RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_DebugBreakOnWorkerStarvation, W("ThreadPool_DebugBreakOnWorkerStarvation"), 0, "Breaks into the debugger if the ThreadPool detects work queue starvation")
RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_EnableWorkerTracking, W("ThreadPool_EnableWorkerTracking"), 0, "Enables extra expensive tracking of how many workers threads are working simultaneously")
#ifdef TARGET_ARM64
// Spinning scheme is currently different on ARM64, see CLRLifoSemaphore::Wait(DWORD, UINT32, UINT32)
// Spinning scheme is currently different on ARM64
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")
#else // !TARGET_ARM64
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")
Expand Down
8 changes: 0 additions & 8 deletions src/coreclr/inc/holder.h
Original file line number Diff line number Diff line change
Expand Up @@ -1144,14 +1144,6 @@ typedef Wrapper<HANDLE, DoNothing<HANDLE>, VoidFindClose, (UINT_PTR) -1> FindHan

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

#ifdef WszDeleteFile
// Deletes a file with the specified path. Do not use if you care about failures
// deleting the file, as failures are ignored by VoidDeleteFile.
FORCEINLINE void VoidDeleteFile(LPCWSTR wszFilePath) { WszDeleteFile(wszFilePath); }
typedef Wrapper<LPCWSTR, DoNothing<LPCWSTR>, VoidDeleteFile, NULL> DeleteFileHolder;
#endif // WszDeleteFile


//-----------------------------------------------------------------------------
// Misc holders
//-----------------------------------------------------------------------------
Expand Down
8 changes: 0 additions & 8 deletions src/coreclr/inc/longfilepathwrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ GetFileAttributesExWrapper(
_In_ GET_FILEEX_INFO_LEVELS fInfoLevelId,
_Out_writes_bytes_(sizeof(WIN32_FILE_ATTRIBUTE_DATA)) LPVOID lpFileInformation
);
BOOL
DeleteFileWrapper(
_In_ LPCWSTR lpFileName
);

#ifndef HOST_UNIX
BOOL
Expand Down Expand Up @@ -66,10 +62,6 @@ DWORD WINAPI GetTempPathWrapper(
SString& lpBuffer
);

DWORD WINAPI GetCurrentDirectoryWrapper(
SString& lpBuffer
);

DWORD
GetModuleFileNameWrapper(
_In_opt_ HMODULE hModule,
Expand Down
7 changes: 0 additions & 7 deletions src/coreclr/inc/winwrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
#undef OpenSemaphore
#undef CreateWaitableTimer
#undef CreateFileMapping
#undef OpenFileMapping
#undef LoadLibrary
#undef LoadLibraryEx
#undef GetModuleFileName
Expand All @@ -92,19 +91,16 @@
#undef GetSystemDirectory
#undef GetTempPath
#undef GetTempFileName
#undef GetCurrentDirectory
#undef GetFullPathName
#undef CreateFile
#undef GetFileAttributes
#undef GetFileAttributesEx
#undef DeleteFile
#undef FindFirstFileEx
#undef FindFirstFile
#undef FindNextFile
#undef CopyFile
#undef CopyFileEx
#undef MoveFile
#undef MoveFileEx
#undef CreateHardLink
#undef CreateNamedPipe
#undef WaitNamedPipe
Expand Down Expand Up @@ -143,7 +139,6 @@
#define WszOpenEvent OpenEventW
#define WszCreateWaitableTimer CreateWaitableTimerW
#define WszCreateFileMapping CreateFileMappingW
#define WszOpenFileMapping OpenFileMappingW
#define WszGetModuleHandle GetModuleHandleW
#define WszGetModuleHandleEx GetModuleHandleExW
#define WszGetCommandLine GetCommandLineW
Expand Down Expand Up @@ -201,13 +196,11 @@
#define WszCreateFile CreateFileWrapper
#define WszGetFileAttributes GetFileAttributesWrapper
#define WszGetFileAttributesEx GetFileAttributesExWrapper
#define WszDeleteFile DeleteFileWrapper

//Can not use extended syntax
#define WszGetFullPathName GetFullPathNameW

//Long Files will not work on these till redstone
#define WszGetCurrentDirectory GetCurrentDirectoryWrapper
#define WszGetTempPath GetTempPathWrapper

//APIS which have a buffer as an out parameter
Expand Down
88 changes: 1 addition & 87 deletions src/coreclr/pal/inc/pal.h
Original file line number Diff line number Diff line change
Expand Up @@ -672,35 +672,6 @@ CopyFileW(
#define CopyFile CopyFileA
#endif

PALIMPORT
BOOL
PALAPI
DeleteFileW(
IN LPCWSTR lpFileName);

#ifdef UNICODE
#define DeleteFile DeleteFileW
#else
#define DeleteFile DeleteFileA
#endif

#define MOVEFILE_REPLACE_EXISTING 0x00000001
#define MOVEFILE_COPY_ALLOWED 0x00000002

PALIMPORT
BOOL
PALAPI
MoveFileExW(
IN LPCWSTR lpExistingFileName,
IN LPCWSTR lpNewFileName,
IN DWORD dwFlags);

#ifdef UNICODE
#define MoveFileEx MoveFileExW
#else
#define MoveFileEx MoveFileExA
#endif

typedef struct _WIN32_FIND_DATAA {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
Expand Down Expand Up @@ -857,12 +828,6 @@ PALAPI
GetStdHandle(
IN DWORD nStdHandle);

PALIMPORT
BOOL
PALAPI
SetEndOfFile(
IN HANDLE hFile);

PALIMPORT
DWORD
PALAPI
Expand Down Expand Up @@ -988,19 +953,6 @@ GetTempPathA(
#define GetTempPath GetTempPathA
#endif

PALIMPORT
DWORD
PALAPI
GetCurrentDirectoryW(
IN DWORD nBufferLength,
OUT LPWSTR lpBuffer);

#ifdef UNICODE
#define GetCurrentDirectory GetCurrentDirectoryW
#else
#define GetCurrentDirectory GetCurrentDirectoryA
#endif

PALIMPORT
HANDLE
PALAPI
Expand Down Expand Up @@ -1123,11 +1075,6 @@ DWORD
PALAPI
GetCurrentProcessId();

PALIMPORT
DWORD
PALAPI
GetCurrentSessionId();

PALIMPORT
HANDLE
PALAPI
Expand Down Expand Up @@ -2601,16 +2548,6 @@ SetThreadPriority(
IN HANDLE hThread,
IN int nPriority);

PALIMPORT
BOOL
PALAPI
GetThreadTimes(
IN HANDLE hThread,
OUT LPFILETIME lpCreationTime,
OUT LPFILETIME lpExitTime,
OUT LPFILETIME lpKernelTime,
OUT LPFILETIME lpUserTime);

PALIMPORT
HRESULT
PALAPI
Expand Down Expand Up @@ -2733,9 +2670,7 @@ typedef struct _CRITICAL_SECTION {
PALIMPORT VOID PALAPI EnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
PALIMPORT VOID PALAPI LeaveCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
PALIMPORT VOID PALAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection);
PALIMPORT BOOL PALAPI InitializeCriticalSectionEx(LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount, DWORD Flags);
PALIMPORT VOID PALAPI DeleteCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
PALIMPORT BOOL PALAPI TryEnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);

#define SEM_FAILCRITICALERRORS 0x0001
#define SEM_NOOPENFILEERRORBOX 0x8000
Expand Down Expand Up @@ -2790,16 +2725,6 @@ CreateFileMappingW(
#define FILE_MAP_ALL_ACCESS SECTION_ALL_ACCESS
#define FILE_MAP_COPY SECTION_QUERY

PALIMPORT
HANDLE
PALAPI
OpenFileMappingW(
IN DWORD dwDesiredAccess,
IN BOOL bInheritHandle,
IN LPCWSTR lpName);

#define OpenFileMapping OpenFileMappingW

typedef INT_PTR (PALAPI_NOEXPORT *FARPROC)();

PALIMPORT
Expand Down Expand Up @@ -3989,16 +3914,6 @@ PALAPI
GetSystemInfo(
OUT LPSYSTEM_INFO lpSystemInfo);

PALIMPORT
BOOL
PALAPI
CreatePipe(
OUT PHANDLE hReadPipe,
OUT PHANDLE hWritePipe,
IN LPSECURITY_ATTRIBUTES lpPipeAttributes,
IN DWORD nSize
);

//
// NUMA related APIs
//
Expand Down Expand Up @@ -4217,6 +4132,7 @@ PALIMPORT int __cdecl iswspace(wint_t);
PALIMPORT int __cdecl iswxdigit(wint_t);
PALIMPORT wint_t __cdecl towupper(wint_t);
PALIMPORT wint_t __cdecl towlower(wint_t);
PALIMPORT int remove(const char*);
#endif // PAL_STDCPP_COMPAT

/* _TRUNCATE */
Expand Down Expand Up @@ -4488,8 +4404,6 @@ PALIMPORT int __cdecl PAL_ferror(PAL_FILE *);
PALIMPORT PAL_FILE * __cdecl PAL_fopen(const char *, const char *);
PALIMPORT int __cdecl PAL_setvbuf(PAL_FILE *stream, char *, int, size_t);

PALIMPORT int __cdecl _getw(PAL_FILE *);
PALIMPORT int __cdecl _putw(int, PAL_FILE *);
PALIMPORT PAL_FILE * __cdecl _fdopen(int, const char *);
PALIMPORT PAL_FILE * __cdecl _wfopen(const WCHAR *, const WCHAR *);

Expand Down
24 changes: 0 additions & 24 deletions src/coreclr/pal/inc/palprivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ PALAPI
DeleteFileA(
IN LPCSTR lpFileName);

PALIMPORT
BOOL
PALAPI
MoveFileExA(
IN LPCSTR lpExistingFileName,
IN LPCSTR lpNewFileName,
IN DWORD dwFlags);

PALIMPORT
BOOL
PALAPI
Expand Down Expand Up @@ -116,13 +108,6 @@ GetTempPathA(
IN DWORD nBufferLength,
OUT LPSTR lpBuffer);

PALIMPORT
DWORD
PALAPI
GetCurrentDirectoryA(
IN DWORD nBufferLength,
OUT LPSTR lpBuffer);

PALIMPORT
BOOL
PALAPI
Expand Down Expand Up @@ -193,15 +178,6 @@ CompareFileTime(
IN CONST FILETIME *lpFileTime1,
IN CONST FILETIME *lpFileTime2);

/* These are from the <FCNTL.H> file in windows.
They are needed for _open_osfhandle.*/
#define _O_RDONLY 0x0000
#define _O_APPEND 0x0008
#define _O_TEXT 0x4000
#define _O_BINARY 0x8000

PALIMPORT int __cdecl _open_osfhandle(INT_PTR, int);

#ifdef __cplusplus
}
#endif
Expand Down
Loading

0 comments on commit e6f3aa9

Please sign in to comment.