Compiles more methods which have IsAggressiveOptimization attribute.
%endif
%define _source_version_flags /p:EnableSourceLink=false /p:DisableSourceLink=true /p:EnableSourceControlManagerQueries=false /p:EmbedUntrackedSources=false
-%define _build_args --keepnativesymbols true --arch %{_barch} --runtimeConfiguration %{dotnet_buildtype_clr} --librariesConfiguration %{dotnet_buildtype_fx} %{_source_version_flags}
+%define _build_args --keepnativesymbols true --arch %{_barch} --runtimeConfiguration %{dotnet_buildtype_clr} --librariesConfiguration %{dotnet_buildtype_fx} %{_source_version_flags} /p:DisableAggressiveOpt=true
%define _build_args_release --keepnativesymbols true --arch %{_barch} --runtimeConfiguration Release --librariesConfiguration Release %{_source_version_flags}
+%define _native_opts --cmakeargs -DDISABLE_AGGRESSIVE_OPT=true
+%define _managed_opts -p:DefineConstants=DISABLE_AGGRESSIVE_OPT
export NUGET_PACKAGES=%{_builddir}/%{name}-%{version}/.packages/
export LD_LIBRARY_PATH=%{_builddir}/%{name}-%{version}/libicu-57.1/
# Build native CoreCLR and native CoreFX
-./build.sh --portablebuild false %{_build_args} --subset clr.runtime+clr.jit+clr.iltools+libs.native --cmakeargs -DFEATURE_IBCLOGGER=true --cmakeargs -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION=true --cmakeargs -DCLR_ADDITIONAL_LINKER_FLAGS=-Wl,-z,relro %{_pgo_flags}
+./build.sh --portablebuild false %{_build_args} --subset clr.runtime+clr.jit+clr.iltools+libs.native --cmakeargs -DFEATURE_IBCLOGGER=true --cmakeargs -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION=true --cmakeargs -DCLR_ADDITIONAL_LINKER_FLAGS=-Wl,-z,relro %{_pgo_flags} %{_native_opts}
%ifarch x86_64
# Publish crossgen2 as a single file with self-contained
./build.sh --portablebuild false %{_build_args} --subset clr.alljits --cmakeargs -DFEATURE_IBCLOGGER=true --cmakeargs -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION=true --cmakeargs -DCLR_ADDITIONAL_LINKER_FLAGS=-Wl,-z,relro %{_pgo_flags}
-./.dotnet/dotnet publish --self-contained true -r linux-%{_barch} ./src/coreclr/tools/aot/crossgen2/crossgen2.csproj -c %{dotnet_buildtype_clr} -p:PublishSingleFile=true
+./.dotnet/dotnet publish --self-contained true -r linux-%{_barch} ./src/coreclr/tools/aot/crossgen2/crossgen2.csproj -c %{dotnet_buildtype_clr} -p:PublishSingleFile=true %{_managed_opts}
%endif
%if 0%{skipmscorlib}
# Build Release CoreCLR & CoreFX (these are required for some tests)
# Build native CoreCLR and native CoreFX
-./build.sh --portablebuild false %{_build_args_release} --subset clr.runtime+clr.jit+clr.iltools+libs.native --cmakeargs -DFEATURE_IBCLOGGER=true --cmakeargs -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION=true --cmakeargs -DCLR_ADDITIONAL_LINKER_FLAGS=-Wl,-z,relro %{_pgo_flags}
+./build.sh --portablebuild false %{_build_args_release} --subset clr.runtime+clr.jit+clr.iltools+libs.native --cmakeargs -DFEATURE_IBCLOGGER=true --cmakeargs -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION=true --cmakeargs -DCLR_ADDITIONAL_LINKER_FLAGS=-Wl,-z,relro %{_pgo_flags} %{_native_opts}
# Build mscorlib (System.Private.CoreLib.dll)
./build.sh --portablebuild false %{_build_args_release} --subset clr.corelib
add_definitions(-DFEATURE_SVR_GC)
add_definitions(-DFEATURE_SYMDIFF)
add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:CROSSGEN_COMPONENT>>>:FEATURE_TIERED_COMPILATION>)
+if(DISABLE_AGGRESSIVE_OPT)
+ add_definitions(-DDISABLE_AGGRESSIVE_OPT)
+endif(DISABLE_AGGRESSIVE_OPT)
if (CLR_CMAKE_TARGET_ARCH_AMD64)
add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:CROSSGEN_COMPONENT>>>:FEATURE_ON_STACK_REPLACEMENT>)
endif (CLR_CMAKE_TARGET_ARCH_AMD64)
if ((methodImplAttributes & MethodImplAttributes.NoInlining) != 0)
flags |= MethodFlags.NoInlining;
+#if !DISABLE_AGGRESSIVE_OPT
// System.Reflection.Primitives we build against doesn't define AggressiveOptimization
const MethodImplAttributes MethodImplAttributes_AggressiveOptimization = (MethodImplAttributes)0x0200;
+#endif
// No optimization bit beats aggressive optimization bit (CLR compatible behavior)
if ((methodImplAttributes & MethodImplAttributes.NoOptimization) != 0)
flags |= MethodFlags.NoOptimization;
+#if !DISABLE_AGGRESSIVE_OPT
else if ((methodImplAttributes & MethodImplAttributes_AggressiveOptimization) != 0)
flags |= MethodFlags.AggressiveOptimization;
+#endif
if ((methodImplAttributes & MethodImplAttributes.AggressiveInlining) != 0)
flags |= MethodFlags.AggressiveInlining;
<Optimize Condition="'$(Optimize)' == ''">true</Optimize>
<DefineConstants>DEBUG;$(DefineConstants)</DefineConstants>
</PropertyGroup>
+ <PropertyGroup Condition="'$(DisableAggressiveOpt)' == 'true'">
+ <DefineConstants>DISABLE_AGGRESSIVE_OPT;$(DefineConstants)</DefineConstants>
+ </PropertyGroup>
</Project>
// see: https://github.com/dotnet/runtime/issues/5857
pMD = CoreLibBinder::GetMethod((BinderMethodID)(METHOD__CASTHELPERS__STELEMREF));
+#ifdef DISABLE_AGGRESSIVE_OPT
+ pDest = pMD->GetMultiCallableAddrOfCode();
+#else // DISABLE_AGGRESSIVE_OPT
pMD->DoPrestub(NULL);
// This helper is marked AggressiveOptimization and its native code is in its final form.
// Get the code directly to avoid PreStub indirection.
pDest = pMD->GetNativeCode();
+#endif // DISABLE_AGGRESSIVE_OPT
SetJitHelperFunction(CORINFO_HELP_ARRADDR_ST, pDest);
pMD = CoreLibBinder::GetMethod((BinderMethodID)(METHOD__CASTHELPERS__LDELEMAREF));
+#ifdef DISABLE_AGGRESSIVE_OPT
+ pDest = pMD->GetMultiCallableAddrOfCode();
+#else // DISABLE_AGGRESSIVE_OPT
pMD->DoPrestub(NULL);
// This helper is marked AggressiveOptimization and its native code is in its final form.
// Get the code directly to avoid PreStub indirection.
pDest = pMD->GetNativeCode();
+#endif // DISABLE_AGGRESSIVE_OPT
SetJitHelperFunction(CORINFO_HELP_LDELEMA_REF, pDest);
#endif //CROSSGEN_COMPILE
}
// Check for the aggressive optimization directive. AggressiveOptimization only makes sense for IL methods.
DWORD ilMethodImplAttribs = 0;
+#ifndef DISABLE_AGGRESSIVE_OPT
if (pMD->IsIL())
{
ilMethodImplAttribs = pMD->GetImplAttrs();
result |= CORINFO_FLG_AGGRESSIVE_OPT;
}
}
+#endif // !DISABLE_AGGRESSIVE_OPT
// Check for an inlining directive.
if (pMD->IsNotInline())
{
WRAPPER_NO_CONTRACT;
+#ifndef DISABLE_AGGRESSIVE_OPT
return
IsIL() && // only makes sense for IL methods, and this implies !IsNoMetadata()
IsMiAggressiveOptimization(GetImplAttrs());
+#else
+ return false;
+#endif // !DISABLE_AGGRESSIVE_OPT
}
// Does this method force the NativeCodeSlot to stay fixed after it