Delete dead code (#25066)
authorJan Kotas <jkotas@microsoft.com>
Tue, 11 Jun 2019 20:18:03 +0000 (13:18 -0700)
committerGitHub <noreply@github.com>
Tue, 11 Jun 2019 20:18:03 +0000 (13:18 -0700)
20 files changed:
src/ToolBox/superpmi/superpmi-shared/coreclrcommoncallbacks.h
src/ToolBox/superpmi/superpmi-shim-collector/coreclrcallbacks.cpp
src/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp
src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.cpp
src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp
src/ToolBox/superpmi/superpmi-shim-simple/coreclrcallbacks.cpp
src/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp
src/ToolBox/superpmi/superpmi/coreclrcallbacks.cpp
src/debug/daccess/daccess.cpp
src/debug/di/rsmain.cpp
src/dlls/mscoree/mscoree.cpp
src/inc/utilcode.h
src/vm/appdomain.cpp
src/vm/ceemain.cpp
src/vm/dllimport.cpp
src/vm/dllimport.h
src/vm/finalizerthread.cpp
src/vm/util.cpp
src/vm/util.hpp
src/vm/vars.hpp

index 674268d..3d5a4dc 100644 (file)
@@ -10,6 +10,5 @@
 
 IExecutionEngine* STDMETHODCALLTYPE IEE_t();
 HRESULT STDMETHODCALLTYPE GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer, DWORD* pdwlength);
-void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName);
 
 #endif
index 759e671..0d79ce7 100644 (file)
@@ -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);
-}
index 71d0e49..cad8ac1 100644 (file)
@@ -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);
     }
index c5ef402..0d79ce7 100644 (file)
@@ -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);
-}
index 65ec724..37fe725 100644 (file)
@@ -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);
     }
index 759e671..0d79ce7 100644 (file)
@@ -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);
-}
index 60fa17d..897880a 100644 (file)
@@ -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);
     }
index 15af7c8..8727bd7 100644 (file)
@@ -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;
 }
index 3985ed2..3b0eb7e 100644 (file)
@@ -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;
index 887cc33..b48715c 100644 (file)
@@ -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;
index 28a3ebe..a59fc9a 100644 (file)
@@ -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)))
index 8e866a0..1021a1d 100644 (file)
@@ -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__
index aab397e..eb70175 100644 (file)
@@ -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<BOOL> g_FinalizerIsRunning = FALSE;
-Volatile<ULONG> g_FinalizerLoopCount = 0;
-
 enum WorkType
 {
     WT_UnloadDomain = 0x1,
index e621de7..19f02f1 100644 (file)
@@ -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.
index aca871d..d5a7933 100644 (file)
@@ -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.
index 4e3b862..740a5e5 100644 (file)
@@ -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
 };
 
 //----------------------------------------------------------------
index 46b4f22..259544a 100644 (file)
@@ -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
index 2b2bb23..ba49458 100644 (file)
@@ -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
index 61fe9ab..4b08b29 100644 (file)
@@ -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
 
index 403e2f6..c841ca9 100644 (file)
@@ -532,16 +532,11 @@ enum FWStatus
 };
 
 EXTERN DWORD g_FinalizerWaiterStatus;
-extern ULONGLONG g_ObjFinalizeStartTime;
-extern Volatile<BOOL> g_FinalizerIsRunning;
-extern Volatile<ULONG> g_FinalizerLoopCount;
 
 #if defined(FEATURE_PAL) && defined(FEATURE_EVENT_TRACE)
 extern Volatile<BOOL> g_TriggerHeapDump;
 #endif // FEATURE_PAL
 
-extern LONG GetProcessedExitProcessEventCount();
-
 #ifndef DACCESS_COMPILE
 //
 // Allow use of native images?