Esempio n. 1
0
        /// <summary>
        /// Add a branch from a location to a target label
        /// </summary>
        /// <param name="ilg"></param>
        /// <param name="target"></param>
        /// <remarks></remarks>
        public void AddBranch(FleeILGenerator ilg, Label target)
        {
            ILLocation startLoc = new ILLocation(ilg.Length);

            BranchInfo bi = new BranchInfo(startLoc, target);

            MyBranchInfos.Add(bi);
        }
Esempio n. 2
0
        /// <summary>
        /// Add a branch from a location to a target label
        /// </summary>
        /// <param name="ilg"></param>
        /// <param name="target"></param>
        /// <remarks></remarks>
        public void AddBranch(FleeILGenerator ilg, Label target)
        {
            ILLocation startLoc = new ILLocation(ilg.Length);

            BranchInfo bi = new BranchInfo(startLoc, target);

            // branches will be sorted in order
            MyBranchInfos.Add(bi);
        }
Esempio n. 3
0
        /// <summary>
        /// Determine if a branch from a point to a label will be long
        /// </summary>
        /// <param name="ilg"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        /// <remarks></remarks>
        public bool IsLongBranch(FleeILGenerator ilg, Label target)
        {
            ILLocation startLoc = new ILLocation(ilg.Length);
            BranchInfo bi       = new BranchInfo(startLoc, target);

            int index = MyBranchInfos.IndexOf(bi);

            bi = MyBranchInfos[index];

            return(bi.IsLongBranch);
        }
Esempio n. 4
0
        /// <summary>
        /// Determine if a branch from a point to a label will be long
        /// </summary>
        /// <param name="ilg"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        /// <remarks></remarks>
        public bool IsLongBranch(FleeILGenerator ilg, Label target)
        {
            //return true;
            ILLocation startLoc = new ILLocation(ilg.Length);
            BranchInfo bi       = new BranchInfo(startLoc, target);

            int index = MyBranchInfos.IndexOf(bi);

            if (index > -1 && index < MyBranchInfos.Count)
            {
                bi = MyBranchInfos[index];
            }

            return(bi.IsLongBranch);
        }
Esempio n. 5
0
        /// <summary>
        /// Determine if a branch from a point to a label will be long
        /// </summary>
        /// <param name="ilg"></param>
        /// <returns></returns>
        /// <remarks></remarks>
        public bool IsLongBranch(FleeILGenerator ilg)
        {
            ILLocation startLoc = new ILLocation(ilg.Length);

            foreach (var bi in MyBranchInfos)
            {
                if (bi.Equals(startLoc))
                {
                    return(bi.IsLongBranch);
                }
            }

            // we don't really know since this branch didn't exist.
            // we could throw an exceptio but
            // do a long branch to be safe.
            return(true);
        }
Esempio n. 6
0
        /// <summary>
        /// Determine if a branch from a point to a label will be long
        /// </summary>
        /// <param name="ilg"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        /// <remarks></remarks>
        public bool IsLongBranch(FleeILGenerator ilg, Label target)
        {
            //return true;
            ILLocation startLoc = new ILLocation(ilg.Length);
            BranchInfo bi       = new BranchInfo(startLoc, target);

            int index = MyBranchInfos.IndexOf(bi);

            if (index > -1 && index < MyBranchInfos.Count)
            {
                bi = MyBranchInfos[index];
                return(bi.IsLongBranch);
            }
            else
            {
                return(true);                // temp fix: not sure why, but MyBranchInfos seems to be missing elements when executing long scripts
            }
        }
Esempio n. 7
0
 public BranchInfo(ILLocation startLocation, Label endLabel)
 {
     _myStart = startLocation;
     _myLabel = endLabel;
     _myEnd   = new ILLocation();
 }
Esempio n. 8
0
 /// <summary>
 /// We only need to compare the start point. Can only have a single
 /// brach from the exact address, so if label doesn't match we have
 /// bigger problems.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool Equals(ILLocation start)
 {
     return(_myStart.Equals1(start));
 }