From cb73944d6d159bd02adc29f0588b97f0f76da1a1 Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Mon, 29 Jan 2018 21:11:10 +0100 Subject: Perform PhysicalMemoryLimit check for workstation GC, refactor GetLargestOnDieCacheSize into GetCacheSizePerLogicalCpu (#15975) * refactor: combine GetLargestOnDieCacheSize and GetLogicalCpuCount in GetCacheSizePerLogicalCpu * Perform PhysicalMemoryLimit check also for workstation GC --- src/vm/amd64/cgenamd64.cpp | 83 ---------------------------------------------- 1 file changed, 83 deletions(-) (limited to 'src/vm/amd64') diff --git a/src/vm/amd64/cgenamd64.cpp b/src/vm/amd64/cgenamd64.cpp index 6075134943..56e3bfa738 100644 --- a/src/vm/amd64/cgenamd64.cpp +++ b/src/vm/amd64/cgenamd64.cpp @@ -458,89 +458,6 @@ BOOL GetAnyThunkTarget (CONTEXT *pctx, TADDR *pTarget, TADDR *pTargetMethodDesc) // determine the number of logical cpus, or the machine is not populated uniformly with the same // type of processors, this function returns 1. -extern "C" DWORD __stdcall getcpuid(DWORD arg, unsigned char result[16]); - -// fix this if/when AMD does multicore or SMT -DWORD GetLogicalCpuCount() -{ - // No CONTRACT possible because GetLogicalCpuCount uses SEH - - STATIC_CONTRACT_THROWS; - STATIC_CONTRACT_GC_NOTRIGGER; - - static DWORD val = 0; - - // cache value for later re-use - if (val) - { - return val; - } - - struct Param : DefaultCatchFilterParam - { - DWORD retVal; - } param; - param.pv = COMPLUS_EXCEPTION_EXECUTE_HANDLER; - param.retVal = 1; - - PAL_TRY(Param *, pParam, ¶m) - { - - unsigned char buffer[16]; - DWORD maxCpuId = getcpuid(0, buffer); - DWORD* dwBuffer = (DWORD*)buffer; - - if (maxCpuId < 1) - goto qExit; - - if (dwBuffer[1] == 'uneG') { - if (dwBuffer[3] == 'Ieni') { - if (dwBuffer[2] == 'letn') { // get SMT/multicore enumeration for Intel EM64T - - - // TODO: Currently GetLogicalCpuCountFromOS() and GetLogicalCpuCountFallback() are broken on - // multi-core processor, but we never call into those two functions since we don't halve the - // gen0size when it's prescott and above processor. We keep the old version here for earlier - // generation system(Northwood based), perf data suggests on those systems, halve gen0 size - // still boost the performance(ex:Biztalk boosts about 17%). So on earlier systems(Northwood) - // based, we still go ahead and halve gen0 size. The logic in GetLogicalCpuCountFromOS() - // and GetLogicalCpuCountFallback() works fine for those earlier generation systems. - // If it's a Prescott and above processor or Multi-core, perf data suggests not to halve gen0 - // size at all gives us overall better performance. - // This is going to be fixed with a new version in orcas time frame. - - if( (maxCpuId > 3) && (maxCpuId < 0x80000000) ) - goto qExit; - - val = GetLogicalCpuCountFromOS(); //try to obtain HT enumeration from OS API - if (val ) - { - pParam->retVal = val; // OS API HT enumeration successful, we are Done - goto qExit; - } - - val = GetLogicalCpuCountFallback(); // Fallback to HT enumeration using CPUID - if( val ) - pParam->retVal = val; - } - } - } -qExit: ; - } - - PAL_EXCEPT_FILTER(DefaultCatchFilter) - { - } - PAL_ENDTRY - - if (val == 0) - { - val = param.retVal; - } - - return param.retVal; -} - void EncodeLoadAndJumpThunk (LPBYTE pBuffer, LPVOID pv, LPVOID pTarget) { CONTRACTL -- cgit v1.2.3