示例#1
0
 internal void AddCreator(Node upNode)
 {
     this.crtrs[new ReferenceCreator(upNode)] = true;
 }
示例#2
0
文件: Graph.cs 项目: DragonXYZ/cilpe
 public SwitchIndexOutOfRangeException(Node node)
     : base(node,"Switch index is out of range")
 {
 }
示例#3
0
文件: Graph.cs 项目: DragonXYZ/cilpe
 protected override void DispatchNode(Node node, object data)
 {
     if (node != null && node.needed == false)
     {
         node.needed = true;
         if (node is Block)
         {
             foreach (Node n in (node as Block).childArray)
                 if (n is Leave)
                     AddNextNodesToTasks(n, null);
         }
         else if (!(node is Leave))
             AddNextNodesToTasks(node, null);
     }
 }
示例#4
0
文件: Graph.cs 项目: DragonXYZ/cilpe
 public LinkException(Node source, Node target, string msg)
     : base(msg)
 {
     this.source = source;
     this.target = target;
 }
示例#5
0
文件: Graph.cs 项目: DragonXYZ/cilpe
 public NodeException(Node node, string msg)
     : base(msg)
 {
     this.node = node;
 }
示例#6
0
文件: Graph.cs 项目: DragonXYZ/cilpe
 internal void removeChild(Node child)
 {
     childArray.Remove(child);
 }
示例#7
0
文件: Graph.cs 项目: DragonXYZ/cilpe
 public InvalidBranchTargetException(Node source, Node target)
     : base(source,target,"Invalid branch target")
 {
 }
示例#8
0
文件: Graph.cs 项目: DragonXYZ/cilpe
        protected internal static string FormatBranchTarget(Node target)
        {
            string result = "@";

            if (target != null && target.Options.ContainsOption(BasicBlock.BASIC_BLOCK_OPTION))
            {
                BasicBlock basicBlock = target.Options[BasicBlock.BASIC_BLOCK_OPTION] as BasicBlock;
                result += basicBlock.Index;
            }
            else
                result += "unknown";

            return result;
        }
示例#9
0
文件: Graph.cs 项目: DragonXYZ/cilpe
        internal void addPrevNode(Node node, int indexInNextArray)
        {
            if (parent == null)
                setParent(node.NextParent);
            else if (parent != node.NextParent)
                throw new InvalidBranchTargetException(node,this);

            prevArray.Add(node);
            prevIndexes.Add(indexInNextArray);
        }
示例#10
0
            public void Callback(Node node)
            {
                if(node is ITypedNode)
                {
                    ITypedNode theNode = node as ITypedNode;
                    theNode.Type = mapper.Map(theNode.Type);
                }
                if(node is ManageField)
                {
                    ManageField theNode = node as ManageField;
                    theNode.Field = mapper.Map(theNode.Field);
                }
                if(node is MethodBodyBlock)
                {
                    MethodBodyBlock body = node as MethodBodyBlock;
                    foreach(Variable var in body.Variables)
                        var.Type = mapper.Map(var.Type);
                    body.ReturnType = mapper.Map(body.ReturnType);
                }
                if(node is CallMethod)
                {
                    CallMethod call = node as CallMethod;
                    ResidualMethod id = Specialization.GetResidualMethod(call);
                    if(id != null)
                    {
                        MethodBodyBlock mbb = mapper.Holder[id];
                        node.Options["HasPseudoParameter"] = mapper.HasPseudoParameter(mbb);
                        call.MethodWithParams = new MethodInfoExtention(mapper.Map(mbb), call.IsVirtCall, mapper.Map(GetParamTypes(mbb, id.IsConstructor)) );
                    }
                    else
                        call.MethodWithParams = mapper.Map(call.MethodWithParams);
                }
                if(node is NewObject)
                {
                    NewObject newObj = node as NewObject;
                    ResidualMethod id = Specialization.GetResidualMethod(node);
                    if(id != null)
                    {
                        MethodBodyBlock mbb = mapper.Holder[id];
                        newObj.CtorWithParams = new MethodInfoExtention(mapper.Map(mbb), false, mapper.Map(GetParamTypes(mbb, id.IsConstructor)));
                        node.Options["HasPseudoParameter"] = mapper.HasPseudoParameter(mbb);
                    }
                    else
                        newObj.CtorWithParams = mapper.Map(newObj.CtorWithParams);
                }
                if(node is CreateDelegate)
                {
                    CreateDelegate crDel = node as CreateDelegate;
                    //Andrew TODO: Map this node...
                }

                // Graph should be verified AFTER the metadata is resolved
            }
示例#11
0
文件: Graph.cs 项目: DragonXYZ/cilpe
        public virtual void ReplaceByNode(Node node)
        {
            //Hy Cepera!!
            int prevCount = this.prevArray.Count;
            Node[] prevArray = new Node[prevCount];
            int[] prevIndexes = new int[prevCount];
            for(int i=0; i<prevCount; i++)
            {
                prevArray[i] = this.prevArray[i];
                prevIndexes[i] = (int)this.prevIndexes[i];
            }

            for (int i = 0; i < prevCount; i++)
            {
                Node prevNode = prevArray[i];
                int index = prevIndexes[i];
                prevNode.NextArray[index] = node;
            }
        }
示例#12
0
 protected PrimitiveCreator(Node upNode)
     : base(upNode)
 {
 }
示例#13
0
 internal void AddCreator(Node upNode, Variable var)
 {
     this.crtrs[new VariablePrimitiveCreator(upNode, var)] = true;
 }
示例#14
0
 internal void AddCreator(Node upNode, int depth)
 {
     this.crtrs[new StackPrimitiveCreator(upNode, depth)] = true;
 }
示例#15
0
文件: Graph.cs 项目: DragonXYZ/cilpe
        protected virtual void SetNode(int index, Node node)
        {
            Node oldValue = nodes[index] as Node;
            nodes[index] = node;

            if (oldValue == null && node != null)
                linkCount++;
            else if (oldValue != null && node == null)
                linkCount--;
        }
示例#16
0
文件: Graph.cs 项目: DragonXYZ/cilpe
 internal void removePrevNode(Node node)
 {
     int index = prevArray.IndexOf(node);
     prevArray.RemoveAt(index);
     prevIndexes.RemoveAt(index);
 }
示例#17
0
文件: Graph.cs 项目: DragonXYZ/cilpe
 internal void addChild(Node child)
 {
     childArray.Add(child);
 }
示例#18
0
文件: Graph.cs 项目: DragonXYZ/cilpe
 public NextNodeArray(Node owner, int arrayLength)
     : base(arrayLength)
 {
     this.owner = owner;
 }
示例#19
0
文件: Graph.cs 项目: DragonXYZ/cilpe
 public HandlerAdditionProhibitedException(Node source, Node target)
     : base(source,target,"Handler addition is prohibited")
 {
 }
示例#20
0
文件: Graph.cs 项目: DragonXYZ/cilpe
            protected override void SetNode(int index, Node node)
            {
                Node linkedNode = GetNode(index);

                if (linkedNode != node)
                {
                    /* Clearing old link */
                    if (linkedNode != null)
                    {
                        base.SetNode(index,null);
                        linkedNode.removePrevNode(owner);
                    }

                    /* Adding new link */
                    if (node != null)
                    {
                        if (! node.CanBeBranchTarget)
                            throw new InvalidBranchTargetException(owner,node);

                        if (owner.NextParent == null)
                            throw new LinkAdditionProhibitedException(owner,node);

                        node.addPrevNode(owner,index);
                        base.SetNode(index,node);
                    }
                }
            }
示例#21
0
文件: Graph.cs 项目: DragonXYZ/cilpe
 public LinkAdditionProhibitedException(Node source, Node target)
     : base(source,target,"Link addition is prohibited")
 {
 }
示例#22
0
文件: Graph.cs 项目: DragonXYZ/cilpe
        public void Add(Node node)
        {
            nodes.Add(node);

            if (node != null)
                linkCount++;
        }
示例#23
0
文件: Graph.cs 项目: DragonXYZ/cilpe
 public MbbNotAvailableException(Node node)
     : base(node,"MethodBodyBlock is not available")
 {
 }
示例#24
0
文件: Graph.cs 项目: DragonXYZ/cilpe
 public int IndexOf(Node node)
 {
     return nodes.IndexOf(node);
 }
示例#25
0
文件: Graph.cs 项目: DragonXYZ/cilpe
 public NodeReplacementProhibitedException(Node node)
     : base(node,"Node replacement is prohibited")
 {
 }
示例#26
0
文件: Graph.cs 项目: DragonXYZ/cilpe
        public void Insert(int index, Node node)
        {
            nodes.Insert(index,node);

            if (node != null)
                linkCount++;
        }
示例#27
0
文件: Graph.cs 项目: DragonXYZ/cilpe
 public VariableNotInMbbException(Node node)
     : base(node,"Variable is not in MethodBodyBlock")
 {
 }
示例#28
0
文件: Graph.cs 项目: DragonXYZ/cilpe
        public void Remove(Node node)
        {
            nodes.Remove(node);

            if (node != null)
                linkCount--;
        }
示例#29
0
文件: Graph.cs 项目: DragonXYZ/cilpe
 public override void ReplaceByNode(Node node)
 {
     throw new NodeReplacementProhibitedException(this);
 }
示例#30
0
 internal BTValueCreator(Node upNode)
 {
     this.UpNode = upNode;
 }