public Tret UpdateBindingAndInvoke(CodeContext context, T0 arg0)
        {
            StandardRule <BigDynamicSiteTarget <T0, Tret> > rule = _rules.GetRule(context, arg0);

            if (rule != null)
            {
                // site is truly polymorphic, build the polymorphic method
                _target = _rules.GetOrMakeTarget(context);
                return(_target(this, context, arg0));
            }

            return((Tret)context.LanguageContext.Binder.UpdateSiteAndExecute <BigDynamicSiteTarget <T0, Tret> >(context, Action, Tuple.GetTupleValues(arg0), this, ref _target, ref _rules));
        }
        public Tret UpdateBindingAndInvoke(T0 arg0)
        {
            StandardRule <FastDynamicSiteTarget <T0, Tret> > rule = _rules.GetRule(Context, arg0);

            if (rule != null)
            {
                // site is truly polymorphic, build the polymorphic method
                _target = _rules.GetOrMakeTarget(Context);
                return(_target(this, arg0));
            }


            return((Tret)Context.LanguageContext.Binder.UpdateSiteAndExecute <FastDynamicSiteTarget <T0, Tret> >(Context, Action, new object[] { arg0 }, this, ref _target, ref _rules));
        }
Exemplo n.º 3
0
        internal static void UpdateSite <T>(CodeContext callerContext, object site, ref T target, ref RuleSet <T> rules, StandardRule <T> rule)
        {
            lock (site) {
                bool monomorphic = rules.HasMonomorphicTarget(target);

                rules = rules.AddRule(rule);
                if (monomorphic || rules == EmptyRuleSet <T> .FixedInstance)
                {
                    target = rule.MonomorphicRuleSet.GetOrMakeTarget(callerContext);
                }
                else
                {
                    target = rules.GetOrMakeTarget(callerContext);
                }
            }
        }