Beispiel #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);
            }
        }
 private void EnsureTarget(bool register)
 {
     if (_target == null)
     {
         _target = CompileBody((LightExpression <LookupCompilationDelegate>)Ast.GetLambda());
         EnsureFunctionCode(_target, false, register);
     }
 }
        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();
            }
        }
 public OnDiskScriptCode(LookupCompilationDelegate code, SourceUnit sourceUnit, string moduleName) :
     base(MakeAstFromSourceUnit(sourceUnit))
 {
     _target     = code;
     _moduleName = moduleName;
 }
 private void EnsureTarget(bool register) {
     if (_target == null) {
         _target = CompileBody((LightExpression<LookupCompilationDelegate>)Ast.GetLambda());
         EnsureFunctionCode(_target, false, register);
     }
 }
 public OnDiskScriptCode(LookupCompilationDelegate code, SourceUnit sourceUnit, string moduleName)
     : base(MakeAstFromSourceUnit(sourceUnit))
 {
     _target = code;
     _moduleName = moduleName;
 }