public void Emit(OpCode op, Sigil.Label label, out UpdateOpCodeDelegate update)
        {
            var localOp = op;

            update =
                newOpcode =>
            {
                LengthCache.Clear();

                localOp = newOpcode;
            };

            InstructionSizes.Add(() => InstructionSize.Get(localOp));

            LengthCache.Clear();

            Buffer.Add(
                (il, logOnly, log) =>
            {
                if (!logOnly)
                {
                    var l = label.LabelDel(il);
                    il.Emit(localOp, l);
                }

                log.AppendLine(localOp + " " + label);
            }
                );

            TraversableBuffer.Add(new BufferedILInstruction {
                IsInstruction = op
            });

            Operations.Add(new Operation <DelegateType> {
                OpCode = op, Parameters = new object[] { label }
            });
        }
        public void Emit(OpCode op, Sigil.Label[] labels, out UpdateOpCodeDelegate update)
        {
            var localOp = op;

            update =
                newOpcode =>
            {
                LengthCache.Clear();

                localOp = newOpcode;
            };

            InstructionSizes.Add(() => InstructionSize.Get(localOp, labels));

            LengthCache.Clear();

            Buffer.Add(
                (il, logOnly, log) =>
            {
                if (!logOnly)
                {
                    var ls = LinqAlternative.Select(labels, l => l.LabelDel(il)).ToArray();
                    il.Emit(localOp, ls);
                }

                log.AppendLine(localOp + " " + Join(", ", ((LinqArray <Label>)labels).AsEnumerable()));
            }
                );

            TraversableBuffer.Add(new BufferedILInstruction {
                IsInstruction = op
            });

            Operations.Add(new Operation <DelegateType> {
                OpCode = op, Parameters = labels
            });
        }
Beispiel #3
0
        private void UpdateState(OpCode instr, Label[] param, TransitionWrapper transitions, out UpdateOpCodeDelegate update)
        {
            UpdateStackAndInstrStream(instr, transitions);

            IL.Emit(instr, param, out update);
        }