Ejemplo n.º 1
0
        public Dictionary <FunctionEndPoint, int> GetCastDistances(ProtoCore.Runtime.Context context, List <StackValue> formalParams, List <ReplicationInstruction> replicationInstructions, ClassTable classTable, Core core)
        {
            Dictionary <FunctionEndPoint, int> ret = new Dictionary <FunctionEndPoint, int>();

            //@PERF: Consider parallelising this
            List <FunctionEndPoint> feps            = FunctionEndPoints;
            List <StackValue>       reducedParamSVs = Replicator.EstimateReducedParams(formalParams, replicationInstructions, core);

            foreach (FunctionEndPoint fep in feps)
            {
                int dist = fep.ComputeCastDistance(reducedParamSVs, classTable, core);
                ret.Add(fep, dist);
            }

            return(ret);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get a dictionary of the function end points that are type compatible
        /// with the costs of the associated conversions
        /// </summary>
        /// <param name="context"></param>
        /// <param name="formalParams"></param>
        /// <param name="replicationInstructions"></param>
        /// <returns></returns>
        public Dictionary <FunctionEndPoint, int> GetConversionDistances(ProtoCore.Runtime.Context context,
                                                                         List <StackValue> formalParams, List <ReplicationInstruction> replicationInstructions,
                                                                         ProtoCore.DSASM.ClassTable classTable, Core core, bool allowArrayPromotion = false)
        {
            Dictionary <FunctionEndPoint, int> ret = new Dictionary <FunctionEndPoint, int>();

            //@PERF: Consider parallelising this
            List <FunctionEndPoint> feps            = FunctionEndPoints;
            List <StackValue>       reducedParamSVs = Replicator.EstimateReducedParams(formalParams, replicationInstructions, core);

            foreach (FunctionEndPoint fep in feps)
            {
                int distance = fep.GetConversionDistance(reducedParamSVs, classTable, allowArrayPromotion, core);
                if (distance !=
                    (int)ProcedureDistance.kInvalidDistance)
                {
                    ret.Add(fep, distance);
                }
            }

            return(ret);
        }