From: Jan Kotas Date: Tue, 11 Jun 2019 20:18:03 +0000 (-0700) Subject: Delete dead code (#25066) X-Git-Tag: accepted/tizen/unified/20190813.215958~40^2~200 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=beeae6da7c1f35fa335868521e1de21a2403eff4;p=platform%2Fupstream%2Fcoreclr.git Delete dead code (#25066) --- diff --git a/src/ToolBox/superpmi/superpmi-shared/coreclrcommoncallbacks.h b/src/ToolBox/superpmi/superpmi-shared/coreclrcommoncallbacks.h index 674268d..3d5a4dc 100644 --- a/src/ToolBox/superpmi/superpmi-shared/coreclrcommoncallbacks.h +++ b/src/ToolBox/superpmi/superpmi-shared/coreclrcommoncallbacks.h @@ -10,6 +10,5 @@ IExecutionEngine* STDMETHODCALLTYPE IEE_t(); HRESULT STDMETHODCALLTYPE GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer, DWORD* pdwlength); -void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName); #endif diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/coreclrcallbacks.cpp b/src/ToolBox/superpmi/superpmi-shim-collector/coreclrcallbacks.cpp index 759e671..0d79ce7 100644 --- a/src/ToolBox/superpmi/superpmi-shim-collector/coreclrcallbacks.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-collector/coreclrcallbacks.cpp @@ -15,8 +15,3 @@ IExecutionEngine* STDMETHODCALLTYPE IEE_t() iee->original_IEE = original_CoreClrCallbacks->m_pfnIEE(); return iee; } - -void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName) -{ - return original_CoreClrCallbacks->m_pfnGetCLRFunction(functionName); -} diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp b/src/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp index 71d0e49..cad8ac1 100644 --- a/src/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp @@ -211,14 +211,12 @@ extern "C" DLLEXPORT void __stdcall sxsJitStartup(CoreClrCallbacks const& origin original_CoreClrCallbacks->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR; original_CoreClrCallbacks->m_pfnIEE = original_cccallbacks.m_pfnIEE; original_CoreClrCallbacks->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory; - original_CoreClrCallbacks->m_pfnGetCLRFunction = original_cccallbacks.m_pfnGetCLRFunction; CoreClrCallbacks* temp = new CoreClrCallbacks(); temp->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR; temp->m_pfnIEE = IEE_t; temp->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory; - temp->m_pfnGetCLRFunction = GetCLRFunction; pnsxsJitStartup(*temp); } diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.cpp index c5ef402..0d79ce7 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.cpp @@ -15,16 +15,3 @@ IExecutionEngine* STDMETHODCALLTYPE IEE_t() iee->original_IEE = original_CoreClrCallbacks->m_pfnIEE(); return iee; } - -/*#pragma warning( suppress :4996 ) //deprecated -HRESULT STDMETHODCALLTYPE GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer, DWORD* pdwlength) -{ - DebugBreakorAV(131); - return 0; -} -*/ - -void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName) -{ - return original_CoreClrCallbacks->m_pfnGetCLRFunction(functionName); -} diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp index 65ec724..37fe725 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp @@ -207,14 +207,12 @@ extern "C" DLLEXPORT void __stdcall sxsJitStartup(CoreClrCallbacks const& origin original_CoreClrCallbacks->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR; original_CoreClrCallbacks->m_pfnIEE = original_cccallbacks.m_pfnIEE; original_CoreClrCallbacks->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory; - original_CoreClrCallbacks->m_pfnGetCLRFunction = original_cccallbacks.m_pfnGetCLRFunction; CoreClrCallbacks* temp = new CoreClrCallbacks(); temp->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR; temp->m_pfnIEE = IEE_t; temp->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory; - temp->m_pfnGetCLRFunction = GetCLRFunction; pnsxsJitStartup(*temp); } diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/coreclrcallbacks.cpp b/src/ToolBox/superpmi/superpmi-shim-simple/coreclrcallbacks.cpp index 759e671..0d79ce7 100644 --- a/src/ToolBox/superpmi/superpmi-shim-simple/coreclrcallbacks.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-simple/coreclrcallbacks.cpp @@ -15,8 +15,3 @@ IExecutionEngine* STDMETHODCALLTYPE IEE_t() iee->original_IEE = original_CoreClrCallbacks->m_pfnIEE(); return iee; } - -void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName) -{ - return original_CoreClrCallbacks->m_pfnGetCLRFunction(functionName); -} diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp b/src/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp index 60fa17d..897880a 100644 --- a/src/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp @@ -182,14 +182,12 @@ extern "C" DLLEXPORT void __stdcall sxsJitStartup(CoreClrCallbacks const& origin original_CoreClrCallbacks->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR; original_CoreClrCallbacks->m_pfnIEE = original_cccallbacks.m_pfnIEE; original_CoreClrCallbacks->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory; - original_CoreClrCallbacks->m_pfnGetCLRFunction = original_cccallbacks.m_pfnGetCLRFunction; CoreClrCallbacks* temp = new CoreClrCallbacks(); temp->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR; temp->m_pfnIEE = IEE_t; temp->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory; - temp->m_pfnGetCLRFunction = GetCLRFunction; pnsxsJitStartup(*temp); } diff --git a/src/ToolBox/superpmi/superpmi/coreclrcallbacks.cpp b/src/ToolBox/superpmi/superpmi/coreclrcallbacks.cpp index 15af7c8..8727bd7 100644 --- a/src/ToolBox/superpmi/superpmi/coreclrcallbacks.cpp +++ b/src/ToolBox/superpmi/superpmi/coreclrcallbacks.cpp @@ -24,12 +24,6 @@ HRESULT STDMETHODCALLTYPE GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer, HANDLE ourHeap = nullptr; -void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName) -{ - DebugBreakorAV(132); - return nullptr; -} - CoreClrCallbacks* InitCoreClrCallbacks() { CoreClrCallbacks* temp = new CoreClrCallbacks(); @@ -38,7 +32,6 @@ CoreClrCallbacks* InitCoreClrCallbacks() temp->m_hmodCoreCLR = (HINSTANCE)(size_t)0xbadbad01; // any non-null value seems okay... temp->m_pfnIEE = IEE_t; temp->m_pfnGetCORSystemDirectory = nullptr; // GetCORSystemDirectory; - temp->m_pfnGetCLRFunction = GetCLRFunction; return temp; } diff --git a/src/debug/daccess/daccess.cpp b/src/debug/daccess/daccess.cpp index 3985ed2..3b0eb7e 100644 --- a/src/debug/daccess/daccess.cpp +++ b/src/debug/daccess/daccess.cpp @@ -5617,7 +5617,6 @@ ClrDataAccess::Initialize(void) cccallbacks.m_hmodCoreCLR = (HINSTANCE)m_globalBase; // Base address of the runtime in the target process cccallbacks.m_pfnIEE = NULL; cccallbacks.m_pfnGetCORSystemDirectory = NULL; - cccallbacks.m_pfnGetCLRFunction = NULL; InitUtilcode(cccallbacks); return S_OK; diff --git a/src/debug/di/rsmain.cpp b/src/debug/di/rsmain.cpp index 887cc33..b48715c 100644 --- a/src/debug/di/rsmain.cpp +++ b/src/debug/di/rsmain.cpp @@ -1435,7 +1435,6 @@ HRESULT Cordb::SetTargetCLR(HMODULE hmodTargetCLR) cccallbacks.m_hmodCoreCLR = hmodTargetCLR; cccallbacks.m_pfnIEE = NULL; cccallbacks.m_pfnGetCORSystemDirectory = NULL; - cccallbacks.m_pfnGetCLRFunction = NULL; InitUtilcode(cccallbacks); return S_OK; diff --git a/src/dlls/mscoree/mscoree.cpp b/src/dlls/mscoree/mscoree.cpp index 28a3ebe..a59fc9a 100644 --- a/src/dlls/mscoree/mscoree.cpp +++ b/src/dlls/mscoree/mscoree.cpp @@ -85,7 +85,6 @@ BOOL WINAPI CoreDllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved) cccallbacks.m_hmodCoreCLR = (HINSTANCE)hInstance; cccallbacks.m_pfnIEE = IEE; cccallbacks.m_pfnGetCORSystemDirectory = GetCORSystemDirectoryInternaL; - cccallbacks.m_pfnGetCLRFunction = GetCLRFunction; InitUtilcode(cccallbacks); if (!(result = _CRT_INIT(hInstance, dwReason, lpReserved))) diff --git a/src/inc/utilcode.h b/src/inc/utilcode.h index 8e866a0..1021a1d 100644 --- a/src/inc/utilcode.h +++ b/src/inc/utilcode.h @@ -4914,22 +4914,15 @@ BOOL IsIPInModule(HMODULE_TGT hModule, PCODE ip); // which in turn calls InitUtilcode. // // This structure collects all of the critical callback info passed in InitUtilcode(). -// Note that one of them is GetCLRFunction() which is itself a gofer for many other -// callbacks. If a callback fetch be safely deferred until we have TLS and stack probe -// functionality running, it should be added to that function rather than this structure. -// Things like IEE are here because that callback has to be set up before GetCLRFunction() -// can be safely called. //---------------------------------------------------------------------------------------- struct CoreClrCallbacks { typedef IExecutionEngine* (* pfnIEE_t)(); typedef HRESULT (* pfnGetCORSystemDirectory_t)(SString& pbuffer); - typedef void* (* pfnGetCLRFunction_t)(LPCSTR functionName); HINSTANCE m_hmodCoreCLR; pfnIEE_t m_pfnIEE; pfnGetCORSystemDirectory_t m_pfnGetCORSystemDirectory; - pfnGetCLRFunction_t m_pfnGetCLRFunction; }; @@ -5317,8 +5310,4 @@ struct SpinConstants extern SpinConstants g_SpinConstants; -// ====================================================================================== - -void* GetCLRFunction(LPCSTR FunctionName); - #endif // __UtilCode_h__ diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp index aab397e..eb70175 100644 --- a/src/vm/appdomain.cpp +++ b/src/vm/appdomain.cpp @@ -5492,14 +5492,6 @@ BOOL AppDomain::OnUnhandledException(OBJECTREF *pThrowable, BOOL isTerminating/* return retVal; } -static LONG s_ProcessedExitProcessEventCount = 0; - -LONG GetProcessedExitProcessEventCount() -{ - LIMITED_METHOD_CONTRACT; - return s_ProcessedExitProcessEventCount; -} - void AppDomain::RaiseExitProcessEvent() { if (!g_fEEStarted) @@ -6236,11 +6228,6 @@ AppDomain::RaiseAssemblyResolveEvent( RETURN pAssembly; } // AppDomain::RaiseAssemblyResolveEvent - -ULONGLONG g_ObjFinalizeStartTime = 0; -Volatile g_FinalizerIsRunning = FALSE; -Volatile g_FinalizerLoopCount = 0; - enum WorkType { WT_UnloadDomain = 0x1, diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp index e621de7..19f02f1 100644 --- a/src/vm/ceemain.cpp +++ b/src/vm/ceemain.cpp @@ -897,7 +897,6 @@ void EEStartupHelper(COINITIEE fFlags) #endif // FEATURE_COMINTEROP StubHelpers::Init(); - NDirect::Init(); // Before setting up the execution manager initialize the first part // of the JIT helpers. diff --git a/src/vm/dllimport.cpp b/src/vm/dllimport.cpp index aca871d..d5a7933 100644 --- a/src/vm/dllimport.cpp +++ b/src/vm/dllimport.cpp @@ -3035,7 +3035,7 @@ BOOL HeuristicDoesThisLookLikeAGetLastErrorCall(LPBYTE pTarget) if (!pGetLastError) { // No need to use a holder here, since no cleanup is necessary. - HMODULE hMod = CLRGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W); + HMODULE hMod = WszGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W); if (hMod) { pGetLastError = (LPBYTE)GetProcAddress(hMod, "GetLastError"); @@ -5918,11 +5918,7 @@ static NATIVE_LIBRARY_HANDLE LocalLoadLibraryHelper( LPCWSTR name, DWORD flags, #ifndef FEATURE_PAL - if ((flags & 0xFFFFFF00) != 0 -#ifndef FEATURE_CORESYSTEM - && NDirect::SecureLoadLibrarySupported() -#endif // !FEATURE_CORESYSTEM - ) + if ((flags & 0xFFFFFF00) != 0) { hmod = CLRLoadLibraryEx(name, NULL, flags & 0xFFFFFF00); if (hmod != NULL) @@ -5952,10 +5948,6 @@ static NATIVE_LIBRARY_HANDLE LocalLoadLibraryHelper( LPCWSTR name, DWORD flags, return hmod; } -#if !defined(FEATURE_PAL) -bool NDirect::s_fSecureLoadLibrarySupported = false; -#endif - #define TOLOWER(a) (((a) >= W('A') && (a) <= W('Z')) ? (W('a') + (a - W('A'))) : (a)) #define TOHEX(a) ((a)>=10 ? W('a')+(a)-10 : W('0')+(a)) @@ -6766,35 +6758,6 @@ VOID NDirect::NDirectLink(NDirectMethodDesc *pMD) } } - -//--------------------------------------------------------- -// One-time init -//--------------------------------------------------------- -/*static*/ void NDirect::Init() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); - } - CONTRACTL_END; - -#if !defined(FEATURE_PAL) - // Check if the OS supports the new secure LoadLibraryEx flags introduced in KB2533623 - HMODULE hMod = CLRGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W); - _ASSERTE(hMod != NULL); - - if (GetProcAddress(hMod, "AddDllDirectory") != NULL) - { - // The AddDllDirectory export was added in KB2533623 together with the new flag support - s_fSecureLoadLibrarySupported = true; - } -#endif // !FEATURE_PAL -} - - //========================================================================== // This function is reached only via NDirectImportThunk. It's purpose // is to ensure that the target DLL is fully loaded and ready to run. diff --git a/src/vm/dllimport.h b/src/vm/dllimport.h index 4e3b862..740a5e5 100644 --- a/src/vm/dllimport.h +++ b/src/vm/dllimport.h @@ -60,11 +60,6 @@ class NDirect public: //--------------------------------------------------------- - // One-time init - //--------------------------------------------------------- - static void Init(); - - //--------------------------------------------------------- // Does a class or method have a NAT_L CustomAttribute? // // S_OK = yes @@ -129,18 +124,6 @@ private: static NATIVE_LIBRARY_HANDLE LoadLibraryModuleViaCallback(NDirectMethodDesc * pMD, LPCWSTR wszLibName); static NATIVE_LIBRARY_HANDLE LoadLibraryModuleBySearch(NDirectMethodDesc * pMD, LoadLibErrorTracker * pErrorTracker, LPCWSTR wszLibName); static NATIVE_LIBRARY_HANDLE LoadLibraryModuleBySearch(Assembly *callingAssembly, BOOL searchAssemblyDirectory, DWORD dllImportSearchPathFlags, LoadLibErrorTracker * pErrorTracker, LPCWSTR wszLibName); - -#if !defined(FEATURE_PAL) - // Indicates if the OS supports the new secure LoadLibraryEx flags introduced in KB2533623 - static bool s_fSecureLoadLibrarySupported; - -public: - static bool SecureLoadLibrarySupported() - { - LIMITED_METHOD_CONTRACT; - return s_fSecureLoadLibrarySupported; - } -#endif // !FEATURE_PAL }; //---------------------------------------------------------------- diff --git a/src/vm/finalizerthread.cpp b/src/vm/finalizerthread.cpp index 46b4f22..259544a 100644 --- a/src/vm/finalizerthread.cpp +++ b/src/vm/finalizerthread.cpp @@ -105,28 +105,8 @@ void FinalizerThread::DoOneFinalization(Object* fobj, Thread* pThread) STATIC_CONTRACT_GC_TRIGGERS; STATIC_CONTRACT_MODE_COOPERATIVE; - class ResetFinalizerStartTime - { - public: - ResetFinalizerStartTime() - { - if (CLRHosted()) - { - g_ObjFinalizeStartTime = CLRGetTickCount64(); - } - } - ~ResetFinalizerStartTime() - { - if (g_ObjFinalizeStartTime) - { - g_ObjFinalizeStartTime = 0; - } - } - }; - { - ResetFinalizerStartTime resetTime; - CallFinalizer(fobj); - } + CallFinalizer(fobj); + pThread->InternalReset(); } @@ -365,22 +345,16 @@ VOID FinalizerThread::FinalizerThreadWorker(void *args) { GetFinalizerThread()->EEResetAbort(Thread::TAR_ALL); } - FastInterlockExchange ((LONG*)&g_FinalizerIsRunning, TRUE); FinalizeAllObjects(0); _ASSERTE(GetFinalizerThread()->GetDomain()->IsDefaultDomain()); - FastInterlockExchange ((LONG*)&g_FinalizerIsRunning, FALSE); // We may still have the finalizer thread for abort. If so the abort request is for previous finalizer method, not for next one. if (GetFinalizerThread()->IsAbortRequested()) { GetFinalizerThread()->EEResetAbort(Thread::TAR_ALL); } - // Increment the loop count. This is currently used by the AddMemoryPressure heuristic to see - // if finalizers have run since the last time it triggered GC. - FastInterlockIncrement((LONG *)&g_FinalizerLoopCount); - // Anyone waiting to drain the Q can now wake up. Note that there is a // race in that another thread starting a drain, as we leave a drain, may // consider itself satisfied by the drain that just completed. This is diff --git a/src/vm/util.cpp b/src/vm/util.cpp index 2b2bb23..ba49458 100644 --- a/src/vm/util.cpp +++ b/src/vm/util.cpp @@ -1832,39 +1832,6 @@ size_t GetCacheSizePerLogicalCpu(BOOL bTrueSize) else return maxSize; } - -//--------------------------------------------------------------------- - -#ifndef FEATURE_PAL -HMODULE CLRGetModuleHandle(LPCWSTR lpModuleFileName) -{ - // Don't use dynamic contract: will override GetLastError value - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; - - HMODULE hMod = WszGetModuleHandle(lpModuleFileName); - return hMod; -} -#endif // !FEATURE_PAL - -void *GetCLRFunction(LPCSTR FunctionName) -{ - - void* func = NULL; - BEGIN_ENTRYPOINT_VOIDRET; - - LIMITED_METHOD_CONTRACT; - - { - _ASSERTE ("Unknown function name"); - func = NULL; - } - END_ENTRYPOINT_VOIDRET; - - return func; -} - #endif // CROSSGEN_COMPILE LPVOID diff --git a/src/vm/util.hpp b/src/vm/util.hpp index 61fe9ab..4b08b29 100644 --- a/src/vm/util.hpp +++ b/src/vm/util.hpp @@ -609,8 +609,6 @@ inline BOOL CLRHosted() } #ifndef FEATURE_PAL -HMODULE CLRGetModuleHandle(LPCWSTR lpModuleFileName); - HMODULE CLRLoadLibraryEx(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags); #endif // !FEATURE_PAL diff --git a/src/vm/vars.hpp b/src/vm/vars.hpp index 403e2f6..c841ca9 100644 --- a/src/vm/vars.hpp +++ b/src/vm/vars.hpp @@ -532,16 +532,11 @@ enum FWStatus }; EXTERN DWORD g_FinalizerWaiterStatus; -extern ULONGLONG g_ObjFinalizeStartTime; -extern Volatile g_FinalizerIsRunning; -extern Volatile g_FinalizerLoopCount; #if defined(FEATURE_PAL) && defined(FEATURE_EVENT_TRACE) extern Volatile g_TriggerHeapDump; #endif // FEATURE_PAL -extern LONG GetProcessedExitProcessEventCount(); - #ifndef DACCESS_COMPILE // // Allow use of native images?