Пример #1
0
        internal void Mark(InstructionList instructions) {
            ContractUtils.Requires(_targetIndex == UnknownIndex && _stackDepth == UnknownDepth && _continuationStackDepth == UnknownDepth);

            _stackDepth = instructions.CurrentStackDepth;
            _continuationStackDepth = instructions.CurrentContinuationsDepth;
            _targetIndex = instructions.Count;

            if (_forwardBranchFixups != null) {
                foreach (var branchIndex in _forwardBranchFixups) {
                    FixupBranch(instructions, branchIndex);
                }
                _forwardBranchFixups = null;
            }
        }
Пример #2
0
        internal void Mark(InstructionList instructions) {
            // TODO: We need to support shadowed labels:
            // Block( goto label; label: ), Block(goto label; label:)
            ContractUtils.Requires(_targetIndex == UnknownIndex && _stackDepth == UnknownDepth && _continuationStackDepth == UnknownDepth);

            _stackDepth = instructions.CurrentStackDepth;
            _continuationStackDepth = instructions.CurrentContinuationsDepth;
            _targetIndex = instructions.Count;

            if (_forwardBranchFixups != null) {
                foreach (var branchIndex in _forwardBranchFixups) {
                    FixupBranch(instructions, branchIndex);
                }
                _forwardBranchFixups = null;
            }
        }
Пример #3
0
 public Instruction BoxIfIndexMatches(int index)
 {
     return((index == _index) ? InstructionList.LoadLocalBoxed(index) : null);
 }
Пример #4
0
 public Instruction BoxIfIndexMatches(int index)
 {
     return((index == _index) ? InstructionList.InitImmutableRefBox(index) : null);
 }
Пример #5
0
 public DebugView(InstructionList list)
 {
     _list = list;
 }
Пример #6
0
        internal void AddBranch(InstructionList instructions, int branchIndex) {
            Debug.Assert(((_targetIndex == UnknownIndex) == (_stackDepth == UnknownDepth)));
            Debug.Assert(((_targetIndex == UnknownIndex) == (_continuationStackDepth == UnknownDepth)));

            if (_targetIndex == UnknownIndex) {
                if (_forwardBranchFixups == null) {
                    _forwardBranchFixups = new List<int>();
                }
                _forwardBranchFixups.Add(branchIndex);
            } else {
                FixupBranch(instructions, branchIndex);
            }
        }
Пример #7
0
 internal void FixupBranch(InstructionList instructions, int branchIndex) {
     Debug.Assert(_targetIndex != UnknownIndex);
     instructions.FixupBranch(branchIndex, _targetIndex - branchIndex);
 }
Пример #8
0
 public DebugView(InstructionList list) {
     _list = list;
 }
Пример #9
0
 internal void FixupBranch(InstructionList instructions, int branchIndex) {
     Debug.Assert(_targetIndex != UnknownIndex);
     instructions.FixupBranch(branchIndex, _targetIndex - branchIndex, _continuationStackDepth, _stackDepth);
 }
Пример #10
0
 internal void FixupBranch(InstructionList instructions, int branchIndex)
 {
     Debug.Assert(_targetIndex != UnknownIndex);
     instructions.FixupBranch(branchIndex, _targetIndex - branchIndex, _continuationStackDepth, _stackDepth);
 }
Пример #11
0
 internal void FixupBranch(InstructionList instructions, int branchIndex)
 {
     Debug.Assert(_targetIndex != UnknownIndex);
     instructions.FixupBranch(branchIndex, _targetIndex - branchIndex);
 }
Пример #12
0
        internal void Box(ParameterExpression variable, InstructionList instructions) {
            var scope = _variables[variable];

            LocalVariable local = scope.Variable;
            Debug.Assert(!local.IsBoxed && !local.InClosure);
            _variables[variable].Variable.IsBoxed = true;
                
            int curChild = 0;
            for (int i = scope.Start; i < scope.Stop && i < instructions.Count; i++) {
                if (scope.ChildScopes != null && scope.ChildScopes[curChild].Start == i) {
                    // skip boxing in the child scope
                    var child = scope.ChildScopes[curChild];
                    i = child.Stop;

                    curChild++;
                    continue;
                }

                instructions.SwitchToBoxed(local.Index, i);
            }
        }
Пример #13
0
 public BranchLabel(InstructionList instructions) {
     _instructions = instructions;
 }