public TotemDynamicStackFrame(CodeContext/*!*/ context, FunctionCode/*!*/ funcCode, int line)
            : base(GetMethod(context, funcCode), funcCode.Code.Name, funcCode.File, line)
        {
            Assert.NotNull(context, funcCode);

            _context = context;
            _code = funcCode;
        }
 private static MethodBase GetMethod(CodeContext context, FunctionCode funcCode)
 {
     MethodBase method;
     Debug.Assert(funcCode._normalDelegate != null || funcCode._tracingDelegate != null);
     if (!context.LanguageContext.EnableTracing || funcCode._tracingDelegate == null)
     {
         method = funcCode._normalDelegate.GetMethodInfo();
     }
     else
     {
         method = funcCode._tracingDelegate.GetMethodInfo();
     }
     return method;
 }
Example #3
0
        public TotemFunction(CodeContext/*!*/ context, FunctionCode code, TotemDictionary globals, string name, object[] defaults, object[] closure)
            : base(context.LanguageContext.GetType<Types.Function>())
        {
            Assert.NotNull(context, code);

            _context = context;
            _defaults = defaults ?? ArrayUtils.EmptyObjects;
            _code = code;
            _name = code.Name;

            Debug.Assert(_defaults.Length <= code.ArgCount);

            Closure = closure;
        }
Example #4
0
 protected void PushFrame(CodeContext context, FunctionCode code)
 {
     if (((TotemContext)SourceUnit.LanguageContext).TotemOptions.Frames)
     {
         throw new NotImplementedException();
         //TotemOps.PushFrame(context, code);
     }
 }
Example #5
0
 public TargetUpdaterForCompilation(TotemContext context, FunctionCode code)
 {
     _code = code;
     _context = context;
 }
Example #6
0
        public static object MakeFunctionDebug(CodeContext context, FunctionCode funcInfo, object modName, MutableTuple closure, object[] defaults, Delegate target)
        {
            funcInfo.SetDebugTarget(context.LanguageContext, target);

            return new TotemFunction(context, funcInfo, modName, defaults, closure);
        }
Example #7
0
 public static object MakeFunction(CodeContext context, FunctionCode funcInfo, object modName, MutableTuple closure, object[] defaults)
 {
     return new TotemFunction(context, funcInfo, modName, defaults, closure);
 }
Example #8
0
        public static void UpdateStackTrace(Exception e, CodeContext context, FunctionCode funcCode, int line)
        {
            if (line != -1)
            {
                Debug.Assert(line != SourceLocation.None.Line);

                List<DynamicStackFrame> totemFrames = e.GetFrameList();

                if (totemFrames == null)
                {
                    e.SetFrameList(totemFrames = new List<DynamicStackFrame>());
                }

                var frame = new TotemDynamicStackFrame(context, funcCode, line);
                funcCode.LightThrowCompile(context);
                totemFrames.Add(frame);
            }
        }
 protected void PushFrame(CodeContext context, FunctionCode code)
 {
     // push if full frame (not supported yet)
 }
Example #10
0
        public static object MakeFunctionDebug(CodeContext/*!*/ context, FunctionCode funcInfo, string name, string[] argNames, object[] defaults, Delegate target)
        {
            funcInfo.SetDebugTarget(context.LanguageContext, target);

            return new TotemFunction(context, funcInfo, null, name, /*argNames, */defaults, null);
        }
Example #11
0
 internal virtual void RewriteBody(TotemAst.LookupVisitor visitor)
 {
     _funcCode = null;
 }
Example #12
0
 public static object MakeFunction(CodeContext/*!*/ context, FunctionCode funcInfo, string name, string[] argNames, object[] defaults)
 {
     return new TotemFunction(context, funcInfo, null, name, /*argNames, */defaults, null);
 }
Example #13
0
 private object OptimizedEvalWrapper(FunctionCode funcCode)
 {
     try
     {
         return _optimizedTarget(funcCode);
     }
     catch (Exception e)
     {
         throw new NotImplementedException();
         //PythonOps.UpdateStackTrace(e, _optimizedContext, Code, 0);
         //throw;
     }
 }
Example #14
0
 internal override void RewriteBody(TotemAst.LookupVisitor visitor)
 {
     _funcCode = null;
 }
Example #15
0
 public TotemDebuggingPayload(FunctionCode code)
 {
     Code = code;
 }
 private object OptimizedEvalWrapper(FunctionCode funcCode)
 {
     try
     {
         return _optimizedTarget(funcCode);
     }
     catch (Exception e)
     {
         TotemOps.UpdateStackTrace(e, _optimizedContext, Code, 0);
         throw;
     }
 }