Skip to content

Commit f0a6396

Browse files
committed
Merge pull request #1 from lightszero/master
合并原作者更新
2 parents a2b158d + 7d01147 commit f0a6396

122 files changed

Lines changed: 14093 additions & 9088 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CLRSharp/CLRSharp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>CLRSharp</RootNamespace>
1111
<AssemblyName>CLRSharp</AssemblyName>
12-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
12+
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<TargetFrameworkProfile />
1515
</PropertyGroup>

CLRSharp/CLRSharp/CLRSharp_Env.cs

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
namespace CLRSharp
66
{
7-
7+
88
public class CLRSharp_Environment : ICLRSharp_Environment
99
{
1010
public string version
1111
{
1212
get
1313
{
14-
return "0.39.7Beta";
14+
return "0.43Beta";
1515
}
1616
}
1717
public ICLRSharp_Logger logger
@@ -46,6 +46,8 @@ public void LoadModule(System.IO.Stream dllStream, System.IO.Stream pdbStream, M
4646
{
4747
if (moduleref.Contains(ar.Name) == false)
4848
moduleref.Add(ar.Name);
49+
if (moduleref.Contains(ar.FullName) == false)
50+
moduleref.Add(ar.FullName);
4951
}
5052
}
5153
//mapModule[module.Name] = module;
@@ -54,7 +56,7 @@ public void LoadModule(System.IO.Stream dllStream, System.IO.Stream pdbStream, M
5456
foreach (var t in module.Types)
5557
{
5658

57-
mapType[t.FullName] = new Type_Common_CLRSharp(this, t);
59+
mapType[t.FullName] = new Type_Common_CLRSharp(this, t);
5860

5961
}
6062
}
@@ -149,7 +151,10 @@ public ICLRType GetType(string fullname)
149151
checkname = fullnameT.Substring(lastsplitpos + 1, i - lastsplitpos - 1);
150152
var subtype = GetType(checkname);
151153
subTypes.Add(subtype);
152-
if (subtype is ICLRType_Sharp) subtype = GetType(typeof(CLRSharp_Instance));
154+
if (!subtype.IsEnum() && subtype is ICLRType_Sharp)
155+
{
156+
subtype = GetType(typeof(CLRSharp_Instance));
157+
}
153158
outname += "[" + subtype.FullNameWithAssembly + "]";
154159
lastsplitpos = i;
155160
}
@@ -172,7 +177,13 @@ public ICLRType GetType(string fullname)
172177
checkname = fullnameT.Substring(lastsplitpos + 1, i - lastsplitpos - 1);
173178
var subtype = GetType(checkname);
174179
subTypes.Add(subtype);
175-
if (subtype is ICLRType_Sharp) subtype = GetType(typeof(CLRSharp_Instance));
180+
181+
if (!subtype.IsEnum() && subtype is ICLRType_Sharp)
182+
{
183+
184+
subtype = GetType(typeof(CLRSharp_Instance));
185+
}
186+
176187
outname += "[" + subtype.FullNameWithAssembly + "],";
177188
lastsplitpos = i;
178189
}
@@ -215,11 +226,31 @@ public ICLRType GetType(string fullname)
215226
}
216227
}
217228
}
229+
218230
if (t != null)
219231
{
232+
//之所以做这么扭曲的设计,是因为Unity的Type.Fullname 实现错误,导致在Unity环境Type.FullName不一致
233+
if (t.FullName.Contains("CLRSharp.CLRSharp_Instance") == false)
234+
{
235+
b = mapType.TryGetValue(t.FullName, out type);
236+
if (b)
237+
{
238+
//mapType[fullname] = type;
239+
return type;
240+
}
241+
type = new Type_Common_System(this, t, subTypes.ToArray());
242+
mapType[t.FullName] = type;
243+
return type;
244+
}
245+
else
246+
{
247+
248+
}
220249
type = new Type_Common_System(this, t, subTypes.ToArray());
250+
mapType[fullname] = type;
251+
//mapType[t.FullName] = type;
221252
}
222-
mapType[fullname] = type;
253+
223254
}
224255
return type;
225256
}
@@ -231,7 +262,7 @@ public ICLRType GetType(System.Type systemType)
231262
bool b = mapType.TryGetValue(systemType.FullName, out type);
232263
if (!b)
233264
{
234-
type = new Type_Common_System(this, systemType, null);
265+
type = new Type_Common_System(this, systemType, null);
235266
mapType[systemType.FullName] = type;
236267
}
237268
return type;

CLRSharp/CLRSharp/CrossBind/Yield.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ public class CrossBind_IEnumerable : ICrossBind
1010
public Type Type
1111
{
1212
get { return typeof(IEnumerable); }
13-
}
1413

14+
}
1515
public object CreateBind(CLRSharp_Instance inst)
1616
{
1717
return new Base_IEnumerable(inst);

CLRSharp/CLRSharp/Execute/CodeBody.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,8 @@ public void InitToken(ThreadContext context, CodeBody body, object _p)
442442

443443
case CodeEx.Ldarga:
444444
case CodeEx.Ldarga_S:
445+
case CodeEx.Starg:
446+
case CodeEx.Starg_S:
445447
this.tokenI32 = (_p as Mono.Cecil.ParameterDefinition).Index;
446448
break;
447449
case CodeEx.Switch:
@@ -461,6 +463,8 @@ public void InitToken(ThreadContext context, CodeBody body, object _p)
461463
case CodeEx.Ldarg_S:
462464
this.tokenI32 = (_p as Mono.Cecil.ParameterReference).Index;
463465
break;
466+
case CodeEx.Volatile:
467+
break;
464468
default:
465469
this.tokenUnknown = _p;
466470
break;

CLRSharp/CLRSharp/Execute/Context.cs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,13 +1027,26 @@ void RunCode(StackFrame stack, CodeBody body)
10271027
case CodeEx.Calli:
10281028
stack.Calli(this, _code.tokenUnknown);
10291029
break;
1030+
case CodeEx.Starg_S:
1031+
if (body.bodyNative.Method.IsStatic)
1032+
stack.Starg(this, _code.tokenI32);
1033+
else
1034+
stack.Starg(this, _code.tokenI32 + 1);
1035+
break;
1036+
case CodeEx.Starg:
1037+
if (body.bodyNative.Method.IsStatic)
1038+
stack.Starg(this, _code.tokenI32);
1039+
else
1040+
stack.Starg(this, _code.tokenI32 + 1);
1041+
break;
1042+
case CodeEx.Volatile:
1043+
stack.Volatile();
1044+
break;
10301045
///下面是还没有处理的指令
10311046
case CodeEx.Break:
10321047
stack.Break(this, _code.tokenUnknown);
10331048
break;
1034-
case CodeEx.Starg_S:
1035-
stack.Starg_S(this, _code.tokenUnknown);
1036-
break;
1049+
10371050
case CodeEx.Ldnull:
10381051
stack.Ldnull();
10391052
break;
@@ -1168,9 +1181,7 @@ void RunCode(StackFrame stack, CodeBody body)
11681181
stack.Arglist(this, _code.tokenUnknown);
11691182
break;
11701183

1171-
case CodeEx.Starg:
1172-
stack.Starg(this, _code.tokenUnknown);
1173-
break;
1184+
11741185
case CodeEx.Localloc:
11751186
stack.Localloc(this, _code.tokenUnknown);
11761187
break;
@@ -1180,9 +1191,7 @@ void RunCode(StackFrame stack, CodeBody body)
11801191
case CodeEx.Unaligned:
11811192
stack.Unaligned(this, _code.tokenUnknown);
11821193
break;
1183-
case CodeEx.Volatile:
1184-
stack.Volatile(this, _code.tokenUnknown);
1185-
break;
1194+
11861195
case CodeEx.Tail:
11871196
stack.Tail(this, _code.tokenUnknown);
11881197
break;

0 commit comments

Comments
 (0)