ETModel_MessageInfo_Binding.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Runtime.InteropServices;
  6. using ILRuntime.CLR.TypeSystem;
  7. using ILRuntime.CLR.Method;
  8. using ILRuntime.Runtime.Enviorment;
  9. using ILRuntime.Runtime.Intepreter;
  10. using ILRuntime.Runtime.Stack;
  11. using ILRuntime.Reflection;
  12. using ILRuntime.CLR.Utils;
  13. namespace ILRuntime.Runtime.Generated
  14. {
  15. unsafe class ETModel_MessageInfo_Binding
  16. {
  17. public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
  18. {
  19. BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
  20. MethodBase method;
  21. Type[] args;
  22. Type type = typeof(ETModel.MessageInfo);
  23. args = new Type[]{};
  24. method = type.GetMethod("get_Opcode", flag, null, args, null);
  25. app.RegisterCLRMethodRedirection(method, get_Opcode_0);
  26. args = new Type[]{};
  27. method = type.GetMethod("get_Message", flag, null, args, null);
  28. app.RegisterCLRMethodRedirection(method, get_Message_1);
  29. app.RegisterCLRCreateDefaultInstance(type, () => new ETModel.MessageInfo());
  30. args = new Type[]{typeof(System.UInt16), typeof(System.Object)};
  31. method = type.GetConstructor(flag, null, args, null);
  32. app.RegisterCLRMethodRedirection(method, Ctor_0);
  33. }
  34. static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, StackObject* ptr_of_this_method, IList<object> __mStack, ref ETModel.MessageInfo instance_of_this_method)
  35. {
  36. ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
  37. switch(ptr_of_this_method->ObjectType)
  38. {
  39. case ObjectTypes.Object:
  40. {
  41. __mStack[ptr_of_this_method->Value] = instance_of_this_method;
  42. }
  43. break;
  44. case ObjectTypes.FieldReference:
  45. {
  46. var ___obj = __mStack[ptr_of_this_method->Value];
  47. if(___obj is ILTypeInstance)
  48. {
  49. ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method;
  50. }
  51. else
  52. {
  53. var t = __domain.GetType(___obj.GetType()) as CLRType;
  54. t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method);
  55. }
  56. }
  57. break;
  58. case ObjectTypes.StaticFieldReference:
  59. {
  60. var t = __domain.GetType(ptr_of_this_method->Value);
  61. if(t is ILType)
  62. {
  63. ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method;
  64. }
  65. else
  66. {
  67. ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method);
  68. }
  69. }
  70. break;
  71. case ObjectTypes.ArrayReference:
  72. {
  73. var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as ETModel.MessageInfo[];
  74. instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method;
  75. }
  76. break;
  77. }
  78. }
  79. static StackObject* get_Opcode_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  80. {
  81. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  82. StackObject* ptr_of_this_method;
  83. StackObject* __ret = ILIntepreter.Minus(__esp, 1);
  84. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  85. ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
  86. ETModel.MessageInfo instance_of_this_method = (ETModel.MessageInfo)typeof(ETModel.MessageInfo).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  87. var result_of_this_method = instance_of_this_method.Opcode;
  88. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  89. WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);
  90. __intp.Free(ptr_of_this_method);
  91. __ret->ObjectType = ObjectTypes.Integer;
  92. __ret->Value = result_of_this_method;
  93. return __ret + 1;
  94. }
  95. static StackObject* get_Message_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  96. {
  97. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  98. StackObject* ptr_of_this_method;
  99. StackObject* __ret = ILIntepreter.Minus(__esp, 1);
  100. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  101. ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
  102. ETModel.MessageInfo instance_of_this_method = (ETModel.MessageInfo)typeof(ETModel.MessageInfo).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  103. var result_of_this_method = instance_of_this_method.Message;
  104. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  105. WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);
  106. __intp.Free(ptr_of_this_method);
  107. object obj_result_of_this_method = result_of_this_method;
  108. if(obj_result_of_this_method is CrossBindingAdaptorType)
  109. {
  110. return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance, true);
  111. }
  112. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method, true);
  113. }
  114. static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  115. {
  116. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  117. StackObject* ptr_of_this_method;
  118. StackObject* __ret = ILIntepreter.Minus(__esp, 2);
  119. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  120. System.Object @message = (System.Object)typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  121. __intp.Free(ptr_of_this_method);
  122. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  123. System.UInt16 @opcode = (ushort)ptr_of_this_method->Value;
  124. var result_of_this_method = new ETModel.MessageInfo(@opcode, @message);
  125. if(!isNewObj)
  126. {
  127. __ret--;
  128. WriteBackInstance(__domain, __ret, __mStack, ref result_of_this_method);
  129. return __ret;
  130. }
  131. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
  132. }
  133. }
  134. }