/// <summary> /// Inserts an unconditional jump to the location described by the jump token. /// This may be a forward or backward jump, but should be local to the Assembler. /// </summary> public override void Jump(Compiler.JumpToken token) { JumpToken t = (JumpToken)token; t.SetKind(JumpTokenKind.Relative); region.WriteByte(0xe9); // relative offset next instruction t.SetJumpSite(region.InsertIntToken()); }
/// <summary> /// Assosiates a JumpToken with a location in the code stream. /// </summary> public override void SetDestination(Compiler.JumpToken token) { if (token == null) { throw new ArgumentNullException("token"); } ((JumpToken)token).SetDestination(region.CurrentLocation); }
public override void JumpIfUnassigned(Compiler.JumpToken token) { JumpToken t = (JumpToken)token; t.SetKind(JumpTokenKind.Relative); region.Write(new byte[] { 0x21, 0xd2, // and edx, edx 0x0f, 0x84 // jz }); t.SetJumpSite(region.InsertIntToken()); }
public override void JumpIfTrue(Compiler.JumpToken token) { JumpToken t = (JumpToken)token; t.SetKind(JumpTokenKind.Relative); region.Write(new byte[] { 0x21, 0xc0, // and eax, eax 0x0f, 0x85 // jnz }); t.SetJumpSite(region.InsertIntToken()); }
public override void JumpIfNotMarked(Compiler.JumpToken token) { region.Write(new byte[] { 0x48, 0xF7, 0xC2, 0x01, 0x00, 0x00, 0x00 // test rdx, 1 }); JumpToken t = (JumpToken)token; t.SetKind(JumpTokenKind.Relative); region.Write(new byte[] { 0x0f, 0x84 // jz }); t.SetJumpSite(region.InsertIntToken()); }