Beispiel #1
0
        public void ResetForPrecompilation()
        {
            GraphNodeUID = 0;
            CodeBlockIndex = 0;
            RuntimeTableIndex = 0;
            
            //Initialize the dynamic string table and dynamic function table
            DynamicVariableTable = new DynamicVariableTable();
            DynamicFunctionTable = new DynamicFunctionTable();

            BuildStatus = new BuildStatus(this, Options.BuildOptWarningAsError);
            
            ExpressionUID = 0;
            ForLoopBlockIndex = Constants.kInvalidIndex;
        }
Beispiel #2
0
        private void ResetAll(Options options)
        {
            Heap = new Heap();
            //Rmem = new RuntimeMemory(Heap);
            Configurations = new Dictionary<string, object>();
            DllTypesToLoad = new List<System.Type>();

            Options = options;
            
            Compilers = new Dictionary<Language, Compiler>();
            ClassIndex = Constants.kInvalidIndex;

            FunctionTable = new FunctionTable(); 


            watchFunctionScope = Constants.kInvalidIndex;
            watchSymbolList = new List<SymbolNode>();
            watchBaseOffset = 0;


            GlobOffset = 0;
            GlobHeapOffset = 0;
            BaseOffset = 0;
            GraphNodeUID = 0;
            CodeBlockIndex = 0;
            RuntimeTableIndex = 0;
            CodeBlockList = new List<CodeBlock>();
            CompleteCodeBlockList = new List<CodeBlock>();
            CallsiteGuidMap = new Dictionary<Guid, int>();

            AssocNode = null;

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

            // Initialize internal attributes
            internalAttributes = new InternalAttributes(ClassTable);

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

            //Initialize the dynamic string table and dynamic function table
            DynamicVariableTable = new DynamicVariableTable();
            DynamicFunctionTable = new DynamicFunctionTable();

            watchStartPC = Constants.kInvalidIndex;

            deltaCompileStartPC = Constants.kInvalidIndex;

            BuildStatus = new BuildStatus(this, Options.BuildOptWarningAsError, null, Options.BuildOptErrorAsWarning);

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

            ExprInterpreterExe = null;
            Options.RunMode = InterpreterMode.Normal;

            assocCodegen = null;

            // Default execution log is Console.Out.
            ExecutionLog = Console.Out;

            DebuggerProperties = new DebugProperties();


            ParsingMode = ParseMode.Normal;
            
            IsParsingPreloadedAssembly = false;
            IsParsingCodeBlockNode = false;
            ImportHandler = null;

            deltaCompileStartPC = 0;
            builtInsLoaded = false;


            ForLoopBlockIndex = Constants.kInvalidIndex;

            GraphNodeCallList = new List<GraphNode>();
            InlineConditionalBodyGraphNodes = new Stack<List<GraphNode>>();

            newEntryPoint = Constants.kInvalidIndex;
        }
Beispiel #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<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;
        }
Beispiel #4
0
        public void ResetForPrecompilation()
        {
            GraphNodeUID = 0;
            CodeBlockIndex = 0;
            RuntimeTableIndex = 0;
            
            //Initialize the dynamic string table and dynamic function table
            DynamicVariableTable = new DynamicVariableTable();
            DynamicFunctionTable = new DynamicFunctionTable();

            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);
            }
            
            ExpressionUID = 0;
            ForLoopBlockIndex = Constants.kInvalidIndex;
        }
Beispiel #5
0
        public void ResetForPrecompilation()
        {
            GraphNodeUID = 0;
            CodeBlockIndex = 0;
            RuntimeTableIndex = 0;
            
            //Initialize the dynamic string table and dynamic function table
            DynamicVariableTable = new DSASM.DynamicVariableTable();
            DynamicFunctionTable = new DSASM.DynamicFunctionTable();

            // If the previous compilation for import resulted in a build error, 
            // ignore it and continue compiling other import statements
            /*if (BuildStatus.ErrorCount > 0)
            {
                ImportHandler = null;
                CodeBlockList.Clear();
                CompleteCodeBlockList.Clear();
            }*/

            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);
            }
            
            if (AstNodeList != null) 
                AstNodeList.Clear();

            ExpressionUID = 0;
            ForLoopBlockIndex = ProtoCore.DSASM.Constants.kInvalidIndex;
        }
Beispiel #6
0
        // Comment Jun:
        // The core is reused on delta execution
        // These are properties that need to be reset on subsequent executions
        // All properties require reset except for the runtime memory
        public void ResetForDeltaExecution()
        {
            ClassIndex = ProtoCore.DSASM.Constants.kInvalidIndex;


            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;
            //CodeBlockList = new List<DSASM.CodeBlock>();
            CompleteCodeBlockList = new List<DSASM.CodeBlock>();
            DSExecutable = new ProtoCore.DSASM.Executable();

            AssocNode = null;


            //
            //
            // Comment Jun: Delta execution should not reset the class tables as they are preserved
            //
            //      FunctionTable = new Lang.FunctionTable();
            //      ClassTable = new DSASM.ClassTable();
            //      TypeSystem = new TypeSystem();
            //      TypeSystem.SetClassTable(ClassTable);
            //      ProcNode = null;
            //      ProcTable = new DSASM.ProcedureTable(ProtoCore.DSASM.Constants.kGlobalScope);
            //
            //      CodeBlockList = new List<DSASM.CodeBlock>();
            //
            //

            //      CodeBlockIndex = 0;
            //      RuntimeTableIndex = 0;

            //

            // Comment Jun:
            // Disable SSA for the previous graphcompiler as it clashes with the way code recompilation behaves
            // SSA is enabled for the new graph strategy of delta compilation and execution
            Options.GenerateSSA = false;


            //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;

            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;
            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();
            InterpreterProps = new Stack<InterpreterProperties>();
            stackActiveExceptionRegistration = new Stack<ExceptionRegistration>();

            ExecutiveProvider = new ExecutiveProvider();
            ParsingMode = ProtoCore.ParseMode.Normal;

            // Reset PC dictionary containing PC to line/col map
            if (codeToLocation != null)
                codeToLocation.Clear();

            if (LocationErrorMap != null)
                LocationErrorMap.Clear();

            if (AstNodeList != null)
                AstNodeList.Clear();

            ResetDeltaCompile();

            DeltaCodeBlockIndex = 0;
            ForLoopBlockIndex = ProtoCore.DSASM.Constants.kInvalidIndex;
        }
Beispiel #7
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);
        }
Beispiel #8
0
        public void ResetForPrecompilation()
        {
            GraphNodeUID = 0;
            CodeBlockIndex = 0;
            RuntimeTableIndex = 0;

            //Initialize the dynamic string table and dynamic function table
            DynamicVariableTable = new DSASM.DynamicVariableTable();
            DynamicFunctionTable = new DSASM.DynamicFunctionTable();

            if (AstNodeList != null)
                AstNodeList.Clear();

            ExpressionUID = 0;
        }
Beispiel #9
0
        // Comment Jun:
        // The core is reused on delta execution
        // These are properties that need to be reset on subsequent executions
        // All properties require reset except for the runtime memory
        public void ResetForDeltaExecution()
        {
            ClassIndex = ProtoCore.DSASM.Constants.kInvalidIndex;

            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;
            //CodeBlockList = new List<DSASM.CodeBlock>();
            CompleteCodeBlockList = new List<DSASM.CodeBlock>();
            DSExecutable = new ProtoCore.DSASM.Executable();

            AssocNode = null;

            //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;

            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();
            InterpreterProps = new Stack<InterpreterProperties>();
            stackActiveExceptionRegistration = new Stack<ExceptionRegistration>();

            ExecutiveProvider = new ExecutiveProvider();
            ParsingMode = ProtoCore.ParseMode.Normal;

            // Reset PC dictionary containing PC to line/col map
            if (codeToLocation != null)
                codeToLocation.Clear();

            if (LocationErrorMap != null)
                LocationErrorMap.Clear();

            if (AstNodeList != null)
                AstNodeList.Clear();

            ResetDeltaCompile();
        }