Ejemplo n.º 1
0
 internal void AddCreator(Node upNode)
 {
     this.crtrs[new ReferenceCreator(upNode)] = true;
 }
Ejemplo n.º 2
0
 public SwitchIndexOutOfRangeException(Node node)
     : base(node,"Switch index is out of range")
 {
 }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
0
 public LinkException(Node source, Node target, string msg)
     : base(msg)
 {
     this.source = source;
     this.target = target;
 }
Ejemplo n.º 5
0
 public NodeException(Node node, string msg)
     : base(msg)
 {
     this.node = node;
 }
Ejemplo n.º 6
0
 internal void removeChild(Node child)
 {
     childArray.Remove(child);
 }
Ejemplo n.º 7
0
 public InvalidBranchTargetException(Node source, Node target)
     : base(source,target,"Invalid branch target")
 {
 }
Ejemplo n.º 8
0
        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;
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 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
            }
Ejemplo n.º 11
0
        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;
            }
        }
Ejemplo n.º 12
0
 protected PrimitiveCreator(Node upNode)
     : base(upNode)
 {
 }
Ejemplo n.º 13
0
 internal void AddCreator(Node upNode, Variable var)
 {
     this.crtrs[new VariablePrimitiveCreator(upNode, var)] = true;
 }
Ejemplo n.º 14
0
 internal void AddCreator(Node upNode, int depth)
 {
     this.crtrs[new StackPrimitiveCreator(upNode, depth)] = true;
 }
Ejemplo n.º 15
0
        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--;
        }
Ejemplo n.º 16
0
 internal void removePrevNode(Node node)
 {
     int index = prevArray.IndexOf(node);
     prevArray.RemoveAt(index);
     prevIndexes.RemoveAt(index);
 }
Ejemplo n.º 17
0
 internal void addChild(Node child)
 {
     childArray.Add(child);
 }
Ejemplo n.º 18
0
 public NextNodeArray(Node owner, int arrayLength)
     : base(arrayLength)
 {
     this.owner = owner;
 }
Ejemplo n.º 19
0
 public HandlerAdditionProhibitedException(Node source, Node target)
     : base(source,target,"Handler addition is prohibited")
 {
 }
Ejemplo n.º 20
0
            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);
                    }
                }
            }
Ejemplo n.º 21
0
 public LinkAdditionProhibitedException(Node source, Node target)
     : base(source,target,"Link addition is prohibited")
 {
 }
Ejemplo n.º 22
0
        public void Add(Node node)
        {
            nodes.Add(node);

            if (node != null)
                linkCount++;
        }
Ejemplo n.º 23
0
 public MbbNotAvailableException(Node node)
     : base(node,"MethodBodyBlock is not available")
 {
 }
Ejemplo n.º 24
0
 public int IndexOf(Node node)
 {
     return nodes.IndexOf(node);
 }
Ejemplo n.º 25
0
 public NodeReplacementProhibitedException(Node node)
     : base(node,"Node replacement is prohibited")
 {
 }
Ejemplo n.º 26
0
        public void Insert(int index, Node node)
        {
            nodes.Insert(index,node);

            if (node != null)
                linkCount++;
        }
Ejemplo n.º 27
0
 public VariableNotInMbbException(Node node)
     : base(node,"Variable is not in MethodBodyBlock")
 {
 }
Ejemplo n.º 28
0
        public void Remove(Node node)
        {
            nodes.Remove(node);

            if (node != null)
                linkCount--;
        }
Ejemplo n.º 29
0
 public override void ReplaceByNode(Node node)
 {
     throw new NodeReplacementProhibitedException(this);
 }
Ejemplo n.º 30
0
 internal BTValueCreator(Node upNode)
 {
     this.UpNode = upNode;
 }