示例#1
0
        public RuntimeCore(Heap heap)
        {
            // The heap is initialized by the core and is used to allocate strings
            // Use the that heap for runtime
            Validity.Assert(heap != null);
            this.Heap = heap;
            RuntimeMemory = new RuntimeMemory(Heap);

            InterpreterProps = new Stack<InterpreterProperties>();
            ReplicationGuides = new List<List<ReplicationGuide>>();

            RunningBlock = 0;
            ExecutionState = (int)ExecutionStateEventArgs.State.kInvalid; //not yet started
            FFIPropertyChangedMonitor = new FFIPropertyChangedMonitor(this);

            ContinuationStruct = new ContinuationStructure();


            watchStack = new List<StackValue>();
            watchFramePointer = Constants.kInvalidIndex;
            WatchSymbolList = new List<SymbolNode>();

            FunctionCallDepth = 0;
            cancellationPending = false;

            watchClassScope = Constants.kInvalidIndex;

            ExecutionInstance = CurrentExecutive = new Executive(this);
            ExecutiveProvider = new ExecutiveProvider();

            RuntimeStatus = new ProtoCore.RuntimeStatus(this);
            StartPC = Constants.kInvalidPC;
            RuntimeData = new ProtoCore.RuntimeData();
        }
示例#2
0
文件: Core.cs 项目: algobasket/Dynamo
        private void ResetAll(Options options)
        {
            ProtoCore.Utils.Validity.AssertExpiry();
            Options = options;
            Executives = new Dictionary<ProtoCore.Language, ProtoCore.Executive>();
            FunctionTable = new Lang.FunctionTable();
            ClassIndex = ProtoCore.DSASM.Constants.kInvalidIndex;

            Heap = new DSASM.Heap();
            Rmem = new ProtoCore.Runtime.RuntimeMemory(Heap);

            watchClassScope = ProtoCore.DSASM.Constants.kInvalidIndex;
            watchFunctionScope = ProtoCore.DSASM.Constants.kInvalidIndex;
            watchBaseOffset = 0;
            watchStack = new List<StackValue>();
            watchSymbolList = new List<SymbolNode>();
            watchFramePointer = ProtoCore.DSASM.Constants.kInvalidIndex;

            ID = FIRST_CORE_ID;

            //recurtion
            recursivePoint = new List<FunctionCounter>();
            funcCounterTable = new List<FunctionCounter>();
            calledInFunction = false;

            GlobOffset = 0;
            GlobHeapOffset = 0;
            BaseOffset = 0;
            GraphNodeUID = 0;
            RunningBlock = 0;
            CodeBlockIndex = 0;
            RuntimeTableIndex = 0;
            CodeBlockList = new List<DSASM.CodeBlock>();
            CompleteCodeBlockList = new List<DSASM.CodeBlock>();
            DSExecutable = new ProtoCore.DSASM.Executable();

            AssocNode = null;

            // TODO Jun/Luke type system refactoring
            // Initialize the globalClass table and type system
            ClassTable = new DSASM.ClassTable();
            TypeSystem = new TypeSystem();
            TypeSystem.SetClassTable(ClassTable);
            ProcNode = null;
            ProcTable = new DSASM.ProcedureTable(ProtoCore.DSASM.Constants.kGlobalScope);

            //Initialize the function pointer table
            FunctionPointerTable = new DSASM.FunctionPointerTable();

            //Initialize the dynamic string table and dynamic function table
            DynamicVariableTable = new DSASM.DynamicVariableTable();
            DynamicFunctionTable = new DSASM.DynamicFunctionTable();
            replicationGuides = new List<List<ProtoCore.ReplicationGuide>>();

            ExceptionHandlingManager = new ExceptionHandlingManager();
            startPC = ProtoCore.DSASM.Constants.kInvalidIndex;

            deltaCompileStartPC = ProtoCore.DSASM.Constants.kInvalidIndex;

            if (options.SuppressBuildOutput)
            {
                //  don't log any of the build related messages
                //  just accumulate them in relevant containers with
                //  BuildStatus object
                //
                BuildStatus = new BuildStatus(this, false, false, false);
            }
            else
            {
                BuildStatus = new BuildStatus(this, Options.BuildOptWarningAsError, null, Options.BuildOptErrorAsWarning);
            }
            RuntimeStatus = new RuntimeStatus(this);

            SSASubscript = 0;
            SSASubscript_GUID = System.Guid.NewGuid();
            ExpressionUID = 0;
            ModifierBlockUID = 0;
            ModifierStateSubscript = 0;

            ExprInterpreterExe = null;
            ExecMode = ProtoCore.DSASM.InterpreterMode.kNormal;

            assocCodegen = null;
            FunctionCallDepth = 0;

            // Default execution log is Console.Out.
            this.ExecutionLog = Console.Out;
            ExecutionState = (int)ExecutionStateEventArgs.State.kInvalid; //not yet started

            DebugProps = new DebugProperties();
            //stackNodeExecutedSameTimes = new Stack<List<AssociativeGraph.GraphNode>>();
            //stackExecutingGraphNodes = new Stack<AssociativeGraph.GraphNode>();
            InterpreterProps = new Stack<InterpreterProperties>();
            stackActiveExceptionRegistration = new Stack<ExceptionRegistration>();

            ExecutiveProvider = new ExecutiveProvider();

            Configurations = new Dictionary<string, object>();

            ContinuationStruct = new Lang.ContinuationStructure();
            ParsingMode = ProtoCore.ParseMode.Normal;
            
            IsParsingPreloadedAssembly = false;
            IsParsingCodeBlockNode = false;
            ImportHandler = null;

            deltaCompileStartPC = 0;
            builtInsLoaded = false;
            FFIPropertyChangedMonitor = new FFIPropertyChangedMonitor(this);

            csExecutionState = null;
            EnableCallsiteExecutionState = false;

            // TODO: Remove check once fully implemeted
            if (EnableCallsiteExecutionState)
            {
                csExecutionState = CallsiteExecutionState.LoadState();
            }
            else
            {
                csExecutionState = new CallsiteExecutionState();
            }
            CallsiteCache = new Dictionary<int, CallSite>();
            CachedSSANodes = new List<AssociativeNode>();
            CallSiteToNodeMap = new Dictionary<Guid, Guid>();
            ASTToCallSiteMap = new Dictionary<int, CallSite>();

            ForLoopBlockIndex = ProtoCore.DSASM.Constants.kInvalidIndex;

            GraphNodeCallList = new List<GraphNode>();

            newEntryPoint = ProtoCore.DSASM.Constants.kInvalidIndex;
        }
示例#3
0
        private void ResetAll(Options options)
        {
            ProtoCore.Utils.Validity.AssertExpiry();
            Options = options;
            Executives = new Dictionary<ProtoCore.Language, ProtoCore.Executive>();
            FunctionTable = new Lang.FunctionTable();
            ClassIndex = ProtoCore.DSASM.Constants.kInvalidIndex;

            Heap = new DSASM.Heap();
            Rmem = new ProtoCore.Runtime.RuntimeMemory(Heap);

            watchClassScope = ProtoCore.DSASM.Constants.kInvalidIndex;
            watchFunctionScope = ProtoCore.DSASM.Constants.kInvalidIndex;
            watchBaseOffset = 0;
            watchStack = new List<StackValue>();
            watchSymbolList = new List<SymbolNode>();
            watchFramePointer = ProtoCore.DSASM.Constants.kInvalidIndex;

            ID = FIRST_CORE_ID;

            //recurtion
            recursivePoint = new List<FunctionCounter>();
            funcCounterTable = new List<FunctionCounter>();
            calledInFunction = false;

            GlobOffset = 0;
            GlobHeapOffset = 0;
            BaseOffset = 0;
            GraphNodeUID = 0;
            RunningBlock = 0;
            CodeBlockIndex = 0;
            RuntimeTableIndex = 0;
            CodeBlockList = new List<DSASM.CodeBlock>();
            CompleteCodeBlockList = new List<DSASM.CodeBlock>();
            DSExecutable = new ProtoCore.DSASM.Executable();

            AssocNode = null;

            // TODO Jun/Luke type system refactoring
            // Initialize the globalClass table and type system
            ClassTable = new DSASM.ClassTable();
            TypeSystem = new TypeSystem();
            TypeSystem.SetClassTable(ClassTable);
            ProcNode = null;
            ProcTable = new DSASM.ProcedureTable(ProtoCore.DSASM.Constants.kGlobalScope);

            //Initialize the function pointer table
            FunctionPointerTable = new DSASM.FunctionPointerTable();

            //Initialize the dynamic string table and dynamic function table
            DynamicVariableTable = new DSASM.DynamicVariableTable();
            DynamicFunctionTable = new DSASM.DynamicFunctionTable();
            replicationGuides = new List<List<int>>();

            ExceptionHandlingManager = new ExceptionHandlingManager();
            startPC = ProtoCore.DSASM.Constants.kInvalidIndex;

            deltaCompileStartPC = ProtoCore.DSASM.Constants.kInvalidIndex;

            RuntimeStatus = new RuntimeStatus(this);

            SSASubscript = 0;
            ExpressionUID = 0;
            ModifierBlockUID = 0;
            ModifierStateSubscript = 0;

            ExprInterpreterExe = null;
            ExecMode = ProtoCore.DSASM.InterpreterMode.kNormal;

            assocCodegen = null;
            FunctionCallDepth = 0;

            // Default execution log is Console.Out.
            this.ExecutionLog = Console.Out;
            ExecutionState = (int)ExecutionStateEventArgs.State.kInvalid; //not yet started

            DebugProps = new DebugProperties();
            //stackNodeExecutedSameTimes = new Stack<List<AssociativeGraph.GraphNode>>();
            //stackExecutingGraphNodes = new Stack<AssociativeGraph.GraphNode>();
            InterpreterProps = new Stack<InterpreterProperties>();
            stackActiveExceptionRegistration = new Stack<ExceptionRegistration>();

            ExecutiveProvider = new ExecutiveProvider();

            Configurations = new Dictionary<string, object>();

            ContinuationStruct = new Lang.ContinuationStructure();
            ParsingMode = ProtoCore.ParseMode.Normal;

            IsParsingPreloadedAssembly = false;
            IsParsingCodeBlockNode = false;
            ImportHandler = null;

            deltaCompileStartPC = 0;
            builtInsLoaded = false;
            FFIPropertyChangedMonitor = new FFIPropertyChangedMonitor(this);
        }