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
AgeCommit message (Collapse)Author
2022-04-07Add constant propagation through methods with parameters or complex bodies ↵Marek Safar
(#2556)
2020-04-24Ensure consistent sources formatting (#1138)Marek Safar
* Apply consistent formatting based on .editorconfig ``` dotnet format -f <path> ``` * Add lint step to the CI * Use local tool * Suppress publish logs warning * Fix more style errors * Fixes bad merge * Write something to log dir * Move lint job to global scope So it doesn't get the arcade publish logs/test steps injected. * Split sources and tests reporting * Include also src folder in the run * Exclude cecil sources * Remove duplicate line * Trigger notification * Format more code Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
2020-03-08Fix wrong optimization value in testsMarek Safar
2020-03-02Explicitly enable optimization during test (#974)Mike Voorhees
Explicitly enable `IPConstantPropagation` during the `UnreachableBlock` tests. This gives implementors of a linker executable the freedom to pick which optimizations are enabled by default while also ensuring that they can pass all tests. This is consistent with other optimizations such as unreachable bodies, used attrs only, etc.
2019-12-22Remove variables which were used in removed scopes only.Marek Safar
2019-12-11Add new optimization steps to make Mark step more effectiveMarek Safar
Two new steps have been introduced BodySubstituterStep This step removes any conditional blocks when the condition or conditions are evaluated as constants. This step does not do any inlining. The conditional logic is kept but based on the known values only one branch is always taken. A simple example which can be detected by linker. ```c# class C { static void Main () { if (Result) Console.WriteLine (); // <- this call will be marked and removed } static bool Result () => false; } ``` RemoveUnreachableBlocksStep A new command-line option called `--substitutions` allow external customization of any methoda for assemblies which are linked. The syntax is same as for existing linker descriptor XML files but it add way to control body modifications. An example of XML file ```xml <linker> <assembly fullname="test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> <type fullname="Mono.Linker.Tests.Cases.Substitutions.StubBodyWithValue"> <method signature="System.String TestMethod_1()" body="stub" value="abcd"> </method> </type> </assembly> </linker> ``` The `value` attribute is optional and only required when the method stub should not fallback to default behaviour. Additional to `stub` value also `remove` value is supported to forcibly remove body of the method when the method is marked. This is useful when the conditional logic cannot be evaluated by linker and the method will be marked but never actually reached. Applicability Both steps can be combined to achieve the effect of externally customizing which conditional branches can be removed during the linking. I can illustrate that on IntPtr.Size property. With following substitution any code that has compiled in conditional logic for 64 bits handling by checking IntPtr.Size will be removed during linking. ```xml <linker> <assembly fullname="mscorlib"> <type fullname="System.IntPtr"> <method signature="System.Int32 get_Size()" body="stub" value="4"> </method> </type> </assembly> </linker> ``` Implements #752