EncodedMethod toEncodedMethod(DexOptions dexOptions) { RopMethod ropMethod = new RopMethod(code.toBasicBlocks(), 0); LocalVariableInfo locals = null; DalvCode dalvCode = RopTranslator.translate( ropMethod, PositionList.NONE, locals, code.paramSize(), dexOptions); return new EncodedMethod(method.constant, flags, dalvCode, StdTypeList.EMPTY); } }
/** * Translates a {@link RopMethod}. This may modify the given * input. * * @param method {@code non-null;} the original method * @param positionInfo how much position info to preserve; one of the * static constants in {@link PositionList} * @param locals {@code null-ok;} local variable information to use * @param paramSize size, in register units, of all the parameters to * this method * @return {@code non-null;} the translated version */ public static DalvCode translate(RopMethod method, int positionInfo, LocalVariableInfo locals, int paramSize) { RopTranslator translator = new RopTranslator(method, positionInfo, locals, paramSize); return translator.translateAndGetResult(); }
/** * Does the translation and returns the result. * * @return {@code non-null;} the result */ private DalvCode translateAndGetResult() { pickOrder(); outputInstructions(); StdCatchBuilder catches = new StdCatchBuilder(method, order, addresses); return new DalvCode(positionInfo, output.getFinisher(), catches); }
/** * Gets the complete register list (result and sources) out of a * given rop instruction. For insns that are commutative, have * two register sources, and have a source equal to the result, * place that source first. * * @param insn {@code non-null;} instruction in question * @return {@code non-null;} the instruction's complete register list */ private static RegisterSpecList getRegs(Insn insn) { return getRegs(insn, insn.getResult()); }
/** * Performs initial creation of output instructions based on the * original blocks. */ private void outputInstructions() { BasicBlockList blocks = method.getBlocks(); int[] order = this.order; int len = order.length; // Process the blocks in output order. for (int i = 0; i < len; i++) { int nextI = i + 1; int nextLabel = (nextI == order.length) ? -1 : order[nextI]; outputBlock(blocks.labelToBlock(order[i]), nextLabel); } }
this.paramSize = paramSize; this.order = null; this.paramsAreInOrder = calculateParamsAreInOrder(method, paramSize);
/** * Does the translation and returns the result. * * @return {@code non-null;} the result */ private DalvCode translateAndGetResult() { pickOrder(); outputInstructions(); StdCatchBuilder catches = new StdCatchBuilder(method, order, addresses); return new DalvCode(positionInfo, output.getFinisher(), catches); }
/** * Gets the complete register list (result and sources) out of a * given rop instruction. For insns that are commutative, have * two register sources, and have a source equal to the result, * place that source first. * * @param insn {@code non-null;} instruction in question * @return {@code non-null;} the instruction's complete register list */ private static RegisterSpecList getRegs(Insn insn) { return getRegs(insn, insn.getResult()); }
/** * Performs initial creation of output instructions based on the * original blocks. */ private void outputInstructions() { BasicBlockList blocks = method.getBlocks(); int[] order = this.order; int len = order.length; // Process the blocks in output order. for (int i = 0; i < len; i++) { int nextI = i + 1; int nextLabel = (nextI == order.length) ? -1 : order[nextI]; outputBlock(blocks.labelToBlock(order[i]), nextLabel); } }
this.paramSize = paramSize; this.order = null; this.paramsAreInOrder = calculateParamsAreInOrder(method, paramSize);
/** * Does the translation and returns the result. * * @return {@code non-null;} the result */ private DalvCode translateAndGetResult() { pickOrder(); outputInstructions(); StdCatchBuilder catches = new StdCatchBuilder(method, order, addresses); return new DalvCode(positionInfo, output.getFinisher(), catches); }
/** * Translates a {@link RopMethod}. This may modify the given * input. * * @param method {@code non-null;} the original method * @param positionInfo how much position info to preserve; one of the * static constants in {@link PositionList} * @param locals {@code null-ok;} local variable information to use * @param paramSize size, in register units, of all the parameters to * this method * @param dexOptions {@code non-null;} options for dex output * @return {@code non-null;} the translated version */ public static DalvCode translate(RopMethod method, int positionInfo, LocalVariableInfo locals, int paramSize, DexOptions dexOptions) { RopTranslator translator = new RopTranslator(method, positionInfo, locals, paramSize, dexOptions); return translator.translateAndGetResult(); }
/** * Gets the complete register list (result and sources) out of a * given rop instruction. For insns that are commutative, have * two register sources, and have a source equal to the result, * place that source first. * * @param insn {@code non-null;} instruction in question * @return {@code non-null;} the instruction's complete register list */ private static RegisterSpecList getRegs(Insn insn) { return getRegs(insn, insn.getResult()); }
/** * Performs initial creation of output instructions based on the * original blocks. */ private void outputInstructions() { BasicBlockList blocks = method.getBlocks(); int[] order = this.order; int len = order.length; // Process the blocks in output order. for (int i = 0; i < len; i++) { int nextI = i + 1; int nextLabel = (nextI == order.length) ? -1 : order[nextI]; outputBlock(blocks.labelToBlock(order[i]), nextLabel); } }
this.paramSize = paramSize; this.order = null; this.paramsAreInOrder = calculateParamsAreInOrder(method, paramSize);
/** * Does the translation and returns the result. * * @return {@code non-null;} the result */ private DalvCode translateAndGetResult() { pickOrder(); outputInstructions(); StdCatchBuilder catches = new StdCatchBuilder(method, order, addresses); return new DalvCode(positionInfo, output.getFinisher(), catches); }
/** * Translates a {@link RopMethod}. This may modify the given * input. * * @param method {@code non-null;} the original method * @param positionInfo how much position info to preserve; one of the * static constants in {@link PositionList} * @param locals {@code null-ok;} local variable information to use * @param paramSize size, in register units, of all the parameters to * this method * @param dexOptions {@code non-null;} options for dex output * @return {@code non-null;} the translated version */ public static DalvCode translate(RopMethod method, int positionInfo, LocalVariableInfo locals, int paramSize, DexOptions dexOptions) { RopTranslator translator = new RopTranslator(method, positionInfo, locals, paramSize, dexOptions); return translator.translateAndGetResult(); }
/** * Gets the complete register list (result and sources) out of a * given rop instruction. For insns that are commutative, have * two register sources, and have a source equal to the result, * place that source first. * * @param insn {@code non-null;} instruction in question * @return {@code non-null;} the instruction's complete register list */ private static RegisterSpecList getRegs(Insn insn) { return getRegs(insn, insn.getResult()); }