internal static Loop Loop(LoopExpression expression) { return new Loop() { Body = Serialize(expression.Body), BreakLabel = expression.BreakLabel.Null(l => LabelTarget.Serialize(l)), ContinueLabel = expression.ContinueLabel.Null(l => LabelTarget.Serialize(l)), }.Apply(n => n.Type = TypeRef.Serialize(expression.Type)); }
protected override Expression VisitLoop(LoopExpression node) { if (node.BreakLabel != null) { Labels.Add(node.BreakLabel); } if (node.ContinueLabel != null) { Labels.Add(node.ContinueLabel); } return base.VisitLoop(node); }
protected override Expression VisitLoop(LoopExpression node) { PushLabelInfo(node); var body = Visit(node.Body); var @break = default(LabelTarget); var @continue = default(LabelTarget); PopLabelInfo(out @break, out @continue); return node.Update(@break, @continue, body); }
protected override Expression VisitLoop(LoopExpression node) { throw new NotSupportedException(); }
private void Compile(object frameObj) { if (Compiled) { return; } lock (this) { if (Compiled) { return; } PerfTrack.NoteEvent(PerfTrack.Categories.Compiler, "Interpreted loop compiled"); InterpretedFrame frame = (InterpretedFrame)frameObj; var compiler = new LoopCompiler(_loop, frame.Interpreter.LabelMapping, _variables, _closureVariables, _instructionIndex, _loopEnd); var instructions = frame.Interpreter.Instructions.Instructions; // replace this instruction with an optimized one: Interlocked.Exchange(ref instructions[_instructionIndex], new CompiledLoopInstruction(compiler.CreateDelegate())); // invalidate this instruction, some threads may still hold on it: _loop = null; _variables = null; _closureVariables = null; } }
internal EnterLoopInstruction(LoopExpression loop, LocalVariables locals, int compilationThreshold, int instructionIndex) { _loop = loop; _variables = locals.CopyLocals(); _closureVariables = locals.ClosureVariables; _compilationThreshold = compilationThreshold; _instructionIndex = instructionIndex; }
public LoopExpressionProxy(LoopExpression node) { _node = node; }
/// <summary> /// Visits the children of the <see cref="LoopExpression"/>. /// </summary> /// <param name="node">The expression to visit.</param> /// <returns>The modified expression, if it or any subexpression was modified; /// otherwise, returns the original expression.</returns> protected internal virtual Expression VisitLoop(LoopExpression node) { return(node.Update(VisitLabelTarget(node.BreakLabel), VisitLabelTarget(node.ContinueLabel), Visit(node.Body))); }
public virtual bool IsEvaluatableLoop (LoopExpression node) { ArgumentUtility.CheckNotNull ("node", node); return true; }
}//end static method internal XElement LoopExpressionToXElement(LoopExpression e) { object value; string xName = "LoopExpression"; object[] XElementValues = new object[6]; value = ((LoopExpression)e).Type; XElementValues[0] = GenerateXmlFromProperty(typeof(System.Type), "Type", value ?? string.Empty); value = ((LoopExpression)e).NodeType; XElementValues[1] = GenerateXmlFromProperty(typeof(System.Linq.Expressions.ExpressionType), "NodeType", value ?? string.Empty); value = ((LoopExpression)e).Body; XElementValues[2] = GenerateXmlFromProperty(typeof(System.Linq.Expressions.Expression), "Body", value ?? string.Empty); value = ((LoopExpression)e).BreakLabel; XElementValues[3] = GenerateXmlFromProperty(typeof(System.Linq.Expressions.LabelTarget), "BreakLabel", value ?? string.Empty); value = ((LoopExpression)e).ContinueLabel; XElementValues[4] = GenerateXmlFromProperty(typeof(System.Linq.Expressions.LabelTarget), "ContinueLabel", value ?? string.Empty); value = ((LoopExpression)e).CanReduce; XElementValues[5] = GenerateXmlFromProperty(typeof(System.Boolean), "CanReduce", value ?? string.Empty); return new XElement(xName, XElementValues); }//end static method
public LoopExpressionProxy(LoopExpression node) { ContractUtils.RequiresNotNull(node, nameof(node)); _node = node; }
public LoopVisitor(LoopExpression node) : base(node) { this.node = node; }
protected internal override Expression VisitLoop(LoopExpression node) { Out("loop { ... }"); return(node); }
private Variable VisitLoop(LoopExpression node) { throw new NotSupportedException("Expression of type " + node.NodeType + " is not supported"); //this.Out("loop { ... }"); }
private void PushLabelInfo(LoopExpression loop) { _loopLabels.Push(new LoopLabelInfo { Break = loop.BreakLabel, Continue = loop.ContinueLabel }); }
internal EnterLoopInstruction(LoopExpression loop, int compilationThreshold, int instructionIndex) { _loop = loop; _compilationThreshold = compilationThreshold; _instructionIndex = instructionIndex; }
private static string VisitLoop(LoopExpression node) { throw new NotImplementedException(); }