Skip to content

Commit 03fd117

Browse files
Merge pull request #465 from JasonXuDeveloper/development
merge dev
2 parents 941988e + 7b41157 commit 03fd117

File tree

19 files changed

+694
-14
lines changed

19 files changed

+694
-14
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ UnityProject/Assets/Dependencies/ILRuntime/Generated.meta
1717
UnityProject/Logs/Packages-Update.log
1818
UnityProject/Sandbox/*
1919
UnityProject/Logs/*
20-
UnityProject/Build/*
20+
UnityProject/Build/*
21+
UnityProject/HotUpdateScripts/.idea/*
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
<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">
2-
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=assets_005Cdependencies_005Cjengine_005Ccore_005Cilruntimehelper/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
2+
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=assets_005Cdependencies_005Cjengine_005Ccore_005Cilruntimehelper/@EntryIndexedValue">True</s:Boolean>
3+
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=assets_005Cdependencies_005Cjengine_005Ceditor_005Cjenginetools_005Coptimizer/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

UnityProject/Assets/Dependencies/JEngine/Core/Tool/HotTypeTools.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ public static AppDomain Domain
3636

3737
_cacheDomain = new AppDomain();
3838
// 只有编辑器才会走到这
39-
ThreadMgr.QueueOnMainThread(async () =>
39+
Task.Run(async () =>
4040
{
4141
_cacheDomain.LoadAssembly(new MemoryStream(await DllMgr.GetDllBytes(ConstMgr.MainHotDLLName, true)), null,
4242
new PdbReaderProvider());
4343
InitJEngine.InitializeILRuntime(_cacheDomain);
44-
});
44+
}).Wait();
4545
return _cacheDomain;
4646
}
4747
}

UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/Optimizer.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
using ILRuntime.Mono.Cecil.Cil;
2+
3+
namespace JEngine.Editor
4+
{
5+
public static partial class Optimizer
6+
{
7+
private static string GetLdLocName(Instruction instruction)
8+
{
9+
var code = instruction.OpCode.Code.ToString();
10+
if(code.StartsWith("Ldloc"))
11+
{
12+
if(code.EndsWith("S"))
13+
{
14+
return instruction.Operand.ToString();
15+
}
16+
17+
return code.Substring(code.Length - 1);
18+
}
19+
20+
return null;
21+
}
22+
23+
private static string GetStLocName(Instruction instruction)
24+
{
25+
var code = instruction.OpCode.Code.ToString();
26+
if(code.StartsWith("Stloc"))
27+
{
28+
if(code.EndsWith("S"))
29+
{
30+
return instruction.Operand.ToString();
31+
}
32+
33+
return code.Substring(code.Length - 1);
34+
}
35+
36+
return null;
37+
}
38+
39+
private static int GetLdcI4Num(Instruction instruction)
40+
{
41+
var code = instruction.OpCode.Code.ToString();
42+
if(code.StartsWith("Ldc_I4"))
43+
{
44+
if(code.EndsWith("S"))
45+
{
46+
return (sbyte)instruction.Operand;
47+
}
48+
49+
if(code.EndsWith("M1"))
50+
{
51+
return -1;
52+
}
53+
54+
if(code.EndsWith("0"))
55+
{
56+
return 0;
57+
}
58+
59+
if(code.EndsWith("1"))
60+
{
61+
return 1;
62+
}
63+
64+
if(code.EndsWith("2"))
65+
{
66+
return 2;
67+
}
68+
69+
if(code.EndsWith("3"))
70+
{
71+
return 3;
72+
}
73+
74+
if(code.EndsWith("4"))
75+
{
76+
return 4;
77+
}
78+
79+
if(code.EndsWith("5"))
80+
{
81+
return 5;
82+
}
83+
84+
if(code.EndsWith("6"))
85+
{
86+
return 6;
87+
}
88+
89+
if(code.EndsWith("7"))
90+
{
91+
return 7;
92+
}
93+
94+
if(code.EndsWith("8"))
95+
{
96+
return 8;
97+
}
98+
99+
return (int)instruction.Operand;
100+
}
101+
102+
return 0;
103+
}
104+
}
105+
}

UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/Optimizer/Optimizer.Helper.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using ILRuntime.Mono.Cecil.Cil;
2+
3+
namespace JEngine.Editor
4+
{
5+
public static partial class Optimizer
6+
{
7+
private static Instruction NewLdcI4Instruction(int i)
8+
{
9+
switch (i)
10+
{
11+
case -1:
12+
return Instruction.Create(OpCodes.Ldc_I4_M1);
13+
case 0:
14+
return Instruction.Create(OpCodes.Ldc_I4_0);
15+
case 1:
16+
return Instruction.Create(OpCodes.Ldc_I4_1);
17+
case 2:
18+
return Instruction.Create(OpCodes.Ldc_I4_2);
19+
case 3:
20+
return Instruction.Create(OpCodes.Ldc_I4_3);
21+
case 4:
22+
return Instruction.Create(OpCodes.Ldc_I4_4);
23+
case 5:
24+
return Instruction.Create(OpCodes.Ldc_I4_5);
25+
case 6:
26+
return Instruction.Create(OpCodes.Ldc_I4_6);
27+
case 7:
28+
return Instruction.Create(OpCodes.Ldc_I4_7);
29+
case 8:
30+
return Instruction.Create(OpCodes.Ldc_I4_8);
31+
case var _ when i <= 127:
32+
return Instruction.Create(OpCodes.Ldc_I4_S, (sbyte)i);
33+
default:
34+
return Instruction.Create(OpCodes.Ldc_I4, i);
35+
}
36+
}
37+
38+
private static Instruction NewLdcI8Instruction(long i)
39+
{
40+
return Instruction.Create(OpCodes.Ldc_I8, i);
41+
}
42+
}
43+
}

UnityProject/Assets/Dependencies/JEngine/Editor/JEngineTools/Optimizer/Optimizer.Instructions.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)