ETModel_AsyncETVoidMethodBuilder_Binding.cs 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  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_AsyncETVoidMethodBuilder_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.AsyncETVoidMethodBuilder);
  23. args = new Type[]{};
  24. method = type.GetMethod("Create", flag, null, args, null);
  25. app.RegisterCLRMethodRedirection(method, Create_0);
  26. Dictionary<string, List<MethodInfo>> genericMethods = new Dictionary<string, List<MethodInfo>>();
  27. List<MethodInfo> lst = null;
  28. foreach(var m in type.GetMethods())
  29. {
  30. if(m.IsGenericMethodDefinition)
  31. {
  32. if (!genericMethods.TryGetValue(m.Name, out lst))
  33. {
  34. lst = new List<MethodInfo>();
  35. genericMethods[m.Name] = lst;
  36. }
  37. lst.Add(m);
  38. }
  39. }
  40. args = new Type[]{typeof(ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor)};
  41. if (genericMethods.TryGetValue("Start", out lst))
  42. {
  43. foreach(var m in lst)
  44. {
  45. if(m.MatchGenericParameters(args, typeof(void), typeof(ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
  46. {
  47. method = m.MakeGenericMethod(args);
  48. app.RegisterCLRMethodRedirection(method, Start_1);
  49. break;
  50. }
  51. }
  52. }
  53. args = new Type[]{};
  54. method = type.GetMethod("get_Task", flag, null, args, null);
  55. app.RegisterCLRMethodRedirection(method, get_Task_2);
  56. args = new Type[]{typeof(ETModel.ETTask<Google.Protobuf.Adapt_IMessage.Adaptor>.Awaiter), typeof(ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor)};
  57. if (genericMethods.TryGetValue("AwaitUnsafeOnCompleted", out lst))
  58. {
  59. foreach(var m in lst)
  60. {
  61. if(m.MatchGenericParameters(args, typeof(void), typeof(ETModel.ETTask<Google.Protobuf.Adapt_IMessage.Adaptor>.Awaiter).MakeByRefType(), typeof(ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
  62. {
  63. method = m.MakeGenericMethod(args);
  64. app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_3);
  65. break;
  66. }
  67. }
  68. }
  69. args = new Type[]{typeof(System.Exception)};
  70. method = type.GetMethod("SetException", flag, null, args, null);
  71. app.RegisterCLRMethodRedirection(method, SetException_4);
  72. args = new Type[]{};
  73. method = type.GetMethod("SetResult", flag, null, args, null);
  74. app.RegisterCLRMethodRedirection(method, SetResult_5);
  75. args = new Type[]{typeof(ETModel.ETTask.Awaiter), typeof(ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor)};
  76. if (genericMethods.TryGetValue("AwaitUnsafeOnCompleted", out lst))
  77. {
  78. foreach(var m in lst)
  79. {
  80. if(m.MatchGenericParameters(args, typeof(void), typeof(ETModel.ETTask.Awaiter).MakeByRefType(), typeof(ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
  81. {
  82. method = m.MakeGenericMethod(args);
  83. app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_6);
  84. break;
  85. }
  86. }
  87. }
  88. args = new Type[]{typeof(ETModel.ETTask<ETModel.IResponse>.Awaiter), typeof(ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor)};
  89. if (genericMethods.TryGetValue("AwaitUnsafeOnCompleted", out lst))
  90. {
  91. foreach(var m in lst)
  92. {
  93. if(m.MatchGenericParameters(args, typeof(void), typeof(ETModel.ETTask<ETModel.IResponse>.Awaiter).MakeByRefType(), typeof(ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).MakeByRefType()))
  94. {
  95. method = m.MakeGenericMethod(args);
  96. app.RegisterCLRMethodRedirection(method, AwaitUnsafeOnCompleted_7);
  97. break;
  98. }
  99. }
  100. }
  101. app.RegisterCLRCreateDefaultInstance(type, () => new ETModel.AsyncETVoidMethodBuilder());
  102. }
  103. static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, StackObject* ptr_of_this_method, IList<object> __mStack, ref ETModel.AsyncETVoidMethodBuilder instance_of_this_method)
  104. {
  105. ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
  106. switch(ptr_of_this_method->ObjectType)
  107. {
  108. case ObjectTypes.Object:
  109. {
  110. __mStack[ptr_of_this_method->Value] = instance_of_this_method;
  111. }
  112. break;
  113. case ObjectTypes.FieldReference:
  114. {
  115. var ___obj = __mStack[ptr_of_this_method->Value];
  116. if(___obj is ILTypeInstance)
  117. {
  118. ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method;
  119. }
  120. else
  121. {
  122. var t = __domain.GetType(___obj.GetType()) as CLRType;
  123. t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method);
  124. }
  125. }
  126. break;
  127. case ObjectTypes.StaticFieldReference:
  128. {
  129. var t = __domain.GetType(ptr_of_this_method->Value);
  130. if(t is ILType)
  131. {
  132. ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method;
  133. }
  134. else
  135. {
  136. ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method);
  137. }
  138. }
  139. break;
  140. case ObjectTypes.ArrayReference:
  141. {
  142. var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as ETModel.AsyncETVoidMethodBuilder[];
  143. instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method;
  144. }
  145. break;
  146. }
  147. }
  148. static StackObject* Create_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  149. {
  150. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  151. StackObject* __ret = ILIntepreter.Minus(__esp, 0);
  152. var result_of_this_method = ETModel.AsyncETVoidMethodBuilder.Create();
  153. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
  154. }
  155. static StackObject* Start_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  156. {
  157. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  158. StackObject* ptr_of_this_method;
  159. StackObject* __ret = ILIntepreter.Minus(__esp, 2);
  160. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  161. ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor @stateMachine = (ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor)typeof(ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).CheckCLRTypes(__intp.RetriveObject(ptr_of_this_method, __mStack));
  162. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  163. ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
  164. ETModel.AsyncETVoidMethodBuilder instance_of_this_method = (ETModel.AsyncETVoidMethodBuilder)typeof(ETModel.AsyncETVoidMethodBuilder).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  165. instance_of_this_method.Start<ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor>(ref @stateMachine);
  166. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  167. switch(ptr_of_this_method->ObjectType)
  168. {
  169. case ObjectTypes.StackObjectReference:
  170. {
  171. var ___dst = ILIntepreter.ResolveReference(ptr_of_this_method);
  172. object ___obj = @stateMachine;
  173. if (___dst->ObjectType >= ObjectTypes.Object)
  174. {
  175. if (___obj is CrossBindingAdaptorType)
  176. ___obj = ((CrossBindingAdaptorType)___obj).ILInstance;
  177. __mStack[___dst->Value] = ___obj;
  178. }
  179. else
  180. {
  181. ILIntepreter.UnboxObject(___dst, ___obj, __mStack, __domain);
  182. }
  183. }
  184. break;
  185. case ObjectTypes.FieldReference:
  186. {
  187. var ___obj = __mStack[ptr_of_this_method->Value];
  188. if(___obj is ILTypeInstance)
  189. {
  190. ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = @stateMachine;
  191. }
  192. else
  193. {
  194. var ___type = __domain.GetType(___obj.GetType()) as CLRType;
  195. ___type.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, @stateMachine);
  196. }
  197. }
  198. break;
  199. case ObjectTypes.StaticFieldReference:
  200. {
  201. var ___type = __domain.GetType(ptr_of_this_method->Value);
  202. if(___type is ILType)
  203. {
  204. ((ILType)___type).StaticInstance[ptr_of_this_method->ValueLow] = @stateMachine;
  205. }
  206. else
  207. {
  208. ((CLRType)___type).SetStaticFieldValue(ptr_of_this_method->ValueLow, @stateMachine);
  209. }
  210. }
  211. break;
  212. case ObjectTypes.ArrayReference:
  213. {
  214. var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor[];
  215. instance_of_arrayReference[ptr_of_this_method->ValueLow] = @stateMachine;
  216. }
  217. break;
  218. }
  219. __intp.Free(ptr_of_this_method);
  220. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  221. WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);
  222. __intp.Free(ptr_of_this_method);
  223. return __ret;
  224. }
  225. static StackObject* get_Task_2(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  226. {
  227. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  228. StackObject* ptr_of_this_method;
  229. StackObject* __ret = ILIntepreter.Minus(__esp, 1);
  230. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  231. ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
  232. ETModel.AsyncETVoidMethodBuilder instance_of_this_method = (ETModel.AsyncETVoidMethodBuilder)typeof(ETModel.AsyncETVoidMethodBuilder).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  233. var result_of_this_method = instance_of_this_method.Task;
  234. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  235. WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);
  236. __intp.Free(ptr_of_this_method);
  237. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
  238. }
  239. static StackObject* AwaitUnsafeOnCompleted_3(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  240. {
  241. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  242. StackObject* ptr_of_this_method;
  243. StackObject* __ret = ILIntepreter.Minus(__esp, 3);
  244. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  245. ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor @stateMachine = (ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor)typeof(ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).CheckCLRTypes(__intp.RetriveObject(ptr_of_this_method, __mStack));
  246. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  247. ETModel.ETTask<Google.Protobuf.Adapt_IMessage.Adaptor>.Awaiter @awaiter = (ETModel.ETTask<Google.Protobuf.Adapt_IMessage.Adaptor>.Awaiter)typeof(ETModel.ETTask<Google.Protobuf.Adapt_IMessage.Adaptor>.Awaiter).CheckCLRTypes(__intp.RetriveObject(ptr_of_this_method, __mStack));
  248. ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
  249. ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
  250. ETModel.AsyncETVoidMethodBuilder instance_of_this_method = (ETModel.AsyncETVoidMethodBuilder)typeof(ETModel.AsyncETVoidMethodBuilder).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  251. instance_of_this_method.AwaitUnsafeOnCompleted<ETModel.ETTask<Google.Protobuf.Adapt_IMessage.Adaptor>.Awaiter, ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor>(ref @awaiter, ref @stateMachine);
  252. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  253. switch(ptr_of_this_method->ObjectType)
  254. {
  255. case ObjectTypes.StackObjectReference:
  256. {
  257. var ___dst = ILIntepreter.ResolveReference(ptr_of_this_method);
  258. object ___obj = @stateMachine;
  259. if (___dst->ObjectType >= ObjectTypes.Object)
  260. {
  261. if (___obj is CrossBindingAdaptorType)
  262. ___obj = ((CrossBindingAdaptorType)___obj).ILInstance;
  263. __mStack[___dst->Value] = ___obj;
  264. }
  265. else
  266. {
  267. ILIntepreter.UnboxObject(___dst, ___obj, __mStack, __domain);
  268. }
  269. }
  270. break;
  271. case ObjectTypes.FieldReference:
  272. {
  273. var ___obj = __mStack[ptr_of_this_method->Value];
  274. if(___obj is ILTypeInstance)
  275. {
  276. ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = @stateMachine;
  277. }
  278. else
  279. {
  280. var ___type = __domain.GetType(___obj.GetType()) as CLRType;
  281. ___type.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, @stateMachine);
  282. }
  283. }
  284. break;
  285. case ObjectTypes.StaticFieldReference:
  286. {
  287. var ___type = __domain.GetType(ptr_of_this_method->Value);
  288. if(___type is ILType)
  289. {
  290. ((ILType)___type).StaticInstance[ptr_of_this_method->ValueLow] = @stateMachine;
  291. }
  292. else
  293. {
  294. ((CLRType)___type).SetStaticFieldValue(ptr_of_this_method->ValueLow, @stateMachine);
  295. }
  296. }
  297. break;
  298. case ObjectTypes.ArrayReference:
  299. {
  300. var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor[];
  301. instance_of_arrayReference[ptr_of_this_method->ValueLow] = @stateMachine;
  302. }
  303. break;
  304. }
  305. __intp.Free(ptr_of_this_method);
  306. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  307. switch(ptr_of_this_method->ObjectType)
  308. {
  309. case ObjectTypes.StackObjectReference:
  310. {
  311. var ___dst = ILIntepreter.ResolveReference(ptr_of_this_method);
  312. object ___obj = @awaiter;
  313. if (___dst->ObjectType >= ObjectTypes.Object)
  314. {
  315. if (___obj is CrossBindingAdaptorType)
  316. ___obj = ((CrossBindingAdaptorType)___obj).ILInstance;
  317. __mStack[___dst->Value] = ___obj;
  318. }
  319. else
  320. {
  321. ILIntepreter.UnboxObject(___dst, ___obj, __mStack, __domain);
  322. }
  323. }
  324. break;
  325. case ObjectTypes.FieldReference:
  326. {
  327. var ___obj = __mStack[ptr_of_this_method->Value];
  328. if(___obj is ILTypeInstance)
  329. {
  330. ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = @awaiter;
  331. }
  332. else
  333. {
  334. var ___type = __domain.GetType(___obj.GetType()) as CLRType;
  335. ___type.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, @awaiter);
  336. }
  337. }
  338. break;
  339. case ObjectTypes.StaticFieldReference:
  340. {
  341. var ___type = __domain.GetType(ptr_of_this_method->Value);
  342. if(___type is ILType)
  343. {
  344. ((ILType)___type).StaticInstance[ptr_of_this_method->ValueLow] = @awaiter;
  345. }
  346. else
  347. {
  348. ((CLRType)___type).SetStaticFieldValue(ptr_of_this_method->ValueLow, @awaiter);
  349. }
  350. }
  351. break;
  352. case ObjectTypes.ArrayReference:
  353. {
  354. var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as ETModel.ETTask<Google.Protobuf.Adapt_IMessage.Adaptor>.Awaiter[];
  355. instance_of_arrayReference[ptr_of_this_method->ValueLow] = @awaiter;
  356. }
  357. break;
  358. }
  359. __intp.Free(ptr_of_this_method);
  360. ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
  361. WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);
  362. __intp.Free(ptr_of_this_method);
  363. return __ret;
  364. }
  365. static StackObject* SetException_4(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  366. {
  367. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  368. StackObject* ptr_of_this_method;
  369. StackObject* __ret = ILIntepreter.Minus(__esp, 2);
  370. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  371. System.Exception @exception = (System.Exception)typeof(System.Exception).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  372. __intp.Free(ptr_of_this_method);
  373. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  374. ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
  375. ETModel.AsyncETVoidMethodBuilder instance_of_this_method = (ETModel.AsyncETVoidMethodBuilder)typeof(ETModel.AsyncETVoidMethodBuilder).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  376. instance_of_this_method.SetException(@exception);
  377. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  378. WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);
  379. __intp.Free(ptr_of_this_method);
  380. return __ret;
  381. }
  382. static StackObject* SetResult_5(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  383. {
  384. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  385. StackObject* ptr_of_this_method;
  386. StackObject* __ret = ILIntepreter.Minus(__esp, 1);
  387. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  388. ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
  389. ETModel.AsyncETVoidMethodBuilder instance_of_this_method = (ETModel.AsyncETVoidMethodBuilder)typeof(ETModel.AsyncETVoidMethodBuilder).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  390. instance_of_this_method.SetResult();
  391. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  392. WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);
  393. __intp.Free(ptr_of_this_method);
  394. return __ret;
  395. }
  396. static StackObject* AwaitUnsafeOnCompleted_6(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  397. {
  398. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  399. StackObject* ptr_of_this_method;
  400. StackObject* __ret = ILIntepreter.Minus(__esp, 3);
  401. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  402. ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor @stateMachine = (ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor)typeof(ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).CheckCLRTypes(__intp.RetriveObject(ptr_of_this_method, __mStack));
  403. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  404. ETModel.ETTask.Awaiter @awaiter = (ETModel.ETTask.Awaiter)typeof(ETModel.ETTask.Awaiter).CheckCLRTypes(__intp.RetriveObject(ptr_of_this_method, __mStack));
  405. ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
  406. ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
  407. ETModel.AsyncETVoidMethodBuilder instance_of_this_method = (ETModel.AsyncETVoidMethodBuilder)typeof(ETModel.AsyncETVoidMethodBuilder).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  408. instance_of_this_method.AwaitUnsafeOnCompleted<ETModel.ETTask.Awaiter, ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor>(ref @awaiter, ref @stateMachine);
  409. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  410. switch(ptr_of_this_method->ObjectType)
  411. {
  412. case ObjectTypes.StackObjectReference:
  413. {
  414. var ___dst = ILIntepreter.ResolveReference(ptr_of_this_method);
  415. object ___obj = @stateMachine;
  416. if (___dst->ObjectType >= ObjectTypes.Object)
  417. {
  418. if (___obj is CrossBindingAdaptorType)
  419. ___obj = ((CrossBindingAdaptorType)___obj).ILInstance;
  420. __mStack[___dst->Value] = ___obj;
  421. }
  422. else
  423. {
  424. ILIntepreter.UnboxObject(___dst, ___obj, __mStack, __domain);
  425. }
  426. }
  427. break;
  428. case ObjectTypes.FieldReference:
  429. {
  430. var ___obj = __mStack[ptr_of_this_method->Value];
  431. if(___obj is ILTypeInstance)
  432. {
  433. ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = @stateMachine;
  434. }
  435. else
  436. {
  437. var ___type = __domain.GetType(___obj.GetType()) as CLRType;
  438. ___type.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, @stateMachine);
  439. }
  440. }
  441. break;
  442. case ObjectTypes.StaticFieldReference:
  443. {
  444. var ___type = __domain.GetType(ptr_of_this_method->Value);
  445. if(___type is ILType)
  446. {
  447. ((ILType)___type).StaticInstance[ptr_of_this_method->ValueLow] = @stateMachine;
  448. }
  449. else
  450. {
  451. ((CLRType)___type).SetStaticFieldValue(ptr_of_this_method->ValueLow, @stateMachine);
  452. }
  453. }
  454. break;
  455. case ObjectTypes.ArrayReference:
  456. {
  457. var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor[];
  458. instance_of_arrayReference[ptr_of_this_method->ValueLow] = @stateMachine;
  459. }
  460. break;
  461. }
  462. __intp.Free(ptr_of_this_method);
  463. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  464. switch(ptr_of_this_method->ObjectType)
  465. {
  466. case ObjectTypes.StackObjectReference:
  467. {
  468. var ___dst = ILIntepreter.ResolveReference(ptr_of_this_method);
  469. object ___obj = @awaiter;
  470. if (___dst->ObjectType >= ObjectTypes.Object)
  471. {
  472. if (___obj is CrossBindingAdaptorType)
  473. ___obj = ((CrossBindingAdaptorType)___obj).ILInstance;
  474. __mStack[___dst->Value] = ___obj;
  475. }
  476. else
  477. {
  478. ILIntepreter.UnboxObject(___dst, ___obj, __mStack, __domain);
  479. }
  480. }
  481. break;
  482. case ObjectTypes.FieldReference:
  483. {
  484. var ___obj = __mStack[ptr_of_this_method->Value];
  485. if(___obj is ILTypeInstance)
  486. {
  487. ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = @awaiter;
  488. }
  489. else
  490. {
  491. var ___type = __domain.GetType(___obj.GetType()) as CLRType;
  492. ___type.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, @awaiter);
  493. }
  494. }
  495. break;
  496. case ObjectTypes.StaticFieldReference:
  497. {
  498. var ___type = __domain.GetType(ptr_of_this_method->Value);
  499. if(___type is ILType)
  500. {
  501. ((ILType)___type).StaticInstance[ptr_of_this_method->ValueLow] = @awaiter;
  502. }
  503. else
  504. {
  505. ((CLRType)___type).SetStaticFieldValue(ptr_of_this_method->ValueLow, @awaiter);
  506. }
  507. }
  508. break;
  509. case ObjectTypes.ArrayReference:
  510. {
  511. var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as ETModel.ETTask.Awaiter[];
  512. instance_of_arrayReference[ptr_of_this_method->ValueLow] = @awaiter;
  513. }
  514. break;
  515. }
  516. __intp.Free(ptr_of_this_method);
  517. ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
  518. WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);
  519. __intp.Free(ptr_of_this_method);
  520. return __ret;
  521. }
  522. static StackObject* AwaitUnsafeOnCompleted_7(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  523. {
  524. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  525. StackObject* ptr_of_this_method;
  526. StackObject* __ret = ILIntepreter.Minus(__esp, 3);
  527. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  528. ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor @stateMachine = (ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor)typeof(ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor).CheckCLRTypes(__intp.RetriveObject(ptr_of_this_method, __mStack));
  529. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  530. ETModel.ETTask<ETModel.IResponse>.Awaiter @awaiter = (ETModel.ETTask<ETModel.IResponse>.Awaiter)typeof(ETModel.ETTask<ETModel.IResponse>.Awaiter).CheckCLRTypes(__intp.RetriveObject(ptr_of_this_method, __mStack));
  531. ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
  532. ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
  533. ETModel.AsyncETVoidMethodBuilder instance_of_this_method = (ETModel.AsyncETVoidMethodBuilder)typeof(ETModel.AsyncETVoidMethodBuilder).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  534. instance_of_this_method.AwaitUnsafeOnCompleted<ETModel.ETTask<ETModel.IResponse>.Awaiter, ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor>(ref @awaiter, ref @stateMachine);
  535. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  536. switch(ptr_of_this_method->ObjectType)
  537. {
  538. case ObjectTypes.StackObjectReference:
  539. {
  540. var ___dst = ILIntepreter.ResolveReference(ptr_of_this_method);
  541. object ___obj = @stateMachine;
  542. if (___dst->ObjectType >= ObjectTypes.Object)
  543. {
  544. if (___obj is CrossBindingAdaptorType)
  545. ___obj = ((CrossBindingAdaptorType)___obj).ILInstance;
  546. __mStack[___dst->Value] = ___obj;
  547. }
  548. else
  549. {
  550. ILIntepreter.UnboxObject(___dst, ___obj, __mStack, __domain);
  551. }
  552. }
  553. break;
  554. case ObjectTypes.FieldReference:
  555. {
  556. var ___obj = __mStack[ptr_of_this_method->Value];
  557. if(___obj is ILTypeInstance)
  558. {
  559. ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = @stateMachine;
  560. }
  561. else
  562. {
  563. var ___type = __domain.GetType(___obj.GetType()) as CLRType;
  564. ___type.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, @stateMachine);
  565. }
  566. }
  567. break;
  568. case ObjectTypes.StaticFieldReference:
  569. {
  570. var ___type = __domain.GetType(ptr_of_this_method->Value);
  571. if(___type is ILType)
  572. {
  573. ((ILType)___type).StaticInstance[ptr_of_this_method->ValueLow] = @stateMachine;
  574. }
  575. else
  576. {
  577. ((CLRType)___type).SetStaticFieldValue(ptr_of_this_method->ValueLow, @stateMachine);
  578. }
  579. }
  580. break;
  581. case ObjectTypes.ArrayReference:
  582. {
  583. var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as ETModel.IAsyncStateMachineClassInheritanceAdaptor.IAsyncStateMachineAdaptor[];
  584. instance_of_arrayReference[ptr_of_this_method->ValueLow] = @stateMachine;
  585. }
  586. break;
  587. }
  588. __intp.Free(ptr_of_this_method);
  589. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  590. switch(ptr_of_this_method->ObjectType)
  591. {
  592. case ObjectTypes.StackObjectReference:
  593. {
  594. var ___dst = ILIntepreter.ResolveReference(ptr_of_this_method);
  595. object ___obj = @awaiter;
  596. if (___dst->ObjectType >= ObjectTypes.Object)
  597. {
  598. if (___obj is CrossBindingAdaptorType)
  599. ___obj = ((CrossBindingAdaptorType)___obj).ILInstance;
  600. __mStack[___dst->Value] = ___obj;
  601. }
  602. else
  603. {
  604. ILIntepreter.UnboxObject(___dst, ___obj, __mStack, __domain);
  605. }
  606. }
  607. break;
  608. case ObjectTypes.FieldReference:
  609. {
  610. var ___obj = __mStack[ptr_of_this_method->Value];
  611. if(___obj is ILTypeInstance)
  612. {
  613. ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = @awaiter;
  614. }
  615. else
  616. {
  617. var ___type = __domain.GetType(___obj.GetType()) as CLRType;
  618. ___type.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, @awaiter);
  619. }
  620. }
  621. break;
  622. case ObjectTypes.StaticFieldReference:
  623. {
  624. var ___type = __domain.GetType(ptr_of_this_method->Value);
  625. if(___type is ILType)
  626. {
  627. ((ILType)___type).StaticInstance[ptr_of_this_method->ValueLow] = @awaiter;
  628. }
  629. else
  630. {
  631. ((CLRType)___type).SetStaticFieldValue(ptr_of_this_method->ValueLow, @awaiter);
  632. }
  633. }
  634. break;
  635. case ObjectTypes.ArrayReference:
  636. {
  637. var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as ETModel.ETTask<ETModel.IResponse>.Awaiter[];
  638. instance_of_arrayReference[ptr_of_this_method->ValueLow] = @awaiter;
  639. }
  640. break;
  641. }
  642. __intp.Free(ptr_of_this_method);
  643. ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
  644. WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);
  645. __intp.Free(ptr_of_this_method);
  646. return __ret;
  647. }
  648. }
  649. }