コード例 #1
0
        private void EnsureTracingTarget()
        {
            if (_tracingTarget == null)
            {
                PythonContext pc = (PythonContext)Ast.CompilerContext.SourceUnit.LanguageContext;

                var debugProperties = new PythonDebuggingPayload(null);

                var debugInfo = new Microsoft.Scripting.Debugging.CompilerServices.DebugLambdaInfo(
                    null,           // IDebugCompilerSupport
                    null,           // lambda alias
                    false,          // optimize for leaf frames
                    null,           // hidden variables
                    null,           // variable aliases
                    debugProperties // custom payload
                    );

                var lambda = (Expression <LookupCompilationDelegate>)pc.DebugContext.TransformLambda((MSAst.LambdaExpression)Ast.GetLambda().Reduce(), debugInfo);

                LookupCompilationDelegate func = ShouldInterpret(pc)
                    ? lambda.LightCompile(pc.Options.CompilationThreshold)
                    : lambda.Compile(pc.EmitDebugSymbols(Ast.CompilerContext.SourceUnit));

                _tracingTarget       = func;
                debugProperties.Code = EnsureFunctionCode(_tracingTarget, true, true);
            }
        }
コード例 #2
0
 private void EnsureTarget(bool register)
 {
     if (_target == null)
     {
         _target = CompileBody((LightExpression <LookupCompilationDelegate>)Ast.GetLambda());
         EnsureFunctionCode(_target, false, register);
     }
 }
コード例 #3
0
        private object RunWorker(CodeContext ctx)
        {
            LookupCompilationDelegate target = GetTarget(true);

            Exception e = PythonOps.SaveCurrentException();

            PushFrame(ctx, _code);
            try {
                return(target(ctx, _code));
            } finally {
                PythonOps.RestoreCurrentException(e);
                PopFrame();
            }
        }
コード例 #4
0
 public OnDiskScriptCode(LookupCompilationDelegate code, SourceUnit sourceUnit, string moduleName) :
     base(MakeAstFromSourceUnit(sourceUnit))
 {
     _target     = code;
     _moduleName = moduleName;
 }
コード例 #5
0
 private void EnsureTarget(bool register) {
     if (_target == null) {
         _target = CompileBody((LightExpression<LookupCompilationDelegate>)Ast.GetLambda());
         EnsureFunctionCode(_target, false, register);
     }
 }
コード例 #6
0
 public OnDiskScriptCode(LookupCompilationDelegate code, SourceUnit sourceUnit, string moduleName)
     : base(MakeAstFromSourceUnit(sourceUnit))
 {
     _target = code;
     _moduleName = moduleName;
 }