org.jf.dexlib2.iface.instruction.formats.Instruction12x Java Examples

The following examples show how to use org.jf.dexlib2.iface.instruction.formats.Instruction12x. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArrayLengthInstruction.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
public void jimplify (DexBody body) {
     if(!(instruction instanceof Instruction12x))
         throw new IllegalArgumentException("Expected Instruction12x but got: "+instruction.getClass());

     Instruction12x lengthOfArrayInstruction = (Instruction12x)instruction;
     int dest = lengthOfArrayInstruction.getRegisterA();

     Local arrayReference = body.getRegisterLocal(lengthOfArrayInstruction.getRegisterB());

     LengthExpr lengthExpr = Jimple.v().newLengthExpr(arrayReference);

     assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), lengthExpr);

     setUnit(assign);
     addTags(assign);
     body.add(assign);
     
     if (IDalvikTyper.ENABLE_DVKTYPER) {
Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
       DalvikTyper.v().setType(assign.getLeftOpBox(), IntType.v(), false);      
     }
 }
 
Example #2
Source File: UnopInstruction.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
public void jimplify (DexBody body) {
      if(!(instruction instanceof Instruction12x))
          throw new IllegalArgumentException("Expected Instruction12x but got: "+instruction.getClass());

      Instruction12x cmpInstr = (Instruction12x)instruction;
      int dest = cmpInstr.getRegisterA();

      Local source = body.getRegisterLocal(cmpInstr.getRegisterB());
      Value expr = getExpression(source);

      assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), expr);

      setUnit(assign);
      addTags(assign);
      body.add(assign);
      
if (IDalvikTyper.ENABLE_DVKTYPER) {
	Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
        int op = (int)instruction.getOpcode().value;
        //DalvikTyper.v().captureAssign((JAssignStmt)assign, op);
        JAssignStmt jass = (JAssignStmt)assign;
        DalvikTyper.v().setType((expr instanceof JCastExpr) ? ((JCastExpr) expr).getOpBox() : ((UnopExpr) expr).getOpBox(), opUnType[op - 0x7b], true);
        DalvikTyper.v().setType(jass.leftBox, resUnType[op - 0x7b], false);
      }
  }
 
Example #3
Source File: ImmutableInstruction12x.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
public static ImmutableInstruction12x of(Instruction12x instruction) {
    if (instruction instanceof ImmutableInstruction12x) {
        return (ImmutableInstruction12x)instruction;
    }
    return new ImmutableInstruction12x(
            instruction.getOpcode(),
            instruction.getRegisterA(),
            instruction.getRegisterB());
}
 
Example #4
Source File: ImmutableInstruction12x.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
public static ImmutableInstruction12x of(Instruction12x instruction) {
    if (instruction instanceof ImmutableInstruction12x) {
        return (ImmutableInstruction12x)instruction;
    }
    return new ImmutableInstruction12x(
            instruction.getOpcode(),
            instruction.getRegisterA(),
            instruction.getRegisterB());
}
 
Example #5
Source File: Binop2addrInstruction.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
public void jimplify (DexBody body) {
     if(!(instruction instanceof Instruction12x))
         throw new IllegalArgumentException("Expected Instruction12x but got: "+instruction.getClass());

     Instruction12x binOp2AddrInstr = (Instruction12x)instruction;
     int dest = binOp2AddrInstr.getRegisterA();

     Local source1 = body.getRegisterLocal(binOp2AddrInstr.getRegisterA());
     Local source2 = body.getRegisterLocal(binOp2AddrInstr.getRegisterB());

     expr = getExpression(source1, source2);

     assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), expr);
     assign.addTag(getTag());

     setUnit(assign);
     addTags(assign);
     body.add(assign);
     
     if (IDalvikTyper.ENABLE_DVKTYPER) {
Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign);
       BinopExpr bexpr = (BinopExpr)expr;
       short op = instruction.getOpcode().value;
       DalvikTyper.v().setType(bexpr.getOp1Box(), op1BinType[op-0xb0], true);
       DalvikTyper.v().setType(bexpr.getOp2Box(), op2BinType[op-0xb0], true);
       DalvikTyper.v().setType(assign.getLeftOpBox(), resBinType[op-0xb0], false);
     }
 }
 
Example #6
Source File: ImmutableInstruction12x.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
public static ImmutableInstruction12x of(Instruction12x instruction) {
    if (instruction instanceof ImmutableInstruction12x) {
        return (ImmutableInstruction12x)instruction;
    }
    return new ImmutableInstruction12x(
            instruction.getOpcode(),
            instruction.getRegisterA(),
            instruction.getRegisterB());
}
 
Example #7
Source File: ImmutableInstruction12x.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
public static ImmutableInstruction12x of(Instruction12x instruction) {
    if (instruction instanceof ImmutableInstruction12x) {
        return (ImmutableInstruction12x)instruction;
    }
    return new ImmutableInstruction12x(
            instruction.getOpcode(),
            instruction.getRegisterA(),
            instruction.getRegisterB());
}