-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #465 from JasonXuDeveloper/development
merge dev
- Loading branch information
Showing
19 changed files
with
694 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=assets_005Cdependencies_005Cjengine_005Ccore_005Cilruntimehelper/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> | ||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=assets_005Cdependencies_005Cjengine_005Ccore_005Cilruntimehelper/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=assets_005Cdependencies_005Cjengine_005Ceditor_005Cjenginetools_005Coptimizer/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/Optimizer.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
105 changes: 105 additions & 0 deletions
105
UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/Optimizer/Optimizer.Helper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
using ILRuntime.Mono.Cecil.Cil; | ||
|
||
namespace JEngine.Editor | ||
{ | ||
public static partial class Optimizer | ||
{ | ||
private static string GetLdLocName(Instruction instruction) | ||
{ | ||
var code = instruction.OpCode.Code.ToString(); | ||
if(code.StartsWith("Ldloc")) | ||
{ | ||
if(code.EndsWith("S")) | ||
{ | ||
return instruction.Operand.ToString(); | ||
} | ||
|
||
return code.Substring(code.Length - 1); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
private static string GetStLocName(Instruction instruction) | ||
{ | ||
var code = instruction.OpCode.Code.ToString(); | ||
if(code.StartsWith("Stloc")) | ||
{ | ||
if(code.EndsWith("S")) | ||
{ | ||
return instruction.Operand.ToString(); | ||
} | ||
|
||
return code.Substring(code.Length - 1); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
private static int GetLdcI4Num(Instruction instruction) | ||
{ | ||
var code = instruction.OpCode.Code.ToString(); | ||
if(code.StartsWith("Ldc_I4")) | ||
{ | ||
if(code.EndsWith("S")) | ||
{ | ||
return (sbyte)instruction.Operand; | ||
} | ||
|
||
if(code.EndsWith("M1")) | ||
{ | ||
return -1; | ||
} | ||
|
||
if(code.EndsWith("0")) | ||
{ | ||
return 0; | ||
} | ||
|
||
if(code.EndsWith("1")) | ||
{ | ||
return 1; | ||
} | ||
|
||
if(code.EndsWith("2")) | ||
{ | ||
return 2; | ||
} | ||
|
||
if(code.EndsWith("3")) | ||
{ | ||
return 3; | ||
} | ||
|
||
if(code.EndsWith("4")) | ||
{ | ||
return 4; | ||
} | ||
|
||
if(code.EndsWith("5")) | ||
{ | ||
return 5; | ||
} | ||
|
||
if(code.EndsWith("6")) | ||
{ | ||
return 6; | ||
} | ||
|
||
if(code.EndsWith("7")) | ||
{ | ||
return 7; | ||
} | ||
|
||
if(code.EndsWith("8")) | ||
{ | ||
return 8; | ||
} | ||
|
||
return (int)instruction.Operand; | ||
} | ||
|
||
return 0; | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...roject/Assets/Dependencies/JEngine/Editor/JEngineTools/Optimizer/Optimizer.Helper.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
...oject/Assets/Dependencies/JEngine/Editor/JEngineTools/Optimizer/Optimizer.Instructions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using ILRuntime.Mono.Cecil.Cil; | ||
|
||
namespace JEngine.Editor | ||
{ | ||
public static partial class Optimizer | ||
{ | ||
private static Instruction NewLdcI4Instruction(int i) | ||
{ | ||
switch (i) | ||
{ | ||
case -1: | ||
return Instruction.Create(OpCodes.Ldc_I4_M1); | ||
case 0: | ||
return Instruction.Create(OpCodes.Ldc_I4_0); | ||
case 1: | ||
return Instruction.Create(OpCodes.Ldc_I4_1); | ||
case 2: | ||
return Instruction.Create(OpCodes.Ldc_I4_2); | ||
case 3: | ||
return Instruction.Create(OpCodes.Ldc_I4_3); | ||
case 4: | ||
return Instruction.Create(OpCodes.Ldc_I4_4); | ||
case 5: | ||
return Instruction.Create(OpCodes.Ldc_I4_5); | ||
case 6: | ||
return Instruction.Create(OpCodes.Ldc_I4_6); | ||
case 7: | ||
return Instruction.Create(OpCodes.Ldc_I4_7); | ||
case 8: | ||
return Instruction.Create(OpCodes.Ldc_I4_8); | ||
case var _ when i <= 127: | ||
return Instruction.Create(OpCodes.Ldc_I4_S, (sbyte)i); | ||
default: | ||
return Instruction.Create(OpCodes.Ldc_I4, i); | ||
} | ||
} | ||
|
||
private static Instruction NewLdcI8Instruction(long i) | ||
{ | ||
return Instruction.Create(OpCodes.Ldc_I8, i); | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
.../Assets/Dependencies/JEngine/Editor/JEngineTools/Optimizer/Optimizer.Instructions.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.