private void AddAlwaysBranch(QueryBranch literalBranch, Opcode next) { if (OpcodeID.Branch == next.ID) { BranchOpcode opcode = (BranchOpcode)next; OpcodeList branches = opcode.Branches; for (int i = 0; i < branches.Count; i++) { Opcode opcode2 = branches[i]; if (this.IsAlwaysBranch(opcode2)) { this.AlwaysBranches.AddInOrder(new QueryBranch(opcode2, literalBranch.ID)); } else { opcode2.Flags |= OpcodeFlags.NoContextCopy; } } } else if (this.IsAlwaysBranch(next)) { this.AlwaysBranches.AddInOrder(new QueryBranch(next, literalBranch.ID)); } else { next.Flags |= OpcodeFlags.NoContextCopy; } }
internal void RemoveJump(BlockEndOpcode jumpTo) { bool flag = base.IsReachableFromConditional(); if (flag) { base.prev.DelinkFromConditional(this); } if (this.jump.ID == OpcodeID.Branch) { BranchOpcode jump = (BranchOpcode)this.jump; jumpTo.DeLinkJump(this); jump.RemoveChild(jumpTo); if (jump.Branches.Count == 0) { this.jump = null; } } else { jumpTo.DeLinkJump(this); this.jump = null; } if (flag && (this.jump != null)) { base.prev.LinkToConditional(this); } }
internal void RemoveJump(BlockEndOpcode jumpTo) { Fx.Assert(null != this.jump, ""); bool conditional = this.IsReachableFromConditional(); if (conditional) { this.prev.DelinkFromConditional(this); } if (this.jump.ID == OpcodeID.Branch) { BranchOpcode jumpBranch = (BranchOpcode)this.jump; jumpTo.DeLinkJump(this); jumpBranch.RemoveChild(jumpTo); if (0 == jumpBranch.Branches.Count) { this.jump = null; } } else { Fx.Assert(object.ReferenceEquals(jumpTo, this.jump), ""); jumpTo.DeLinkJump(this); this.jump = null; } if (conditional && null != this.jump) { this.prev.LinkToConditional(this); } }
void AddAlwaysBranch(QueryBranch literalBranch, Opcode next) { if (OpcodeID.Branch == next.ID) { BranchOpcode opcode = (BranchOpcode)next; OpcodeList branches = opcode.Branches; for (int i = 0; i < branches.Count; ++i) { Opcode branch = branches[i]; if (this.IsAlwaysBranch(branch)) { this.AlwaysBranches.AddInOrder(new QueryBranch(branch, literalBranch.ID)); } else { branch.Flags |= OpcodeFlags.NoContextCopy; } } } else { Fx.Assert(!next.TestFlag(OpcodeFlags.Branch), ""); if (this.IsAlwaysBranch(next)) { this.AlwaysBranches.AddInOrder(new QueryBranch(next, literalBranch.ID)); } else { next.Flags |= OpcodeFlags.NoContextCopy; } } }
internal virtual void AddBranch(Opcode opcode) { Fx.Assert(null != opcode, ""); // Replace what follows this opcode with a branch containing .next and the new opcode // If this opcode is a conditional, then since the tree structure is about to change, conditional // reachability for everything that follows is about to change. // 1. Remove .next from the conditional's AlwaysBranch Table. // 2. Create the new branch structure. // 3. The branch, once in the tree, will fix up all conditional jumps Opcode next = this.next; if (this.TestFlag(OpcodeFlags.InConditional)) { this.DelinkFromConditional(next); } BranchOpcode branch = new BranchOpcode(); this.next = null; this.Attach(branch); if (null != next) { Fx.Assert(OpcodeID.Branch != next.ID, ""); branch.Add(next); } branch.Add(opcode); }
internal virtual void AddBranch(Opcode opcode) { Opcode next = this.next; if (this.TestFlag(OpcodeFlags.InConditional)) { this.DelinkFromConditional(next); } BranchOpcode op = new BranchOpcode(); this.next = null; this.Attach(op); if (next != null) { op.Add(next); } op.Add(opcode); }
internal void AddJump(BlockEndOpcode jumpTo) { bool conditional = this.IsReachableFromConditional(); if (conditional) { this.prev.DelinkFromConditional(this); } if (null == this.jump) { this.jump = jumpTo; } else { BranchOpcode jumpBranch; if (this.jump.ID == OpcodeID.Branch) { // already a branch jumpBranch = (BranchOpcode)this.jump; } else { BlockEndOpcode currentJump = (BlockEndOpcode)this.jump; jumpBranch = new BranchOpcode(); jumpBranch.Branches.Add(currentJump); this.jump = jumpBranch; } jumpBranch.Branches.Add(jumpTo); } jumpTo.LinkJump(this); if (conditional && null != this.jump) { this.prev.LinkToConditional(this); } }