private void PopCILRef(ILIndexRef cilRef) { if (cilRef == null) return; _cilRefStack.Pop(); }
private void PopCILRef(ILIndexRef cilRef) { if (cilRef == null) { return; } _cilRefStack.Pop(); }
private void ExtractCILIndex(Expression e) { var ilIndexRef = e.QueryAttribute <ILIndexRef>(); if (ilIndexRef != null) { _curCILRef = ilIndexRef; } }
private BranchLabel CreateLabelForNextInstruction(Statement nextStmt) { var ilIndexRef = nextStmt.QueryAttribute <ILIndexRef>(); _curCILRef = ilIndexRef; BranchLabel label = CreateLabel(nextStmt); label.InstructionIndex = NextInstructionIndex; return(label); }
protected override void CopyAttributesToLastStatement(Statement stmt) { base.CopyAttributesToLastStatement(stmt); var cilRef = stmt.QueryAttribute<ILIndexRef>(); if (cilRef != null) { var top = _cilRefStack.Any() ? _cilRefStack.Peek() : null; cilRef = new ILIndexRef(cilRef.Method, cilRef.ILIndex) { Caller = top }; LastStatement.AddAttribute(cilRef); } }
protected override void CopyAttributesToLastStatement(Statement stmt) { base.CopyAttributesToLastStatement(stmt); var cilRef = stmt.QueryAttribute <ILIndexRef>(); if (cilRef != null) { var top = _cilRefStack.Any() ? _cilRefStack.Peek() : null; cilRef = new ILIndexRef(cilRef.Method, cilRef.ILIndex) { Caller = top }; LastStatement.AddAttribute(cilRef); } }
private void PushCILRef(ILIndexRef cilRef) { if (cilRef == null) return; if (!_cilRefStack.Any()) { _cilRefStack.Push(cilRef); } else { ILIndexRef top = new ILIndexRef(cilRef.Method, cilRef.ILIndex) { Caller = _cilRefStack.Peek() }; _cilRefStack.Push(top); } }
public override bool Rewrite(CodeDescriptor decompilee, MethodBase callee, StackElement[] args, IDecompiler stack, IFunctionBuilder builder) { var elemProf = args[0]; if (elemProf.Variability != EVariability.Constant) { throw new NotSupportedException("Profiler must be derivable as constant value"); } var prof = (ScheduleProfiler)elemProf.Sample; var ilRef = new ILIndexRef(decompilee.Method, stack.CurrentILIndex); if (_isBegin) { if (prof.FirstILIndex != null) { throw new InvalidOperationException("Profiling of " + prof.Name + " already has start position at " + prof.FirstILIndex); } prof.FirstILIndex = ilRef; } else { if (prof.LastILIndex != null) { throw new InvalidOperationException("Profiling of " + prof.Name + " already has end position at " + prof.LastILIndex); } prof.LastILIndex = ilRef; } var constraints = builder.ResultFunction.QueryAttribute <SchedulingConstraints>(); if (constraints == null) { constraints = new SchedulingConstraints(); builder.ResultFunction.AddAttribute(constraints); } if (!constraints.Profilers.Contains(prof)) { constraints.Profilers.Add(prof); } return(true); }
private void PushCILRef(ILIndexRef cilRef) { if (cilRef == null) { return; } if (!_cilRefStack.Any()) { _cilRefStack.Push(cilRef); } else { ILIndexRef top = new ILIndexRef(cilRef.Method, cilRef.ILIndex) { Caller = _cilRefStack.Peek() }; _cilRefStack.Push(top); } }
public override bool Rewrite(CodeDescriptor decompilee, MethodBase callee, StackElement[] args, IDecompiler stack, IFunctionBuilder builder) { var elemProf = args[0]; if (elemProf.Variability != EVariability.Constant) throw new NotSupportedException("Profiler must be derivable as constant value"); var prof = (ScheduleProfiler)elemProf.Sample; var ilRef = new ILIndexRef(decompilee.Method, stack.CurrentILIndex); if (_isBegin) { if (prof.FirstILIndex != null) throw new InvalidOperationException("Profiling of " + prof.Name + " already has start position at " + prof.FirstILIndex); prof.FirstILIndex = ilRef; } else { if (prof.LastILIndex != null) throw new InvalidOperationException("Profiling of " + prof.Name + " already has end position at " + prof.LastILIndex); prof.LastILIndex = ilRef; } var constraints = builder.ResultFunction.QueryAttribute<SchedulingConstraints>(); if (constraints == null) { constraints = new SchedulingConstraints(); builder.ResultFunction.AddAttribute(constraints); } if (!constraints.Profilers.Contains(prof)) constraints.Profilers.Add(prof); return true; }