Skip to content

Commit b504d98

Browse files
lewingCopilot
andcommitted
Fix readytorun merged runner build and compute inliner identity lazily
Give the ilbody-implflags-versioning helper a unique assembly name and exclude its versioned helper projects from the readytorun merged runner, as is already done for tests/testv1 and tests/testv2. Only compute the cross-module inliner identity when it is needed. Co-authored-by: Copilot App <[email protected]>
1 parent 957b384 commit b504d98

6 files changed

Lines changed: 14 additions & 8 deletions

File tree

‎src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/InliningInfoNode.cs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
7474
}
7575
MethodDesc inliner = methodNode.Method;
7676
EcmaMethod inlinerDefinition = (EcmaMethod)inliner.GetPrimaryMethodDesc().GetTypicalMethodDefinition();
77-
MethodDesc inlinerIdentity = ILBodyFixupSignature.GetSignatureMethodForCompiledMethod(inliner);
7877

7978
if (inlinerDefinition.IsNonVersionable())
8079
{
@@ -85,8 +84,11 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
8584
// Only encode inlining info for inliners within the active module, or if cross module inline format is in use
8685
Debug.Assert(AllowCrossModuleInlines || (inlinerDefinition.Module == _module));
8786

87+
MethodDesc inlinerIdentity;
8888
if (AllowCrossModuleInlines && !factory.CompilationModuleGroup.VersionsWithMethodBody(inlinerDefinition))
8989
{
90+
inlinerIdentity = ILBodyFixupSignature.GetSignatureMethodForCompiledMethod(inliner);
91+
9092
// Cross-module inliners are encoded by their own Check_IL_Body import. Thunks and stubs don't have one.
9193
if (inlinerIdentity is null || inlinerIdentity.IsCompilerGeneratedILBodyForAsync())
9294
continue;

‎src/tests/readytorun/ilbody-implflags-versioning/helperv1/helper.csproj‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Library</OutputType>
4+
<AssemblyName>ImplFlagHelper</AssemblyName>
45
<Features>$(Features);runtime-async=on</Features>
56
<!-- V1 and V2 must produce identical IL bodies. -->
67
<Optimize>true</Optimize>

‎src/tests/readytorun/ilbody-implflags-versioning/helperv2/helper.csproj‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Library</OutputType>
4+
<AssemblyName>ImplFlagHelper</AssemblyName>
45
<Features>$(Features);runtime-async=on</Features>
56
<DefineConstants>$(DefineConstants);V2</DefineConstants>
67
<!-- V1 and V2 must produce identical IL bodies. -->

‎src/tests/readytorun/ilbody-implflags-versioning/ilbody-implflags-versioning.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using System.Runtime.CompilerServices;
66
using System.Threading.Tasks;
77

8-
// This assembly is compiled with cross-module inlining against V1 of helper.dll and runs against V2,
8+
// This assembly is compiled with cross-module inlining against V1 of ImplFlagHelper.dll and runs against V2,
99
// whose methods have the same IL bodies but different runtime-async or synchronized impl flags. Code
1010
// that inlined the V1 bodies must be rejected, so every result below must reflect the V2 semantics.
1111
public class ILBodyImplFlagsVersioning

‎src/tests/readytorun/ilbody-implflags-versioning/ilbody-implflags-versioning.csproj‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if not exist IL_DLLS\ilbody-implflags-versioning.dll (
3939
)
4040
4141
REM Compile against V1 of the helper, with cross-module inlining of its methods
42-
%Core_Root%\crossgen2\crossgen2.exe -O --opt-cross-module:helper -r:%Core_Root%\*.dll -r:%25CD%\helperv1\helper.dll -o:ilbody-implflags-versioning.dll IL_DLLS\ilbody-implflags-versioning.dll
42+
%Core_Root%\crossgen2\crossgen2.exe -O --opt-cross-module:ImplFlagHelper -r:%Core_Root%\*.dll -r:%25CD%\helperv1\ImplFlagHelper.dll -o:ilbody-implflags-versioning.dll IL_DLLS\ilbody-implflags-versioning.dll
4343
4444
set CrossGenStatus=!ERRORLEVEL!
4545
IF NOT !CrossGenStatus!==0 (
@@ -48,7 +48,7 @@ IF NOT !CrossGenStatus!==0 (
4848
)
4949
5050
REM Run against V2 of the helper
51-
copy /y helperv2\helper.dll helper.dll
51+
copy /y helperv2\ImplFlagHelper.dll ImplFlagHelper.dll
5252
5353
endlocal
5454
]]></CLRTestBatchPreCommands>
@@ -71,7 +71,7 @@ then
7171
fi
7272
7373
# Compile against V1 of the helper, with cross-module inlining of its methods
74-
"$CORE_ROOT"/crossgen2/crossgen2 -O --opt-cross-module:helper -r:"$CORE_ROOT"/*.dll -r:helperv1/helper.dll -o:ilbody-implflags-versioning.dll IL_DLLS/ilbody-implflags-versioning.dll
74+
"$CORE_ROOT"/crossgen2/crossgen2 -O --opt-cross-module:ImplFlagHelper -r:"$CORE_ROOT"/*.dll -r:helperv1/ImplFlagHelper.dll -o:ilbody-implflags-versioning.dll IL_DLLS/ilbody-implflags-versioning.dll
7575
7676
__cgExitCode=$?
7777
if [ $__cgExitCode -ne 0 ]
@@ -81,7 +81,7 @@ then
8181
fi
8282
8383
# Run against V2 of the helper
84-
cp helperv2/helper.dll helper.dll
84+
cp helperv2/ImplFlagHelper.dll ImplFlagHelper.dll
8585
8686
export DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun
8787
]]></CLRTestBashPreCommands>
@@ -95,7 +95,7 @@ export DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun
9595
<HelperV2TargetPath>$(OutputPath)/helperv2</HelperV2TargetPath>
9696
</PropertyGroup>
9797
<MakeDir Directories="$(HelperV1TargetPath);$(HelperV2TargetPath)" />
98-
<Copy SourceFiles="$(HelperV1SourcePath)helper.dll" DestinationFolder="$(HelperV1TargetPath)" />
99-
<Copy SourceFiles="$(HelperV2SourcePath)helper.dll" DestinationFolder="$(HelperV2TargetPath)" />
98+
<Copy SourceFiles="$(HelperV1SourcePath)ImplFlagHelper.dll" DestinationFolder="$(HelperV1TargetPath)" />
99+
<Copy SourceFiles="$(HelperV2SourcePath)ImplFlagHelper.dll" DestinationFolder="$(HelperV2TargetPath)" />
100100
</Target>
101101
</Project>

‎src/tests/readytorun/readytorun.csproj‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
<MergedWrapperProjectReference Include="*/**/*.??proj" />
88
<MergedWrapperProjectReference Remove="tests/testv1/*.??proj" />
99
<MergedWrapperProjectReference Remove="tests/testv2/*.??proj" />
10+
<MergedWrapperProjectReference Remove="ilbody-implflags-versioning/helperv1/*.??proj" />
11+
<MergedWrapperProjectReference Remove="ilbody-implflags-versioning/helperv2/*.??proj" />
1012
<MergedWrapperProjectReference Remove="coreroot_determinism/**/*.??proj" />
1113
</ItemGroup>
1214

0 commit comments

Comments
 (0)