org.jf.dexlib2.iface.instruction.OneRegisterInstruction Java Examples
The following examples show how to use
org.jf.dexlib2.iface.instruction.OneRegisterInstruction.
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: DexWriter.java From zjdroid with Apache License 2.0 | 6 votes |
private void fixInstructions(@Nonnull MutableMethodImplementation methodImplementation) { List<? extends Instruction> instructions = methodImplementation.getInstructions(); for (int i=0; i<instructions.size(); i++) { Instruction instruction = instructions.get(i); if (instruction.getOpcode() == Opcode.CONST_STRING) { if (stringSection.getItemIndex( (StringRef)((ReferenceInstruction)instruction).getReference()) >= 65536) { methodImplementation.replaceInstruction(i, new BuilderInstruction31c(Opcode.CONST_STRING_JUMBO, ((OneRegisterInstruction)instruction).getRegisterA(), ((ReferenceInstruction)instruction).getReference())); } } } }
Example #2
Source File: DexWriter.java From ZjDroid with Apache License 2.0 | 6 votes |
private void fixInstructions(@Nonnull MutableMethodImplementation methodImplementation) { List<? extends Instruction> instructions = methodImplementation.getInstructions(); for (int i=0; i<instructions.size(); i++) { Instruction instruction = instructions.get(i); if (instruction.getOpcode() == Opcode.CONST_STRING) { if (stringSection.getItemIndex( (StringRef)((ReferenceInstruction)instruction).getReference()) >= 65536) { methodImplementation.replaceInstruction(i, new BuilderInstruction31c(Opcode.CONST_STRING_JUMBO, ((OneRegisterInstruction)instruction).getRegisterA(), ((ReferenceInstruction)instruction).getReference())); } } } }
Example #3
Source File: DexWriter.java From HeyGirl with Apache License 2.0 | 6 votes |
private void fixInstructions(@Nonnull MutableMethodImplementation methodImplementation) { List<? extends Instruction> instructions = methodImplementation.getInstructions(); for (int i=0; i<instructions.size(); i++) { Instruction instruction = instructions.get(i); if (instruction.getOpcode() == Opcode.CONST_STRING) { if (stringSection.getItemIndex( (StringRef)((ReferenceInstruction)instruction).getReference()) >= 65536) { methodImplementation.replaceInstruction(i, new BuilderInstruction31c(Opcode.CONST_STRING_JUMBO, ((OneRegisterInstruction)instruction).getRegisterA(), ((ReferenceInstruction)instruction).getReference())); } } } }
Example #4
Source File: ConstClassInstruction.java From JAADAS with GNU General Public License v3.0 | 6 votes |
public void jimplify (DexBody body) { if(!(instruction instanceof Instruction21c)) throw new IllegalArgumentException("Expected Instruction21c but got: "+instruction.getClass()); ReferenceInstruction constClass = (ReferenceInstruction) this.instruction; TypeReference tidi = (TypeReference)(constClass.getReference()); String type = tidi.getType(); if (type.startsWith("L") && type.endsWith(";")) type = type.replaceAll("^L", "").replaceAll(";$", ""); int dest = ((OneRegisterInstruction) instruction).getRegisterA(); Constant cst = ClassConstant.v(type); assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), cst); 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); //TODO: classtype could be null! DalvikTyper.v().setType(assign.getLeftOpBox(), cst.getType(), false); } }
Example #5
Source File: ConstInstruction.java From JAADAS with GNU General Public License v3.0 | 6 votes |
public void jimplify (DexBody body) { int dest = ((OneRegisterInstruction) instruction).getRegisterA(); Constant cst = getConstant(dest, body); assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), cst); setUnit(assign); addTags(assign); body.add(assign); if (IDalvikTyper.ENABLE_DVKTYPER) { Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign); int op = (int)instruction.getOpcode().value; if (cst instanceof UntypedConstant) { DalvikTyper.v().addConstraint(assign.getLeftOpBox(), assign.getRightOpBox()); } else { DalvikTyper.v().setType(assign.getLeftOpBox(), cst.getType(), false); } } }
Example #6
Source File: SputInstruction.java From JAADAS with GNU General Public License v3.0 | 6 votes |
public void jimplify (DexBody body) { int source = ((OneRegisterInstruction)instruction).getRegisterA(); FieldReference f = (FieldReference)((ReferenceInstruction)instruction).getReference(); StaticFieldRef instanceField = Jimple.v().newStaticFieldRef(getStaticSootFieldRef(f)); Local sourceValue = body.getRegisterLocal(source); assign = getAssignStmt(body, sourceValue, instanceField); 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(assign.getRightOpBox(), instanceField.getType(), true); } }
Example #7
Source File: MoveResultInstruction.java From JAADAS with GNU General Public License v3.0 | 6 votes |
public void jimplify (DexBody body) { // if (local != null && expr != null) // throw new RuntimeException("Both local and expr are set to move."); int dest = ((OneRegisterInstruction)instruction).getRegisterA(); // if (local != null) // assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), local); // else if (expr != null) // assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), expr); // else // throw new RuntimeException("Neither local and expr are set to move."); assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), body.getStoreResultLocal()); setUnit(assign); addTags(assign); if (tag != null) assign.addTag(tag); body.add(assign); if (IDalvikTyper.ENABLE_DVKTYPER) { Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign); int op = (int)instruction.getOpcode().value; JAssignStmt jassign = (JAssignStmt)assign; DalvikTyper.v().addConstraint(assign.getLeftOpBox(), assign.getRightOpBox()); } }
Example #8
Source File: DexWriter.java From ZjDroid with Apache License 2.0 | 6 votes |
private void fixInstructions(@Nonnull MutableMethodImplementation methodImplementation) { List<? extends Instruction> instructions = methodImplementation.getInstructions(); for (int i=0; i<instructions.size(); i++) { Instruction instruction = instructions.get(i); if (instruction.getOpcode() == Opcode.CONST_STRING) { if (stringSection.getItemIndex( (StringRef)((ReferenceInstruction)instruction).getReference()) >= 65536) { methodImplementation.replaceInstruction(i, new BuilderInstruction31c(Opcode.CONST_STRING_JUMBO, ((OneRegisterInstruction)instruction).getRegisterA(), ((ReferenceInstruction)instruction).getReference())); } } } }
Example #9
Source File: SgetInstruction.java From JAADAS with GNU General Public License v3.0 | 5 votes |
public void jimplify (DexBody body) { int dest = ((OneRegisterInstruction)instruction).getRegisterA(); FieldReference f = (FieldReference)((ReferenceInstruction)instruction).getReference(); StaticFieldRef r = Jimple.v().newStaticFieldRef(getStaticSootFieldRef(f)); assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), r); 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(assign.getLeftOpBox(), r.getType(), false); } }
Example #10
Source File: SwitchInstruction.java From JAADAS with GNU General Public License v3.0 | 5 votes |
public void deferredJimplify(DexBody body) { int keyRegister = ((OneRegisterInstruction) instruction).getRegisterA(); int offset = ((OffsetInstruction) instruction).getCodeOffset(); Local key = body.getRegisterLocal(keyRegister); int targetAddress = codeAddress + offset; Instruction targetData = body.instructionAtAddress(targetAddress).instruction; Stmt stmt = switchStatement(body, targetData, key); body.getBody().getUnits().insertAfter(stmt, markerUnit); }
Example #11
Source File: MonitorEnterInstruction.java From JAADAS with GNU General Public License v3.0 | 5 votes |
public void jimplify (DexBody body) { int reg = ((OneRegisterInstruction) instruction).getRegisterA(); Local object = body.getRegisterLocal(reg); enterMonitorStmt = Jimple.v().newEnterMonitorStmt(object); setUnit(enterMonitorStmt); addTags(enterMonitorStmt); body.add(enterMonitorStmt); if (IDalvikTyper.ENABLE_DVKTYPER) { Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ enterMonitorStmt); DalvikTyper.v().setType(enterMonitorStmt.getOpBox(), RefType.v("java.lang.Object"), true); } }
Example #12
Source File: MoveExceptionInstruction.java From JAADAS with GNU General Public License v3.0 | 5 votes |
public void jimplify (DexBody body) { int dest = ((OneRegisterInstruction)instruction).getRegisterA(); Local l = body.getRegisterLocal(dest); stmtToRetype = Jimple.v().newIdentityStmt(l, Jimple.v().newCaughtExceptionRef()); setUnit(stmtToRetype); addTags(stmtToRetype); body.add(stmtToRetype); if (IDalvikTyper.ENABLE_DVKTYPER) { Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ stmtToRetype); DalvikTyper.v().setType(stmtToRetype.getLeftOpBox(), RefType.v("java.lang.Throwable"), false); } }
Example #13
Source File: MonitorExitInstruction.java From JAADAS with GNU General Public License v3.0 | 5 votes |
public void jimplify (DexBody body) { int reg = ((OneRegisterInstruction) instruction).getRegisterA(); Local object = body.getRegisterLocal(reg); exitMonitorStmt = Jimple.v().newExitMonitorStmt(object); setUnit(exitMonitorStmt); addTags(exitMonitorStmt); body.add(exitMonitorStmt); if (IDalvikTyper.ENABLE_DVKTYPER) { Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ exitMonitorStmt); DalvikTyper.v().setType(exitMonitorStmt.getOpBox(), RefType.v("java.lang.Object"), true); } }
Example #14
Source File: SgetInstruction.java From JAADAS with GNU General Public License v3.0 | 4 votes |
@Override boolean overridesRegister(int register) { OneRegisterInstruction i = (OneRegisterInstruction) instruction; int dest = i.getRegisterA(); return register == dest; }
Example #15
Source File: AgetInstruction.java From JAADAS with GNU General Public License v3.0 | 4 votes |
@Override boolean overridesRegister(int register) { OneRegisterInstruction i = (OneRegisterInstruction) instruction; int dest = i.getRegisterA(); return register == dest; }
Example #16
Source File: ConstStringInstruction.java From JAADAS with GNU General Public License v3.0 | 4 votes |
@Override boolean overridesRegister(int register) { OneRegisterInstruction i = (OneRegisterInstruction) instruction; int dest = i.getRegisterA(); return register == dest; }
Example #17
Source File: NewInstanceInstruction.java From JAADAS with GNU General Public License v3.0 | 4 votes |
@Override boolean overridesRegister(int register) { OneRegisterInstruction i = (OneRegisterInstruction) instruction; int dest = i.getRegisterA(); return register == dest; }
Example #18
Source File: MoveExceptionInstruction.java From JAADAS with GNU General Public License v3.0 | 4 votes |
@Override boolean overridesRegister(int register) { OneRegisterInstruction i = (OneRegisterInstruction) instruction; int dest = i.getRegisterA(); return register == dest; }
Example #19
Source File: MoveResultInstruction.java From JAADAS with GNU General Public License v3.0 | 4 votes |
@Override boolean overridesRegister(int register) { OneRegisterInstruction i = (OneRegisterInstruction) instruction; int dest = i.getRegisterA(); return register == dest; }
Example #20
Source File: ConstInstruction.java From JAADAS with GNU General Public License v3.0 | 4 votes |
@Override boolean overridesRegister(int register) { OneRegisterInstruction i = (OneRegisterInstruction) instruction; int dest = i.getRegisterA(); return register == dest; }
Example #21
Source File: ConstClassInstruction.java From JAADAS with GNU General Public License v3.0 | 4 votes |
@Override boolean overridesRegister(int register) { OneRegisterInstruction i = (OneRegisterInstruction) instruction; int dest = i.getRegisterA(); return register == dest; }