[Tizen] Force Inline for Generic Methods (#224) accepted/tizen/unified/20200623.124116 submit/tizen/20200622.225420
author정동헌/Common Platform Lab(SR)/Principal Engineer/삼성전자 <dheon.jung@samsung.com>
Mon, 22 Jun 2020 22:44:28 +0000 (07:44 +0900)
committer이형주/Common Platform Lab(SR)/Staff Engineer/삼성전자 <leee.lee@samsung.com>
Mon, 22 Jun 2020 22:44:28 +0000 (07:44 +0900)
This patch enables more generic method inlining for methods which are not compiled by NI.

clrdefinitions.cmake
packaging/coreclr.spec
src/vm/jitinterface.cpp

index 4d366e1..9120cad 100644 (file)
@@ -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)
index 77a5481..4a9ad3a 100755 (executable)
@@ -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
 
index bf4abe1..b26c5ba 100644 (file)
@@ -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;
 }