Examples of DalvInsnList


Examples of com.android.dx.dex.code.DalvInsnList

    }
    // TODO: We don't need this, as it should be added by code blocks, if
    // the exception is actually used. If it's not used, we shouldn't care.
    // processCatchTable(code.getCatches(), dependencies);

    DalvInsnList instructions= code.getInsns();
    for (int i= 0; i < instructions.size(); ++i)
    {
      processInstruction(instructions.get(i), methodDeps);
    }
  }
View Full Code Here

Examples of com.android.dx.dex.code.DalvInsnList

     */
    private byte[] encode0(DexFile file, String prefix, PrintWriter debugPrint,
            AnnotatedOutput out, boolean consume) {
        PositionList positions = code.getPositions();
        LocalList locals = code.getLocals();
        DalvInsnList insns = code.getInsns();
        int codeSize = insns.codeSize();
        int regSize = insns.getRegistersSize();

        DebugInfoEncoder encoder =
            new DebugInfoEncoder(positions, locals,
                    file, codeSize, regSize, isStatic, ref);

View Full Code Here

Examples of com.android.dx.dex.code.DalvInsnList

     * @param verbose whether to be verbose with the output
     */
    public void debugPrint(PrintWriter out, String prefix, boolean verbose) {
        out.println(ref.toHuman() + ":");

        DalvInsnList insns = code.getInsns();
        out.println("regs: " + Hex.u2(getRegistersSize()) +
                "; ins: " + Hex.u2(getInsSize()) + "; outs: " +
                Hex.u2(getOutsSize()));

        insns.debugPrint(out, prefix, verbose);

        String prefix2 = prefix + "  ";

        if (catches != null) {
            out.print(prefix);
View Full Code Here

Examples of com.android.dx.dex.code.DalvInsnList

     *
     * @param file {@code non-null;} file we are part of
     * @param out {@code non-null;} where to write to
     */
    private void writeCodes(DexFile file, AnnotatedOutput out) {
        DalvInsnList insns = code.getInsns();

        try {
            insns.writeTo(out);
        } catch (RuntimeException ex) {
            throw ExceptionWithContext.withContext(ex, "...while writing " +
                    "instructions for " + ref.toHuman());
        }
    }
View Full Code Here

Examples of com.android.dx.dex.code.DalvInsnList

     */
    public static void validateEncode(byte[] info, DexFile file,
            CstMethodRef ref, DalvCode code, boolean isStatic) {
        PositionList pl = code.getPositions();
        LocalList ll = code.getLocals();
        DalvInsnList insns = code.getInsns();
        int codeSize = insns.codeSize();
        int countRegisters = insns.getRegistersSize();
       
        try {
            validateEncode0(info, codeSize, countRegisters,
                    isStatic, ref, file, pl, ll);
        } catch (RuntimeException ex) {
            System.err.println("instructions:");
            insns.debugPrint(System.err, "  ", true);
            System.err.println("local list:");
            ll.debugPrint(System.err, "  ");
            throw ExceptionWithContext.withContext(ex,
                    "while processing " + ref.toHuman());
        }
View Full Code Here

Examples of com.android.dx.dex.code.DalvInsnList

        return 0;
      }
    };
    code.assignIndices(callback);

    DalvInsnList instructions= code.getInsns();
    codeElement.setAttribute("register-size", String.valueOf(instructions.getRegistersSize()));
    processLocals(instructions.getRegistersSize(), isStatic, parseClassName(cf.getThisClass().getClassType().getClassName()).toString(), meth.getPrototype().getParameterTypes(), codeElement);
    Map<Integer, SwitchData> switchDataBlocks= extractSwitchData(instructions);
    Map<Integer, ArrayData> arrayData= extractArrayData(instructions);
    CatchTable catches= code.getCatches();
    processCatchTable(catches, codeElement);
    Map<Integer, Target> targets= extractTargets(instructions, catches);

    // For each entry in the catch table, we create a try-catch element,
    // including the try and all the catch children and append it to the
    // code element. We store the try elements in a list, in order to
    // append the matching instructions to them as they are processed.
    List<Element> tryElements= new ArrayList<Element>();
    Map<Integer, Element> tryCatchElements= new HashMap<Integer, Element>();
    for (int i= 0; i < catches.size(); ++i)
    {
      Element tryCatchElement= new Element("try-catch", NS_DEX);
      Element tryElement= new Element("try", NS_DEX);
      tryCatchElement.addContent(tryElement);
      tryElements.add(tryElement);

      // For each handler create a catch element as the child of the
      // try-catch element.
      CatchHandlerList handlers= catches.get(i).getHandlers();
      for (int j= 0; j < handlers.size(); ++j)
      {
        String exceptionType= handlers.get(j).getExceptionType().toHuman();

        // We can remove the exception because a red type exception
        // will never be created or thrown.
        // This change is in sync with the one in processCatchTable
        if (!isRedType(exceptionType))
        {
          Element catchElement= new Element("catch", NS_DEX);
          catchElement.setAttribute("exception-type", exceptionType);
          catchElement.setAttribute("target", String.valueOf(handlers.get(j).getHandler()));
          tryCatchElement.addContent(catchElement);
        }
      }
      tryCatchElements.put(catches.get(i).getStart(), tryCatchElement);
    }

    Element lastTryCatchElement= null;

    // Used inside processInstruction to mark source file lines as
    // already added, so they don't get added twice.
    List<Integer> sourceLinesAlreadyPut= new ArrayList<Integer>();
    // Process every single instruction of this method. Either add it do
    // the main code element, or to a try-catch block.
    for (int i= 0; i < instructions.size(); ++i)
    {
      Element instructionParent= codeElement;
      DalvInsn instruction= instructions.get(i);
      int address= instruction.getAddress();

      // Determine whether to add the next instruction to the
      // codeElement or to a try block.
      Entry currentCatch= null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.