diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2016-12-12 11:13:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-12 11:13:41 +0100 |
commit | 4a86f9481ae4902cc3a0048050c60e8645eb56b2 (patch) | |
tree | 8449c23716622bcb743e2a05ccfc23aab1416988 /Xamarin.Forms.Build.Tasks/XamlCTask.cs | |
parent | 22bdca32339838702920802e49465264fcccd48b (diff) | |
download | xamarin-forms-4a86f9481ae4902cc3a0048050c60e8645eb56b2.tar.gz xamarin-forms-4a86f9481ae4902cc3a0048050c60e8645eb56b2.tar.bz2 xamarin-forms-4a86f9481ae4902cc3a0048050c60e8645eb56b2.zip |
[XamlC] optimize Datatemplate IL as well (#612)
Diffstat (limited to 'Xamarin.Forms.Build.Tasks/XamlCTask.cs')
-rw-r--r-- | Xamarin.Forms.Build.Tasks/XamlCTask.cs | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/Xamarin.Forms.Build.Tasks/XamlCTask.cs b/Xamarin.Forms.Build.Tasks/XamlCTask.cs index 5127efda..4e2029c4 100644 --- a/Xamarin.Forms.Build.Tasks/XamlCTask.cs +++ b/Xamarin.Forms.Build.Tasks/XamlCTask.cs @@ -185,8 +185,7 @@ namespace Xamarin.Forms.Build.Tasks if (OptimizeIL) { Logger.LogString(2, " Optimizing IL... "); - OptimizeLongs(initComp.Body); - initComp.Body.OptimizeMacros(); + initComp.Body.Optimize(); Logger.LogLine(2, "done"); } @@ -237,28 +236,6 @@ namespace Xamarin.Forms.Build.Tasks return success; } - static void ExpandMacro(Instruction instruction, OpCode opcode, object operand) - { - instruction.OpCode = opcode; - instruction.Operand = operand; - } - - //this can be removed if/when https://github.com/jbevain/cecil/pull/307 is released in a nuget we consume - static void OptimizeLongs(MethodBody self) - { - var method = self.Method; - for (var i = 0; i < self.Instructions.Count; i++) { - var instruction = self.Instructions[i]; - if (instruction.OpCode.Code != Code.Ldc_I8) - continue; - var l = (long)instruction.Operand; - if (l < int.MinValue || l > int.MaxValue) - continue; - ExpandMacro(instruction, OpCodes.Ldc_I4, unchecked((int)l)); - self.Instructions.Insert(++i, Instruction.Create(OpCodes.Conv_I8)); - } - } - bool TryCoreCompile(MethodDefinition initComp, MethodDefinition initCompRuntime, ILRootNode rootnode, out Exception exception) { try { |