Ejemplo n.º 1
0
 public ILInstruction(InstructionKind kind, OpCode opCode, ILInstructionParameter parameter, ILInstructionComment comment)
 {
     Kind      = kind;
     OpCode    = opCode;
     Parameter = parameter;
     Comment   = comment;
 }
Ejemplo n.º 2
0
        public static void Mutate(OpCode opCode, GroboIL il, ILInstructionParameter parameter, ref EvaluationStack stack)
        {
            StackMutator stackMutator;

            if (opCode.Size == 0)
            {
                stackMutator = markLabelStackMutator;
            }
            else if (!stackMutators.TryGetValue(opCode, out stackMutator))
            {
                throw new NotSupportedException("OpCode '" + opCode + "' is not supported");
            }
            stackMutator.Mutate(il, parameter, ref stack);
        }
Ejemplo n.º 3
0
        public int Append(OpCode opCode, ILInstructionParameter parameter, ILInstructionComment comment)
        {
            var lastInstructionPrefix = Count > 0 ? instructions[Count - 1] as ILInstructionPrefix : null;

            if (lastInstructionPrefix == null)
            {
                instructions.Add(new ILInstruction(InstructionKind.Instruction, opCode, parameter, comment));
                return(Count++);
            }
            instructions[Count - 1] = new ILInstruction(InstructionKind.Instruction, opCode, parameter, comment)
            {
                Prefixes = lastInstructionPrefix.Prefixes
            };
            return(Count - 1);
        }
Ejemplo n.º 4
0
        public int AppendPrefix(OpCode prefix, ILInstructionParameter parameter)
        {
            var lastInstructionPrefix = instructions[Count - 1] as ILInstructionPrefix;

            if (lastInstructionPrefix != null)
            {
                lastInstructionPrefix.Prefixes.Add(new KeyValuePair <OpCode, ILInstructionParameter>(prefix, parameter));
                return(Count - 1);
            }
            instructions.Add(new ILInstructionPrefix {
                Prefixes = new List <KeyValuePair <OpCode, ILInstructionParameter> > {
                    new KeyValuePair <OpCode, ILInstructionParameter>(prefix, parameter)
                }
            });
            return(Count++);
        }
Ejemplo n.º 5
0
 public abstract void Mutate(GroboIL il, ILInstructionParameter parameter, ref EvaluationStack stack);