A simple forth-style stack machine for executing Expression trees without the need to compile to IL and then invoke the JIT. This trades off much faster compilation time for a slower execution performance. For code that is only run a small number of times this can be a sweet spot. The core loop in the interpreter is the Run(InterpretedFrame) method.
Пример #1
0
        internal LightDelegateCreator(Interpreter interpreter, LambdaExpression lambda)
        {
            Debug.Assert(interpreter != null);
            Debug.Assert(lambda != null);

            Interpreter = interpreter;
            _lambda = lambda;
        }
Пример #2
0
        internal InterpretedFrame(Interpreter interpreter, IStrongBox[] closure)
        {
            Interpreter = interpreter;
            StackIndex = interpreter.LocalCount;
            Data = new object[StackIndex + interpreter.Instructions.MaxStackDepth];

            int c = interpreter.Instructions.MaxContinuationDepth;
            if (c > 0)
            {
                _continuations = new int[c];
            }

            Closure = closure;

            _pendingContinuation = -1;
            _pendingValue = Interpreter.NoValue;
        }
Пример #3
0
 internal LightDelegateCreator(Interpreter interpreter, LambdaExpression lambda)
 {
     Assert.NotNull(lambda);
     _interpreter = interpreter;
     _lambda = lambda;
 }
Пример #4
0
 internal LightLambda(LightDelegateCreator delegateCreator, IStrongBox[] closure)
 {
     _delegateCreator = delegateCreator;
     _closure         = closure;
     _interpreter     = delegateCreator.Interpreter;
 }