From f0e537f540595900f3e89cc532fadeb79ae02efc Mon Sep 17 00:00:00 2001 From: liiir1985 Date: Wed, 22 Apr 2020 18:31:55 +0800 Subject: [PATCH] Fixed a bug with Value type --- ILRuntime/Runtime/Intepreter/ILIntepreter.cs | 1 + ILRuntimeTest/AutoGenerate/CLRBindings.cs | 2 +- ...tFramework_TestVector3NoBinding_Binding.cs | 14 ++ .../AutoGenerate/System_Double_Binding.cs | 20 +++ .../System_Int32_Array2_Binding.cs | 26 --- .../AutoGenerate/System_Single_Binding.cs | 20 +++ .../AutoGenerate/System_String_Binding.cs | 151 +++++------------- ILRuntimeTest/TestFramework/TestVector3.cs | 4 + TestCases/TestValueTypeBinding.cs | 10 ++ 9 files changed, 112 insertions(+), 136 deletions(-) diff --git a/ILRuntime/Runtime/Intepreter/ILIntepreter.cs b/ILRuntime/Runtime/Intepreter/ILIntepreter.cs index 59f54174..02cce5cf 100644 --- a/ILRuntime/Runtime/Intepreter/ILIntepreter.cs +++ b/ILRuntime/Runtime/Intepreter/ILIntepreter.cs @@ -1893,6 +1893,7 @@ public object Run(ILMethod method, object instance, object[] p) switch (objRef->ObjectType) { case ObjectTypes.Object: + mStack[objRef->Value] = obj; break; case ObjectTypes.FieldReference: { diff --git a/ILRuntimeTest/AutoGenerate/CLRBindings.cs b/ILRuntimeTest/AutoGenerate/CLRBindings.cs index 172357e8..5c065c29 100644 --- a/ILRuntimeTest/AutoGenerate/CLRBindings.cs +++ b/ILRuntimeTest/AutoGenerate/CLRBindings.cs @@ -77,6 +77,7 @@ public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app) System_Math_Binding.Register(app); ILRuntimeTest_TestFramework_TestStruct_Binding.Register(app); ILRuntimeTest_TestFramework_TestClass3_Binding.Register(app); + System_Single_Binding.Register(app); System_Byte_Binding.Register(app); System_Char_Binding.Register(app); System_IO_File_Binding.Register(app); @@ -94,7 +95,6 @@ public static void Initialize(ILRuntime.Runtime.Enviorment.AppDomain app) System_Int32_Array3_Binding.Register(app); System_Int32_Array2_Binding.Register(app); ILRuntimeTest_TestFramework_TestClass4_Binding.Register(app); - System_Single_Binding.Register(app); System_Nullable_1_Int32_Binding.Register(app); System_Collections_Generic_Dictionary_2_String_Int32_Binding_Enumerator_Binding.Register(app); System_Collections_Generic_KeyValuePair_2_String_Int32_Binding.Register(app); diff --git a/ILRuntimeTest/AutoGenerate/ILRuntimeTest_TestFramework_TestVector3NoBinding_Binding.cs b/ILRuntimeTest/AutoGenerate/ILRuntimeTest_TestFramework_TestVector3NoBinding_Binding.cs index 2bed3fa8..39c1f705 100644 --- a/ILRuntimeTest/AutoGenerate/ILRuntimeTest_TestFramework_TestVector3NoBinding_Binding.cs +++ b/ILRuntimeTest/AutoGenerate/ILRuntimeTest_TestFramework_TestVector3NoBinding_Binding.cs @@ -23,6 +23,9 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) FieldInfo field; Type[] args; Type type = typeof(ILRuntimeTest.TestFramework.TestVector3NoBinding); + args = new Type[]{}; + method = type.GetMethod("get_zero", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, get_zero_0); field = type.GetField("y", flag); app.RegisterCLRFieldGetter(field, get_y_0); @@ -85,6 +88,17 @@ static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, S } } + static StackObject* get_zero_0(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* __ret = ILIntepreter.Minus(__esp, 0); + + + var result_of_this_method = ILRuntimeTest.TestFramework.TestVector3NoBinding.zero; + + return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); + } + static object get_y_0(ref object o) { diff --git a/ILRuntimeTest/AutoGenerate/System_Double_Binding.cs b/ILRuntimeTest/AutoGenerate/System_Double_Binding.cs index db36e79e..5e5046e6 100644 --- a/ILRuntimeTest/AutoGenerate/System_Double_Binding.cs +++ b/ILRuntimeTest/AutoGenerate/System_Double_Binding.cs @@ -18,7 +18,13 @@ unsafe class System_Double_Binding { public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) { + BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly; + MethodBase method; + Type[] args; Type type = typeof(System.Double); + args = new Type[]{}; + method = type.GetMethod("ToString", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, ToString_0); app.RegisterCLRCreateArrayInstance(type, s => new System.Double[s]); @@ -71,6 +77,20 @@ static System.Double GetInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain return instance_of_this_method; } + static StackObject* ToString_0(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 1); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + System.Double instance_of_this_method = GetInstance(__domain, ptr_of_this_method, __mStack); + + var result_of_this_method = instance_of_this_method.ToString(); + + return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); + } + } diff --git a/ILRuntimeTest/AutoGenerate/System_Int32_Array2_Binding.cs b/ILRuntimeTest/AutoGenerate/System_Int32_Array2_Binding.cs index 628410a5..f0fedacd 100644 --- a/ILRuntimeTest/AutoGenerate/System_Int32_Array2_Binding.cs +++ b/ILRuntimeTest/AutoGenerate/System_Int32_Array2_Binding.cs @@ -25,9 +25,6 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) args = new Type[]{typeof(System.Int32), typeof(System.Int32), typeof(System.Int32)}; method = type.GetMethod("Set", flag, null, args, null); app.RegisterCLRMethodRedirection(method, Set_0); - args = new Type[]{typeof(System.Int32), typeof(System.Int32)}; - method = type.GetMethod("Get", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, Get_1); args = new Type[]{typeof(System.Int32), typeof(System.Int32)}; method = type.GetConstructor(flag, null, args, null); @@ -60,29 +57,6 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return __ret; } - static StackObject* Get_1(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) - { - ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; - StackObject* ptr_of_this_method; - StackObject* __ret = ILIntepreter.Minus(__esp, 3); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 1); - System.Int32 a2 = ptr_of_this_method->Value; - - ptr_of_this_method = ILIntepreter.Minus(__esp, 2); - System.Int32 a1 = ptr_of_this_method->Value; - - ptr_of_this_method = ILIntepreter.Minus(__esp, 3); - System.Int32[,] instance_of_this_method = (System.Int32[,])typeof(System.Int32[,]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); - __intp.Free(ptr_of_this_method); - - var result_of_this_method = instance_of_this_method[a1, a2]; - - __ret->ObjectType = ObjectTypes.Integer; - __ret->Value = result_of_this_method; - return __ret + 1; - } - static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) { diff --git a/ILRuntimeTest/AutoGenerate/System_Single_Binding.cs b/ILRuntimeTest/AutoGenerate/System_Single_Binding.cs index 2941002b..daafe9a7 100644 --- a/ILRuntimeTest/AutoGenerate/System_Single_Binding.cs +++ b/ILRuntimeTest/AutoGenerate/System_Single_Binding.cs @@ -18,7 +18,13 @@ unsafe class System_Single_Binding { public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) { + BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly; + MethodBase method; + Type[] args; Type type = typeof(System.Single); + args = new Type[]{}; + method = type.GetMethod("ToString", flag, null, args, null); + app.RegisterCLRMethodRedirection(method, ToString_0); app.RegisterCLRCreateArrayInstance(type, s => new System.Single[s]); @@ -71,6 +77,20 @@ static System.Single GetInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain return instance_of_this_method; } + static StackObject* ToString_0(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) + { + ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; + StackObject* ptr_of_this_method; + StackObject* __ret = ILIntepreter.Minus(__esp, 1); + + ptr_of_this_method = ILIntepreter.Minus(__esp, 1); + System.Single instance_of_this_method = GetInstance(__domain, ptr_of_this_method, __mStack); + + var result_of_this_method = instance_of_this_method.ToString(); + + return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); + } + } diff --git a/ILRuntimeTest/AutoGenerate/System_String_Binding.cs b/ILRuntimeTest/AutoGenerate/System_String_Binding.cs index d4824a47..d4d23096 100644 --- a/ILRuntimeTest/AutoGenerate/System_String_Binding.cs +++ b/ILRuntimeTest/AutoGenerate/System_String_Binding.cs @@ -31,45 +31,38 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) args = new Type[]{typeof(System.String), typeof(System.Object), typeof(System.Object), typeof(System.Object)}; method = type.GetMethod("Format", flag, null, args, null); app.RegisterCLRMethodRedirection(method, Format_2); - args = new Type[]{typeof(System.Object), typeof(System.Object)}; + args = new Type[]{typeof(System.String), typeof(System.String)}; method = type.GetMethod("Concat", flag, null, args, null); app.RegisterCLRMethodRedirection(method, Concat_3); - args = new Type[]{typeof(System.Object), typeof(System.Object), typeof(System.Object)}; + args = new Type[]{typeof(System.String), typeof(System.String), typeof(System.String)}; method = type.GetMethod("Concat", flag, null, args, null); app.RegisterCLRMethodRedirection(method, Concat_4); - args = new Type[]{typeof(System.String), typeof(System.String)}; - method = type.GetMethod("Concat", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, Concat_5); args = new Type[]{typeof(System.String), typeof(System.Object), typeof(System.Object)}; method = type.GetMethod("Format", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, Format_6); - args = new Type[]{typeof(System.String), typeof(System.String), typeof(System.String)}; - method = type.GetMethod("Concat", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, Concat_7); + app.RegisterCLRMethodRedirection(method, Format_5); args = new Type[]{typeof(System.Int32)}; method = type.GetMethod("get_Chars", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, get_Chars_8); - args = new Type[]{typeof(System.Object)}; - method = type.GetMethod("Concat", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, Concat_9); - args = new Type[]{typeof(System.Object[])}; + app.RegisterCLRMethodRedirection(method, get_Chars_6); + args = new Type[]{typeof(System.String), typeof(System.String), typeof(System.String), typeof(System.String)}; method = type.GetMethod("Concat", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, Concat_10); + app.RegisterCLRMethodRedirection(method, Concat_7); args = new Type[]{typeof(System.String)}; method = type.GetMethod("Equals", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, Equals_11); - args = new Type[]{typeof(System.String), typeof(System.String), typeof(System.String), typeof(System.String)}; + app.RegisterCLRMethodRedirection(method, Equals_8); + args = new Type[]{typeof(System.String[])}; method = type.GetMethod("Concat", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, Concat_12); + app.RegisterCLRMethodRedirection(method, Concat_9); args = new Type[]{typeof(System.String)}; method = type.GetMethod("IsNullOrEmpty", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, IsNullOrEmpty_13); + app.RegisterCLRMethodRedirection(method, IsNullOrEmpty_10); args = new Type[]{typeof(System.String), typeof(System.String)}; method = type.GetMethod("op_Equality", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, op_Equality_14); + app.RegisterCLRMethodRedirection(method, op_Equality_11); args = new Type[]{typeof(System.IFormatProvider), typeof(System.String), typeof(System.Object[])}; method = type.GetMethod("Format", flag, null, args, null); - app.RegisterCLRMethodRedirection(method, Format_15); + app.RegisterCLRMethodRedirection(method, Format_12); + + app.RegisterCLRCreateArrayInstance(type, s => new System.String[s]); } @@ -150,15 +143,15 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); - System.Object @arg1 = (System.Object)typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); + System.String @str1 = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); - System.Object @arg0 = (System.Object)typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); + System.String @str0 = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); - var result_of_this_method = System.String.Concat(@arg0, @arg1); + var result_of_this_method = System.String.Concat(@str0, @str1); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } @@ -170,44 +163,24 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) StackObject* __ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); - System.Object @arg2 = (System.Object)typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); + System.String @str2 = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); - System.Object @arg1 = (System.Object)typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); - __intp.Free(ptr_of_this_method); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 3); - System.Object @arg0 = (System.Object)typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); - __intp.Free(ptr_of_this_method); - - - var result_of_this_method = System.String.Concat(@arg0, @arg1, @arg2); - - return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); - } - - static StackObject* Concat_5(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) - { - ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; - StackObject* ptr_of_this_method; - StackObject* __ret = ILIntepreter.Minus(__esp, 2); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.String @str1 = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); - ptr_of_this_method = ILIntepreter.Minus(__esp, 2); + ptr_of_this_method = ILIntepreter.Minus(__esp, 3); System.String @str0 = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); - var result_of_this_method = System.String.Concat(@str0, @str1); + var result_of_this_method = System.String.Concat(@str0, @str1, @str2); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } - static StackObject* Format_6(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* Format_5(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -231,31 +204,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } - static StackObject* Concat_7(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) - { - ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; - StackObject* ptr_of_this_method; - StackObject* __ret = ILIntepreter.Minus(__esp, 3); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 1); - System.String @str2 = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); - __intp.Free(ptr_of_this_method); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 2); - System.String @str1 = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); - __intp.Free(ptr_of_this_method); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 3); - System.String @str0 = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); - __intp.Free(ptr_of_this_method); - - - var result_of_this_method = System.String.Concat(@str0, @str1, @str2); - - return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); - } - - static StackObject* get_Chars_8(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* get_Chars_6(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -275,39 +224,35 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return __ret + 1; } - static StackObject* Concat_9(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* Concat_7(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; - StackObject* __ret = ILIntepreter.Minus(__esp, 1); + StackObject* __ret = ILIntepreter.Minus(__esp, 4); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); - System.Object @arg0 = (System.Object)typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); + System.String @str3 = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); + ptr_of_this_method = ILIntepreter.Minus(__esp, 2); + System.String @str2 = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); + __intp.Free(ptr_of_this_method); - var result_of_this_method = System.String.Concat(@arg0); - - return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); - } - - static StackObject* Concat_10(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) - { - ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; - StackObject* ptr_of_this_method; - StackObject* __ret = ILIntepreter.Minus(__esp, 1); + ptr_of_this_method = ILIntepreter.Minus(__esp, 3); + System.String @str1 = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); + __intp.Free(ptr_of_this_method); - ptr_of_this_method = ILIntepreter.Minus(__esp, 1); - System.Object[] @args = (System.Object[])typeof(System.Object[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); + ptr_of_this_method = ILIntepreter.Minus(__esp, 4); + System.String @str0 = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); - var result_of_this_method = System.String.Concat(@args); + var result_of_this_method = System.String.Concat(@str0, @str1, @str2, @str3); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } - static StackObject* Equals_11(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* Equals_8(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -328,35 +273,23 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return __ret + 1; } - static StackObject* Concat_12(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* Concat_9(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; - StackObject* __ret = ILIntepreter.Minus(__esp, 4); + StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); - System.String @str3 = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); + System.String[] @values = (System.String[])typeof(System.String[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); - ptr_of_this_method = ILIntepreter.Minus(__esp, 2); - System.String @str2 = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); - __intp.Free(ptr_of_this_method); - - ptr_of_this_method = ILIntepreter.Minus(__esp, 3); - System.String @str1 = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); - __intp.Free(ptr_of_this_method); - ptr_of_this_method = ILIntepreter.Minus(__esp, 4); - System.String @str0 = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); - __intp.Free(ptr_of_this_method); - - - var result_of_this_method = System.String.Concat(@str0, @str1, @str2, @str3); + var result_of_this_method = System.String.Concat(@values); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } - static StackObject* IsNullOrEmpty_13(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* IsNullOrEmpty_10(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -374,7 +307,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return __ret + 1; } - static StackObject* op_Equality_14(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* op_Equality_11(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; @@ -396,7 +329,7 @@ public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app) return __ret + 1; } - static StackObject* Format_15(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) + static StackObject* Format_12(ILIntepreter __intp, StackObject* __esp, IList __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; diff --git a/ILRuntimeTest/TestFramework/TestVector3.cs b/ILRuntimeTest/TestFramework/TestVector3.cs index 58e08dd9..682f974e 100644 --- a/ILRuntimeTest/TestFramework/TestVector3.cs +++ b/ILRuntimeTest/TestFramework/TestVector3.cs @@ -10,6 +10,10 @@ public struct TestVector3NoBinding { public float x, y, z; + static TestVector3NoBinding mZero = new TestVector3NoBinding(0, 0, 0); + + public static TestVector3NoBinding zero => mZero; + public TestVector3NoBinding(float x, float y, float z) { this.x = x; diff --git a/TestCases/TestValueTypeBinding.cs b/TestCases/TestValueTypeBinding.cs index ea529573..9c986bcd 100644 --- a/TestCases/TestValueTypeBinding.cs +++ b/TestCases/TestValueTypeBinding.cs @@ -285,5 +285,15 @@ static void ChangePosY2(TestVector3 pos) { pos.Y = 0; } + + public static void UnitTest_10038() + { + TestVector3NoBinding rawPos = TestVector3NoBinding.zero; + rawPos.y = 1122333; + + Console.WriteLine(rawPos.y); + if(rawPos.y != 1122333) + throw new AccessViolationException(); + } } } \ No newline at end of file