Exemplo n.º 1
0
        /// <summary>
        /// Finds all graphnodes associated with each AST and marks them dirty
        /// </summary>
        /// <param name="nodeList"></param>
        /// <summary>
        /// <returns></returns>
        public static void MarkGraphNodesDirty(ProtoCore.Core core, IEnumerable<ProtoCore.AST.AssociativeAST.AssociativeNode> nodeList)
        {
            if (nodeList == null)
                return;

            bool setEntryPoint = false;
            foreach (var node in nodeList)
            {
                var bNode = node as ProtoCore.AST.AssociativeAST.BinaryExpressionNode;
                if (bNode == null)
                {
                    continue;
                }

                foreach (var gnode in core.DSExecutable.instrStreamList[0].dependencyGraph.GraphList)
                {
                    if (gnode.isActive && gnode.OriginalAstID == bNode.OriginalAstID)
                    {
                        if (!setEntryPoint)
                        {
                            setEntryPoint = true;
                            core.SetNewEntryPoint(gnode.updateBlock.startpc);
                        }
                        gnode.isDirty = true;
                        gnode.isActive = true;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static void MarkGraphNodesDirtyFromFunctionRedef(ProtoCore.Core core, List<ProtoCore.AST.AssociativeAST.AssociativeNode> fnodeList)
        {
            foreach (ProtoCore.AST.AssociativeAST.AssociativeNode node in fnodeList)
            {
                ProtoCore.AST.AssociativeAST.FunctionDefinitionNode fnode = node as ProtoCore.AST.AssociativeAST.FunctionDefinitionNode;
                if (null == fnode)
                {
                    continue;
                }

                int exprId = ProtoCore.DSASM.Constants.kInvalidIndex;
                foreach (var gnode in core.DSExecutable.instrStreamList[0].dependencyGraph.GraphList)
                {
                    if (gnode.isActive)
                    {
                        if (null != gnode.firstProc)
                        {
                            if (fnode.Name == gnode.firstProc.name && fnode.Signature.Arguments.Count == gnode.firstProc.argInfoList.Count)
                            {
                                if (ProtoCore.DSASM.Constants.kInvalidIndex == exprId)
                                {
                                    exprId = gnode.exprUID;
                                    core.SetNewEntryPoint(gnode.updateBlock.startpc);
                                }
                                gnode.isDirty = true;
                            }
                        }
                        else if (ProtoCore.DSASM.Constants.kInvalidIndex != exprId)
                        {
                            if (gnode.exprUID == exprId)
                            {
                                gnode.isDirty = true;
                                if (gnode.IsLastNodeInSSA)
                                {
                                    exprId = ProtoCore.DSASM.Constants.kInvalidIndex;
                                }
                            }
                        }
                    }
                }
            }
        }