private InstructionHolder[] readInstructionsIntoHolders(ShortArrayCodeInput in, int length) { in.reset(); final InstructionHolder[] result = new InstructionHolder[length]; InstructionReader ir = new InstructionReader(in); try { ir.accept(new InstructionVisitor(null) { public void visitZeroRegisterInsn(int currentAddress, int opcode, int index, int indexType, int target, long literal) { InstructionHolder insnHolder = new InstructionHolder();
private boolean isMethodReferToAnyClasses(DexClassInfo classInfo, ClassData.Method method, Set<String> refereeClassDescs) { if (method.codeOffset == ClassDef.NO_OFFSET) { return false; } Code methodCode = classInfo.owner.readCode(method); InstructionReader ir = new InstructionReader(new ShortArrayCodeInput(methodCode.instructions)); ReferToClassesCheckVisitor rtcv = new ReferToClassesCheckVisitor(classInfo.owner, method, refereeClassDescs); try { ir.accept(rtcv); } catch (EOFException e) { // Should not be here. } return rtcv.isReferToAnyRefereeClasses; }
public short[] transform(short[] encodedInstructions) throws DexException { ShortArrayCodeOutput out = new ShortArrayCodeOutput(encodedInstructions.length); InstructionPromoter ipmo = new InstructionPromoter(); InstructionWriter iw = new InstructionWriter(out, ipmo); InstructionReader ir = new InstructionReader(new ShortArrayCodeInput(encodedInstructions)); try { // First visit, we collect mappings from original target address to promoted target address. ir.accept(new InstructionTransformVisitor(ipmo)); // Then do the real transformation work. ir.accept(new InstructionTransformVisitor(iw)); } catch (EOFException e) { throw new DexException(e); } return out.getArray(); }
private boolean isMethodReferToAnyClasses(DexClassInfo classInfo, ClassData.Method method, Set<String> refereeClassDescs) { if (method.codeOffset == ClassDef.NO_OFFSET) { return false; } Code methodCode = classInfo.owner.readCode(method); InstructionReader ir = new InstructionReader(new ShortArrayCodeInput(methodCode.instructions)); ReferToClassesCheckVisitor rtcv = new ReferToClassesCheckVisitor(classInfo.owner, method, refereeClassDescs); try { ir.accept(rtcv); } catch (EOFException e) { // Should not be here. } return rtcv.isReferToAnyRefereeClasses; }
private InstructionHolder[] readInstructionsIntoHolders(ShortArrayCodeInput in, int length) { in.reset(); final InstructionHolder[] result = new InstructionHolder[length]; InstructionReader ir = new InstructionReader(in); try { ir.accept(new InstructionVisitor(null) { public void visitZeroRegisterInsn(int currentAddress, int opcode, int index, int indexType, int target, long literal) { InstructionHolder insnHolder = new InstructionHolder();
public short[] transform(short[] encodedInstructions) throws DexException { ShortArrayCodeOutput out = new ShortArrayCodeOutput(encodedInstructions.length); InstructionPromoter ipmo = new InstructionPromoter(); InstructionWriter iw = new InstructionWriter(out, ipmo); InstructionReader ir = new InstructionReader(new ShortArrayCodeInput(encodedInstructions)); try { // First visit, we collect mappings from original target address to promoted target address. ir.accept(new InstructionTransformVisitor(ipmo)); // Then do the real transformation work. ir.accept(new InstructionTransformVisitor(iw)); } catch (EOFException e) { throw new DexException(e); } return out.getArray(); }
public short[] transform(short[] encodedInstructions) throws DexException { ShortArrayCodeOutput out = new ShortArrayCodeOutput(encodedInstructions.length); InstructionPromoter ipmo = new InstructionPromoter(); InstructionWriter iw = new InstructionWriter(out, ipmo); InstructionReader ir = new InstructionReader(new ShortArrayCodeInput(encodedInstructions)); try { // First visit, we collect mappings from original target address to promoted target address. ir.accept(new InstructionTransformVisitor(ipmo)); // Then do the real transformation work. ir.accept(new InstructionTransformVisitor(iw)); } catch (EOFException e) { throw new DexException(e); } return out.getArray(); }