public void AddRet() { CurrentInstructions.AddLast(new Instruction() { OpCode = InstructionType.RET }); }
public void AddConst(int index) { CurrentInstructions.AddLast(new Instruction() { OpCode = InstructionType.CONST, Params = BitConverter.GetBytes(index) }); }
public void AddNewArr(VariableType variableType) { CurrentInstructions.AddLast(new Instruction() { OpCode = InstructionType.NEWARR, Params = new byte[] { (byte)(variableType.Tag) } }); }
public void AddLocal(int offset) { CurrentInstructions.AddLast(new Instruction() { OpCode = InstructionType.LOCAL, Params = BitConverter.GetBytes(offset) }); }
/// <summary> /// 请自行保证是static /// </summary> /// <param name="poolIndex"></param> public void AddStoreStatic(int poolIndex) { CurrentInstructions.AddLast(new Instruction() { OpCode = InstructionType.STORESTATIC, Params = BitConverter.GetBytes(poolIndex) }); }
/// <summary> /// 自行保证是non-static /// </summary> /// <param name="poolIndex"></param> public void AddLoadNonStatic(int poolIndex) { CurrentInstructions.AddLast(new Instruction() { OpCode = InstructionType.LOADNONSTATIC, Params = BitConverter.GetBytes(poolIndex) }); }
public void AddPushA(uint value) { CurrentInstructions.AddLast(new Instruction() { OpCode = InstructionType.PUSHA, Params = BitConverter.GetBytes(value) }); }
public void AddNew(int classTypeIndex) { CurrentInstructions.AddLast(new Instruction() { OpCode = InstructionType.NEW, Params = BitConverter.GetBytes(classTypeIndex) }); }
public void AddCall(int methodIndex) { CurrentInstructions.AddLast(new Instruction() { OpCode = InstructionType.CALL, Params = BitConverter.GetBytes(methodIndex) }); }
public VariableType AddSetGtI() { CurrentInstructions.AddLast(new Instruction() { OpCode = InstructionType.SETGTI }); return(VariableType.ByteType); }
public VariableType AddNegI() { CurrentInstructions.AddLast(new Instruction() { OpCode = InstructionType.NEGI }); return(VariableType.IntType); }
public VariableType AddMod() { CurrentInstructions.AddLast(new Instruction() { OpCode = InstructionType.MOD }); return(VariableType.IntType); }
public VariableType AddI2D() { CurrentInstructions.AddLast(new Instruction() { OpCode = InstructionType.SETEQI }); return(VariableType.DoubleType); }
public void AddPushB(byte value) { CurrentInstructions.AddLast(new Instruction() { OpCode = InstructionType.PUSHB, Params = new byte[1] { value } }); }
public void AddJmp(BasicBlock target) { Instruction inst = new Instruction() { OpCode = InstructionType.JMP, Params = new byte[sizeof(int)] }; CurrentInstructions.AddLast(inst); CurrentBasicBlock.JmpTargets.Add(target); }
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); }