From 982bdae7fce02ab9901b051109dacf060a5d1dfb Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=A0=95=EB=8F=99=ED=97=8C/Common=20Platform=20Lab=28SR=29?= =?utf8?q?/Principal=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Tue, 23 Jun 2020 07:44:28 +0900 Subject: [PATCH] [Tizen] Force Inline for Generic Methods (#224) This patch enables more generic method inlining for methods which are not compiled by NI. --- clrdefinitions.cmake | 4 ++++ packaging/coreclr.spec | 4 ++-- src/vm/jitinterface.cpp | 11 +++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/clrdefinitions.cmake b/clrdefinitions.cmake index 4d366e1..9120cad 100644 --- a/clrdefinitions.cmake +++ b/clrdefinitions.cmake @@ -258,3 +258,7 @@ endif(WIN32) if(CLR_CMAKE_PLATFORM_DARWIN) add_definitions(-DFEATURE_WRITEBARRIER_COPY) endif(CLR_CMAKE_PLATFORM_DARWIN) + +if(TIZEN_AGGRESSIVE_INLINING_GENERIC) + add_definitions(-DTIZEN_AGGRESSIVE_INLINING_GENERIC) +endif(TIZEN_AGGRESSIVE_INLINING_GENERIC) diff --git a/packaging/coreclr.spec b/packaging/coreclr.spec index 77a5481..4a9ad3a 100755 --- a/packaging/coreclr.spec +++ b/packaging/coreclr.spec @@ -212,7 +212,7 @@ export CXXFLAGS+="-fstack-protector-strong" # Build native only. export NUGET_PACKAGES=%{_builddir}/%{name}-%{version}/.packages/ export LD_LIBRARY_PATH=%{_builddir}/%{name}-%{version}/libicu-57.1/ -./build.sh -portablebuild=false -%{_barch} -%{_buildtype} -numproc %{_numproc} -skipmscorlib -skipgenerateversion -skipnuget -msbuildonunsupportedplatform cmakeargs "-DFEATURE_PREJIT=true -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION=true -DCLR_ADDITIONAL_LINKER_FLAGS=-Wl,-z,relro" %{_ngen_relocs_opts} %{_pgo_flags} +./build.sh -portablebuild=false -%{_barch} -%{_buildtype} -numproc %{_numproc} -skipmscorlib -skipgenerateversion -skipnuget -msbuildonunsupportedplatform cmakeargs "-DFEATURE_PREJIT=true -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION=true -DTIZEN_AGGRESSIVE_INLINING_GENERIC=true -DCLR_ADDITIONAL_LINKER_FLAGS=-Wl,-z,relro" %{_ngen_relocs_opts} %{_pgo_flags} %endif %else %if 0%{skipnative} @@ -224,7 +224,7 @@ export LD_LIBRARY_PATH=%{_builddir}/%{name}-%{version}/libicu-57.1/ # Build native and mscorlib. export NUGET_PACKAGES=%{_builddir}/%{name}-%{version}/.packages/ export LD_LIBRARY_PATH=%{_builddir}/%{name}-%{version}/libicu-57.1/ -./build.sh -portablebuild=false -%{_barch} -%{_buildtype} -numproc %{_numproc} -skipgenerateversion -skiprestore -skiprestoreoptdata -skipnuget -skipcrossgen -msbuildonunsupportedplatform cmakeargs "-DFEATURE_IBCLOGGER=true -DFEATURE_PREJIT=true -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION=true -DCLR_ADDITIONAL_LINKER_FLAGS=-Wl,-z,relro" %{_ngen_relocs_opts} %{_pgo_flags} +./build.sh -portablebuild=false -%{_barch} -%{_buildtype} -numproc %{_numproc} -skipgenerateversion -skiprestore -skiprestoreoptdata -skipnuget -skipcrossgen -msbuildonunsupportedplatform cmakeargs "-DFEATURE_IBCLOGGER=true -DFEATURE_PREJIT=true -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION=true -DTIZEN_AGGRESSIVE_INLINING_GENERIC=true -DCLR_ADDITIONAL_LINKER_FLAGS=-Wl,-z,relro" %{_ngen_relocs_opts} %{_pgo_flags} %endif %endif diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp index bf4abe1..b26c5ba 100644 --- a/src/vm/jitinterface.cpp +++ b/src/vm/jitinterface.cpp @@ -6862,6 +6862,17 @@ DWORD CEEInfo::getMethodAttribsInternal (CORINFO_METHOD_HANDLE ftn) } #endif +#if defined(FEATURE_PREJIT) && defined(CROSSGEN_COMPILE) +#ifdef TIZEN_AGGRESSIVE_INLINING_GENERIC + if (!IsReadyToRunCompilation() && pMD->IsIL() && (result & CORINFO_FLG_FORCEINLINE) == 0 && + !pMD->IsTypicalMethodDefinition() && !pMD->IsGenericMethodDefinition() && + Module::GetPreferredZapModuleForMethodDesc(pMD) != pMD->GetLoaderModule()) + { + result |= CORINFO_FLG_FORCEINLINE; + } +#endif +#endif + return result; } -- 2.7.4