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

The following examples show how to use org.jf.dexlib2.iface.instruction.formats.Instruction22c. 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 Project: JAADAS   Author: flankerhqd   File: InstanceOfInstruction.java    License: GNU General Public License v3.0 6 votes vote down vote up
public void jimplify (DexBody body) {
      Instruction22c i = (Instruction22c)instruction;
      int dest = i.getRegisterA();
      int source = i.getRegisterB();

      Type t = DexType.toSoot((TypeReference)(i.getReference()));

      InstanceOfExpr e = Jimple.v().newInstanceOfExpr(body.getRegisterLocal(source), t);
      assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), e);
      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().?
      }
  }
 
Example #2
Source Project: ZjDroid   Author: KB5201314   File: ImmutableInstruction22c.java    License: Apache License 2.0 5 votes vote down vote up
public static ImmutableInstruction22c of(Instruction22c instruction) {
    if (instruction instanceof ImmutableInstruction22c) {
        return (ImmutableInstruction22c)instruction;
    }
    return new ImmutableInstruction22c(
            instruction.getOpcode(),
            instruction.getRegisterA(),
            instruction.getRegisterB(),
            instruction.getReference());
}
 
Example #3
Source Project: zjdroid   Author: Miracle963   File: ImmutableInstruction22c.java    License: Apache License 2.0 5 votes vote down vote up
public static ImmutableInstruction22c of(Instruction22c instruction) {
    if (instruction instanceof ImmutableInstruction22c) {
        return (ImmutableInstruction22c)instruction;
    }
    return new ImmutableInstruction22c(
            instruction.getOpcode(),
            instruction.getRegisterA(),
            instruction.getRegisterB(),
            instruction.getReference());
}
 
Example #4
Source Project: JAADAS   Author: flankerhqd   File: FieldInstruction.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Return the source register for this instruction.
 */
private int sourceRegister() {
    // I hate smali's API ..
    if (instruction instanceof Instruction23x)
        return ((Instruction23x) instruction).getRegisterA();
    else if (instruction instanceof Instruction22c)
        return ((Instruction22c) instruction).getRegisterA();
    else if (instruction instanceof Instruction21c)
        return ((Instruction21c) instruction).getRegisterA();
    else throw new RuntimeException("Instruction is not a instance, array or static op");
}
 
Example #5
Source Project: JAADAS   Author: flankerhqd   File: NewArrayInstruction.java    License: GNU General Public License v3.0 5 votes vote down vote up
public void jimplify (DexBody body) {

        if(!(instruction instanceof Instruction22c))
            throw new IllegalArgumentException("Expected Instruction22c but got: "+instruction.getClass());

        Instruction22c newArray = (Instruction22c)instruction;
        int dest = newArray.getRegisterA();

        Value size = body.getRegisterLocal(newArray.getRegisterB());

        Type t = DexType.toSoot((TypeReference) newArray.getReference());
        // NewArrayExpr needs the ElementType as it increases the array dimension by 1
        Type arrayType = ((ArrayType) t).getElementType();
        Debug.printDbg("new array element type: ", arrayType);
        
        NewArrayExpr newArrayExpr = Jimple.v().newNewArrayExpr(arrayType, size);

        Local l = body.getRegisterLocal(dest);
        assign = Jimple.v().newAssignStmt(l, newArrayExpr);

        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().setType(newArrayExpr.getSizeBox(), IntType.v(), true);
          DalvikTyper.v().setType(assign.getLeftOpBox(), newArrayExpr.getType(), false);
        }
    }
 
Example #6
Source Project: HeyGirl   Author: mikusjelly   File: ImmutableInstruction22c.java    License: Apache License 2.0 5 votes vote down vote up
public static ImmutableInstruction22c of(Instruction22c instruction) {
    if (instruction instanceof ImmutableInstruction22c) {
        return (ImmutableInstruction22c)instruction;
    }
    return new ImmutableInstruction22c(
            instruction.getOpcode(),
            instruction.getRegisterA(),
            instruction.getRegisterB(),
            instruction.getReference());
}
 
Example #7
Source Project: ZjDroid   Author: halfkiss   File: ImmutableInstruction22c.java    License: Apache License 2.0 5 votes vote down vote up
public static ImmutableInstruction22c of(Instruction22c instruction) {
    if (instruction instanceof ImmutableInstruction22c) {
        return (ImmutableInstruction22c)instruction;
    }
    return new ImmutableInstruction22c(
            instruction.getOpcode(),
            instruction.getRegisterA(),
            instruction.getRegisterB(),
            instruction.getReference());
}