/// <summary> /// This consutructor is for instantiating a Runtime mirror object where we already have the mirrorData /// </summary> /// <param name="mirrorData"></param> /// <param name="core"></param> public RuntimeMirror(MirrorData mirrorData, ProtoCore.Core core, ProtoCore.Core staticCore = null) : base(core, staticCore) { Validity.Assert(this.core != null); TargetExecutive = core.CurrentExecutive.CurrentDSASMExec; deprecateThisMirror = new DSASM.Mirror.ExecutionMirror(TargetExecutive, core); this.mirrorData = mirrorData; }
/// <summary> /// This consutructor is for instantiating a Runtime mirror object where we already have the mirrorData /// </summary> /// <param name="mirrorData"></param> /// <param name="core"></param> public RuntimeMirror(MirrorData mirrorData, ProtoCore.RuntimeCore runtimeCoreReflect, ProtoCore.Core staticCore = null) : base(runtimeCoreReflect, staticCore) { Validity.Assert(this.runtimeCore != null); TargetExecutive = runtimeCoreReflect.CurrentExecutive.CurrentDSASMExec; deprecateThisMirror = new DSASM.Mirror.ExecutionMirror(TargetExecutive, runtimeCoreReflect); this.mirrorData = mirrorData; }
public RuntimeMirror(string varname, int blockDecl, ProtoCore.Core core) : base(core) { TargetExecutive = core.CurrentExecutive.CurrentDSASMExec; deprecateThisMirror = new DSASM.Mirror.ExecutionMirror(TargetExecutive, core); Validity.Assert(this.core != null); variableName = varname; blockDeclaration = blockDecl; StackValue svData = deprecateThisMirror.GetValue(variableName, blockDeclaration).DsasmValue; mirrorData = new MirrorData(this.core, svData); }
public RuntimeMirror(string varname, int blockDecl, ProtoCore.RuntimeCore runtimeCore, ProtoCore.Core staticCore = null) : base(runtimeCore, staticCore) { TargetExecutive = runtimeCore.CurrentExecutive.CurrentDSASMExec; deprecateThisMirror = new DSASM.Mirror.ExecutionMirror(TargetExecutive, runtimeCore); Validity.Assert(this.runtimeCore != null); variableName = varname; blockDeclaration = blockDecl; StackValue svData = deprecateThisMirror.GetValue(variableName); mirrorData = new MirrorData(staticCore, this.runtimeCore, svData); }
public RuntimeMirror(string varname, int blockDecl, ProtoCore.RuntimeCore runtimeCore, ProtoCore.Core staticCore = null) : base(runtimeCore, staticCore) { TargetExecutive = runtimeCore.CurrentExecutive.CurrentDSASMExec; deprecateThisMirror = new DSASM.Mirror.ExecutionMirror(TargetExecutive, runtimeCore); Validity.Assert(this.runtimeCore != null); variableName = varname; blockDeclaration = blockDecl; StackValue svData = deprecateThisMirror.GetGlobalValue(variableName); mirrorData = new MirrorData(staticCore, this.runtimeCore, svData); }
public void SetUpBounce(DSASM.Executive exec, int exeblock, int returnAddr) { DebugFrame debugFrame = new DebugFrame(); // TODO: Replace FepRun with StackFrameTypeinfo from Core.Rmem.Stack - pratapa debugFrame.FepRun = 0; debugFrame.IsResume = false; if (exec != null) { debugFrame.ExecutingGraphNode = exec.Properties.executingGraphNode; } else { debugFrame.ExecutingGraphNode = null; } DebugStackFrame.Push(debugFrame); }
/// <summary> /// Mark and sweep garbage collection. /// </summary> /// <param name="gcRootPointers"></param> /// <param name="exe"></param> public void GC(List <StackValue> gcRootPointers, DSASM.Executive exe) { Heap.GCMarkAndSweep(gcRootPointers.ToList(), exe); }
public void SetUpCallrForDebug(RuntimeCore runtimeCore, DSASM.Executive exec, ProcedureNode fNode, int pc, bool isBaseCall = false, CallSite callsite = null, List <StackValue> arguments = null, List <List <ReplicationGuide> > replicationGuides = null, StackFrame stackFrame = null, List <StackValue> dotCallDimensions = null, bool hasDebugInfo = false, bool isMember = false, StackValue?thisPtr = null) { //ProtoCore.DSASM.Executive exec = core.CurrentExecutive.CurrentDSASMExec; DebugFrame debugFrame = new DebugFrame(); debugFrame.IsBaseCall = isBaseCall; debugFrame.Arguments = arguments; debugFrame.IsMemberFunction = isMember; debugFrame.ThisPtr = thisPtr; debugFrame.HasDebugInfo = hasDebugInfo; if (CoreUtils.IsDisposeMethod(fNode.Name)) { debugFrame.IsDisposeCall = true; ReturnPCFromDispose = DebugEntryPC; } if (RunMode == Runmode.StepNext) { debugFrame.FunctionStepOver = true; } bool isReplicating = false; bool isExternalFunction = false; // callsite is set to null for a base class constructor call in CALL if (callsite == null) { isReplicating = false; isExternalFunction = false; SetUpCallr(ref debugFrame, isReplicating, isExternalFunction, exec); DebugStackFrame.Push(debugFrame); return; } // Comment Jun: A dot call does not replicate and must be handled immediately if (fNode.Name == Constants.kDotMethodName) { isReplicating = false; isExternalFunction = false; debugFrame.IsDotCall = true; debugFrame.DotCallDimensions = dotCallDimensions; SetUpCallr(ref debugFrame, isReplicating, isExternalFunction, exec); DebugStackFrame.Push(debugFrame); return; } List <List <ReplicationInstruction> > replicationTrials; bool willReplicate = callsite.WillCallReplicate(new Context(), arguments, replicationGuides, stackFrame, runtimeCore, out replicationTrials); // the inline conditional built-in is handled separately as 'WillCallReplicate' is always true in this case if (fNode.Name.Equals(Constants.kInlineConditionalMethodName)) { // The inline conditional built-in is created only for associative blocks and needs to be handled separately as below InstructionStream istream = runtimeCore.DSExecutable.instrStreamList[CurrentBlockId]; Validity.Assert(istream.language == Language.Associative); { runtimeCore.DebugProps.InlineConditionOptions.isInlineConditional = true; runtimeCore.DebugProps.InlineConditionOptions.startPc = pc; runtimeCore.DebugProps.InlineConditionOptions.endPc = FindEndPCForAssocGraphNode(pc, istream, fNode, exec.Properties.executingGraphNode, runtimeCore.Options.ExecuteSSA); runtimeCore.DebugProps.InlineConditionOptions.instructionStream = runtimeCore.RunningBlock; debugFrame.IsInlineConditional = true; } // no replication case if (willReplicate && replicationTrials.Count == 1) { runtimeCore.DebugProps.InlineConditionOptions.ActiveBreakPoints.AddRange(runtimeCore.Breakpoints); isReplicating = false; isExternalFunction = false; } else // an inline conditional call that replicates { // Clear all breakpoints for outermost replicated call if (!DebugStackFrameContains(StackFrameFlagOptions.IsReplicating)) { ActiveBreakPoints.AddRange(runtimeCore.Breakpoints); runtimeCore.Breakpoints.Clear(); } isExternalFunction = false; isReplicating = true; } SetUpCallr(ref debugFrame, isReplicating, isExternalFunction, exec, 0); DebugStackFrame.Push(debugFrame); return; } // Prevent breaking inside a function that is external except for dot calls // by clearing all breakpoints from outermost external function call // This check takes precedence over the replication check else if (fNode.IsExternal && fNode.Name != Constants.kDotMethodName) { // Clear all breakpoints if (!DebugStackFrameContains(StackFrameFlagOptions.IsExternalFunction) && fNode.Name != Constants.kFunctionRangeExpression) { ActiveBreakPoints.AddRange(runtimeCore.Breakpoints); runtimeCore.Breakpoints.Clear(); } isExternalFunction = true; isReplicating = false; } // Find if function call will replicate or not and if so // prevent stepping in by removing all breakpoints from outermost replicated call else if (willReplicate) { // Clear all breakpoints for outermost replicated call if (!DebugStackFrameContains(StackFrameFlagOptions.IsReplicating)) { ActiveBreakPoints.AddRange(runtimeCore.Breakpoints); runtimeCore.Breakpoints.Clear(); } isReplicating = true; isExternalFunction = false; } // For all other function calls else { isReplicating = false; isExternalFunction = false; } SetUpCallr(ref debugFrame, isReplicating, isExternalFunction, exec); DebugStackFrame.Push(debugFrame); }
private void SetUpCallr(ref DebugFrame debugFrame, bool isReplicating, bool isExternalFunc, DSASM.Executive exec, int fepRun = 1) { // There is no corresponding RETURN instruction for external functions such as FFI's and dot calls //if (procNode.name != DSDefinitions.Kw.kw_Dispose) { debugFrame.IsExternalFunction = isExternalFunc; debugFrame.IsReplicating = isReplicating; // TODO: Replace FepRun with StackFrameTypeinfo from Core.Rmem.Stack - pratapa debugFrame.FepRun = fepRun; debugFrame.IsResume = false; debugFrame.ExecutingGraphNode = exec.Properties.executingGraphNode; } }