Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitek Karas <vitek.karas@microsoft.com>2021-01-11 15:34:57 +0300
committerGitHub <noreply@github.com>2021-01-11 15:34:57 +0300
commit17db5ef4d319d11a842d3bd16ea0f6819cc56bb1 (patch)
tree94990e991038779e66448d84153f937dcdb399dc /test/Mono.Linker.Tests.Cases/UnreachableBlock/BodiesWithSubstitutions.xml
parentcc0926072018dd567a47e4fd3dca7927cced7f2b (diff)
Only compute if method returns a constant when needed (#1734)
This changes how the `RemoveUnreachableBlocksStep` computes if a method returns a constant or not. Previously we would go over all methods and detect those which return constants (and store only those in a dictionary). Then we would proceed with branch removal relying on this dictionary. For a hello world console app this means we ran the detection of constants on almost 50K methods. On the other hand the dictionary stored only about 1.5K records (actually constant methods). With this change the constant detection only runs on methods we need the result for later on. This means the dictionary stores records for all methods asked about (`null` value represents "We checked, and it's not constant"). For the same hello world console app we now run the detection only on ~5K methods (10x less). On the other hand we have records for all (5K -> 3x increase). So this trades CPU for memory. The purpose of this change is not the CPU/memory tradeoff, it's to prepare the constant propagation to make it possible to call it on-demand per-method from `MarkStep` which will be needed once we switch over to the current lazy-loading of assemblies.
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/UnreachableBlock/BodiesWithSubstitutions.xml')
-rw-r--r--test/Mono.Linker.Tests.Cases/UnreachableBlock/BodiesWithSubstitutions.xml2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/UnreachableBlock/BodiesWithSubstitutions.xml b/test/Mono.Linker.Tests.Cases/UnreachableBlock/BodiesWithSubstitutions.xml
index 23fb0d5e9..cad903687 100644
--- a/test/Mono.Linker.Tests.Cases/UnreachableBlock/BodiesWithSubstitutions.xml
+++ b/test/Mono.Linker.Tests.Cases/UnreachableBlock/BodiesWithSubstitutions.xml
@@ -3,6 +3,8 @@
<type fullname="Mono.Linker.Tests.Cases.UnreachableBlock.BodiesWithSubstitutions">
<method signature="System.Int32 get_Property()" body="stub" value="3">
</method>
+ <method signature="System.Boolean get_CollisionProperty()" body="stub" value="false">
+ </method>
</type>
<type fullname="Mono.Linker.Tests.Cases.UnreachableBlock.BodiesWithSubstitutions/ClassWithField">
<field name="SField" value="9"/>