diff options
author | Matt Mitchell <mmitche@microsoft.com> | 2015-04-01 16:07:45 -0700 |
---|---|---|
committer | Matt Mitchell <mmitche@microsoft.com> | 2015-04-01 16:07:45 -0700 |
commit | 08fa669ea1857e5dfbda0fecb7adb85ee7acd1ed (patch) | |
tree | df4d6812ca52bc07e75c82750ef95a092ba4e356 | |
parent | 268f0a413d807a5edacf33a9e5f514c7b19f7104 (diff) | |
parent | 838807429a0828a839958e3b7d392d65886c8f2e (diff) | |
download | coreclr-08fa669ea1857e5dfbda0fecb7adb85ee7acd1ed.tar.gz coreclr-08fa669ea1857e5dfbda0fecb7adb85ee7acd1ed.tar.bz2 coreclr-08fa669ea1857e5dfbda0fecb7adb85ee7acd1ed.zip |
Merge branch 'master' into usage-exit-code
Conflicts:
build.cmd
69 files changed, 390 insertions, 434 deletions
diff --git a/.gitignore b/.gitignore index 9f49d1b3ee..5e66c59078 100644 --- a/.gitignore +++ b/.gitignore @@ -22,8 +22,6 @@ bld/ [Bb]in/ [Oo]bj/ msbuild.log -binaries -intermediates # Roslyn stuff *.sln.ide diff --git a/CMakeLists.txt b/CMakeLists.txt index 4db7946086..9b2786fab0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -264,26 +264,23 @@ add_definitions(-DDISABLE_CONTRACTS) add_compile_options(-ferror-limit=4096) # Disabled warnings -add_compile_options(-Wno-unknown-pragmas) add_compile_options(-Wno-unused-private-field) add_compile_options(-Wno-dangling-else) add_compile_options(-Wno-implicit-exception-spec-mismatch) -# Using the result of an assignment as a condition without parentheses -add_compile_options(-Wno-parentheses) +# A derived class defines a virtual method with the same name as its base +# class, but different set of parameters. add_compile_options(-Wno-overloaded-virtual) add_compile_options(-Wno-unused-variable) # Enum value is not handled in a switch (and there is no default clause) # Remaining cases are in JIT only add_compile_options(-Wno-switch) +# Explicit constructor calls are not supported by clang (this->ClassName::ClassName()) add_compile_options(-Wno-microsoft) # This warning is caused by comparing 'this' to NULL add_compile_options(-Wno-tautological-compare) +# There are constants of type BOOL used in a condition. But BOOL is defined as int +# and so the compiler thinks that there is a mistake. add_compile_options(-Wno-constant-logical-operand) -add_compile_options(-Wno-unused-function) -add_compile_options(-Wno-extra-tokens) -add_compile_options(-Wno-self-assign) -add_compile_options(-Wno-bitfield-constant-conversion) -add_compile_options(-Wno-unused-value) add_compile_options(-Wno-unknown-warning-option) @@ -331,6 +328,7 @@ endif (WIN32) if (CLR_CMAKE_PLATFORM_UNIX) add_definitions(-DPLATFORM_UNIX=1) add_definitions(-DFEATURE_PAL_SXS) + add_definitions(-DFEATURE_COREFX_GLOBALIZATION) if(IS_64BIT_BUILD) add_definitions(-DBIT64=1) @@ -3,7 +3,7 @@ setlocal EnableDelayedExpansion :: Set the default arguments for build set __BuildArch=x64 -set __BuildType=debug +set __BuildType=Debug set __BuildOS=Windows_NT :: Set the various build properties here so that CMake and MSBuild can pick them up @@ -13,7 +13,7 @@ if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%" set "__ProjectFilesDir=%__ProjectDir%" set "__SourceDir=%__ProjectDir%\src" set "__PackagesDir=%__ProjectDir%\packages" -set "__RootBinDir=%__ProjectDir%\binaries" +set "__RootBinDir=%__ProjectDir%\bin" set "__LogsDir=%__RootBinDir%\Logs" set __MSBCleanBuildArgs= @@ -22,12 +22,13 @@ if "%1" == "" goto ArgsDone if /i "%1" == "/?" goto Usage if /i "%1" == "x64" (set __BuildArch=x64&&shift&goto Arg_Loop) -if /i "%1" == "debug" (set __BuildType=debug&shift&goto Arg_Loop) -if /i "%1" == "release" (set __BuildType=release&shift&goto Arg_Loop) +if /i "%1" == "debug" (set __BuildType=Debug&shift&goto Arg_Loop) +if /i "%1" == "release" (set __BuildType=Release&shift&goto Arg_Loop) if /i "%1" == "clean" (set __CleanBuild=1&shift&goto Arg_Loop) -if /i "%1" == "unixmscorlib" (set __UnixMscorlibOnly=1&set __BuildOS=Unix&shift&goto Arg_Loop) +if /i "%1" == "linuxmscorlib" (set __MscorlibOnly=1&set __BuildOS=Linux&shift&goto Arg_Loop) +if /i "%1" == "osxmscorlib" (set __MscorlibOnly=1&set __BuildOS=OSX&shift&goto Arg_Loop) echo Invalid commandline argument: %1 goto Usage @@ -39,7 +40,7 @@ echo. :: Set the remaining variables based upon the determined build configuration set "__BinDir=%__RootBinDir%\Product\%__BuildOS%.%__BuildArch%.%__BuildType%" -set "__IntermediatesDir=%__RootBinDir%\intermediates\%__BuildOS%.%__BuildArch%.%__BuildType%" +set "__IntermediatesDir=%__RootBinDir%\obj\%__BuildOS%.%__BuildArch%.%__BuildType%" set "__PackagesBinDir=%__BinDir%\.nuget" set "__ToolsDir=%__RootBinDir%\tools" set "__TestBinDir=%__RootBinDir%\tests\%__BuildOS%.%__BuildArch%.%__BuildType%" @@ -64,8 +65,8 @@ if not exist "%__BinDir%" md "%__BinDir%" if not exist "%__IntermediatesDir%" md "%__IntermediatesDir%" if not exist "%__LogsDir%" md "%__LogsDir%" -:: CMake isn't a requirement when building unixmscorlib -if defined __UnixMscorlibOnly goto CheckVS +:: CMake isn't a requirement when building mscorlib only +if defined __MscorlibOnly goto CheckVS :CheckPrereqs :: Check prerequisites @@ -104,7 +105,7 @@ if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe. Please see h :: All set to commence the build setlocal -if defined __UnixMscorlibOnly goto PerformMScorlibBuild +if defined __MscorlibOnly goto PerformMScorlibBuild echo Commencing build of native components for %__BuildOS%.%__BuildArch%.%__BuildType% echo. @@ -153,7 +154,7 @@ set __AdditionalMSBuildArgs= rem Explicitly set Platform causes conflicts in mscorlib project files. Clear it to allow building from VS x64 Native Tools Command Prompt set Platform= -if defined __UnixMscorlibOnly set __AdditionalMSBuildArgs=/p:BuildNugetPackage=false +if defined __MscorlibOnly set __AdditionalMSBuildArgs=/p:BuildNugetPackage=false :: Set the environment for the managed build call "%VS120COMNTOOLS%\VsDevCmd.bat" @@ -162,7 +163,7 @@ echo. set "__MScorlibBuildLog=%__LogsDir%\MScorlib_%__BuildOS%__%__BuildArch%__%__BuildType%.log" %_msbuildexe% "%__ProjectFilesDir%\build.proj" %__MSBCleanBuildArgs% /nologo /maxcpucount /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=diag;LogFile="%__MScorlibBuildLog%" /p:OS=%__BuildOS% %__AdditionalMSBuildArgs% IF NOT ERRORLEVEL 1 ( - if defined __UnixMscorlibOnly goto :eof + if defined __MscorlibOnly goto :eof goto PerformTestBuild ) @@ -194,4 +195,6 @@ echo. echo BuildArch can be: x64 echo BuildType can be: Debug, Release echo Clean - optional argument to force a clean build. -exit /b 1
\ No newline at end of file +echo linuxmscorlib - Build mscorlib for Linux +echo osxmscorlib - Build mscorlib for OS X +exit /b 1 @@ -3,8 +3,8 @@ usage() { echo "Usage: $0 [BuildArch] [BuildType] [clean]" - echo "BuildArch can be: amd64" - echo "BuildType can be: debug, release" + echo "BuildArch can be: x64" + echo "BuildType can be: Debug, Release" echo "clean - optional argument to force a clean build." exit 1 @@ -96,35 +96,35 @@ __BuildArch=x64 OSName=$(uname -s) case $OSName in Linux) - __BuildOS=linux + __BuildOS=Linux ;; Darwin) - __BuildOS=mac + __BuildOS=OSX ;; FreeBSD) - __BuildOS=freebsd + __BuildOS=FreeBSD ;; OpenBSD) - __BuildOS=openbsd + __BuildOS=OpenBSD ;; *) echo "Unsupported OS $OSName detected, configuring as if for Linux" - __BuildOS=linux + __BuildOS=Linux ;; esac __MSBuildBuildArch=x64 -__BuildType=debug +__BuildType=Debug __CMakeArgs=DEBUG # Set the various build properties here so that CMake and MSBuild can pick them up __ProjectDir="$__ProjectRoot" __SourceDir="$__ProjectDir/src" __PackagesDir="$__ProjectDir/packages" -__RootBinDir="$__ProjectDir/binaries" +__RootBinDir="$__ProjectDir/bin" __LogsDir="$__RootBinDir/Logs" __UnprocessedBuildArgs= __MSBCleanBuildArgs= @@ -143,10 +143,10 @@ for i in "$@" __MSBuildBuildArch=x64 ;; debug) - __BuildType=debug + __BuildType=Debug ;; release) - __BuildType=release + __BuildType=Release __CMakeArgs=RELEASE ;; clean) @@ -162,7 +162,7 @@ __BinDir="$__RootBinDir/Product/$__BuildOS.$__BuildArch.$__BuildType" __PackagesBinDir="$__BinDir/.nuget" __ToolsDir="$__RootBinDir/tools" __TestWorkingDir="$__RootBinDir/tests/$__BuildOS.$__BuildArch.$__BuildType" -__IntermediatesDir="$__RootBinDir/intermediates/$__BuildOS.$__BuildArch.$__BuildType" +__IntermediatesDir="$__RootBinDir/obj/$__BuildOS.$__BuildArch.$__BuildType" # Specify path to be set for CMAKE_INSTALL_PREFIX. # This is where all built CoreClr libraries will copied to. diff --git a/clr.coreclr.props b/clr.coreclr.props index 59c3f0ce7b..da1b6816d3 100644 --- a/clr.coreclr.props +++ b/clr.coreclr.props @@ -94,7 +94,7 @@ <FeatureSvrGc Condition="'$(TargetArch)' != 'arm'">true</FeatureSvrGc> </PropertyGroup> - <PropertyGroup Condition="'$(OS)' == 'Unix'"> + <PropertyGroup Condition="'$(TargetsUnix)' == 'true'"> <FeaturePal>true</FeaturePal> <FeatureStubsAsIL>true</FeatureStubsAsIL> diff --git a/clr.defines.targets b/clr.defines.targets index b0c5c51b94..0a64d551be 100644 --- a/clr.defines.targets +++ b/clr.defines.targets @@ -219,6 +219,6 @@ <DefineConstants Condition="'$(FeatureWinDbAppCompat)' == 'true'">$(DefineConstants);FEATURE_WIN_DB_APPCOMPAT</DefineConstants> <DefineConstants Condition="'$(FeatureReadyToRun)' == 'true'">$(DefineConstants);FEATURE_READYTORUN</DefineConstants> - <DefineConstants Condition="'$(OS)' == 'Unix'">$(DefineConstants);PLATFORM_UNIX</DefineConstants> + <DefineConstants Condition="'$(TargetsUnix)' == 'true'">$(DefineConstants);PLATFORM_UNIX</DefineConstants> </PropertyGroup> </Project> @@ -24,7 +24,7 @@ <PackagesDir Condition="'$(__PackagesDir)'==''">$(ProjectDir)\packages\</PackagesDir> <RootBinDir>$(__RootBinDir)\</RootBinDir> - <RootBinDir Condition="'$(__RootBinDir)'==''">$(ProjectDir)\binaries\</RootBinDir> + <RootBinDir Condition="'$(__RootBinDir)'==''">$(ProjectDir)\bin\</RootBinDir> <BinDir>$(__BinDir)\</BinDir> <BinDir Condition="'$(__BinDir)'==''">$(RootBinDir)\Product\$(BuildOS).$(BuildArch).$(BuildType)\</BinDir> @@ -55,7 +55,15 @@ <NuSpecs Condition="'$(Configuration)'=='Debug'" Include="$(PackagesBinDir)\Microsoft.DotNet.CoreCLR.Debug.Development.nuspec" /> </ItemGroup> + <!-- Setup common target properties that we use to conditionally include sources --> + <PropertyGroup> + <TargetsWindows Condition="'$(BuildOS)' == 'Windows_NT'">true</TargetsWindows> + <TargetsLinux Condition="'$(BuildOS)' == 'Linux'">true</TargetsLinux> + <TargetsOSX Condition="'$(BuildOS)' == 'OSX'">true</TargetsOSX> + <TargetsUnix Condition="'$(TargetsLinux)' == 'true' or '$(TargetsOSX)' == 'true'">true</TargetsUnix> + </PropertyGroup> + <!-- Common NuGet properties --> <PropertyGroup> <NuGetToolPath>$(ToolsDir)NuGet.exe</NuGetToolPath> diff --git a/src/ToolBox/SOS/Strike/stressLogDump.cpp b/src/ToolBox/SOS/Strike/stressLogDump.cpp index 6d6d9241f6..1cd1e38dc9 100644 --- a/src/ToolBox/SOS/Strike/stressLogDump.cpp +++ b/src/ToolBox/SOS/Strike/stressLogDump.cpp @@ -249,7 +249,7 @@ void formatOutput(struct IDebugDataSpaces* memCallBack, __in FILE* file, __inout } } } - else if (*ptr == 's' || *ptr == 'h' && *(ptr+1) == 's' && ++ptr) + else if (*ptr == 's' || (*ptr == 'h' && *(ptr+1) == 's' && ++ptr)) { HRESULT hr; @@ -266,7 +266,7 @@ void formatOutput(struct IDebugDataSpaces* memCallBack, __in FILE* file, __inout args[iArgCount] = strBuf; } - else if (*ptr == 'S' || *ptr == 'l' && *(ptr+1) == 's' && ++ptr) + else if (*ptr == 'S' || (*ptr == 'l' && *(ptr+1) == 's' && ++ptr)) { HRESULT hr; diff --git a/src/ToolBox/SOS/Strike/util.h b/src/ToolBox/SOS/Strike/util.h index 9476b75446..6f88a7b141 100644 --- a/src/ToolBox/SOS/Strike/util.h +++ b/src/ToolBox/SOS/Strike/util.h @@ -1427,7 +1427,7 @@ DllsName( inline BOOL IsElementValueType (CorElementType cet) { - return cet >= ELEMENT_TYPE_BOOLEAN && cet <= ELEMENT_TYPE_R8 + return (cet >= ELEMENT_TYPE_BOOLEAN && cet <= ELEMENT_TYPE_R8) || cet == ELEMENT_TYPE_VALUETYPE || cet == ELEMENT_TYPE_I || cet == ELEMENT_TYPE_U; } diff --git a/src/binder/applicationcontext.cpp b/src/binder/applicationcontext.cpp index 8aadd409c0..d560a1d3d1 100644 --- a/src/binder/applicationcontext.cpp +++ b/src/binder/applicationcontext.cpp @@ -32,88 +32,6 @@ namespace BINDER_SPACE { - namespace - { - void CopyIntoBuffer(/* in */ SBuffer *pPropertyValue, - /* in */ LPVOID pvValue, - /* in */ DWORD cbValue) - { - _ASSERTE(pPropertyValue != NULL); - - BYTE *pRawBuffer = pPropertyValue->OpenRawBuffer(cbValue); - - memcpy(pRawBuffer, pvValue, cbValue); - pPropertyValue->CloseRawBuffer(); - } - - const void *GetRawBuffer(SBuffer *pPropertyValue) - { - _ASSERTE(pPropertyValue != NULL); - - // SBuffer provides const void *() operator - const void *pPropertyRawBuffer = *pPropertyValue; - - _ASSERTE(pPropertyRawBuffer != NULL); - _ASSERTE(pPropertyRawBuffer != pPropertyValue); - - return pPropertyRawBuffer; - } - - HRESULT CheckRequiredBufferSize(/* in */ SBuffer *pPropertyValue, - /* in */ LPVOID pvValue, - /* in, out */ LPDWORD pcbValue) - { - _ASSERTE(pPropertyValue != NULL); - - HRESULT hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - DWORD cbPropertySize = static_cast<DWORD>(pPropertyValue->GetSize()); - - if (pcbValue == NULL) - { - hr = E_INVALIDARG; - } - else if ((cbPropertySize <= *pcbValue) && (pvValue != NULL)) - { - *pcbValue = cbPropertySize; - hr = S_OK; - } - else - { - *pcbValue = cbPropertySize; - } - - return hr; - } - - HRESULT CopyTextPropertyIntoBuffer(/* in */ SBuffer *pPropertyValue, - /* out */ LPWSTR wzPropertyBuffer, - /* in, out */ DWORD *pdwPropertyBufferSize) - { - HRESULT hr = S_OK; - void *pvValue = static_cast<void *>(wzPropertyBuffer); - DWORD cbValue = *pdwPropertyBufferSize * sizeof(WCHAR); - - if ((hr = CheckRequiredBufferSize(pPropertyValue, pvValue, &cbValue)) == S_OK) - { - memcpy(pvValue, GetRawBuffer(pPropertyValue), cbValue); - } - - // Adjust byte size to character count - _ASSERTE(cbValue % sizeof(WCHAR) == 0); - *pdwPropertyBufferSize = cbValue / sizeof(WCHAR); - - return hr; - } - - BOOL EndsWithPathSeparator(/* in */ PathString &path) - { - SString winDirSeparor(SString::Literal, W("\\")); - SString unixDirSeparor(SString::Literal, W("/")); - - return (path.EndsWith(winDirSeparor) || path.EndsWith(unixDirSeparor)); - } - }; - STDMETHODIMP ApplicationContext::QueryInterface(REFIID riid, void **ppv) { @@ -407,8 +325,8 @@ namespace BINDER_SPACE // we encounter a native image. Since we don't touch IL in the presence of // native images, we replace the IL entry with the NI. // - if (pExistingEntry->m_wszILFileName != nullptr && !isNativeImage || - pExistingEntry->m_wszNIFileName != nullptr && isNativeImage) + if ((pExistingEntry->m_wszILFileName != nullptr && !isNativeImage) || + (pExistingEntry->m_wszNIFileName != nullptr && isNativeImage)) { BINDER_LOG_STRING(W("ApplicationContext::SetupBindingPaths: Skipping TPA entry because of already existing IL/NI entry for short name "), fileName.GetUnicode()); continue; diff --git a/src/binder/assemblybinder.cpp b/src/binder/assemblybinder.cpp index 308e1229df..89a3c0fb3f 100644 --- a/src/binder/assemblybinder.cpp +++ b/src/binder/assemblybinder.cpp @@ -469,66 +469,6 @@ namespace BINDER_SPACE Exit: return hr; } - - // Host assembly "equivalence" relation - HRESULT IsValidHostAssembly(AssemblyName *pProposedAssemblyName, - AssemblyName *pRequestedAssemblyName, - VersionMatchMode versionMatchMode, - BOOL fRequireHigherSV, - BOOL *pFIsValidHostAssembly) - { - HRESULT hr = S_OK; - - AssemblyVersion *pProposedVersion = pProposedAssemblyName->GetVersion(); - AssemblyVersion *pRequestedVersion = pRequestedAssemblyName->GetVersion(); - - if (pProposedVersion->IsEqualFeatureVersion(pRequestedVersion)) - { - if (fRequireHigherSV) - { - *pFIsValidHostAssembly = - pProposedVersion->IsLargerServiceVersion(pRequestedVersion); - } - else if (versionMatchMode == kVersionExact) - { - *pFIsValidHostAssembly = - pProposedVersion->IsEqualServiceVersion(pRequestedVersion); - } - else - { - *pFIsValidHostAssembly = - (pProposedVersion->IsLargerServiceVersion(pRequestedVersion) || - pProposedVersion->IsEqualServiceVersion(pRequestedVersion)); - } - } - else if ((versionMatchMode == kVersionFeatureRollForward) && - (pProposedVersion->IsLargerFeatureVersion(pRequestedVersion))) - { - *pFIsValidHostAssembly = TRUE; - } - else - { - *pFIsValidHostAssembly = FALSE; - } - - return hr; - } - - inline DWORD BindingStoreEnumToDWORD(INT32 kBindingStore) - { - switch (kBindingStore) - { - case 0: - return kBindingStoreGAC; - case 1: - return kBindingStoreManifest; - case 2: - return kBindingStoreHost; - default: - _ASSERTE(0); - return 0; - } - } }; /* static */ @@ -700,8 +640,7 @@ namespace BINDER_SPACE #ifdef FEATURE_VERSIONING_LOG hr = LogBindResult(pApplicationContext, hr, &bindResult); #else // FEATURE_VERSIONING_LOG - // Shut up GCC - hr = hr; + ; #endif // FEATURE_VERSIONING_LOG #ifndef CROSSGEN_COMPILE diff --git a/src/binder/textualidentityparser.cpp b/src/binder/textualidentityparser.cpp index e1ca4a53f5..2162629d93 100644 --- a/src/binder/textualidentityparser.cpp +++ b/src/binder/textualidentityparser.cpp @@ -189,19 +189,6 @@ namespace BINDER_SPACE return NULL; } - BOOL ValidateAndConvertContentType( - SString & ssContentType, - AssemblyContentType * pkContentType) - { - if (EqualsCaseInsensitive(ssContentType, W("WindowsRuntime"))) - { - *pkContentType = AssemblyContentType_WindowsRuntime; - return TRUE; - } - - return FALSE; - } - LPCWSTR ContentTypeToString(AssemblyContentType kContentType) { _ASSERTE(kContentType != AssemblyContentType_Default); diff --git a/src/binder/variables.cpp b/src/binder/variables.cpp index c2915244fc..b2c56550e1 100644 --- a/src/binder/variables.cpp +++ b/src/binder/variables.cpp @@ -19,6 +19,7 @@ namespace BINDER_SPACE { +#ifdef FEATURE_VERSIONING_LOG namespace { HRESULT CheckFileExistence(LPCWSTR pwzFile, LPDWORD pdwAttrib) @@ -51,6 +52,7 @@ namespace BINDER_SPACE return hr; } }; +#endif // FEATURE_VERSIONING_LOG Variables *g_BinderVariables = NULL; diff --git a/src/classlibnative/bcltype/decimal.cpp b/src/classlibnative/bcltype/decimal.cpp index c3fbc31251..ac1ffa59e1 100644 --- a/src/classlibnative/bcltype/decimal.cpp +++ b/src/classlibnative/bcltype/decimal.cpp @@ -335,10 +335,10 @@ int COMDecimal::NumberToDecimal(NUMBER* number, DECIMAL* value) } } else { if (e > DECIMAL_PRECISION) return 0; - while ((e > 0 || *p && e > -28) && - (DECIMAL_HI32(d) < 0x19999999 || DECIMAL_HI32(d) == 0x19999999 && - (DECIMAL_MID32(d) < 0x99999999 || DECIMAL_MID32(d) == 0x99999999 && - (DECIMAL_LO32(d) < 0x99999999 || DECIMAL_LO32(d) == 0x99999999 && *p <= '5')))) { + while ((e > 0 || (*p && e > -28)) && + (DECIMAL_HI32(d) < 0x19999999 || (DECIMAL_HI32(d) == 0x19999999 && + (DECIMAL_MID32(d) < 0x99999999 || (DECIMAL_MID32(d) == 0x99999999 && + (DECIMAL_LO32(d) < 0x99999999 || (DECIMAL_LO32(d) == 0x99999999 && *p <= '5'))))))) { DecMul10(&d); if (*p) DecAddInt32(&d, *p++ - '0'); e--; @@ -1306,10 +1306,10 @@ HaveScale64: rgulRem[1] = (rgulRem[1] << 1) + ulTmp; rgulRem[2] = (rgulRem[2] << 1) + ulTmp1; - if (rgulRem[2] > rgulDivisor[2] || rgulRem[2] == rgulDivisor[2] && - (rgulRem[1] > rgulDivisor[1] || rgulRem[1] == rgulDivisor[1] && - (rgulRem[0] > rgulDivisor[0] || rgulRem[0] == rgulDivisor[0] && - (rgulQuo[0] & 1)))) + if (rgulRem[2] > rgulDivisor[2] || (rgulRem[2] == rgulDivisor[2] && + (rgulRem[1] > rgulDivisor[1] || (rgulRem[1] == rgulDivisor[1] && + (rgulRem[0] > rgulDivisor[0] || (rgulRem[0] == rgulDivisor[0] && + (rgulQuo[0] & 1))))))) goto RoundUp; break; } @@ -1707,10 +1707,10 @@ HaveScale64: rgulRem[1] = (rgulRem[1] << 1) + ulTmp; rgulRem[2] = (rgulRem[2] << 1) + ulTmp1; - if (rgulRem[2] > rgulDivisor[2] || rgulRem[2] == rgulDivisor[2] && - (rgulRem[1] > rgulDivisor[1] || rgulRem[1] == rgulDivisor[1] && - (rgulRem[0] > rgulDivisor[0] || rgulRem[0] == rgulDivisor[0] && - (rgulQuo[0] & 1)))) + if (rgulRem[2] > rgulDivisor[2] || (rgulRem[2] == rgulDivisor[2] && + (rgulRem[1] > rgulDivisor[1] || (rgulRem[1] == rgulDivisor[1] && + (rgulRem[0] > rgulDivisor[0] || (rgulRem[0] == rgulDivisor[0] && + (rgulQuo[0] & 1))))))) goto RoundUp; break; } diff --git a/src/classlibnative/bcltype/number.cpp b/src/classlibnative/bcltype/number.cpp index 89bb49372e..04fe9f6526 100644 --- a/src/classlibnative/bcltype/number.cpp +++ b/src/classlibnative/bcltype/number.cpp @@ -1046,7 +1046,7 @@ wchar ParseFormatSpecifier(STRINGREF str, int* digits) _ASSERTE(p != NULL); wchar ch = *p; if (ch != 0) { - if (ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z') { + if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) { p++; int n = -1; if (*p >= '0' && *p <= '9') { diff --git a/src/debug/daccess/dacdbiimpl.cpp b/src/debug/daccess/dacdbiimpl.cpp index aed15c0434..8151f79834 100644 --- a/src/debug/daccess/dacdbiimpl.cpp +++ b/src/debug/daccess/dacdbiimpl.cpp @@ -1887,7 +1887,7 @@ TypeHandle DacDbiInterfaceImpl::TypeDataWalk::ReadLoadedTypeArg(TypeHandleReadTy return ReadLoadedTypeHandle(kGetExact); #else - if ((retrieveWhich == kGetExact)) + if (retrieveWhich == kGetExact) return ReadLoadedTypeHandle(kGetExact); // This nasty bit of code works out what the "canonicalization" of a diff --git a/src/debug/di/rsthread.cpp b/src/debug/di/rsthread.cpp index 82103699cf..601d21f384 100644 --- a/src/debug/di/rsthread.cpp +++ b/src/debug/di/rsthread.cpp @@ -8915,7 +8915,7 @@ HRESULT CordbJITILFrame::GetReturnValueForILOffsetImpl(ULONG32 ILoffset, ICorDeb bool found = false; ULONG32 currentOffset = m_nativeFrame->GetIPOffset(); for (ULONG32 i = 0; i < count; ++i) - if (found = currentOffset == offsets[i]) + if ((found = currentOffset == offsets[i])) break; if (!found) diff --git a/src/debug/ee/debugger.cpp b/src/debug/ee/debugger.cpp index 582a3954a9..11460ecefd 100644 --- a/src/debug/ee/debugger.cpp +++ b/src/debug/ee/debugger.cpp @@ -8146,7 +8146,7 @@ void Debugger::SendCatchHandlerFound( LOG((LF_CORDB, LL_INFO10000, "D::FirstChanceManagedExceptionCatcherFound\n")); - if ((pThread == NULL)) + if (pThread == NULL) { _ASSERTE(!"Bad parameter"); LOG((LF_CORDB, LL_INFO10000, "D::FirstChanceManagedExceptionCatcherFound - Bad parameter.\n")); diff --git a/src/debug/ee/debugger.h b/src/debug/ee/debugger.h index 25c1ad5dd6..96103844a9 100644 --- a/src/debug/ee/debugger.h +++ b/src/debug/ee/debugger.h @@ -225,7 +225,7 @@ private: startInCoop = bStartInCoop; conditional = bConditional; - if (!conditional || IFTHREAD && g_pEEInterface->GetThread() == NULL) + if (!conditional || (IFTHREAD && g_pEEInterface->GetThread() == NULL)) { return; } @@ -245,7 +245,7 @@ private: void LeaveInternal() { - if (!conditional || IFTHREAD && g_pEEInterface->GetThread() == NULL) + if (!conditional || (IFTHREAD && g_pEEInterface->GetThread() == NULL)) { return; } diff --git a/src/debug/ee/funceval.cpp b/src/debug/ee/funceval.cpp index 93f5dcdc60..a15e6ad7ff 100644 --- a/src/debug/ee/funceval.cpp +++ b/src/debug/ee/funceval.cpp @@ -1805,7 +1805,7 @@ void GatherFuncEvalArgInfo(DebuggerEval *pDE, // the sig says value class, but we've got a boxed value class, then remember that we need to unbox it. // bool fNeedBoxOrUnbox = ((argSigType == ELEMENT_TYPE_CLASS) && (pFEAD->argElementType == ELEMENT_TYPE_VALUETYPE)) || - ((argSigType == ELEMENT_TYPE_VALUETYPE) && ((pFEAD->argElementType == ELEMENT_TYPE_CLASS) || (pFEAD->argElementType == ELEMENT_TYPE_OBJECT)) || + (((argSigType == ELEMENT_TYPE_VALUETYPE) && ((pFEAD->argElementType == ELEMENT_TYPE_CLASS) || (pFEAD->argElementType == ELEMENT_TYPE_OBJECT))) || // This is when method signature is expecting a BYREF ValueType, yet we recieve the boxed valuetype's handle. (pFEAD->argElementType == ELEMENT_TYPE_CLASS && argSigType == ELEMENT_TYPE_BYREF && byrefArgSigType == ELEMENT_TYPE_VALUETYPE)); diff --git a/src/debug/ee/rcthread.cpp b/src/debug/ee/rcthread.cpp index 896db99884..cf19d6fbec 100644 --- a/src/debug/ee/rcthread.cpp +++ b/src/debug/ee/rcthread.cpp @@ -809,7 +809,7 @@ static LONG _debugFilter(LPEXCEPTION_POINTERS ep, PVOID pv) DWORD tid = GetCurrentThreadId(); DebuggerIPCEventType type = (DebuggerIPCEventType) (event->type & DB_IPCE_TYPE_MASK); -#endif _DEBUG || !FEATURE_CORESYSTEM +#endif // _DEBUG || !FEATURE_CORESYSTEM // We should never AV here. In a debug build, throw up an assert w/ lots of useful (private) info. #ifdef _DEBUG diff --git a/src/debug/inc/dacdbistructures.inl b/src/debug/inc/dacdbistructures.inl index 0471426ef7..fe591c8735 100644 --- a/src/debug/inc/dacdbistructures.inl +++ b/src/debug/inc/dacdbistructures.inl @@ -343,7 +343,7 @@ DWORD SequencePoints::MapNativeOffsetToIL(DWORD dwNativeOffset, // If the end offset is 0, we want to check if we're in the prologue before concluding that the // value of dwNativeOffset is out of range. if ((dwNativeOffset >= m_map[i].nativeStartOffset) && - ((m_map[i].nativeEndOffset == 0) && (m_map[i].ilOffset != (ULONG)ICorDebugInfo::PROLOG) || + (((m_map[i].nativeEndOffset == 0) && (m_map[i].ilOffset != (ULONG)ICorDebugInfo::PROLOG)) || (dwNativeOffset < m_map[i].nativeEndOffset))) { ULONG uILOffset = m_map[i].ilOffset; diff --git a/src/dlls/mscoree/mscoree.cpp b/src/dlls/mscoree/mscoree.cpp index 4d935d2c73..3f207b565d 100644 --- a/src/dlls/mscoree/mscoree.cpp +++ b/src/dlls/mscoree/mscoree.cpp @@ -728,6 +728,10 @@ STDAPI LoadStringRCEx( #if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE) +extern HINSTANCE g_pMSCorEE; + +#ifndef FEATURE_PAL + // // Returns path name from a file name. The path name will be (null-terminated, incl. the last '\' if present). // Example: For input "C:\Windows\System.dll" returns "C:\Windows\". @@ -788,10 +792,6 @@ HRESULT CopySystemDirectory(__in WCHAR *pFileName, return hr; } -extern HINSTANCE g_pMSCorEE; - -#ifndef FEATURE_PAL - BOOL PAL_GetPALDirectory(__out_ecount(cchBuffer) LPWSTR pbuffer, DWORD cchBuffer) { diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp index b9e070728b..873d336010 100644 --- a/src/gc/gc.cpp +++ b/src/gc/gc.cpp @@ -1873,7 +1873,9 @@ size_t switch_alignment_size (BOOL already_padded_p) void set_node_aligninfo (BYTE *node, int requiredAlignment, ptrdiff_t pad); void clear_node_aligninfo (BYTE *node); #else // FEATURE_STRUCTALIGN +#define node_realigned(node) (((plug_and_reloc*)(node))[-1].reloc & 1) void set_node_realigned (BYTE* node); +void clear_node_realigned(BYTE* node); #endif // FEATURE_STRUCTALIGN inline @@ -5858,25 +5860,45 @@ BYTE*& pin_allocation_context_start_region (mark* m) return m->allocation_context_start_region; } +BYTE* get_plug_start_in_saved (BYTE* old_loc, mark* pinned_plug_entry) +{ + BYTE* saved_pre_plug_info = (BYTE*)(pinned_plug_entry->get_pre_plug_reloc_info()); + BYTE* plug_start_in_saved = saved_pre_plug_info + (old_loc - (pinned_plug (pinned_plug_entry) - sizeof (plug_and_gap))); + //dprintf (1, ("detected a very short plug: %Ix before PP %Ix, pad %Ix", + // old_loc, pinned_plug (pinned_plug_entry), plug_start_in_saved)); + dprintf (1, ("EP: %Ix(%Ix), %Ix", old_loc, (BYTE)pinned_plug_entry, plug_start_in_saved)); + return plug_start_in_saved; +} + inline void set_padding_in_expand (BYTE* old_loc, - BOOL set_padding_on_saved_p, - mark* pinned_plug_entry) + BOOL set_padding_on_saved_p, + mark* pinned_plug_entry) { if (set_padding_on_saved_p) { - BYTE* saved_pre_plug_info = (BYTE*)(pinned_plug_entry->get_pre_plug_reloc_info()); - BYTE* plug_start_in_saved = saved_pre_plug_info + (old_loc - (pinned_plug (pinned_plug_entry) - sizeof (plug_and_gap))); - //dprintf (1, ("detected a very short plug: %Ix before PP %Ix, pad %Ix", - // old_loc, pinned_plug (pinned_plug_entry), plug_start_in_saved)); - dprintf (1, ("EP: %Ix(%Ix)", old_loc, (BYTE)pinned_plug_entry)); - set_plug_padded (plug_start_in_saved); + set_plug_padded (get_plug_start_in_saved (old_loc, pinned_plug_entry)); } else { set_plug_padded (old_loc); } } + +inline +void clear_padding_in_expand (BYTE* old_loc, + BOOL set_padding_on_saved_p, + mark* pinned_plug_entry) +{ + if (set_padding_on_saved_p) + { + clear_plug_padded (get_plug_start_in_saved (old_loc, pinned_plug_entry)); + } + else + { + clear_plug_padded (old_loc); + } +} #endif //SHORT_PLUGS void gc_heap::reset_pinned_queue() @@ -6041,7 +6063,7 @@ size_t& gc_heap::bpromoted_bytes(int thread) #ifdef MULTIPLE_HEAPS return g_bpromoted [thread*16]; #else //MULTIPLE_HEAPS - thread = thread; + UNREFERENCED_PARAMETER(thread); return g_bpromoted; #endif //MULTIPLE_HEAPS } @@ -8303,6 +8325,16 @@ public: size_t plug_size REQD_ALIGN_AND_OFFSET_DCL) { + if (old_loc) + { +#ifdef SHORT_PLUGS + assert (!is_plug_padded (old_loc)); +#endif //SHORT_PLUGS + assert (!node_realigned (old_loc)); + } + + size_t saved_plug_size = plug_size; + #ifdef FEATURE_STRUCTALIGN // BARTOKTODO (4841): this code path is disabled (see can_fit_all_blocks_p) until we take alignment requirements into account _ASSERTE(requiredAlignment == DATA_ALIGNMENT && false); @@ -8351,10 +8383,15 @@ retry: size_t new_free_space_size = 0; BOOL can_fit = FALSE; size_t pad = 0; - + for (i = 0; i < free_space_count; i++) { size_t free_space_size = 0; + pad = 0; +#ifdef SHORT_PLUGS + BOOL short_plugs_padding_p = FALSE; +#endif //SHORT_PLUGS + BOOL realign_padding_p = FALSE; if (bucket_free_space[i].is_plug) { @@ -8367,17 +8404,17 @@ retry: ((plug_free_space_start - pin_allocation_context_start_region (m))>=DESIRED_PLUG_LENGTH))) { pad = Align (min_obj_size); - set_padding_in_expand (old_loc, set_padding_on_saved_p, pinned_plug_entry); + short_plugs_padding_p = TRUE; } #endif //SHORT_PLUGS if (!((old_loc == 0) || same_large_alignment_p (old_loc, plug_free_space_start+pad))) { - pad += switch_alignment_size (FALSE); - set_node_realigned (old_loc); + pad += switch_alignment_size (pad != 0); + realign_padding_p = TRUE; } - plug_size += pad; + plug_size = saved_plug_size + pad; free_space_size = pinned_len (m); new_address = pinned_plug (m) - pinned_len (m); @@ -8388,17 +8425,29 @@ retry: new_free_space_size = free_space_size - plug_size; pinned_len (m) = new_free_space_size; #ifdef SIMPLE_DPRINTF - dprintf (SEG_REUSE_LOG_0, ("[%d]free space before pin: [0x%Ix, [0x%Ix (2^%d) -> [0x%Ix, [0x%Ix (2^%d)", + dprintf (SEG_REUSE_LOG_0, ("[%d]FP: 0x%Ix->0x%Ix(%Ix)(%Ix), [0x%Ix (2^%d) -> [0x%Ix (2^%d)", heap_num, - new_address, pinned_plug (m), + old_loc, + new_address, + (plug_size - pad), + pad, + pinned_plug (m), index_of_set_bit (round_down_power2 (free_space_size)), - (pinned_plug (m) - pinned_len (m)), pinned_plug (m), + (pinned_plug (m) - pinned_len (m)), index_of_set_bit (round_down_power2 (new_free_space_size)))); #endif //SIMPLE_DPRINTF - if (pad) +#ifdef SHORT_PLUGS + if (short_plugs_padding_p) { pin_allocation_context_start_region (m) = plug_free_space_start; + set_padding_in_expand (old_loc, set_padding_on_saved_p, pinned_plug_entry); + } +#endif //SHORT_PLUGS + + if (realign_padding_p) + { + set_node_realigned (old_loc); } can_fit = TRUE; @@ -8412,10 +8461,10 @@ retry: if (!((old_loc == 0) || same_large_alignment_p (old_loc, heap_segment_plan_allocated (seg)))) { pad = switch_alignment_size (FALSE); - set_node_realigned (old_loc); + realign_padding_p = TRUE; } - plug_size += pad; + plug_size = saved_plug_size + pad; if (free_space_size >= (plug_size + Align (min_obj_size)) || free_space_size == plug_size) @@ -8424,13 +8473,19 @@ retry: new_free_space_size = free_space_size - plug_size; heap_segment_plan_allocated (seg) = new_address + plug_size; #ifdef SIMPLE_DPRINTF - dprintf (SEG_REUSE_LOG_0, ("[%d]free space at the end of seg 0x%Ix (2^%d) -> 0x%Ix (2^%d)", + dprintf (SEG_REUSE_LOG_0, ("[%d]FS: 0x%Ix-> 0x%Ix(%Ix) (2^%d) -> 0x%Ix (2^%d)", heap_num, + old_loc, new_address, + (plug_size - pad), index_of_set_bit (round_down_power2 (free_space_size)), heap_segment_plan_allocated (seg), index_of_set_bit (round_down_power2 (new_free_space_size)))); #endif //SIMPLE_DPRINTF + + if (realign_padding_p) + set_node_realigned (old_loc); + can_fit = TRUE; } } @@ -10242,8 +10297,6 @@ BOOL gc_heap::size_fit_p (size_t size REQD_ALIGN_AND_OFFSET_DCL, BYTE* alloc_poi } #endif //SHORT_PLUGS - // TODO: this is incorrect - if we don't pad, we would have a different alignment so - // calculating the alignment requirement here is incorrect. if (!((old_loc == 0) || same_large_alignment_p (old_loc, alloc_pointer))) size = size + switch_alignment_size (already_padded); @@ -13528,6 +13581,7 @@ BYTE* gc_heap::allocate_in_condemned_generations (generation* gen, size_t size, int from_gen_number, #ifdef SHORT_PLUGS + BOOL* convert_to_pinned_p, BYTE* next_pinned_plug, heap_segment* current_seg, #endif //SHORT_PLUGS @@ -13739,8 +13793,17 @@ retry: if ((dist_to_next_pin >= 0) && (dist_to_next_pin < (ptrdiff_t)Align (min_obj_size))) { + dprintf (3, ("%Ix->(%Ix,%Ix),%Ix(%Ix)(%Ix),NP->PP", + old_loc, + generation_allocation_pointer (gen), + generation_allocation_limit (gen), + next_pinned_plug, + size, + dist_to_next_pin)); clear_plug_padded (old_loc); pad = 0; + *convert_to_pinned_p = TRUE; + return 0; } } #endif //SHORT_PLUGS @@ -16269,7 +16332,7 @@ size_t& gc_heap::promoted_bytes(int thread) #ifdef MULTIPLE_HEAPS return g_promoted [thread*16]; #else //MULTIPLE_HEAPS - thread = thread; + UNREFERENCED_PARAMETER(thread); return g_promoted; #endif //MULTIPLE_HEAPS } @@ -16913,7 +16976,7 @@ __declspec(naked) void __fastcall Prefetch(void* addr) #else //PREFETCH inline void Prefetch (void* addr) { - addr = addr; + UNREFERENCED_PARAMETER(addr); } #endif //PREFETCH #ifdef MH_SC_MARK @@ -17856,7 +17919,7 @@ void gc_heap::background_verify_mark (Object*& object, ScanContext* sc, DWORD fl void gc_heap::background_promote (Object** ppObject, ScanContext* sc, DWORD flags) { - sc; + UNREFERENCED_PARAMETER(sc); //in order to save space on the array, mark the object, //knowing that it will be visited later assert (settings.concurrent); @@ -19482,8 +19545,6 @@ void set_node_relocation_distance(BYTE* node, ptrdiff_t val) #define set_node_left(node) ((plug_and_reloc*)(node))[-1].reloc |= 2; #ifndef FEATURE_STRUCTALIGN -#define node_realigned(node) (((plug_and_reloc*)(node))[-1].reloc & 1) - void set_node_realigned(BYTE* node) { ((plug_and_reloc*)(node))[-1].reloc |= 1; @@ -19635,7 +19696,6 @@ void gc_heap::plan_generation_start (generation* gen, generation* consing_gen, B allocate_in_condemned_generations (consing_gen, Align (min_obj_size), -1); generation_plan_allocation_start_size (gen) = Align (min_obj_size); size_t allocation_left = (size_t)(generation_allocation_limit (consing_gen) - generation_allocation_pointer (consing_gen)); -#ifdef RESPECT_LARGE_ALIGNMENT if (next_plug_to_allocate) { size_t dist_to_next_plug = (size_t)(next_plug_to_allocate - generation_allocation_pointer (consing_gen)); @@ -19644,16 +19704,17 @@ void gc_heap::plan_generation_start (generation* gen, generation* consing_gen, B allocation_left = dist_to_next_plug; } } -#endif //RESPECT_LARGE_ALIGNMENT if (allocation_left < Align (min_obj_size)) { generation_plan_allocation_start_size (gen) += allocation_left; generation_allocation_pointer (consing_gen) += allocation_left; } - dprintf (1, ("plan alloc gen%d start at %Ix (ptr: %Ix, limit: %Ix)", gen->gen_num, + dprintf (1, ("plan alloc gen%d(%Ix) start at %Ix (ptr: %Ix, limit: %Ix, next: %Ix)", gen->gen_num, generation_plan_allocation_start (gen), - generation_allocation_pointer (consing_gen), generation_allocation_limit (consing_gen))); + generation_plan_allocation_start_size (gen), + generation_allocation_pointer (consing_gen), generation_allocation_limit (consing_gen), + next_plug_to_allocate)); } void gc_heap::realloc_plan_generation_start (generation* gen, generation* consing_gen) @@ -20594,6 +20655,18 @@ BOOL gc_heap::loh_object_p (BYTE* o) } #endif //FEATURE_LOH_COMPACTION +void gc_heap::convert_to_pinned_plug (BOOL& last_npinned_plug_p, + BOOL& last_pinned_plug_p, + BOOL& pinned_plug_p, + size_t ps, + size_t& artificial_pinned_size) +{ + last_npinned_plug_p = FALSE; + last_pinned_plug_p = TRUE; + pinned_plug_p = TRUE; + artificial_pinned_size = ps; +} + // Because we have the artifical pinning, we can't gaurantee that pinned and npinned // plugs are always interleaved. void gc_heap::store_plug_gap_info (BYTE* plug_start, @@ -21152,34 +21225,12 @@ void gc_heap::plan_phase (int condemned_gen_number) last_pinned_plug = plug_start; } - last_pinned_plug_p = TRUE; - last_npinned_plug_p = FALSE; - pinned_plug_p = TRUE; - artificial_pinned_size = ps; + convert_to_pinned_plug (last_npinned_plug_p, last_pinned_plug_p, pinned_plug_p, + ps, artificial_pinned_size); } } } - if (pinned_plug_p) - { - if (fire_pinned_plug_events_p) - FireEtwPinPlugAtGCTime(plug_start, plug_end, - (merge_with_last_pin_p ? 0 : (BYTE*)node_gap_size (plug_start)), - GetClrInstanceId()); - - if (merge_with_last_pin_p) - { - merge_with_last_pinned_plug (last_pinned_plug, ps); - } - else - { - assert (last_pinned_plug == plug_start); - set_pinned_info (plug_start, ps, consing_gen); - } - - new_address = plug_start; - } - if (allocate_first_generation_start) { allocate_first_generation_start = FALSE; @@ -21200,6 +21251,8 @@ void gc_heap::plan_phase (int condemned_gen_number) dynamic_data* dd_active_old = dynamic_data_of (active_old_gen_number); dd_survived_size (dd_active_old) += ps; + BOOL convert_to_pinned_p = FALSE; + if (!pinned_plug_p) { #if defined (RESPECT_LARGE_ALIGNMENT) || defined (FEATURE_STRUCTALIGN) @@ -21217,6 +21270,7 @@ void gc_heap::plan_phase (int condemned_gen_number) ps, active_old_gen_number, #ifdef SHORT_PLUGS + &convert_to_pinned_p, (npin_before_pin_p ? plug_end : 0), seg1, #endif //SHORT_PLUGS @@ -21242,6 +21296,7 @@ void gc_heap::plan_phase (int condemned_gen_number) allocate_in_condemned = TRUE; new_address = allocate_in_condemned_generations (consing_gen, ps, active_old_gen_number, #ifdef SHORT_PLUGS + &convert_to_pinned_p, (npin_before_pin_p ? plug_end : 0), seg1, #endif //SHORT_PLUGS @@ -21249,39 +21304,72 @@ void gc_heap::plan_phase (int condemned_gen_number) } } - if (!new_address) + if (convert_to_pinned_p) { - //verify that we are at then end of the ephemeral segment - assert (generation_allocation_segment (consing_gen) == - ephemeral_heap_segment); - //verify that we are near the end - assert ((generation_allocation_pointer (consing_gen) + Align (ps)) < - heap_segment_allocated (ephemeral_heap_segment)); - assert ((generation_allocation_pointer (consing_gen) + Align (ps)) > - (heap_segment_allocated (ephemeral_heap_segment) + Align (min_obj_size))); + assert (last_npinned_plug_p == TRUE); + assert (last_pinned_plug_p == FALSE); + convert_to_pinned_plug (last_npinned_plug_p, last_pinned_plug_p, pinned_plug_p, + ps, artificial_pinned_size); + enque_pinned_plug (plug_start, FALSE, 0); + last_pinned_plug = plug_start; } else { + if (!new_address) + { + //verify that we are at then end of the ephemeral segment + assert (generation_allocation_segment (consing_gen) == + ephemeral_heap_segment); + //verify that we are near the end + assert ((generation_allocation_pointer (consing_gen) + Align (ps)) < + heap_segment_allocated (ephemeral_heap_segment)); + assert ((generation_allocation_pointer (consing_gen) + Align (ps)) > + (heap_segment_allocated (ephemeral_heap_segment) + Align (min_obj_size))); + } + else + { #ifdef SIMPLE_DPRINTF - dprintf (3, ("(%Ix)[%Ix->%Ix, NA: [%Ix(%Id), %Ix[: %Ix", - (size_t)(node_gap_size (plug_start)), - plug_start, plug_end, (size_t)new_address, (size_t)(plug_start - new_address), - (size_t)new_address + ps, ps)); + dprintf (3, ("(%Ix)[%Ix->%Ix, NA: [%Ix(%Id), %Ix[: %Ix", + (size_t)(node_gap_size (plug_start)), + plug_start, plug_end, (size_t)new_address, (size_t)(plug_start - new_address), + (size_t)new_address + ps, ps)); #endif //SIMPLE_DPRINTF + #ifdef SHORT_PLUGS - if (is_plug_padded (plug_start)) - { - dprintf (3, ("%Ix was padded", plug_start)); - dd_padding_size (dd_active_old) += Align (min_obj_size); - } + if (is_plug_padded (plug_start)) + { + dprintf (3, ("%Ix was padded", plug_start)); + dd_padding_size (dd_active_old) += Align (min_obj_size); + } #endif //SHORT_PLUGS + } } } - else + + if (pinned_plug_p) { - dprintf (3, ( "(%Ix)PP: [%Ix, %Ix[%Ix]", + if (fire_pinned_plug_events_p) + FireEtwPinPlugAtGCTime(plug_start, plug_end, + (merge_with_last_pin_p ? 0 : (BYTE*)node_gap_size (plug_start)), + GetClrInstanceId()); + + if (merge_with_last_pin_p) + { + merge_with_last_pinned_plug (last_pinned_plug, ps); + } + else + { + assert (last_pinned_plug == plug_start); + set_pinned_info (plug_start, ps, consing_gen); + } + + new_address = plug_start; + + dprintf (3, ( "(%Ix)PP: [%Ix, %Ix[%Ix](m:%d)", (size_t)(node_gap_size (plug_start)), (size_t)plug_start, - (size_t)plug_end, ps)); + (size_t)plug_end, ps, + (merge_with_last_pin_p ? 1 : 0))); + dprintf (3, ("adding %Id to gen%d pinned surv", plug_end - plug_start, active_old_gen_number)); dd_pinned_survived_size (dd_active_old) += plug_end - plug_start; dd_added_pinned_size (dd_active_old) += added_pinning_size; @@ -21434,7 +21522,7 @@ void gc_heap::plan_phase (int condemned_gen_number) generation* gen = generation_of (active_new_gen_number); plan_generation_start (gen, consing_gen, 0); - if ((demotion_low == MAX_PTR)) + if (demotion_low == MAX_PTR) { demotion_low = pplug; dprintf (3, ("end plan: dlow->%Ix", demotion_low)); @@ -25824,7 +25912,7 @@ void gc_heap::background_grow_c_mark_list() void gc_heap::background_promote_callback (Object** ppObject, ScanContext* sc, DWORD flags) { - sc = sc; + UNREFERENCED_PARAMETER(sc); //in order to save space on the array, mark the object, //knowing that it will be visited later assert (settings.concurrent); @@ -28269,11 +28357,6 @@ void gc_heap::realloc_plug (size_t last_plug_size, BYTE*& last_plug, } else if (last_plug >= start_address) { - -#ifdef SHORT_PLUGS - clear_plug_padded (last_plug); -#endif //SHORT_PLUGS - #ifdef FEATURE_STRUCTALIGN int requiredAlignment; ptrdiff_t pad; @@ -28300,11 +28383,10 @@ void gc_heap::realloc_plug (size_t last_plug_size, BYTE*& last_plug, if (shortened_p) { - assert (pinned_plug_entry != NULL); - last_plug_size += sizeof (gap_reloc_pair); #ifdef SHORT_PLUGS + assert (pinned_plug_entry != NULL); if (last_plug_size <= sizeof (plug_and_gap)) { set_padding_on_saved_p = TRUE; @@ -28314,6 +28396,10 @@ void gc_heap::realloc_plug (size_t last_plug_size, BYTE*& last_plug, dprintf (3, ("ra plug %Ix was shortened, adjusting plug size to %Ix", last_plug_size)) } +#ifdef SHORT_PLUGS + clear_padding_in_expand (last_plug, set_padding_on_saved_p, pinned_plug_entry); +#endif //SHORT_PLUGS + BYTE* new_address = allocate_in_expanded_heap(gen, last_plug_size, adjacentp, last_plug, #ifdef SHORT_PLUGS set_padding_on_saved_p, @@ -31326,7 +31412,7 @@ void gc_heap::descr_card_table () { if (card_set_p (i)) { - if ((min == -1)) + if (min == -1) { min = i; } @@ -32415,7 +32501,7 @@ gc_heap::verify_heap (BOOL begin_gc_p) } // Are we at the end of the youngest_generation? - if ((seg == ephemeral_heap_segment)) + if (seg == ephemeral_heap_segment) { if (curr_object >= end_youngest) { @@ -34550,7 +34636,7 @@ GCHeap::GarbageCollectGeneration (unsigned int gen, gc_reason reason) #endif //!MULTIPLE_HEAPS #ifdef FEATURE_PREMORTEM_FINALIZATION - if (!pGenGCHeap->settings.concurrent && pGenGCHeap->settings.found_finalizers || + if ((!pGenGCHeap->settings.concurrent && pGenGCHeap->settings.found_finalizers) || FinalizerThread::HaveExtraWorkForFinalizer()) { FinalizerThread::EnableFinalization(); @@ -34668,7 +34754,7 @@ bool GCHeap::IsThreadUsingAllocationContextHeap(alloc_context* acontext, int thr { #ifdef MULTIPLE_HEAPS return ((acontext->home_heap == GetHeap(thread_number)) || - (acontext->home_heap == 0) && (thread_number == 0)); + ((acontext->home_heap == 0) && (thread_number == 0))); #else return true; #endif //MULTIPLE_HEAPS diff --git a/src/gc/gcpriv.h b/src/gc/gcpriv.h index 395b027957..9da73bc6f7 100644 --- a/src/gc/gcpriv.h +++ b/src/gc/gcpriv.h @@ -45,6 +45,7 @@ inline void FATAL_GC_ERROR() #endif //FEATURE_64BIT_ALIGNMENT #define SHORT_PLUGS //used to keep ephemeral plugs short so they fit better into the oldest generation free items + #ifdef SHORT_PLUGS #define DESIRED_PLUG_LENGTH (1000) #endif //SHORT_PLUGS @@ -1848,6 +1849,7 @@ protected: size_t size, int from_gen_number, #ifdef SHORT_PLUGS + BOOL* convert_to_pinned_p=NULL, BYTE* next_pinned_plug=0, heap_segment* current_seg=0, #endif //SHORT_PLUGS @@ -2111,6 +2113,12 @@ protected: PER_HEAP void sweep_ro_segments (heap_segment* start_seg); PER_HEAP + void convert_to_pinned_plug (BOOL& last_npinned_plug_p, + BOOL& last_pinned_plug_p, + BOOL& pinned_plug_p, + size_t ps, + size_t& artificial_pinned_size); + PER_HEAP void store_plug_gap_info (BYTE* plug_start, BYTE* plug_end, BOOL& last_npinned_plug_p, diff --git a/src/inc/CMakeLists.txt b/src/inc/CMakeLists.txt index 51f7a8dfb6..be7f6d4329 100644 --- a/src/inc/CMakeLists.txt +++ b/src/inc/CMakeLists.txt @@ -50,6 +50,11 @@ add_compile_options(/TC) else() #The MIDL tool exists for Windows only, so for other systems, we have the prebuilt xxx_i.c files checked in + +# The prebuilt files contain extra '!_MIDL_USE_GUIDDEF_' after the #endif, but not in the comment. +# In order to not to have to modify these prebuilt files, we disable the extra tokens warning. +add_compile_options(-Wno-extra-tokens) + foreach(IDL_SOURCE IN LISTS CORGUIDS_IDL_SOURCES) get_filename_component(IDLNAME ${IDL_SOURCE} NAME_WE) set(C_SOURCE ../pal/prebuilt/idl/${IDLNAME}_i.c) diff --git a/src/inc/arraylist.h b/src/inc/arraylist.h index f6f4014c4e..b22fb2e037 100644 --- a/src/inc/arraylist.h +++ b/src/inc/arraylist.h @@ -421,7 +421,7 @@ public: ELEMENT_TYPE *pSrc; SIZE_T nSrc; - while (pSrc = iter.GetNext(&nSrc)) + while ((pSrc = iter.GetNext(&nSrc))) { memcpy(pDest, pSrc, nSrc * sizeof(ELEMENT_TYPE)); pDest += nSrc; @@ -436,7 +436,7 @@ public: SIZE_T count; SIZE_T chunkBaseIndex = 0; - while (chunk = iter.GetNext(&count)) + while ((chunk = iter.GetNext(&count))) { SIZE_T nextBaseIndex = chunkBaseIndex + count; if (nextBaseIndex > index) diff --git a/src/inc/ceefilegenwriter.h b/src/inc/ceefilegenwriter.h index cbd5d87596..5d0df4da0c 100644 --- a/src/inc/ceefilegenwriter.h +++ b/src/inc/ceefilegenwriter.h @@ -190,7 +190,7 @@ inline LPWSTR CeeFileGenWriter::getResourceFileName() { } inline HRESULT CeeFileGenWriter::setDllSwitch(bool dllSwitch) { - if(m_dllSwitch = dllSwitch) m_objSwitch = FALSE; return S_OK; + if((m_dllSwitch = dllSwitch)) m_objSwitch = FALSE; return S_OK; } inline bool CeeFileGenWriter::getDllSwitch() { @@ -198,7 +198,7 @@ inline bool CeeFileGenWriter::getDllSwitch() { } inline HRESULT CeeFileGenWriter::setObjSwitch(bool objSwitch) { - if(m_objSwitch = objSwitch) m_dllSwitch = FALSE; return S_OK; + if((m_objSwitch = objSwitch)) m_dllSwitch = FALSE; return S_OK; } inline bool CeeFileGenWriter::getObjSwitch() { diff --git a/src/inc/clrconfigvalues.h b/src/inc/clrconfigvalues.h index 6bfa645af4..ca4c146eca 100644 --- a/src/inc/clrconfigvalues.h +++ b/src/inc/clrconfigvalues.h @@ -817,6 +817,8 @@ RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_ProcessNameFormat, W("ProcessNameFormat"), RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_COR_ENABLE_PROFILING, W("COR_ENABLE_PROFILING"), 0, "Flag to indicate whether profiling should be enabled for the currently running process.", CLRConfig::DontPrependCOMPLUS_ | CLRConfig::IgnoreConfigFiles) RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_COR_PROFILER, W("COR_PROFILER"), "Specifies GUID of profiler to load into currently running process", CLRConfig::DontPrependCOMPLUS_) RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_COR_PROFILER_PATH, W("COR_PROFILER_PATH"), "Specifies the path to the DLL of profiler to load into currently running process", CLRConfig::DontPrependCOMPLUS_) +RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_COR_PROFILER_PATH_32, W("COR_PROFILER_PATH_32"), "Specifies the path to the DLL of profiler to load into currently running 32 bits process", CLRConfig::DontPrependCOMPLUS_) +RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_COR_PROFILER_PATH_64, W("COR_PROFILER_PATH_64"), "Specifies the path to the DLL of profiler to load into currently running 64 bits process", CLRConfig::DontPrependCOMPLUS_) RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_CORECLR_ENABLE_PROFILING, W("CORECLR_ENABLE_PROFILING"), 0, "CoreCLR only: Flag to indicate whether profiling should be enabled for the currently running process.", CLRConfig::DontPrependCOMPLUS_ | CLRConfig::IgnoreConfigFiles) RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_CORECLR_PROFILER, W("CORECLR_PROFILER"), "CoreCLR only: Specifies GUID of profiler to load into currently running process", CLRConfig::DontPrependCOMPLUS_) RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_CORECLR_PROFILER_PATH, W("CORECLR_PROFILER_PATH"), "CoreCLR only: Specifies the path to the DLL of profiler to load into currently running process", CLRConfig::DontPrependCOMPLUS_) diff --git a/src/inc/cortypeinfo.h b/src/inc/cortypeinfo.h index a7f53a3ed1..e35ae6f101 100644 --- a/src/inc/cortypeinfo.h +++ b/src/inc/cortypeinfo.h @@ -5,9 +5,11 @@ // This describes information about the COM+ primitive types +#define NO_SIZE 255 + // TYPEINFO(type (CorElementType), namespace, class, size, gcType, isArray,isPrim, isFloat,isModifier,isGenVariable) -TYPEINFO(ELEMENT_TYPE_END, NULL, NULL, ~0, TYPE_GC_NONE, false, false, false, false, false) // 0x00 +TYPEINFO(ELEMENT_TYPE_END, NULL, NULL, NO_SIZE, TYPE_GC_NONE, false, false, false, false, false) // 0x00 TYPEINFO(ELEMENT_TYPE_VOID, "System", "Void", 0, TYPE_GC_NONE, false, true, false, false, false) // 0x01 TYPEINFO(ELEMENT_TYPE_BOOLEAN, "System", "Boolean", 1, TYPE_GC_NONE, false, true, false, false, false) // 0x02 TYPEINFO(ELEMENT_TYPE_CHAR, "System", "Char", 2, TYPE_GC_NONE, false, true, false, false, false) // 0x03 @@ -26,18 +28,18 @@ TYPEINFO(ELEMENT_TYPE_R8, "System", "Double", 8, T TYPEINFO(ELEMENT_TYPE_STRING, "System", "String", sizeof(void*), TYPE_GC_REF, false, false, false, false, false) // 0x0e TYPEINFO(ELEMENT_TYPE_PTR, NULL, NULL, sizeof(void*), TYPE_GC_NONE, false, false, false, true, false) // 0x0f TYPEINFO(ELEMENT_TYPE_BYREF, NULL, NULL, sizeof(void*), TYPE_GC_BYREF, false, false, false, true, false) // 0x10 -TYPEINFO(ELEMENT_TYPE_VALUETYPE, NULL, NULL, ~0, TYPE_GC_OTHER, false, false, false, false, false) // 0x11 +TYPEINFO(ELEMENT_TYPE_VALUETYPE, NULL, NULL, NO_SIZE, TYPE_GC_OTHER, false, false, false, false, false) // 0x11 TYPEINFO(ELEMENT_TYPE_CLASS, NULL, NULL, sizeof(void*), TYPE_GC_REF, false, false, false, false, false) // 0x12 TYPEINFO(ELEMENT_TYPE_VAR, NULL, NULL, sizeof(void*), TYPE_GC_OTHER, false, false, false, false, true) // 0x13 TYPEINFO(ELEMENT_TYPE_ARRAY, NULL, NULL, sizeof(void*), TYPE_GC_REF, true, false, false, true, false) // 0x14 TYPEINFO(ELEMENT_TYPE_GENERICINST, NULL, NULL, sizeof(void*), TYPE_GC_OTHER, false, false, false, false, false) // 0x15 TYPEINFO(ELEMENT_TYPE_TYPEDBYREF, "System", "TypedReference",2*sizeof(void*),TYPE_GC_BYREF, false, false, false, false, false) // 0x16 -TYPEINFO(ELEMENT_TYPE_VALUEARRAY_UNSUPPORTED, NULL,NULL, ~0, TYPE_GC_NONE, false, false, false, false, false) // 0x17 (unsupported, not in the ECMA spec) +TYPEINFO(ELEMENT_TYPE_VALUEARRAY_UNSUPPORTED, NULL,NULL, NO_SIZE, TYPE_GC_NONE, false, false, false, false, false) // 0x17 (unsupported, not in the ECMA spec) TYPEINFO(ELEMENT_TYPE_I, "System", "IntPtr", sizeof(void*), TYPE_GC_NONE, false, true, false, false, false) // 0x18 TYPEINFO(ELEMENT_TYPE_U, "System", "UIntPtr", sizeof(void*), TYPE_GC_NONE, false, true, false, false, false) // 0x19 -TYPEINFO(ELEMENT_TYPE_R_UNSUPPORTED,NULL, NULL, ~0, TYPE_GC_NONE, false, false, false, false, false) // 0x1a (unsupported, not in the ECMA spec) +TYPEINFO(ELEMENT_TYPE_R_UNSUPPORTED,NULL, NULL, NO_SIZE, TYPE_GC_NONE, false, false, false, false, false) // 0x1a (unsupported, not in the ECMA spec) TYPEINFO(ELEMENT_TYPE_FNPTR, NULL, NULL, sizeof(void*), TYPE_GC_NONE, false, false, false, false, false) // 0x1b TYPEINFO(ELEMENT_TYPE_OBJECT, "System", "Object", sizeof(void*), TYPE_GC_REF, false, false, false, false, false) // 0x1c diff --git a/src/inc/gcinfoencoder.h b/src/inc/gcinfoencoder.h index 2450ffe670..9987d67be1 100644 --- a/src/inc/gcinfoencoder.h +++ b/src/inc/gcinfoencoder.h @@ -554,7 +554,7 @@ public: size_t currentChunk = ((size_t) n) & (numEncodings-1); size_t topmostBit = currentChunk & (numEncodings >> 1); n >>= base; // signed arithmetic shift - if( topmostBit && (n == (SSIZE_T)-1) || !topmostBit && (n == 0)) + if((topmostBit && (n == (SSIZE_T)-1)) || (!topmostBit && (n == 0))) { // The topmost bit correctly represents the sign Write( currentChunk, base+1 ); // This sets the extension bit to zero diff --git a/src/inc/internalunknownimpl.h b/src/inc/internalunknownimpl.h index 0fe54bedcd..cf72a0a1a1 100644 --- a/src/inc/internalunknownimpl.h +++ b/src/inc/internalunknownimpl.h @@ -70,7 +70,7 @@ namespace ComUtil typedef char (&_Yes)[1]; typedef char (&_No)[2]; - static _No _IsTypeWrapper(...); + static inline _No _IsTypeWrapper(...); template <typename T> static _Yes _IsTypeWrapper(T *, typename T::wrapped_type * = nullptr); diff --git a/src/jit/assertionprop.cpp b/src/jit/assertionprop.cpp index b3c1da6944..8181957f35 100644 --- a/src/jit/assertionprop.cpp +++ b/src/jit/assertionprop.cpp @@ -3769,7 +3769,7 @@ EXPSET_TP Compiler::optImpliedByConstAssertion(AssertionDsc* constAssertion) case O2K_CONST_INT: // Is the const assertion's constant equal/not equal to the implied assertion? usable = ((impAssertion->assertionKind == OAK_EQUAL) && (impAssertion->op2.u1.iconVal == iconVal)) || - (impAssertion->assertionKind == OAK_NOT_EQUAL) && (impAssertion->op2.u1.iconVal != iconVal); + ((impAssertion->assertionKind == OAK_NOT_EQUAL) && (impAssertion->op2.u1.iconVal != iconVal)); break; } diff --git a/src/jit/compiler.cpp b/src/jit/compiler.cpp index de8925d69c..b044c8fe83 100644 --- a/src/jit/compiler.cpp +++ b/src/jit/compiler.cpp @@ -885,8 +885,9 @@ void Compiler::compDisplayStaticSizes(FILE* fout) #if FEATURE_STACK_FP_X87 fprintf(fout, "Offset / size of gtFPlvl = %2u / %2u\n", offsetof(GenTree, gtFPlvl ), sizeof(gtDummy->gtFPlvl )); #endif // FEATURE_STACK_FP_X87 - fprintf(fout, "Offset / size of gtCostEx = %2u / %2u\n", offsetof(GenTree, _gtCostEx ), sizeof(gtDummy->_gtCostEx )); - fprintf(fout, "Offset / size of gtCostSz = %2u / %2u\n", offsetof(GenTree, _gtCostSz ), sizeof(gtDummy->_gtCostSz )); +// TODO: The section that report GenTree sizes should be made into a public static member function of the GenTree class (see https://github.com/dotnet/coreclr/pull/493) +// fprintf(fout, "Offset / size of gtCostEx = %2u / %2u\n", offsetof(GenTree, _gtCostEx ), sizeof(gtDummy->_gtCostEx )); +// fprintf(fout, "Offset / size of gtCostSz = %2u / %2u\n", offsetof(GenTree, _gtCostSz ), sizeof(gtDummy->_gtCostSz )); fprintf(fout, "Offset / size of gtFlags = %2u / %2u\n", offsetof(GenTree, gtFlags ), sizeof(gtDummy->gtFlags )); fprintf(fout, "Offset / size of gtVNPair = %2u / %2u\n", offsetof(GenTree, gtVNPair ), sizeof(gtDummy->gtVNPair )); fprintf(fout, "Offset / size of gtRsvdRegs = %2u / %2u\n", offsetof(GenTree, gtRsvdRegs ), sizeof(gtDummy->gtRsvdRegs )); diff --git a/src/jit/emitxarch.cpp b/src/jit/emitxarch.cpp index 2112fae827..44632da71a 100644 --- a/src/jit/emitxarch.cpp +++ b/src/jit/emitxarch.cpp @@ -1925,12 +1925,11 @@ UNATIVE_OFFSET emitter::emitInsSizeAM(instrDesc* id, size_t code) // Most 16-bit operands will require a size prefix . // This refers to 66h size prefix override. - if ( (attrSize == EA_2BYTE) #if FEATURE_STACK_FP_X87 - && (ins != INS_fldcw) - && (ins != INS_fnstcw) + if ((attrSize == EA_2BYTE) && (ins != INS_fldcw) && (ins != INS_fnstcw)) +#else // FEATURE_STACK_FP_X87 + if (attrSize == EA_2BYTE) #endif // FEATURE_STACK_FP_X87 - ) { size++; } diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp index 6bd2f62763..54472600f8 100644 --- a/src/jit/flowgraph.cpp +++ b/src/jit/flowgraph.cpp @@ -5382,8 +5382,8 @@ DECODE_OPCODE: case CEE_CALLI: { if (compIsForInlining() || // Ignore tail call in the inlinee. Period. - !tailCall && - !compTailCallStress() // A new BB with BBJ_RETURN would have been created + (!tailCall && + !compTailCallStress()) // A new BB with BBJ_RETURN would have been created // after a tailcall statement. // We need to keep this invariant if we want to stress the tailcall. @@ -21716,7 +21716,7 @@ JitInlineResult Compiler::fgInvokeInlineeCompiler(GenTreeCall* call) pParam->pThis->eeGetMethodFullName(pParam->fncHandle), pParam->pThis->dspPtr(pParam->inlineInfo->tokenLookupContextHandle))); - unsigned compileFlagsForInlinee = pParam->pThis->opts.eeFlags & ~CORJIT_FLG_LOST_WHEN_INLINING + unsigned compileFlagsForInlinee = (pParam->pThis->opts.eeFlags & ~CORJIT_FLG_LOST_WHEN_INLINING) | CORJIT_FLG_SKIP_VERIFICATION; #ifdef DEBUG diff --git a/src/jit/importer.cpp b/src/jit/importer.cpp index d55710400b..7e6a10bed4 100644 --- a/src/jit/importer.cpp +++ b/src/jit/importer.cpp @@ -1913,9 +1913,9 @@ void Compiler::impSpillSideEffects(bool spillGlobEffects, GenTreePtr lclVarTree; if ((tree->gtFlags & spillFlags) != 0 || - spillGlobEffects && // Only consider the following when spillGlobEffects == TRUE + (spillGlobEffects && // Only consider the following when spillGlobEffects == TRUE !impIsAddressInLocal(tree, &lclVarTree) && // No need to spill the GT_ADDR node on a local. - gtHasLocalsWithAddrOp(tree)) // Spill if we still see GT_LCL_VAR that contains lvHasLdAddrOp or lvAddrTaken flag. + gtHasLocalsWithAddrOp(tree))) // Spill if we still see GT_LCL_VAR that contains lvHasLdAddrOp or lvAddrTaken flag. { impSpillStackEntry(i, BAD_VAR_NUM DEBUGARG(false) DEBUGARG(reason)); @@ -6085,8 +6085,12 @@ var_types Compiler::impImportCall (OPCODE opcode, } else #endif //INLINE_NDIRECT - if (opcode == CEE_CALLI && - (sig->callConv & CORINFO_CALLCONV_MASK) == CORINFO_CALLCONV_STDCALL || + // TODO-Review: the indentation below suggests different precedence of the && and || + // operators than the one based on the parens around the first && term. + // It needs to be investigated whether the indentation is wrong or the + // parens are wrong and all the || terms should be grouped together in parens. + if ((opcode == CEE_CALLI && + (sig->callConv & CORINFO_CALLCONV_MASK) == CORINFO_CALLCONV_STDCALL) || (sig->callConv & CORINFO_CALLCONV_MASK) == CORINFO_CALLCONV_C || (sig->callConv & CORINFO_CALLCONV_MASK) == CORINFO_CALLCONV_THISCALL || (sig->callConv & CORINFO_CALLCONV_MASK) == CORINFO_CALLCONV_FASTCALL) @@ -10488,8 +10492,12 @@ _CONV: if (codeAddr < codeEndp) { OPCODE nextOpcode = (OPCODE) getU1LittleEndian(codeAddr); - if (!opts.compDbgCode && - (nextOpcode == CEE_STLOC) || + // TODO-Review: the indentation below suggests different precedence of the && and || + // operators than the one based on the parens around the first && term. + // It needs to be investigated whether the indentation is wrong or the + // parens are wrong and all the || terms should be grouped together in parens. + if ((!opts.compDbgCode && + (nextOpcode == CEE_STLOC)) || (nextOpcode == CEE_STLOC_S) || ((nextOpcode >= CEE_STLOC_0) && (nextOpcode <= CEE_STLOC_3))) { diff --git a/src/jit/lsra.cpp b/src/jit/lsra.cpp index 3019f3e932..691db8071a 100644 --- a/src/jit/lsra.cpp +++ b/src/jit/lsra.cpp @@ -7802,7 +7802,7 @@ LinearScan::handleOutoingCriticalEdges(BasicBlock* block) // live only at another target), and we can't copy another lclVar into that reg in this block. regMaskTP sameToRegMask = genRegMask(sameToReg); if (maybeSameLivePaths && - ((sameToRegMask & liveOutRegs) != RBM_NONE) || ((sameToRegMask & sameWriteRegs) != RBM_NONE)) + (((sameToRegMask & liveOutRegs) != RBM_NONE) || ((sameToRegMask & sameWriteRegs) != RBM_NONE))) { sameToReg = REG_NA; } diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp index 3e292e099b..c21bb2991d 100644 --- a/src/jit/morph.cpp +++ b/src/jit/morph.cpp @@ -3880,11 +3880,11 @@ void Compiler::fgSetRngChkTarget(GenTreePtr tree, { GenTreeBoundsChk* bndsChk = NULL; - if ((tree->gtOper == GT_ARR_BOUNDS_CHECK) #ifdef FEATURE_SIMD - || (tree->gtOper == GT_SIMD_CHK) + if ((tree->gtOper == GT_ARR_BOUNDS_CHECK) || (tree->gtOper == GT_SIMD_CHK)) +#else // FEATURE_SIMD + if (tree->gtOper == GT_ARR_BOUNDS_CHECK) #endif // FEATURE_SIMD - ) { bndsChk = tree->AsBoundsChk(); } diff --git a/src/jit/utils.cpp b/src/jit/utils.cpp index 4a9c26774d..a5386ff999 100644 --- a/src/jit/utils.cpp +++ b/src/jit/utils.cpp @@ -353,12 +353,13 @@ void dspRegMask(regMaskTP regMask, size_t minSiz) #endif // _TARGET_* } // We've already printed a register. Is this the end of a range? - else if ((regNum == REG_INT_LAST) #if defined(_TARGET_ARM64_) + else if ((regNum == REG_INT_LAST) || (regNum == REG_R17) // last register before TEB - || (regNum == REG_R28) // last register before FP + || (regNum == REG_R28)) // last register before FP +#else // _TARGET_ARM64_ + else if (regNum == REG_INT_LAST) #endif // _TARGET_ARM64_ - ) { const char* nam = getRegName(regNum); printf("%s%s", sep, nam); diff --git a/src/md/ceefilegen/blobfetcher.cpp b/src/md/ceefilegen/blobfetcher.cpp index 1657326e72..aa1b06aa8a 100644 --- a/src/md/ceefilegen/blobfetcher.cpp +++ b/src/md/ceefilegen/blobfetcher.cpp @@ -14,14 +14,6 @@ #include "log.h" //----------------------------------------------------------------------------- -// round a pointer back down to something aligned -static inline char* truncateTo(__in char* val, unsigned align) { - _ASSERTE((align & (align - 1)) == 0); // align must be a power of 2 - - return((char*) ((UINT_PTR)(val) & ~(((UINT_PTR)align)-1))); -} - -//----------------------------------------------------------------------------- // round up to a certain alignment static inline unsigned roundUp(unsigned val, unsigned align) { _ASSERTE((align & (align - 1)) == 0); // align must be a power of 2 diff --git a/src/mscorlib/corefx/System/Globalization/CompareInfo.Unix.cs b/src/mscorlib/corefx/System/Globalization/CompareInfo.Unix.cs index 137b79826d..8091eeb261 100644 --- a/src/mscorlib/corefx/System/Globalization/CompareInfo.Unix.cs +++ b/src/mscorlib/corefx/System/Globalization/CompareInfo.Unix.cs @@ -54,6 +54,12 @@ namespace System.Globalization Contract.Assert(value != null); // TODO: Implement This Fully. + + if (value.Length == 0) + { + return startIndex; + } + if (ignoreCase) { source = source.ToUpper(CultureInfo.InvariantCulture); diff --git a/src/mscorlib/mscorlib.csproj b/src/mscorlib/mscorlib.csproj index f74349be06..ae6b173978 100644 --- a/src/mscorlib/mscorlib.csproj +++ b/src/mscorlib/mscorlib.csproj @@ -104,7 +104,7 @@ <!-- Output paths --> <PropertyGroup> - <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)' == ''">$(RootBinDir)intermediates</BaseIntermediateOutputPath> + <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)' == ''">$(RootBinDir)obj</BaseIntermediateOutputPath> <IntermediateOutputPath Condition="'$(IntermediateOutputPath)' == ''">$(BaseIntermediateOutputPath)\$(BuildOS).$(BuildArch).$(Configuration)</IntermediateOutputPath> <OutputPath Condition="'$(OutputPath)' == ''">$(BaseIntermediateOutputPath)\$(BuildOS).$(BuildArch).$(Configuration)</OutputPath> <FinalOutputPath Condition="'$(FinalOutputPath)' == ''">$(BinDir)</FinalOutputPath> diff --git a/src/mscorlib/mscorlib.shared.sources.props b/src/mscorlib/mscorlib.shared.sources.props index e75b0df61d..a4b0511dc5 100644 --- a/src/mscorlib/mscorlib.shared.sources.props +++ b/src/mscorlib/mscorlib.shared.sources.props @@ -776,7 +776,7 @@ <GlobalizationSources Include="$(CoreFxSourcesRoot)\System\Globalization\UmAlQuraCalendar.cs" /> <GlobalizationSources Include="$(CoreFxSourcesRoot)\System\Globalization\UnicodeCategory.cs " /> </ItemGroup> - <ItemGroup Condition="'$(FeatureCoreFxGlobalization)' == 'true' and '$(OS)' == 'Unix'"> + <ItemGroup Condition="'$(FeatureCoreFxGlobalization)' == 'true' and '$(TargetsUnix)' == 'true'"> <GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\EncodingTable.Unix.cs" /> <GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\EncodingDataItem.Unix.cs" /> diff --git a/src/pal/inc/rt/palrt.h b/src/pal/inc/rt/palrt.h index 3cd7aee671..10e9f13400 100644 --- a/src/pal/inc/rt/palrt.h +++ b/src/pal/inc/rt/palrt.h @@ -1380,7 +1380,7 @@ typedef VOID (__stdcall *WAITORTIMERCALLBACK)(PVOID, BOOLEAN); #define PORTABILITY_ASSERT(message) _ASSERTE(false && message) #endif -#define UNREFERENCED_PARAMETER(P) (P) +#define UNREFERENCED_PARAMETER(P) (void)(P) #ifdef _WIN64 #define VALPTR(x) VAL64(x) diff --git a/src/palrt/decarith.cpp b/src/palrt/decarith.cpp index 03b206924d..1552dbd740 100644 --- a/src/palrt/decarith.cpp +++ b/src/palrt/decarith.cpp @@ -1001,10 +1001,10 @@ HaveScale64: rgulRem[1] = (rgulRem[1] << 1) + ulTmp; rgulRem[2] = (rgulRem[2] << 1) + ulTmp1; - if (rgulRem[2] > rgulDivisor[2] || rgulRem[2] == rgulDivisor[2] && - (rgulRem[1] > rgulDivisor[1] || rgulRem[1] == rgulDivisor[1] && - (rgulRem[0] > rgulDivisor[0] || rgulRem[0] == rgulDivisor[0] && - (rgulQuo[0] & 1)))) + if (rgulRem[2] > rgulDivisor[2] || (rgulRem[2] == rgulDivisor[2] && + (rgulRem[1] > rgulDivisor[1] || (rgulRem[1] == rgulDivisor[1] && + (rgulRem[0] > rgulDivisor[0] || (rgulRem[0] == rgulDivisor[0] && + (rgulQuo[0] & 1))))))) goto RoundUp; break; } diff --git a/src/palrt/decconv.cpp b/src/palrt/decconv.cpp index 259f72e9c8..2ba6703904 100644 --- a/src/palrt/decconv.cpp +++ b/src/palrt/decconv.cpp @@ -186,7 +186,7 @@ VarDecFromR4(float fltIn, DECIMAL FAR* pdecOut) // ulMant = (LONG)dbl; dbl -= (double)ulMant; // difference between input & integer - if ( dbl > 0.5 || dbl == 0.5 && (ulMant & 1) ) + if ( dbl > 0.5 || (dbl == 0.5 && (ulMant & 1)) ) ulMant++; if (ulMant == 0) @@ -333,7 +333,7 @@ VarDecFromR8(double dblIn, DECIMAL FAR* pdecOut) // sdlMant.int64 = (LONGLONG)dbl; dbl -= (double)(LONGLONG)sdlMant.int64; // dif between input & integer - if ( dbl > 0.5 || dbl == 0.5 && (sdlMant.u.Lo & 1) ) + if ( dbl > 0.5 || (dbl == 0.5 && (sdlMant.u.Lo & 1)) ) sdlMant.int64++; if (sdlMant.int64 == 0) @@ -529,7 +529,7 @@ STDAPI VarCyFromDec(DECIMAL FAR* pdecIn, CY FAR* pcyOut) // Round result based on remainder in sdlTmp1.Hi. // ulPwr >>= 1; // compare to power/2 (power always even) - if (sdlTmp1.u.Hi > ulPwr || sdlTmp1.u.Hi == ulPwr && (sdlTmp.u.Lo & 1)) + if (sdlTmp1.u.Hi > ulPwr || (sdlTmp1.u.Hi == ulPwr && (sdlTmp.u.Lo & 1))) sdlTmp.int64++; } else { @@ -584,8 +584,8 @@ STDAPI VarCyFromDec(DECIMAL FAR* pdecIn, CY FAR* pcyOut) // Current result is in sdlTmp. // ulPwr >>= 1; // compare to power/2 (power always even) - if (sdlTmp1.u.Lo > ulPwr || sdlTmp1.u.Lo == ulPwr && - ((sdlTmp.u.Lo & 1) || sdlTmp1.u.Hi != 0)) + if (sdlTmp1.u.Lo > ulPwr || (sdlTmp1.u.Lo == ulPwr && + ((sdlTmp.u.Lo & 1) || sdlTmp1.u.Hi != 0))) sdlTmp.int64++; } diff --git a/src/utilcode/corimage.cpp b/src/utilcode/corimage.cpp index b6fd60d785..3763e541e4 100644 --- a/src/utilcode/corimage.cpp +++ b/src/utilcode/corimage.cpp @@ -82,8 +82,8 @@ Cor_RtlImageRvaToSection32(PTR_IMAGE_NT_HEADERS32 NtHeaders, NtSection = PTR_IMAGE_FIRST_SECTION( NtHeaders ); for (i=0; i<NtHeaders->FileHeader.NumberOfSections; i++) { if (FileLength && - ((VAL32(NtSection->PointerToRawData) > FileLength)) || - (VAL32(NtSection->SizeOfRawData) > FileLength - VAL32(NtSection->PointerToRawData))) + (((VAL32(NtSection->PointerToRawData) > FileLength)) || + (VAL32(NtSection->SizeOfRawData) > FileLength - VAL32(NtSection->PointerToRawData)))) return NULL; if (Rva >= VAL32(NtSection->VirtualAddress) && Rva < VAL32(NtSection->VirtualAddress) + VAL32(NtSection->SizeOfRawData)) @@ -107,8 +107,8 @@ Cor_RtlImageRvaToSection64(PTR_IMAGE_NT_HEADERS64 NtHeaders, NtSection = PTR_IMAGE_FIRST_SECTION( NtHeaders ); for (i=0; i<VAL16(NtHeaders->FileHeader.NumberOfSections); i++) { if (FileLength && - ((VAL32(NtSection->PointerToRawData) > FileLength)) || - (VAL32(NtSection->SizeOfRawData) > FileLength - VAL32(NtSection->PointerToRawData))) + (((VAL32(NtSection->PointerToRawData) > FileLength)) || + (VAL32(NtSection->SizeOfRawData) > FileLength - VAL32(NtSection->PointerToRawData)))) return NULL; if (Rva >= VAL32(NtSection->VirtualAddress) && Rva < VAL32(NtSection->VirtualAddress) + VAL32(NtSection->SizeOfRawData)) diff --git a/src/utilcode/ex.cpp b/src/utilcode/ex.cpp index 032971fb86..1fd997fd60 100644 --- a/src/utilcode/ex.cpp +++ b/src/utilcode/ex.cpp @@ -1815,16 +1815,20 @@ Exception *ExThrowWithInnerHelper(Exception *inner) #ifdef _DEBUG -#pragma warning(disable: 4748) +#ifdef _MSC_VER #pragma optimize("", off) -#pragma warning(disable: 4748) - +#endif // _MSC_VER void ExThrowTrap(const char *fcn, const char *file, int line, const char *szType, HRESULT hr, const char *args) { SUPPORTS_DAC; return; } + +#ifdef _MSC_VER +#pragma optimize("", on) +#endif // _MSC_VER + #endif diff --git a/src/utilcode/rangetree.cpp b/src/utilcode/rangetree.cpp index 028ebd9769..6d3f644471 100644 --- a/src/utilcode/rangetree.cpp +++ b/src/utilcode/rangetree.cpp @@ -357,8 +357,8 @@ BOOL RangeTree::OverlapsNode(Node *node, SIZE_T start, SIZE_T end, SIZE_T mask) && (end > node->start && start < node->end)) return TRUE; - if (node->children[0] != NULL && OverlapsNode(node->children[0], start, end, mask) - || node->children[1] != NULL && OverlapsNode(node->children[1], start, end, mask)) + if ((node->children[0] != NULL && OverlapsNode(node->children[0], start, end, mask)) + || (node->children[1] != NULL && OverlapsNode(node->children[1], start, end, mask))) return TRUE; return FALSE; diff --git a/src/utilcode/util.cpp b/src/utilcode/util.cpp index 205659831f..ee115c7aa5 100644 --- a/src/utilcode/util.cpp +++ b/src/utilcode/util.cpp @@ -1980,7 +1980,7 @@ HRESULT validateTokenSig( if(i == IMAGE_CEE_CS_CALLCONV_FIELD) return validateOneArg(tk, &sig, NULL, pImport, TRUE); // EXPLICITTHIS and native call convs are for stand-alone sigs only (for calli) - if((i != IMAGE_CEE_CS_CALLCONV_DEFAULT)&&( i != IMAGE_CEE_CS_CALLCONV_VARARG) + if(((i != IMAGE_CEE_CS_CALLCONV_DEFAULT)&&( i != IMAGE_CEE_CS_CALLCONV_VARARG)) || (ulCallConv & IMAGE_CEE_CS_CALLCONV_EXPLICITTHIS)) return VLDTR_E_MD_BADCALLINGCONV; break; diff --git a/src/vm/CMakeLists.txt b/src/vm/CMakeLists.txt index 5795fa3d91..62ec27fcf0 100644 --- a/src/vm/CMakeLists.txt +++ b/src/vm/CMakeLists.txt @@ -25,7 +25,6 @@ add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE) if(CLR_CMAKE_PLATFORM_UNIX) add_compile_options(-fPIC) - add_definitions(-DFEATURE_COREFX_GLOBALIZATION) endif(CLR_CMAKE_PLATFORM_UNIX) set(VM_SOURCES_DAC_AND_WKS_COMMON diff --git a/src/vm/clsload.cpp b/src/vm/clsload.cpp index f80041cf38..59ceddd9e8 100644 --- a/src/vm/clsload.cpp +++ b/src/vm/clsload.cpp @@ -1393,9 +1393,9 @@ TypeHandle ClassLoader::LookupTypeHandleForTypeKeyInner(TypeKey *pKey, BOOL fChe // Check if it's the typical instantiation. In this case it's not stored in the same // way as other constructed types. if (!pKey->IsConstructed() || - pKey->GetKind() == ELEMENT_TYPE_CLASS && ClassLoader::IsTypicalInstantiation(pKey->GetModule(), - pKey->GetTypeToken(), - pKey->GetInstantiation())) + (pKey->GetKind() == ELEMENT_TYPE_CLASS && ClassLoader::IsTypicalInstantiation(pKey->GetModule(), + pKey->GetTypeToken(), + pKey->GetInstantiation()))) { return TypeHandle(pKey->GetModule()->LookupTypeDef(pKey->GetTypeToken())); } @@ -6235,7 +6235,7 @@ BOOL ClassLoader::CheckAccessMember( // TRUE if access is allowed // it was already done in CanAccessClass above. if (accessCheckOptions.TransparencyCheckNeeded() && - (checkTargetMethodTransparency && pOptionalTargetMethod || + ((checkTargetMethodTransparency && pOptionalTargetMethod) || pOptionalTargetField)) { if (!CheckTransparentAccessToCriticalCode( diff --git a/src/vm/codeman.cpp b/src/vm/codeman.cpp index b5243a5f75..bd9a82f270 100644 --- a/src/vm/codeman.cpp +++ b/src/vm/codeman.cpp @@ -2393,7 +2393,7 @@ EEJitManager::DomainCodeHeapList *EEJitManager::GetCodeHeapList(MethodDesc *pMD, for (int i=0; i < count; i++) { if (ppList[i]->m_pAllocator == pAllocator || - !fCanUnload && !ppList[i]->m_pAllocator->CanUnload()) + (!fCanUnload && !ppList[i]->m_pAllocator->CanUnload())) { pList = ppList[i]; break; diff --git a/src/vm/exceptionhandling.cpp b/src/vm/exceptionhandling.cpp index 0d89fbb281..4012a62dd0 100644 --- a/src/vm/exceptionhandling.cpp +++ b/src/vm/exceptionhandling.cpp @@ -6243,8 +6243,8 @@ StackFrame ExceptionTracker::FindParentStackFrameHelper(CrawlFrame* pCF, lExit: ; - STRESS_LOG3(LF_EH|LF_GCROOTS, LL_INFO100, "Returning" FMT_ADDR "as the parent stack frame for %s" FMT_ADDR "\n", - DBG_ADDR(sfResult.SP), fIsFilterFunclet ? "filter funclet" : "funclet", DBG_ADDR(csfCurrent.SP)); + STRESS_LOG3(LF_EH|LF_GCROOTS, LL_INFO100, "Returning 0x%p as the parent stack frame for %s 0x%p\n", + sfResult.SP, fIsFilterFunclet ? "filter funclet" : "funclet", csfCurrent.SP); return sfResult; } diff --git a/src/vm/frames.cpp b/src/vm/frames.cpp index bc1d48e252..e65aade1cb 100644 --- a/src/vm/frames.cpp +++ b/src/vm/frames.cpp @@ -490,7 +490,7 @@ Frame::~Frame() Pop(pThread); } } -#endif FEATURE_PAL +#endif // FEATURE_PAL //----------------------------------------------------------------------- #endif // #ifndef DACCESS_COMPILE diff --git a/src/vm/gcenv.cpp b/src/vm/gcenv.cpp index a342533f98..68eee622f5 100644 --- a/src/vm/gcenv.cpp +++ b/src/vm/gcenv.cpp @@ -327,25 +327,6 @@ StackWalkAction GcStackCrawlCallBack(CrawlFrame* pCF, VOID* pData) return SWA_CONTINUE; } -static void CALLBACK CheckPromoted(_UNCHECKED_OBJECTREF *pObjRef, LPARAM *pExtraInfo, LPARAM lp1, LPARAM lp2) -{ - LIMITED_METHOD_CONTRACT; - - LOG((LF_GC, LL_INFO100000, LOG_HANDLE_OBJECT_CLASS("Checking referent of Weak-", pObjRef, "to ", *pObjRef))); - - Object **pRef = (Object **)pObjRef; - if (!GCHeap::GetGCHeap()->IsPromoted(*pRef)) - { - LOG((LF_GC, LL_INFO100, LOG_HANDLE_OBJECT_CLASS("Severing Weak-", pObjRef, "to unreachable ", *pObjRef))); - - *pRef = NULL; - } - else - { - LOG((LF_GC, LL_INFO1000000, "reachable " LOG_OBJECT_CLASS(*pObjRef))); - } -} - VOID GCToEEInterface::SyncBlockCacheWeakPtrScan(HANDLESCANPROC scanProc, LPARAM lp1, LPARAM lp2) { CONTRACTL diff --git a/src/vm/hash.h b/src/vm/hash.h index 8929c5c0a9..2fd4418d67 100644 --- a/src/vm/hash.h +++ b/src/vm/hash.h @@ -491,7 +491,7 @@ public: { LIMITED_METHOD_DAC_CONTRACT; - for (m_pBucket = m_pBucket;m_pBucket < m_pSentinel; m_pBucket++) + for (;m_pBucket < m_pSentinel; m_pBucket++) { //loop thru all buckets for (m_id = m_id+1; m_id < 4; m_id++) { //loop through all slots diff --git a/src/vm/interoputil.cpp b/src/vm/interoputil.cpp index b1943bc13a..6dbc7c1e50 100644 --- a/src/vm/interoputil.cpp +++ b/src/vm/interoputil.cpp @@ -1509,7 +1509,7 @@ ULONG SafeReleasePreemp(IUnknown * pUnk, RCW * pRCW) return res; } -#ifdef _TARGET_AMD64_ +#if defined(_TARGET_AMD64_) && defined(_MSC_VER) // codegen bug on amd64 causes BBT to fail for the following function. as a // workaround I have disabled optimizations for it until we get an updated toolset. #pragma optimize( "", off ) @@ -1600,7 +1600,7 @@ ULONG SafeRelease(IUnknown* pUnk, RCW* pRCW) return res; } -#ifdef _TARGET_AMD64_ +#if defined(_TARGET_AMD64_) && defined(_MSC_VER) // turn optimizations back on #pragma optimize( "", on ) #endif diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp index e677e27c3a..c12351adc5 100644 --- a/src/vm/jitinterface.cpp +++ b/src/vm/jitinterface.cpp @@ -4050,7 +4050,7 @@ DWORD CEEInfo::getClassAttribsInternal (CORINFO_CLASS_HANDLE clsHnd) if (pMT->ContainsStackPtr()) ret |= CORINFO_FLG_CONTAINS_STACK_PTR; - if (pClass->IsNotTightlyPacked() && (!pClass->IsManagedSequential() || pClass->HasExplicitSize()) || + if ((pClass->IsNotTightlyPacked() && (!pClass->IsManagedSequential() || pClass->HasExplicitSize())) || pMT == g_TypedReferenceMT || VMClsHnd.IsNativeValueType()) { diff --git a/src/vm/object.cpp b/src/vm/object.cpp index 9b576005d5..648cbf99b5 100644 --- a/src/vm/object.cpp +++ b/src/vm/object.cpp @@ -2176,7 +2176,7 @@ INT32 StringObject::FastCompareStringHelper(DWORD* strAChars, INT32 countA, DWOR alignmentA = 0; } - if ((alignmentA == 0)) + if (alignmentA == 0) { while (count >= 4) { diff --git a/src/vm/profilinghelper.cpp b/src/vm/profilinghelper.cpp index 1a4f2f4184..140ad07600 100644 --- a/src/vm/profilinghelper.cpp +++ b/src/vm/profilinghelper.cpp @@ -760,7 +760,16 @@ HRESULT ProfilingAPIUtility::AttemptLoadProfilerForStartup() IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH, &wszProfilerDLL)); #else // FEATURE_CORECLR IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_COR_PROFILER, &wszClsid)); - IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_COR_PROFILER_PATH, &wszProfilerDLL)); + +#if defined(_TARGET_X86_) + IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_COR_PROFILER_PATH_32, &wszProfilerDLL)); +#elif defined(_TARGET_AMD64_) + IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_COR_PROFILER_PATH_64, &wszProfilerDLL)); +#endif + if(wszProfilerDLL == NULL) + { + IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_COR_PROFILER_PATH, &wszProfilerDLL)); + } #endif // FEATURE_CORECLR // If the environment variable doesn't exist, profiling is not enabled. diff --git a/src/vm/securitymeta.cpp b/src/vm/securitymeta.cpp index f631cc17d1..b46ac44b73 100644 --- a/src/vm/securitymeta.cpp +++ b/src/vm/securitymeta.cpp @@ -1723,7 +1723,7 @@ void ModuleSecurityDescriptor::VerifyDataComputed() #endif // _DEBUG #ifdef FEATURE_CORECLR - if (pAssembly->IsSystem() || pAssembly->GetManifestFile()->HasOpenedILimage() && GetAppDomain()->IsImageFullyTrusted(pAssembly->GetManifestFile()->GetOpenedILimage())) + if (pAssembly->IsSystem() || (pAssembly->GetManifestFile()->HasOpenedILimage() && GetAppDomain()->IsImageFullyTrusted(pAssembly->GetManifestFile()->GetOpenedILimage()))) { // Set the flag if the assembly is microsoft platform. This gets saved in Ngen Image // to determinne if the NI was genrated as full-trust. If NI is generated as full-trust diff --git a/src/vm/siginfo.cpp b/src/vm/siginfo.cpp index 3cc9cf1a23..dd57e63840 100644 --- a/src/vm/siginfo.cpp +++ b/src/vm/siginfo.cpp @@ -1121,7 +1121,7 @@ TypeHandle SigPointer::GetTypeHandleThrowing( ClassLoader::NotFoundAction notFoundAction; CorInternalStates tdTypes; - switch(typ) { + switch((DWORD)typ) { case ELEMENT_TYPE_TYPEDBYREF: { thRet = TypeHandle(g_TypedReferenceMT); @@ -1517,7 +1517,7 @@ TypeHandle SigPointer::GetTypeHandleThrowing( // Check that the type that we loaded matches the signature // with regards to ET_CLASS and ET_VALUETYPE // - if ((fLoadTypes == ClassLoader::LoadTypes)) + if (fLoadTypes == ClassLoader::LoadTypes) { // Skip this check when using zap sigs; it should have been correctly computed at NGen time // and a change from one to the other would have invalidated the image. @@ -1811,7 +1811,7 @@ TypeHandle SigPointer::GetGenericInstType(Module * pModule, } #ifndef DACCESS_COMPILE - if ((fLoadTypes == ClassLoader::LoadTypes)) + if (fLoadTypes == ClassLoader::LoadTypes) { // Skip this check when using zap sigs; it should have been correctly computed at NGen time // and a change from one to the other would have invalidated the image. Leave in the code for debug so we can assert below. @@ -4816,9 +4816,9 @@ BOOL MetaSig::CompareVariableConstraints(const Substitution *pSubst1, // b) may be implicit (ie. absent) in the overriden variable's declaration if (!(CompareTypeDefOrRefOrSpec(pModule1, tkConstraintType1, NULL, MscorlibBinder::GetModule(), g_pObjectClass->GetCl(), NULL, NULL) || - ((specialConstraints1 & gpNotNullableValueTypeConstraint) != 0) && + (((specialConstraints1 & gpNotNullableValueTypeConstraint) != 0) && (CompareTypeDefOrRefOrSpec(pModule1, tkConstraintType1, NULL, - MscorlibBinder::GetModule(), g_pValueTypeClass->GetCl(), NULL, NULL)))) + MscorlibBinder::GetModule(), g_pValueTypeClass->GetCl(), NULL, NULL))))) { HENUMInternalHolder hEnum2(pInternalImport2); mdGenericParamConstraint tkConstraint2; diff --git a/src/vm/stackwalk.cpp b/src/vm/stackwalk.cpp index e78b1eb71f..d39ce06ef4 100644 --- a/src/vm/stackwalk.cpp +++ b/src/vm/stackwalk.cpp @@ -1972,8 +1972,8 @@ ProcessFuncletsForGCReporting: _ASSERTE(m_flags & GC_FUNCLET_REFERENCE_REPORTING); STRESS_LOG2(LF_GCROOTS, LL_INFO100, - "STACKWALK: Reached parent of non-filter funclet @ CallerSP: " FMT_ADDR ", m_crawl.pFunc = " FMT_ADDR "\n", - DBG_ADDR(m_sfParent.SP), DBG_ADDR(m_crawl.pFunc)); + "STACKWALK: Reached parent of non-filter funclet @ CallerSP: %p, m_crawl.pFunc = %p\n", + m_sfParent.SP, m_crawl.pFunc); // by default a funclet's parent won't report its GC roots since they would have already // been reported by the funclet. however there is a small window during unwind before @@ -2008,8 +2008,8 @@ ProcessFuncletsForGCReporting: } STRESS_LOG4(LF_GCROOTS, LL_INFO100, - "Funclet didn't report references: handling frame: " FMT_ADDR ", m_sfFuncletParent = " FMT_ADDR ", is funclet: %d, skip reporting %d\n", - DBG_ADDR(pTracker->GetEstablisherOfActualHandlingFrame().SP), DBG_ADDR(m_sfFuncletParent.SP), m_crawl.IsFunclet(), shouldSkipReporting); + "Funclet didn't report references: handling frame: %p, m_sfFuncletParent = %p, is funclet: %d, skip reporting %d\n", + pTracker->GetEstablisherOfActualHandlingFrame().SP, m_sfFuncletParent.SP, m_crawl.IsFunclet(), shouldSkipReporting); } m_crawl.fShouldParentToFuncletSkipReportingGCReferences = shouldSkipReporting; diff --git a/tests/buildtest.cmd b/tests/buildtest.cmd index a2ebdf07c3..c8823f961e 100644 --- a/tests/buildtest.cmd +++ b/tests/buildtest.cmd @@ -8,15 +8,15 @@ set "__SourceDir=%__ProjectDir%\src" set "__TestDir=%__ProjectDir%\tests" set "__ProjectFilesDir=%__TestDir%" set "__PackagesDir=%__ProjectDir%\packages" -set "__RootBinDir=%__ProjectDir%\binaries" +set "__RootBinDir=%__ProjectDir%\bin" set "__LogsDir=%__RootBinDir%\Logs" :Arg_Loop if "%1" == "" goto ArgsDone if /i "%1" == "x64" (set __BuildArch=x64&shift&goto Arg_Loop) -if /i "%1" == "debug" (set __BuildType=debug&shift&goto Arg_Loop) -if /i "%1" == "release" (set __BuildType=release&shift&goto Arg_Loop) +if /i "%1" == "debug" (set __BuildType=Debug&shift&goto Arg_Loop) +if /i "%1" == "release" (set __BuildType=Release&shift&goto Arg_Loop) if /i "%1" == "clean" (set __CleanBuild=1&shift&goto Arg_Loop) @@ -27,14 +27,14 @@ goto Usage if not defined __BuildArch set __BuildArch=x64 -if not defined __BuildType set __BuildType=debug +if not defined __BuildType set __BuildType=Debug if not defined __BuildOS set __BuildOS=Windows_NT set "__TestBinDir=%__RootBinDir%\tests\%__BuildOS%.%__BuildArch%.%__BuildType%" :: We have different managed and native intermediate dirs because the managed bits will include :: the configuration information deeper in the intermediates path. -set "__NativeTestIntermediatesDir=%__RootBinDir%\tests\intermediates\%__BuildOS%.%__BuildArch%.%__BuildType%" -set "__ManagedTestIntermediatesDir=%__RootBinDir%\tests\intermediates" +set "__NativeTestIntermediatesDir=%__RootBinDir%\tests\obj\%__BuildOS%.%__BuildArch%.%__BuildType%" +set "__ManagedTestIntermediatesDir=%__RootBinDir%\tests\obj" set "__TestManagedBuildLog=%__LogsDir%\Tests_Managed_%__BuildOS%__%__BuildArch%__%__BuildType%.log" set "__TestNativeBuildLog=%__LogsDir%\Tests_Native_%__BuildOS%__%__BuildArch%__%__BuildType%.log" set "__XunitWrapperBuildLog=%__LogsDir%\Tests_XunitWrapper_%__BuildOS%__%__BuildArch%__%__BuildType%.log" diff --git a/tests/runtest.cmd b/tests/runtest.cmd index ffefb5e9fc..4978618980 100644 --- a/tests/runtest.cmd +++ b/tests/runtest.cmd @@ -38,9 +38,9 @@ if not defined VSINSTALLDIR echo Error: runtest.cmd should be run from a Visual if not defined __BuildArch set __BuildArch=x64 if not defined __BuildType set __BuildType=debug if not defined __BuildOS set __BuildOS=Windows_NT -if not defined __BinDir set __BinDir=%__ProjectFilesDir%..\binaries\Product\%__BuildOS%.%__BuildArch%.%__BuildType% -if not defined __TestWorkingDir set __TestWorkingDir=%__ProjectFilesDir%..\binaries\tests\%__BuildOS%.%__BuildArch%.%__BuildType% -if not defined __LogsDir set __LogsDir=%__ProjectFilesDir%..\binaries\Logs +if not defined __BinDir set __BinDir=%__ProjectFilesDir%..\bin\Product\%__BuildOS%.%__BuildArch%.%__BuildType% +if not defined __TestWorkingDir set __TestWorkingDir=%__ProjectFilesDir%..\bin\tests\%__BuildOS%.%__BuildArch%.%__BuildType% +if not defined __LogsDir set __LogsDir=%__ProjectFilesDir%..\bin\Logs :: Default global test environmet variables if not defined XunitTestBinBase set XunitTestBinBase=%__TestWorkingDir%\ diff --git a/tests/src/dir.common.props b/tests/src/dir.common.props index 359acdf207..0b2a873d84 100644 --- a/tests/src/dir.common.props +++ b/tests/src/dir.common.props @@ -29,12 +29,12 @@ <!-- Setup the default output and intermediate paths --> <PropertyGroup> - <BaseOutputPathWithConfig>$(ProjectDir)\..\binaries\tests\$(BuildOS).$(Platform).$(Configuration)\</BaseOutputPathWithConfig> + <BaseOutputPathWithConfig>$(ProjectDir)\..\bin\tests\$(BuildOS).$(Platform).$(Configuration)\</BaseOutputPathWithConfig> <BaseOutputPathWithConfig Condition="'$(__TestBinDir)' != ''">$(__TestBinDir)\</BaseOutputPathWithConfig> <BinDir>$(BaseOutputPathWithConfig)\..</BinDir> - <BaseIntermediateOutputPath>$(ProjectDir)\..\binaries\tests\intermediates\</BaseIntermediateOutputPath> + <BaseIntermediateOutputPath>$(ProjectDir)\..\bin\tests\obj\</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(__ManagedTestIntermediatesDir)' != ''">$(__ManagedTestIntermediatesDir)\</BaseIntermediateOutputPath> - <__NativeTestIntermediatesDir Condition="'$(__NativeTestIntermediatesDir)' == ''">$([System.IO.Path]::GetFullPath($(BaseOutputPathWithConfig)..\intermediates\$(BuildOS).$(Platform).$(Configuration)\))</__NativeTestIntermediatesDir> + <__NativeTestIntermediatesDir Condition="'$(__NativeTestIntermediatesDir)' == ''">$([System.IO.Path]::GetFullPath($(BaseOutputPathWithConfig)..\obj\$(BuildOS).$(Platform).$(Configuration)\))</__NativeTestIntermediatesDir> <BuildProjectRelativeDir>$(MSBuildProjectName)\</BuildProjectRelativeDir> <BuildProjectRelativeDir Condition="'$(MSBuildProjectDirectory.Contains($(SourceDir)))'">$([System.String]::Copy('$(MSBuildProjectDirectory)').Replace($(SourceDir),''))</BuildProjectRelativeDir> <IntermediateOutputPath>$(BaseIntermediateOutputPath)$(BuildProjectRelativeDir)</IntermediateOutputPath> diff --git a/tests/src/dir.targets b/tests/src/dir.targets index cd45da5440..0c38331b7d 100644 --- a/tests/src/dir.targets +++ b/tests/src/dir.targets @@ -36,7 +36,7 @@ <ItemGroup> <PossibleTargetFrameworks Include="$(_TargetFrameworkDirectories)" /> <ReferencePath Condition="'$(LinkLocalMscorlib)' != 'true'" Include="%(PossibleTargetFrameworks.Identity)mscorlib.dll" /> - <ReferencePath Condition="'$(LinkLocalMscorlib)' == 'true'" Include="$(ProjectDir)\..\binaries\Product\$(BuildOS).$(BuildArch).$(BuildType)\mscorlib.dll" /> + <ReferencePath Condition="'$(LinkLocalMscorlib)' == 'true'" Include="$(ProjectDir)\..\bin\Product\$(BuildOS).$(BuildArch).$(BuildType)\mscorlib.dll" /> </ItemGroup> </Target> |