Ejemplo n.º 1
0
 void invertjump(expdesc e) {
   InstructionPtr pc = this.getjumpcontrol(e.u.info);
   _assert(
       testTMode(GET_OPCODE(pc.get()))
           && GET_OPCODE(pc.get()) != OP_TESTSET
           && Lua.GET_OPCODE(pc.get()) != OP_TEST);
   // SETARG_A(pc, !(GETARG_A(pc.get())));
   int a = GETARG_A(pc.get());
   int nota = (a != 0 ? 0 : 1);
   SETARG_A(pc, nota);
 }
Ejemplo n.º 2
0
  boolean patchtestreg(int node, int reg) {
    InstructionPtr i = this.getjumpcontrol(node);
    if (GET_OPCODE(i.get()) != OP_TESTSET)
      /* cannot patch other instructions */
      return false;
    if (reg != NO_REG && reg != GETARG_B(i.get())) SETARG_A(i, reg);
    else
      /* no register to put value or register already has the value */
      i.set(CREATE_ABC(OP_TEST, GETARG_B(i.get()), 0, Lua.GETARG_C(i.get())));

    return true;
  }