Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ UpdateAndExecute4< T0, T1, T2, T3, TRet >()

static TRet System.Dynamic.UpdateDelegates.UpdateAndExecute4< T0, T1, T2, T3, TRet > ( CallSite site,
T0 arg0,
T1 arg1,
T2 arg2,
T3 arg3 )
inlinestaticpackage

Definition at line 260 of file UpdateDelegates.cs.

261 {
263 Func<CallSite, T0, T1, T2, T3, TRet> target = callSite.Target;
264 site = callSite.GetMatchmaker();
265 Func<CallSite, T0, T1, T2, T3, TRet>[] rules;
266 Func<CallSite, T0, T1, T2, T3, TRet> func;
267 if ((rules = CallSiteOps.GetRules(callSite)) != null)
268 {
269 for (int i = 0; i < rules.Length; i++)
270 {
271 func = rules[i];
272 if ((object)func != target)
273 {
274 callSite.Target = func;
275 TRet result = func(site, arg0, arg1, arg2, arg3);
276 if (CallSiteOps.GetMatch(site))
277 {
278 CallSiteOps.UpdateRules(callSite, i);
279 callSite.ReleaseMatchmaker(site);
280 return result;
281 }
283 }
284 }
285 }
286 RuleCache<Func<CallSite, T0, T1, T2, T3, TRet>> ruleCache = CallSiteOps.GetRuleCache(callSite);
287 rules = ruleCache.GetRules();
288 for (int j = 0; j < rules.Length; j++)
289 {
290 func = (callSite.Target = rules[j]);
291 try
292 {
293 TRet result = func(site, arg0, arg1, arg2, arg3);
294 if (CallSiteOps.GetMatch(site))
295 {
296 callSite.ReleaseMatchmaker(site);
297 return result;
298 }
299 }
300 finally
301 {
302 if (CallSiteOps.GetMatch(site))
303 {
304 CallSiteOps.AddRule(callSite, func);
305 CallSiteOps.MoveRule(ruleCache, func, j);
306 }
307 }
309 }
310 func = null;
311 object[] args = new object[4] { arg0, arg1, arg2, arg3 };
312 while (true)
313 {
314 callSite.Target = target;
315 func = (callSite.Target = callSite.Binder.BindCore(callSite, args));
316 try
317 {
318 TRet result = func(site, arg0, arg1, arg2, arg3);
319 if (CallSiteOps.GetMatch(site))
320 {
321 callSite.ReleaseMatchmaker(site);
322 return result;
323 }
324 }
325 finally
326 {
327 if (CallSiteOps.GetMatch(site))
328 {
329 CallSiteOps.AddRule(callSite, func);
330 }
331 }
333 }
334 }
static bool GetMatch(CallSite site)
static void ClearMatch(CallSite site)
void ReleaseMatchmaker(CallSite matchMaker)
Definition CallSite.cs:106

References System.Runtime.CompilerServices.CallSite< T >.Binder, System.Runtime.CompilerServices.CallSiteOps.ClearMatch(), System.Runtime.CompilerServices.CallSiteOps.GetMatch(), System.Runtime.CompilerServices.CallSite< T >.GetMatchmaker(), System.Runtime.CompilerServices.RuleCache< T >.GetRules(), System.Runtime.CompilerServices.CallSite< T >.ReleaseMatchmaker(), and System.Runtime.CompilerServices.CallSite< T >.Target.