Skip to content

Commit

Permalink
[mono] Fix LLVMArgWasmVtypeAsScalar when a method doesn't set its r…
Browse files Browse the repository at this point in the history
…eturn value (#101299)

* Update mini-llvm.c

I think we should handle it here, the same way as `LLVMArgVtypeAsScalar`. They differ only in the return type, where the wasm specific one is returning type of the element instead of `int`.

* Include TrimmerRootDescriptor only on Apple mobile platforms

* Update src/mono/mono/mini/mini-llvm.c
---------

Co-authored-by: Radek Doulik <radek.doulik@gmail.com>
Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
  • Loading branch information
3 people authored Apr 25, 2024
1 parent c028937 commit 43ba3a8
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\src\System.Configuration.ConfigurationManager.csproj" />
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
<!-- Apple mobile trimming descriptor for Mono runtime -->
<TrimmerRootDescriptor Condition="'$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'" Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Reference Include="System.Configuration" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
<ItemGroup>
<PackageReference Include="System.Data.Common.TestData" Version="$(SystemDataCommonTestDataVersion)" />
<PackageReference Include="System.Data.SqlClient" Version="$(SystemDataSqlClientVersion)" />
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
<!-- Apple mobile trimming descriptor for Mono runtime -->
<TrimmerRootDescriptor Condition="'$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'" Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<!-- R2R testing does not tolerate the combination of a regular project reference and a content reference. -->
<!-- This is a bug in the SDK tracked here: https://github.com/dotnet/sdk/issues/30718 -->
<PublishReadyToRunExclude Include="System.Diagnostics.FileVersionInfo.TestAssembly.dll" />
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
<!-- Apple mobile trimming descriptor for Mono runtime -->
<TrimmerRootDescriptor Condition="'$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'" Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
</Project>
3 changes: 2 additions & 1 deletion src/libraries/System.Linq/tests/System.Linq.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
</PropertyGroup>
<ItemGroup>
<RdXmlFile Include="default.rd.xml" />
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
<!-- Apple mobile trimming descriptor for Mono runtime -->
<TrimmerRootDescriptor Condition="'$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'" Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AggregateTests.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<WasmFilesToIncludeFromPublishDir Include="mscorlib.dll" />
</ItemGroup>

<ItemGroup Condition="'$(TargetOS)' == 'browser' or ('$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true')">
<ItemGroup Condition="'$(TargetOS)' == 'browser' or ('$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true')">
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
<PackageReference Include="System.ValueTuple" Version="$(SystemValueTupleVersion)" />
</ItemGroup>
<ItemGroup>
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
<!-- Apple mobile trimming descriptor for Mono runtime -->
<TrimmerRootDescriptor Condition="'$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'" Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
<!-- Use the following target to regenerate the test resources file.
This is done from a test application and checked in so that we don't run
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<ItemGroup Condition="'$(TargetOS)' == 'browser'">
<WasmFilesToIncludeFromPublishDir Include="$(AssemblyName).dll" />
</ItemGroup>
<ItemGroup Condition="'$(TargetOS)' == 'browser' or ('$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true')">
<ItemGroup Condition="'$(TargetOS)' == 'browser' or ('$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true')">
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
</PropertyGroup>
<ItemGroup>
<RdXmlFile Include="default.rd.xml" />
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
<!-- Apple mobile trimming descriptor for Mono runtime -->
<TrimmerRootDescriptor Condition="'$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'" Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(CommonTestPath)StreamConformanceTests\StreamConformanceTests.csproj" />
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
<!-- Apple mobile trimming descriptor for Mono runtime -->
<TrimmerRootDescriptor Condition="'$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'" Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
<ItemGroup>
<RuntimeHostConfigurationOption Include="System.IO.DisableFileLocking" Value="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(CommonTestPath)StreamConformanceTests\StreamConformanceTests.csproj" />
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
<!-- Apple mobile trimming descriptor for Mono runtime -->
<TrimmerRootDescriptor Condition="'$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'" Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<Reference Include="System.Security" />
</ItemGroup>
<ItemGroup>
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
<!-- Apple mobile trimming descriptor for Mono runtime -->
<TrimmerRootDescriptor Condition="'$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'" Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
<!-- Apple mobile trimming descriptor for Mono runtime -->
<TrimmerRootDescriptor Condition="'$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'" Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
</Project>
10 changes: 8 additions & 2 deletions src/mono/mono/mini/mini-llvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -6119,8 +6119,14 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
gboolean src_in_reg = FALSE;
gboolean is_simd = mini_class_is_simd (ctx->cfg, mono_class_from_mono_type_internal (sig->ret));
switch (linfo->ret.storage) {
case LLVMArgNormal: src_in_reg = TRUE; break;
case LLVMArgVtypeInReg: case LLVMArgVtypeAsScalar: src_in_reg = is_simd; break;
case LLVMArgNormal:
src_in_reg = TRUE;
break;
case LLVMArgVtypeInReg:
case LLVMArgVtypeAsScalar:
case LLVMArgWasmVtypeAsScalar:
src_in_reg = is_simd;
break;
}
if (src_in_reg && (!lhs || ctx->is_dead [ins->sreg1])) {
/*
Expand Down

0 comments on commit 43ba3a8

Please sign in to comment.