Ejemplo n.º 1
0
 public void AddRet()
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.RET
     });
 }
Ejemplo n.º 2
0
 public void AddConst(int index)
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.CONST,
         Params = BitConverter.GetBytes(index)
     });
 }
Ejemplo n.º 3
0
 public void AddNewArr(VariableType variableType)
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.NEWARR,
         Params = new byte[] { (byte)(variableType.Tag) }
     });
 }
Ejemplo n.º 4
0
 public void AddLocal(int offset)
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.LOCAL,
         Params = BitConverter.GetBytes(offset)
     });
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 请自行保证是static
 /// </summary>
 /// <param name="poolIndex"></param>
 public void AddStoreStatic(int poolIndex)
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.STORESTATIC,
         Params = BitConverter.GetBytes(poolIndex)
     });
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 自行保证是non-static
 /// </summary>
 /// <param name="poolIndex"></param>
 public void AddLoadNonStatic(int poolIndex)
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.LOADNONSTATIC,
         Params = BitConverter.GetBytes(poolIndex)
     });
 }
Ejemplo n.º 7
0
 public void AddPushA(uint value)
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.PUSHA,
         Params = BitConverter.GetBytes(value)
     });
 }
Ejemplo n.º 8
0
 public void AddNew(int classTypeIndex)
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.NEW,
         Params = BitConverter.GetBytes(classTypeIndex)
     });
 }
Ejemplo n.º 9
0
 public void AddCall(int methodIndex)
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.CALL,
         Params = BitConverter.GetBytes(methodIndex)
     });
 }
Ejemplo n.º 10
0
 public VariableType AddSetGtI()
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.SETGTI
     });
     return(VariableType.ByteType);
 }
Ejemplo n.º 11
0
 public VariableType AddNegI()
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.NEGI
     });
     return(VariableType.IntType);
 }
Ejemplo n.º 12
0
 public VariableType AddMod()
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.MOD
     });
     return(VariableType.IntType);
 }
Ejemplo n.º 13
0
 public VariableType AddI2D()
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.SETEQI
     });
     return(VariableType.DoubleType);
 }
Ejemplo n.º 14
0
 public void AddPushB(byte value)
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.PUSHB,
         Params = new byte[1] {
             value
         }
     });
 }
Ejemplo n.º 15
0
        public void AddJmp(BasicBlock target)
        {
            Instruction inst = new Instruction()
            {
                OpCode = InstructionType.JMP,
                Params = new byte[sizeof(int)]
            };

            CurrentInstructions.AddLast(inst);
            CurrentBasicBlock.JmpTargets.Add(target);
        }
Ejemplo n.º 16
0
        public void AddJCond(BasicBlock target1, BasicBlock target2)
        {
            Instruction inst = new Instruction()
            {
                OpCode = InstructionType.JCOND,
                Params = new byte[sizeof(int) * 2]
            };

            CurrentInstructions.AddLast(inst);
            CurrentBasicBlock.JmpTargets.Add(target1);
            CurrentBasicBlock.JmpTargets.Add(target2);
        }