コード例 #1
0
 public void AddRet()
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.RET
     });
 }
コード例 #2
0
 public void AddConst(int index)
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.CONST,
         Params = BitConverter.GetBytes(index)
     });
 }
コード例 #3
0
 public void AddNewArr(VariableType variableType)
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.NEWARR,
         Params = new byte[] { (byte)(variableType.Tag) }
     });
 }
コード例 #4
0
 public void AddLocal(int offset)
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.LOCAL,
         Params = BitConverter.GetBytes(offset)
     });
 }
コード例 #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)
     });
 }
コード例 #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)
     });
 }
コード例 #7
0
 public void AddPushA(uint value)
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.PUSHA,
         Params = BitConverter.GetBytes(value)
     });
 }
コード例 #8
0
 public void AddNew(int classTypeIndex)
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.NEW,
         Params = BitConverter.GetBytes(classTypeIndex)
     });
 }
コード例 #9
0
ファイル: MiscInstructions.cs プロジェクト: XiPotatonium/XiVM
 public void AddCall(int methodIndex)
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.CALL,
         Params = BitConverter.GetBytes(methodIndex)
     });
 }
コード例 #10
0
 public VariableType AddSetGtI()
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.SETGTI
     });
     return(VariableType.ByteType);
 }
コード例 #11
0
 public VariableType AddNegI()
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.NEGI
     });
     return(VariableType.IntType);
 }
コード例 #12
0
 public VariableType AddMod()
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.MOD
     });
     return(VariableType.IntType);
 }
コード例 #13
0
 public VariableType AddI2D()
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.SETEQI
     });
     return(VariableType.DoubleType);
 }
コード例 #14
0
 public void AddPushB(byte value)
 {
     CurrentInstructions.AddLast(new Instruction()
     {
         OpCode = InstructionType.PUSHB,
         Params = new byte[1] {
             value
         }
     });
 }
コード例 #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);
        }
コード例 #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);
        }