コード例 #1
0
        /// <summary>
        /// Creates the LambdaExpression which is the actual function body.
        /// </summary>
        private LightLambdaExpression EnsureFunctionLambda()
        {
            if (_dlrBody == null)
            {
                PerfTrack.NoteEvent(PerfTrack.Categories.Compiler, "Creating FunctionBody");
                _dlrBody = CreateFunctionLambda();
            }

            return _dlrBody;
        }
コード例 #2
0
ファイル: GeneratorRewriter.cs プロジェクト: SueDou/python
 public PythonGeneratorExpression(LightLambdaExpression lambda, int compilationThreshold)
 {
     _lambda = lambda;
     _compilationThreshold = compilationThreshold;
 }
コード例 #3
0
        internal override void RewriteBody(TotemAst.LookupVisitor visitor)
        {
            _dlrBody = null;    // clear the cached body if we've been reduced

            MSAst.Expression funcCode = GlobalParent.Constant(GetOrMakeFunctionCode());
            FuncCodeExpr = funcCode;

            Body = new TotemAst.RewrittenBodyStatement(Body, visitor.Visit(Body));
        }
コード例 #4
0
 internal LightDelegateCreator(Interpreter interpreter, LightLambdaExpression lambda)
 {
     Assert.NotNull(lambda);
     _interpreter = interpreter;
     _lambda      = lambda;
 }
コード例 #5
0
ファイル: FunctionCode.cs プロジェクト: shaias/ironlangs
        private Delegate CompileLambda(LightLambdaExpression code, EventHandler<LightLambdaCompileEventArgs> handler) {
#if EMIT_PDB
            if (_lambda.EmitDebugSymbols) {
                return CompilerHelpers.CompileToMethod((LambdaExpression)code.Reduce(), DebugInfoGenerator.CreatePdbGenerator(), true);
            }
#endif    
            if (_lambda.ShouldInterpret) {
                Delegate result = code.Compile(_lambda.GlobalParent.PyContext.Options.CompilationThreshold);

                // If the adaptive compiler decides to compile this function, we
                // want to store the new compiled target. This saves us from going
                // through the interpreter stub every call.
                var lightLambda = result.Target as LightLambda;
                if (lightLambda != null) {
                    lightLambda.Compile += handler;
                }

                return result;
            }

            return code.Compile();
        }
コード例 #6
0
 public TotemGeneratorExpression(LightLambdaExpression lambda, bool async, int compilationThreshold)
 {
     _lambda = lambda;
     _compilationThreshold = compilationThreshold;
     _async = async;
 }
コード例 #7
0
 internal LightDelegateCreator(Interpreter interpreter, LightLambdaExpression lambda)
 {
     Assert.NotNull(lambda);
     _interpreter = interpreter;
     _lambda = lambda;
 }
コード例 #8
0
ファイル: ClassDefinition.cs プロジェクト: TerabyteX/main
 internal override void RewriteBody(PythonAst.LookupVisitor visitor)
 {
     _dlrBody = null;
     _body = new PythonAst.RewrittenBodyStatement(Body, visitor.Visit(Body));
 }
コード例 #9
0
ファイル: ClassDefinition.cs プロジェクト: TerabyteX/main
        internal override LightLambdaExpression GetLambda()
        {
            if (_dlrBody == null) {
                PerfTrack.NoteEvent(PerfTrack.Categories.Compiler, "Creating FunctionBody");
                _dlrBody = MakeClassBody();
            }

            return _dlrBody;
        }
コード例 #10
0
ファイル: FunctionCode.cs プロジェクト: Alxandr/IronTotem-3.0
        private Delegate CompileLambda(LightLambdaExpression code, EventHandler<LightLambdaCompileEventArgs> handler)
        {
            if (_lambda.ShouldInterpret)
            {
                Delegate result = code.Compile(_lambda.GlobalParent.TotemContext.Options.CompilationThreshold);

                // If the adaptive compiler decides to compile this function, we
                // want to store the new compiled target. This saves us from going
                // through the interpreter stub every call.
                var lightLambda = result.Target as LightLambda;
                if (lightLambda != null)
                {
                    lightLambda.Compile += handler;
                }

                return result;
            }

            return code.Compile();
        }