Skip to content

Commit

Permalink
Fix test and update comment
Browse files Browse the repository at this point in the history
Even if possible (in metadata) there is no point in setting `final` on
a method if we remove `virtual`. This match ILLink version of the sealer
and makes the same test pass on both.
  • Loading branch information
Sebastien Pouliot committed Aug 4, 2021
1 parent 23887ac commit f1de3c5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dotnet/targets/Xamarin.Shared.Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@
-->
<_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --disable-opt unusedtypechecks</_ExtraTrimmerArgs>

<!-- if a release build, not using the JIT (macOS) or the interpreter then the sealer optimization can be used -->
<!-- If a release build and the app is not extensible (no interpreter or JIT/code-loading for macOS) then the sealer optimization can be used -->
<_ExtraTrimmerArgs Condition="'$(_BundlerDebug)' != 'true' And '$(MtouchInterpreter)' == '' And '$(_PlatformName)' != 'macOS'">$(_ExtraTrimmerArgs) --enable-opt sealer</_ExtraTrimmerArgs>

<!-- We always want the linker to process debug symbols, even when building in Release mode, because the AOT compiler uses the managed debug symbols to output DWARF debugging symbols -->
Expand Down
2 changes: 1 addition & 1 deletion tests/linker/ios/link all/SealerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void Final ()
// but it can be optimized / sealed as nothing else is (or can) overrides it
Assert.True (a.IsFinal, "A");
Assert.True (b.IsFinal, "B");
Assert.True (c.IsFinal, "C");
Assert.False (c.IsFinal, "C"); // devirtualized
#endif
}

Expand Down
1 change: 1 addition & 0 deletions tools/linker/MonoTouch.Tuner/SealerSubStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ protected override void Process (TypeDefinition type)
// look if this method is an override to existing _marked_ methods
if (!AreMarked (bases)) {
method.IsVirtual = false;
method.IsFinal = false; // since it's not virtual anymore
#if DEBUG
Console.WriteLine ("Devirtualize {0} ({1})", method, ++devirtualize);
#endif
Expand Down

0 comments on commit f1de3c5

Please sign in to comment.