private static void updateDexStatistics(
      DxContext context,
      CfOptions cfOptions,
      DexOptions dexOptions,
      RopMethod optRmeth,
      RopMethod nonOptRmeth,
      LocalVariableInfo locals,
      int paramSize,
      int originalByteCount) {
    /*
     * Run rop->dex again on optimized vs. non-optimized method to
     * collect statistics. We have to totally convert both ways,
     * since converting the "real" method getting added to the
     * file would corrupt it (by messing with its constant pool
     * indices).
     */

    DalvCode optCode =
        RopTranslator.translate(optRmeth, cfOptions.positionInfo, locals, paramSize, dexOptions);
    DalvCode nonOptCode =
        RopTranslator.translate(nonOptRmeth, cfOptions.positionInfo, locals, paramSize, dexOptions);

    /*
     * Fake out the indices, so code.getInsns() can work well enough
     * for the current purpose.
     */

    DalvCode.AssignIndicesCallback callback =
        new DalvCode.AssignIndicesCallback() {
          @Override
          public int getIndex(Constant cst) {
            // Everything is at index 0!
            return 0;
          }
        };

    optCode.assignIndices(callback);
    nonOptCode.assignIndices(callback);

    context.codeStatistics.updateDexStatistics(nonOptCode, optCode);
    context.codeStatistics.updateOriginalByteCount(originalByteCount);
  }
Helper that updates the dex statistics.
android/android_framework/dex-maker/src/main/java/com/android/dx/dex/cf/CfTranslator.java