Example #1
0
        internal Interpreter(LambdaExpression lambda, bool[] localIsBoxed, int maxStackDepth,
            InstructionArray instructions, ExceptionHandler[] handlers, DebugInfo[] debugInfos, int compilationThreshold) {

            _lambda = lambda;
            _numberOfLocals = localIsBoxed.Length;
            if (Array.IndexOf(localIsBoxed, true) != -1) {
                _localIsBoxed = localIsBoxed;
            } else {
                _localIsBoxed = null;
            }
                
            _maxStackDepth = maxStackDepth;
            _instructions = instructions;
            _objects = instructions.Objects;
            _handlers = handlers;
            _debugInfos = debugInfos;

            _onlyFaultHandlers = true;
            foreach (var handler in handlers) {
                if (!handler.IsFinallyOrFault) {
                    _onlyFaultHandlers = false;
                    break;
                }
            }

            _compilationThreshold = compilationThreshold;
        }
Example #2
0
        internal Interpreter(LambdaExpression lambda, LocalVariables locals, Dictionary<LabelTarget, BranchLabel> labelMapping,
            InstructionArray instructions, ExceptionHandler[] handlers, DebugInfo[] debugInfos, int compilationThreshold) {

            _lambda = lambda;
            _locals = locals;
            _boxedLocals = locals.GetBoxed();
                
            _instructions = instructions;
            _objects = instructions.Objects;
            _labels = instructions.Labels;
            _labelMapping = labelMapping;

            _handlers = handlers;
            _debugInfos = debugInfos;
            _compilationThreshold = compilationThreshold;
        }
Example #3
0
        internal Interpreter(string name, LocalVariables locals, HybridReferenceDictionary<LabelTarget, BranchLabel> labelMapping,
            InstructionArray instructions, ExceptionHandler[] handlers, DebugInfo[] debugInfos, int compilationThreshold) {

            _name = name;
            _localCount = locals.LocalCount;
            _closureVariables = locals.ClosureVariables;

            _instructions = instructions;
            _objects = instructions.Objects;
            _labels = instructions.Labels;
            _labelMapping = labelMapping;

            _handlers = handlers;
            _debugInfos = debugInfos;
            _compilationThreshold = compilationThreshold;
        }
Example #4
0
        internal Interpreter(LambdaExpression lambda, bool[] localIsBoxed, int maxStackDepth, 
                           Instruction[] instructions, 
                           ExceptionHandler[] handlers, DebugInfo[] debugInfos) {
            this._lambda = lambda;
            this._numberOfLocals = localIsBoxed.Length;
            if (AnyBoxedLocals(localIsBoxed)) {
                _localIsBoxed = localIsBoxed;
            } else {
                _localIsBoxed = null;
            }
                
            this._maxStackDepth = maxStackDepth;
            this._instructions = instructions;
            this._handlers = handlers;
            this._debugInfos = debugInfos;

            _onlyFaultHandlers = true;
            foreach (var handler in handlers) {
                if (!handler.IsFault) {
                    _onlyFaultHandlers = false;
                    break;
                }
            }
        }
Example #5
0
 private void CompileDebugInfoExpression(Expression expr) {
     var node = (DebugInfoExpression)expr;
     int start = _instructions.Count;
     this.Compile(node.Expression);
     int end = _instructions.Count;
     var info = new DebugInfo()
     {
         StartIndex = start,
         EndIndex = end,
         FileName = node.Document.FileName,
         StartLine = node.StartLine,
         EndLine = node.EndLine
     };
     _debugInfos.Add(info);
 }