dex-translator-0.0.9.15

16:35:23.292 INFO  jd.cli.Main - Decompiling dex-translator-0.0.9.15.jar
package com.googlecode.dex2jar.v3;

import com.googlecode.dex2jar.Method;
import com.googlecode.dex2jar.util.ASMifierCodeV;
import com.googlecode.dex2jar.util.Escape;
import com.googlecode.dex2jar.util.Out;
import com.googlecode.dex2jar.visitors.DexCodeVisitor;
import com.googlecode.dex2jar.visitors.DexMethodVisitor;
import com.googlecode.dex2jar.visitors.EmptyVisitor;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

class DexExceptionHandlerImpl$2$1
  extends EmptyVisitor
{
  DexExceptionHandlerImpl$2$1(DexExceptionHandlerImpl.2 param2, ZipOutputStream paramZipOutputStream, int[] paramArrayOfInt, PrintWriter paramPrintWriter, Out paramOut) {}
  
  public DexMethodVisitor visitMethod(final int accessFlags, final Method method)
  {
    if (DexExceptionHandlerImpl.access$0(DexExceptionHandlerImpl.2.access$0(this$1)).containsKey(method)) {
      new EmptyVisitor()
      {
        public DexCodeVisitor visitCode()
        {
          try
          {
            int tmp22_21 = 0; int[] tmp22_18 = val$count; int tmp24_23 = tmp22_18[tmp22_21];tmp22_18[tmp22_21] = (tmp24_23 + 1);val$errorZipOutputStream.putNextEntry(new ZipEntry("t" + tmp24_23 + ".txt"));
          }
          catch (IOException e)
          {
            throw new RuntimeException(e);
          }
          Exception exception = (Exception)DexExceptionHandlerImpl.access$0(DexExceptionHandlerImpl.2.access$0(this$1)).get(method);
          exception.printStackTrace(val$fw);
          val$out.s("");
          val$out.s("DexMethodVisitor mv=cv.visitMethod(%s, %s);", new Object[] { Escape.methodAcc(accessFlags), 
            Escape.v(method) });
          val$out.s("DexCodeVisitor code = mv.visitCode();");
          return new ASMifierCodeV(val$out);
        }
        
        public void visitEnd()
        {
          val$out.s("mv.visitEnd();");
          val$fw.flush();
          try
          {
            val$errorZipOutputStream.closeEntry();
          }
          catch (IOException e)
          {
            throw new RuntimeException(e);
          }
        }
      };
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     com.googlecode.dex2jar.v3.DexExceptionHandlerImpl.2.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.googlecode.dex2jar.v3;

import com.googlecode.dex2jar.DexType;
import com.googlecode.dex2jar.visitors.DexAnnotationVisitor;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Type;

public class Dex2AsmAnnotationAdapter
  implements DexAnnotationVisitor
{
  protected AnnotationVisitor asm;
  
  public Dex2AsmAnnotationAdapter(AnnotationVisitor asm)
  {
    this.asm = asm;
  }
  
  public void visit(String name, Object value)
  {
    if ((value instanceof DexType)) {
      value = Type.getType(desc);
    }
    asm.visit(name, value);
  }
  
  public void visitEnum(String name, String desc, String value)
  {
    asm.visitEnum(name, desc, value);
  }
  
  public DexAnnotationVisitor visitAnnotation(String name, String desc)
  {
    AnnotationVisitor n = asm.visitAnnotation(name, desc);
    if (n != null) {
      return new Dex2AsmAnnotationAdapter(n);
    }
    return null;
  }
  
  public DexAnnotationVisitor visitArray(String name)
  {
    AnnotationVisitor n = asm.visitArray(name);
    if (n != null) {
      return new Dex2AsmAnnotationAdapter(n);
    }
    return null;
  }
  
  public void visitEnd()
  {
    asm.visitEnd();
  }
}

/* Location:
 * Qualified Name:     com.googlecode.dex2jar.v3.Dex2AsmAnnotationAdapter
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.googlecode.dex2jar.v3;

import com.googlecode.dex2jar.ir.Local;
import com.googlecode.dex2jar.ir.Value;
import com.googlecode.dex2jar.ir.Value.VT;
import com.googlecode.dex2jar.ir.ValueBox;
import com.googlecode.dex2jar.ir.stmt.AssignStmt;
import com.googlecode.dex2jar.ir.stmt.Stmt;
import com.googlecode.dex2jar.ir.ts.Cfg.StmtVisitor;
import com.googlecode.dex2jar.ir.ts.LocalType;
import org.objectweb.asm.Type;

class IrMethod2AsmMethod$2
  implements Cfg.StmtVisitor<Object>
{
  IrMethod2AsmMethod$2(IrMethod2AsmMethod paramIrMethod2AsmMethod, int[] paramArrayOfInt1, int[] paramArrayOfInt2) {}
  
  public Object exec(Stmt stmt)
  {
    switch (st)
    {
    case ASSIGN: 
    case IDENTITY: 
      if (op1.value.vt == Value.VT.LOCAL)
      {
        Local local = (Local)op1.value;
        if (_ls_index == -1)
        {
          Type localType = LocalType.typeOf(local);
          if (!Type.VOID_TYPE.equals(localType))
          {
            Value ref = op2.value;
            switch (vt)
            {
            case SUB: 
              _ls_index = 0;
              break;
            case OR: 
              _ls_index = val$ids[parameterIndex];
              break;
            case FIELD: 
              int tmp186_185 = 0; int[] tmp186_182 = val$indexHolder; int tmp188_187 = tmp186_182[tmp186_185];tmp186_182[tmp186_185] = (tmp188_187 + 1);_ls_index = tmp188_187;
              break;
            default: 
              _ls_index = val$indexHolder[0];
              val$indexHolder[0] += LocalType.typeOf(ref).getSize();
            }
          }
        }
      }
      break;
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     com.googlecode.dex2jar.v3.IrMethod2AsmMethod.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.googlecode.dex2jar.v3;

import com.googlecode.dex2jar.DexException;
import com.googlecode.dex2jar.ir.Constant;
import com.googlecode.dex2jar.ir.IrMethod;
import com.googlecode.dex2jar.ir.Local;
import com.googlecode.dex2jar.ir.LocalVar;
import com.googlecode.dex2jar.ir.Trap;
import com.googlecode.dex2jar.ir.Value;
import com.googlecode.dex2jar.ir.Value.E1Expr;
import com.googlecode.dex2jar.ir.Value.E2Expr;
import com.googlecode.dex2jar.ir.Value.EnExpr;
import com.googlecode.dex2jar.ir.Value.VT;
import com.googlecode.dex2jar.ir.ValueBox;
import com.googlecode.dex2jar.ir.expr.ArrayExpr;
import com.googlecode.dex2jar.ir.expr.CastExpr;
import com.googlecode.dex2jar.ir.expr.Exprs;
import com.googlecode.dex2jar.ir.expr.FieldExpr;
import com.googlecode.dex2jar.ir.expr.FilledArrayExpr;
import com.googlecode.dex2jar.ir.expr.InvokeExpr;
import com.googlecode.dex2jar.ir.expr.NewExpr;
import com.googlecode.dex2jar.ir.expr.NewMutiArrayExpr;
import com.googlecode.dex2jar.ir.expr.RefExpr;
import com.googlecode.dex2jar.ir.expr.TypeExpr;
import com.googlecode.dex2jar.ir.stmt.AssignStmt;
import com.googlecode.dex2jar.ir.stmt.JumpStmt;
import com.googlecode.dex2jar.ir.stmt.LabelStmt;
import com.googlecode.dex2jar.ir.stmt.LookupSwitchStmt;
import com.googlecode.dex2jar.ir.stmt.Stmt;
import com.googlecode.dex2jar.ir.stmt.Stmt.E2Stmt;
import com.googlecode.dex2jar.ir.stmt.Stmt.ST;
import com.googlecode.dex2jar.ir.stmt.StmtList;
import com.googlecode.dex2jar.ir.stmt.TableSwitchStmt;
import com.googlecode.dex2jar.ir.stmt.UnopStmt;
import com.googlecode.dex2jar.ir.ts.BaseLiveAnalyze.Phi;
import com.googlecode.dex2jar.ir.ts.Cfg;
import com.googlecode.dex2jar.ir.ts.Cfg.StmtVisitor;
import com.googlecode.dex2jar.ir.ts.LiveAnalyze;
import com.googlecode.dex2jar.ir.ts.LiveAnalyze.LivePhi;
import com.googlecode.dex2jar.ir.ts.LocalType;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;

public class IrMethod2AsmMethod
  implements Opcodes
{
  private boolean reuseReg = false;
  private boolean optimizeSynchronized = false;
  
  public IrMethod2AsmMethod() {}
  
  /**
   * @deprecated
   */
  public IrMethod2AsmMethod(boolean reuseReg)
  {
    this.reuseReg = reuseReg;
  }
  
  public IrMethod2AsmMethod(int config)
  {
    reuseReg = ((config & 0x1) != 0);
    optimizeSynchronized = ((config & 0x8) != 0);
  }
  
  private void reIndexLocalReuseReg(IrMethod ir)
  {
    LiveAnalyze la = new LiveAnalyze(ir);
    la.analyze();
    List<BaseLiveAnalyze.Phi> phis = phis;
    
    int index = 0;
    if ((access & 0x8) == 0) {
      index++;
    }
    int localSize = locals.size();
    int[] parameterIdx = new int[args.length];
    for (int i = 0; i < args.length; i++)
    {
      parameterIdx[i] = index;
      index += args[i].getSize();
    }
    int[] maps = new int[localSize];
    for (int i = 0; i < localSize; i++) {
      maps[i] = -1;
    }
    Local _thisLocal = null;
    Local[] _parameterLocals = new Local[args.length];
    int i;
    for (Stmt stmt = stmts.getFirst(); stmt != null; stmt = stmt.getNext()) {
      if ((st == Stmt.ST.IDENTITY) || (st == Stmt.ST.ASSIGN))
      {
        e2 = (Stmt.E2Stmt)stmt;
        switch (op2.value.vt)
        {
        case SUB: 
          Local local = (Local)op1.value;
          maps[_ls_index] = 0;
          _thisLocal = local;
          
          break;
        case OR: 
          local = (Local)op1.value;
          i = op2.value).parameterIndex;
          maps[_ls_index] = parameterIdx[i];
          _parameterLocals[i] = local;
        }
      }
    }
    createGraph(ir, phis.size());
    if (((access & 0x8) == 0) && (_thisLocal != null)) {
      markPhiNeverReuse(phis, _thisLocal);
    }
    Local local = (i = _parameterLocals).length;
    for (Stmt.E2Stmt e2 = 0; e2 < local; e2++)
    {
      Local local = i[e2];
      if (local != null) {
        markPhiNeverReuse(phis, local);
      }
    }
    gradyColoring(phis, maps);
    for (Local local : locals) {
      _ls_index = maps[_ls_index];
    }
  }
  
  private void markPhiNeverReuse(List<BaseLiveAnalyze.Phi> phis, Local local)
  {
    LiveAnalyze.LivePhi nPhi = null;
    for (BaseLiveAnalyze.Phi x : phis)
    {
      LiveAnalyze.LivePhi phi = (LiveAnalyze.LivePhi)x;
      if (local == local)
      {
        nPhi = phi;
        break;
      }
    }
    if (nPhi == null)
    {
      nPhi = new LiveAnalyze.LivePhi();
      local = local;
    }
    for (BaseLiveAnalyze.Phi phi : phis) {
      if (phi != nPhi)
      {
        parents.add(nPhi);
        parents.add(phi);
      }
    }
  }
  
  private int findNextColor(BaseLiveAnalyze.Phi v, int n, int max, int[] maps)
  {
    BitSet bs = new BitSet(max);
    bs.set(0, max);
    for (BaseLiveAnalyze.Phi t : parents)
    {
      LiveAnalyze.LivePhi one = (LiveAnalyze.LivePhi)t;
      int x = maps[local._ls_index];
      if (x >= 0)
      {
        bs.clear(x);
        if (sizeOf(one) > 1) {
          bs.clear(x + 1);
        }
      }
    }
    boolean wide = sizeOf(v) > 1;
    for (int i = bs.nextSetBit(n); i >= 0; i = bs.nextSetBit(i + 1)) {
      if (wide)
      {
        if ((i + 1 < bs.length()) && (bs.get(i + 1))) {
          return i;
        }
      }
      else {
        return i;
      }
    }
    return -1;
  }
  
  private void gradyColoring(List<BaseLiveAnalyze.Phi> phis, int[] maps)
  {
    if (phis.size() <= 0) {
      return;
    }
    Collections.sort(phis, new Comparator()
    {
      public int compare(BaseLiveAnalyze.Phi o1, BaseLiveAnalyze.Phi o2)
      {
        int r = parents.size() - parents.size();
        return r == 0 ? IrMethod2AsmMethod.sizeOf(o2) - IrMethod2AsmMethod.sizeOf(o1) : r;
      }
    });
    BaseLiveAnalyze.Phi first = (BaseLiveAnalyze.Phi)phis.get(0);
    int size = sizeOf(first);
    for (BaseLiveAnalyze.Phi p : parents) {
      size += sizeOf(p);
    }
    BitSet toColor = new BitSet(phis.size());
    for (int i = 0; i < phis.size(); i++)
    {
      LiveAnalyze.LivePhi p = (LiveAnalyze.LivePhi)phis.get(i);
      if (maps[local._ls_index] < 0) {
        toColor.set(i);
      }
    }
    while (!doColor(0, toColor, phis, size, maps)) {
      size++;
    }
  }
  
  private boolean doColor(int idx, BitSet toColor, List<BaseLiveAnalyze.Phi> phis, int size, int[] maps)
  {
    int x = toColor.nextSetBit(idx);
    if (x < 0) {
      return true;
    }
    LiveAnalyze.LivePhi phi = (LiveAnalyze.LivePhi)phis.get(x);
    for (int i = findNextColor(phi, 0, size, maps); i >= 0; i = findNextColor(phi, i + 1, size, maps))
    {
      maps[local._ls_index] = i;
      if (doColor(x + 1, toColor, phis, size, maps)) {
        return true;
      }
      maps[local._ls_index] = -1;
    }
    return false;
  }
  
  private static int sizeOf(BaseLiveAnalyze.Phi p)
  {
    return LocalType.typeOf(local).getSize();
  }
  
  private void createGraph(IrMethod ir, int localSize)
  {
    List<BaseLiveAnalyze.Phi> tmp = new ArrayList(localSize);
    for (Stmt p = stmts.getFirst(); p != null; p = p.getNext())
    {
      tmp.clear();
      
      BaseLiveAnalyze.Phi[] frame = (BaseLiveAnalyze.Phi[])_ls_forward_frame;
      _ls_forward_frame = null;
      if (frame != null)
      {
        BaseLiveAnalyze.Phi[] arrayOfPhi1;
        int j = (arrayOfPhi1 = frame).length;
        for (int i = 0; i < j; i++)
        {
          BaseLiveAnalyze.Phi r = arrayOfPhi1[i];
          if (r != null) {
            tmp.add(r);
          }
        }
      }
      for (int i = 0; i < tmp.size() - 1; i++)
      {
        BaseLiveAnalyze.Phi a = (BaseLiveAnalyze.Phi)tmp.get(i);
        for (int j = i + 1; j < tmp.size(); j++)
        {
          BaseLiveAnalyze.Phi b = (BaseLiveAnalyze.Phi)tmp.get(j);
          if (a != b)
          {
            parents.add(b);
            parents.add(a);
          }
        }
      }
    }
  }
  
  private void reIndexLocal(IrMethod ir)
  {
    if (reuseReg) {
      reIndexLocalReuseReg(ir);
    } else {
      reIndexLocalDirect(ir);
    }
  }
  
  private void reIndexLocalDirect(IrMethod ir)
  {
    int index = 0;
    if ((access & 0x8) == 0) {
      index++;
    }
    final int[] ids = new int[args.length];
    for (int i = 0; i < args.length; i++)
    {
      ids[i] = index;
      index += args[i].getSize();
    }
    for (Local local : locals) {
      _ls_index = -1;
    }
    final int[] indexHolder = { index };
    Cfg.createCFG(ir);
    Cfg.Forward(ir, new Cfg.StmtVisitor()
    {
      public Object exec(Stmt stmt)
      {
        switch (st)
        {
        case ASSIGN: 
        case IDENTITY: 
          if (op1.value.vt == Value.VT.LOCAL)
          {
            Local local = (Local)op1.value;
            if (_ls_index == -1)
            {
              Type localType = LocalType.typeOf(local);
              if (!Type.VOID_TYPE.equals(localType))
              {
                Value ref = op2.value;
                switch (vt)
                {
                case SUB: 
                  _ls_index = 0;
                  break;
                case OR: 
                  _ls_index = ids[parameterIndex];
                  break;
                case FIELD: 
                  int tmp186_185 = 0; int[] tmp186_182 = indexHolder; int tmp188_187 = tmp186_182[tmp186_185];tmp186_182[tmp186_185] = (tmp188_187 + 1);_ls_index = tmp188_187;
                  break;
                default: 
                  _ls_index = indexHolder[0];
                  indexHolder[0] += LocalType.typeOf(ref).getSize();
                }
              }
            }
          }
          break;
        }
        return null;
      }
    });
  }
  
  public void convert(IrMethod ir, MethodVisitor asm)
  {
    reIndexLocal(ir);
    reIndexStmts(ir);
    reBuildInstructions(ir, asm);
    reBuildTryCatchBlocks(ir, asm);
    reBuildLocalVar(ir, asm);
  }
  
  private void reBuildTryCatchBlocks(IrMethod ir, MethodVisitor asm)
  {
    for (Trap trap : traps)
    {
      boolean needAdd = false;
      for (Stmt p = start.getNext(); (p != null) && (p != end); p = p.getNext()) {
        if (st != Stmt.ST.LABEL)
        {
          needAdd = true;
          break;
        }
      }
      if (needAdd) {
        for (int i = 0; i < handlers.length; i++)
        {
          Type type = types[i];
          asm.visitTryCatchBlock(start.label, end.label, handlers[i].label, 
            type == null ? null : type.getInternalName());
        }
      }
    }
  }
  
  private void reIndexStmts(IrMethod ir)
  {
    int count = 0;
    for (Stmt st : stmts)
    {
      id = count;
      count++;
    }
  }
  
  private void reBuildInstructions(IrMethod ir, MethodVisitor asm)
  {
    Map<String, Integer> lockMap = new HashMap();
    int maxLocalIndex;
    int maxLocalIndex;
    if (locals.size() == 0)
    {
      maxLocalIndex = 0;
    }
    else
    {
      Local maxLoale = (Local)Collections.max(locals, new Comparator()
      {
        public int compare(Local o1, Local o2)
        {
          int i = _ls_index - _ls_index;
          if (i != 0) {
            return i;
          }
          Type t1 = LocalType.typeOf(o1);
          if (t1 == null) {
            return -1;
          }
          Type t2 = LocalType.typeOf(o2);
          if (t2 == null) {
            return 1;
          }
          return t1.getSize() - t2.getSize();
        }
      });
      int maxLocalIndex;
      if ((maxLoale == null) || (_ls_index < 0)) {
        maxLocalIndex = 0;
      } else {
        maxLocalIndex = _ls_index + LocalType.typeOf(maxLoale).getSize() - 1;
      }
    }
    for (Stmt st : stmts) {
      switch (st)
      {
      case LABEL: 
        LabelStmt labelStmt = (LabelStmt)st;
        asm.visitLabel(label);
        if (lineNumber >= 0) {
          asm.visitLineNumber(lineNumber, label);
        }
        break;
      case ASSIGN: 
        Stmt.E2Stmt e2 = (Stmt.E2Stmt)st;
        Value v1 = op1.value;
        Value v2 = op2.value;
        switch (vt)
        {
        case LENGTH: 
          Local local = (Local)v1;
          int i = _ls_index;
          if ((vt != Value.VT.LOCAL) || (i != _ls_index))
          {
            boolean skipOrg = false;
            if (LocalType.typeOf(v1).equals(Type.INT_TYPE)) {
              if (vt == Value.VT.ADD)
              {
                Value.E2Expr e = (Value.E2Expr)v2;
                if (((op1.value == local) && (op2.value.vt == Value.VT.CONSTANT)) || (
                  (op2.value == local) && (op1.value.vt == Value.VT.CONSTANT)))
                {
                  int increment = ((Integer)op1.value == local ? op2.value : op1.value)).value).intValue();
                  if ((increment >= 32768) && (increment <= 32767))
                  {
                    asm.visitIincInsn(i, increment);
                    skipOrg = true;
                  }
                }
              }
              else if (vt == Value.VT.SUB)
              {
                Value.E2Expr e = (Value.E2Expr)v2;
                if ((op1.value == local) && (op2.value.vt == Value.VT.CONSTANT))
                {
                  int increment = -((Integer)op2.value).value).intValue();
                  if ((increment >= 32768) && (increment <= 32767))
                  {
                    asm.visitIincInsn(i, increment);
                    skipOrg = true;
                  }
                }
              }
            }
            if (!skipOrg)
            {
              accept(v2, asm);
              if (i >= 0)
              {
                if (_ls_read_count == 0) {
                  asm.visitInsn(LocalType.typeOf(v1).getSize() == 2 ? 88 : 87);
                } else {
                  asm.visitVarInsn(LocalType.typeOf(v1).getOpcode(54), i);
                }
              }
              else if (!LocalType.typeOf(v1).equals(Type.VOID_TYPE)) {
                asm.visitInsn(LocalType.typeOf(v1).getSize() == 2 ? 88 : 87);
              }
            }
          }
          break;
        case FILLED_ARRAY: 
          FieldExpr fe = (FieldExpr)v1;
          if (op == null)
          {
            accept(v2, asm);
            insertI2x(LocalType.typeOf(v2), fieldType, asm);
            asm.visitFieldInsn(179, fieldOwnerType.getInternalName(), fieldName, 
              fieldType.getDescriptor());
          }
          else
          {
            accept(op.value, asm);
            accept(v2, asm);
            insertI2x(LocalType.typeOf(v2), fieldType, asm);
            asm.visitFieldInsn(181, fieldOwnerType.getInternalName(), fieldName, 
              fieldType.getDescriptor());
          }
          break;
        case ARRAY: 
          ArrayExpr ae = (ArrayExpr)v1;
          accept(op1.value, asm);
          accept(op2.value, asm);
          accept(v2, asm);
          Type tp1 = LocalType.typeOf(op1.value);
          Type tp2 = LocalType.typeOf(ae);
          if (tp1.getSort() == 9)
          {
            Type arrayElementType = Type.getType(tp1.getDescriptor().substring(1));
            insertI2x(LocalType.typeOf(v2), arrayElementType, asm);
            asm.visitInsn(arrayElementType.getOpcode(79));
          }
          else
          {
            asm.visitInsn(tp2.getOpcode(79));
          }
          break;
        }
        break;
      case IDENTITY: 
        Stmt.E2Stmt e2 = (Stmt.E2Stmt)st;
        if (op2.value.vt == Value.VT.EXCEPTION_REF)
        {
          int index = op1.value)._ls_index;
          if (index >= 0) {
            asm.visitVarInsn(58, index);
          } else {
            asm.visitInsn(87);
          }
        }
        break;
      case GOTO: 
        asm.visitJumpInsn(167, target.label);
        break;
      case IF: 
        reBuildJumpInstructions((JumpStmt)st, asm);
        break;
      case LOCK: 
        Value v = op.value;
        accept(v, asm);
        if (optimizeSynchronized) {
          switch (vt)
          {
          case EXCEPTION_REF: 
          case LENGTH: 
            String key;
            String key;
            if (vt == Value.VT.LOCAL) {
              key = "L" + _ls_index;
            } else {
              key = "C" + value;
            }
            Integer integer = (Integer)lockMap.get(key);
            maxLocalIndex++;int nIndex = integer != null ? integer.intValue() : maxLocalIndex;
            asm.visitInsn(89);
            asm.visitVarInsn(LocalType.typeOf(v).getOpcode(54), nIndex);
            lockMap.put(key, Integer.valueOf(nIndex));
            
            break;
          default: 
            throw new RuntimeException();
          }
        }
        asm.visitInsn(194);
        
        break;
      case UNLOCK: 
        Value v = op.value;
        if (optimizeSynchronized) {
          switch (vt)
          {
          case EXCEPTION_REF: 
          case LENGTH: 
            String key;
            String key;
            if (vt == Value.VT.LOCAL) {
              key = "L" + _ls_index;
            } else {
              key = "C" + value;
            }
            Integer integer = (Integer)lockMap.get(key);
            if (integer != null) {
              asm.visitVarInsn(LocalType.typeOf(v).getOpcode(21), integer.intValue());
            } else {
              accept(v, asm);
            }
            break;
          default: 
            accept(v, asm);
            break;
          }
        } else {
          accept(v, asm);
        }
        asm.visitInsn(195);
        
        break;
      case NOP: 
        break;
      case RETURN: 
        Value v = op.value;
        accept(v, asm);
        insertI2x(LocalType.typeOf(v), ret, asm);
        asm.visitInsn(LocalType.typeOf(v).getOpcode(172));
        
        break;
      case RETURN_VOID: 
        asm.visitInsn(177);
        break;
      case LOOKUP_SWITCH: 
        LookupSwitchStmt lss = (LookupSwitchStmt)st;
        accept(op.value, asm);
        Label[] targets = new Label[targets.length];
        for (int i = 0; i < targets.length; i++) {
          targets[i] = targets[i].label;
        }
        asm.visitLookupSwitchInsn(defaultTarget.label, lookupValues, targets);
        
        break;
      case TABLE_SWITCH: 
        TableSwitchStmt tss = (TableSwitchStmt)st;
        accept(op.value, asm);
        Label[] targets = new Label[targets.length];
        for (int i = 0; i < targets.length; i++) {
          targets[i] = targets[i].label;
        }
        asm.visitTableSwitchInsn(lowIndex, highIndex, defaultTarget.label, targets);
        
        break;
      case THROW: 
        accept(op.value, asm);
        asm.visitInsn(191);
      }
    }
  }
  
  private static void insertI2x(Type tos, Type expect, MethodVisitor mv)
  {
    switch (expect.getSort())
    {
    case 3: 
      switch (tos.getSort())
      {
      case 2: 
      case 4: 
      case 5: 
        mv.visitInsn(145);
      }
      break;
    case 4: 
      switch (tos.getSort())
      {
      case 2: 
      case 5: 
        mv.visitInsn(147);
      }
      break;
    case 2: 
      switch (tos.getSort())
      {
      case 5: 
        mv.visitInsn(146);
      }
      break;
    }
  }
  
  private void reBuildJumpInstructions(JumpStmt st, MethodVisitor asm)
  {
    Label target = target.label;
    Value v = op.value;
    Value v1 = op1.value;
    Value v2 = op2.value;
    
    Type type = LocalType.typeOf(v1);
    switch (type.getSort())
    {
    case 1: 
    case 2: 
    case 3: 
    case 4: 
    case 5: 
      if (((vt == Value.VT.CONSTANT) && (value.equals(new Integer(0)))) || (
        (vt == Value.VT.CONSTANT) && (value.equals(new Integer(0))))) {
        if ((vt == Value.VT.CONSTANT) && (value.equals(new Integer(0)))) {
          accept(v1, asm);
        } else {
          accept(v2, asm);
        }
      }
      switch (vt)
      {
      case MUL: 
        asm.visitJumpInsn(154, target);
        break;
      case FCMPL: 
        asm.visitJumpInsn(153, target);
        break;
      case GE: 
        asm.visitJumpInsn(156, target);
        break;
      case GT: 
        asm.visitJumpInsn(157, target);
        break;
      case LCMP: 
        asm.visitJumpInsn(158, target);
        break;
      case LOCAL: 
        asm.visitJumpInsn(155, target);
      default: 
        break;accept(v1, asm);
        accept(v2, asm);
        switch (vt)
        {
        case MUL: 
          asm.visitJumpInsn(160, target);
          break;
        case FCMPL: 
          asm.visitJumpInsn(159, target);
          break;
        case GE: 
          asm.visitJumpInsn(162, target);
          break;
        case GT: 
          asm.visitJumpInsn(163, target);
          break;
        case LCMP: 
          asm.visitJumpInsn(164, target);
          break;
        case LOCAL: 
          asm.visitJumpInsn(161, target);
        }
        break;
      }
      break;
    case 9: 
    case 10: 
      if (((vt == Value.VT.CONSTANT) && (value.equals(Constant.Null))) || (
        (vt == Value.VT.CONSTANT) && (value.equals(Constant.Null))))
      {
        if ((vt == Value.VT.CONSTANT) && (value.equals(Constant.Null))) {
          accept(v1, asm);
        } else {
          accept(v2, asm);
        }
        asm.visitJumpInsn(vt == Value.VT.EQ ? 198 : 199, target);
      }
      else
      {
        accept(v1, asm);
        accept(v2, asm);
        asm.visitJumpInsn(vt == Value.VT.EQ ? 165 : 166, target);
      }
      break;
    }
  }
  
  private void reBuildLocalVar(IrMethod ir, MethodVisitor asm)
  {
    for (LocalVar vs : vars)
    {
      if (reg.value.vt != Value.VT.LOCAL) {
        throw new DexException("the reg in LocalVar is not a Local");
      }
      if (start.id <= end.id) {
        asm.visitLocalVariable(name, type, signature, start.label, end.label, 
          reg.value)._ls_index);
      } else {
        asm.visitLocalVariable(name, type, signature, end.label, start.label, 
          reg.value)._ls_index);
      }
    }
  }
  
  private static void accept(Value value, MethodVisitor asm)
  {
    switch (et)
    {
    case E0: 
      switch (vt)
      {
      case LENGTH: 
        asm.visitVarInsn(LocalType.typeOf(value).getOpcode(21), _ls_index);
        break;
      case EXCEPTION_REF: 
        Constant cst = (Constant)value;
        if (value.equals(Constant.Null)) {
          asm.visitInsn(1);
        } else {
          asm.visitLdcInsn(value);
        }
        break;
      case NEG: 
        asm.visitTypeInsn(187, type.getInternalName());
      }
      break;
    case E1: 
      reBuildE1Expression((Value.E1Expr)value, asm);
      break;
    case E2: 
      reBuildE2Expression((Value.E2Expr)value, asm);
      break;
    case En: 
      reBuildEnExpression((Value.EnExpr)value, asm);
    }
  }
  
  private static void reBuildEnExpression(Value.EnExpr value, MethodVisitor asm)
  {
    TypeExpr te;
    Type tp1;
    int xastore;
    if (vt == Value.VT.FILLED_ARRAY)
    {
      FilledArrayExpr fae = (FilledArrayExpr)value;
      te = Exprs.nNewArray(type, Constant.nInt(ops.length));
      reBuildE1Expression(te, asm);
      tp1 = LocalType.typeOf(fae);
      xastore = 79;
      Type elementType = null;
      if (tp1.getSort() == 9)
      {
        elementType = Type.getType(tp1.getDescriptor().substring(1));
        xastore = elementType.getOpcode(79);
      }
      for (int i = 0; i < ops.length; i++) {
        if (ops[i].value != null)
        {
          asm.visitInsn(89);
          asm.visitLdcInsn(Integer.valueOf(i));
          accept(ops[i].value, asm);
          Type tp2 = LocalType.typeOf(ops[i].value);
          if (elementType != null) {
            insertI2x(tp2, elementType, asm);
          }
          asm.visitInsn(xastore);
        }
      }
      return;
    }
    switch (vt)
    {
    case NEW_ARRAY: 
      tp1 = (xastore = ops).length;
      for (te = 0; te < tp1; te++)
      {
        ValueBox vb = xastore[te];
        accept(value, asm);
      }
      NewMutiArrayExpr nmae = (NewMutiArrayExpr)value;
      StringBuilder sb = new StringBuilder();
      for (int i = 0; i < dimension; i++) {
        sb.append('[');
      }
      sb.append(baseType.getDescriptor());
      asm.visitMultiANewArrayInsn(sb.toString(), dimension);
      break;
    case INVOKE_NEW: 
      asm.visitTypeInsn(187, methodOwnerType.getInternalName());
      asm.visitInsn(89);
    case INVOKE_INTERFACE: 
    case INVOKE_SPECIAL: 
    case INVOKE_STATIC: 
    case INVOKE_VIRTUAL: 
      InvokeExpr ie = (InvokeExpr)value;
      int i = 0;
      if ((vt != Value.VT.INVOKE_STATIC) && (vt != Value.VT.INVOKE_NEW))
      {
        i = 1;
        accept(ops[0].value, asm);
      }
      for (int j = 0; i < ops.length; j++)
      {
        ValueBox vb = ops[i];
        accept(value, asm);
        insertI2x(LocalType.typeOf(value), argmentTypes[j], asm);i++;
      }
      int opcode;
      int opcode;
      int opcode;
      int opcode;
      int opcode;
      switch (vt)
      {
      case INVOKE_VIRTUAL: 
        opcode = 182;
        break;
      case INVOKE_INTERFACE: 
        opcode = 185;
        break;
      case INVOKE_NEW: 
      case INVOKE_SPECIAL: 
        opcode = 183;
        break;
      case INVOKE_STATIC: 
        opcode = 184;
        break;
      default: 
        opcode = -1;
      }
      asm.visitMethodInsn(opcode, methodOwnerType.getInternalName(), methodName, Type.getMethodDescriptor(
        vt == Value.VT.INVOKE_NEW ? Type.VOID_TYPE : methodReturnType, argmentTypes));
    }
  }
  
  private static void reBuildE1Expression(Value.E1Expr e1, MethodVisitor asm)
  {
    if (op != null) {
      accept(op.value, asm);
    }
    switch (vt)
    {
    case FILLED_ARRAY: 
      FieldExpr fe = (FieldExpr)e1;
      asm.visitFieldInsn(op == null ? 178 : 180, fieldOwnerType.getInternalName(), fieldName, 
        fieldType.getDescriptor());
      break;
    case NEW: 
      TypeExpr te = (TypeExpr)e1;
      switch (type.getSort())
      {
      case 9: 
      case 10: 
        asm.visitTypeInsn(189, type.getInternalName());
        break;
      default: 
        int operand;
        int operand;
        int operand;
        int operand;
        int operand;
        int operand;
        int operand;
        int operand;
        int operand;
        switch (type.getSort())
        {
        case 1: 
          operand = 4;
          break;
        case 3: 
          operand = 8;
          break;
        case 4: 
          operand = 9;
          break;
        case 2: 
          operand = 5;
          break;
        case 5: 
          operand = 10;
          break;
        case 6: 
          operand = 6;
          break;
        case 7: 
          operand = 11;
          break;
        case 8: 
          operand = 7;
          break;
        default: 
          operand = -1;
        }
        asm.visitIntInsn(188, operand);
      }
      break;
    case CHECK_CAST: 
    case INSTANCE_OF: 
      TypeExpr te = (TypeExpr)e1;
      asm.visitTypeInsn(vt == Value.VT.CHECK_CAST ? 192 : 193, type.getInternalName());
      
      break;
    case CAST: 
      CastExpr te = (CastExpr)e1;
      cast2(LocalType.typeOf(op.value), to, asm);
      
      break;
    case LE: 
      asm.visitInsn(190);
      break;
    case NE: 
      asm.visitInsn(LocalType.typeOf(e1).getOpcode(116));
    }
  }
  
  private static void reBuildE2Expression(Value.E2Expr e2, MethodVisitor asm)
  {
    Type type = LocalType.typeOf(op2.value);
    accept(op1.value, asm);
    if (((vt == Value.VT.ADD) || (vt == Value.VT.SUB)) && (op2.value.vt == Value.VT.CONSTANT))
    {
      Constant constant = (Constant)op2.value;
      Type t = LocalType.typeOf(constant);
      switch (t.getSort())
      {
      case 3: 
      case 4: 
      case 5: 
        int s = ((Integer)value).intValue();
        if (s < 0)
        {
          asm.visitLdcInsn(Integer.valueOf(-s));
          asm.visitInsn(type.getOpcode(vt == Value.VT.ADD ? 100 : 96)); return;
        }
        break;
      case 6: 
        float s = ((Float)value).floatValue();
        if (s < 0.0F)
        {
          asm.visitLdcInsn(Float.valueOf(-s));
          asm.visitInsn(type.getOpcode(vt == Value.VT.ADD ? 100 : 96)); return;
        }
        break;
      case 7: 
        long s = ((Long)value).longValue();
        if (s < 0L)
        {
          asm.visitLdcInsn(Long.valueOf(-s));
          asm.visitInsn(type.getOpcode(vt == Value.VT.ADD ? 100 : 96)); return;
        }
        break;
      case 8: 
        double s = ((Double)value).doubleValue();
        if (s < 0.0D)
        {
          asm.visitLdcInsn(Double.valueOf(-s));
          asm.visitInsn(type.getOpcode(vt == Value.VT.ADD ? 100 : 96)); return;
        }
        break;
      }
    }
    accept(op2.value, asm);
    
    Type tp1 = LocalType.typeOf(op1.value);
    switch (vt)
    {
    case ARRAY: 
      Type tp2 = LocalType.typeOf(e2);
      if (tp1.getSort() == 9) {
        asm.visitInsn(Type.getType(tp1.getDescriptor().substring(1)).getOpcode(46));
      } else {
        asm.visitInsn(tp2.getOpcode(46));
      }
      break;
    case ADD: 
      asm.visitInsn(type.getOpcode(96));
      break;
    case SHR: 
      asm.visitInsn(type.getOpcode(100));
      break;
    case FCMPG: 
      asm.visitInsn(type.getOpcode(108));
      break;
    case LT: 
      asm.visitInsn(type.getOpcode(104));
      break;
    case PARAMETER_REF: 
      asm.visitInsn(type.getOpcode(112));
      break;
    case AND: 
      asm.visitInsn(type.getOpcode(126));
      break;
    case NOT: 
      asm.visitInsn(type.getOpcode(128));
      break;
    case USHR: 
      asm.visitInsn(type.getOpcode(130));
      break;
    case REM: 
      asm.visitInsn(tp1.getOpcode(120));
      break;
    case SHL: 
      asm.visitInsn(tp1.getOpcode(122));
      break;
    case THIS_REF: 
      asm.visitInsn(tp1.getOpcode(124));
      break;
    case CONSTANT: 
      asm.visitInsn(148);
      break;
    case DCMPG: 
      asm.visitInsn(150);
      break;
    case DIV: 
      asm.visitInsn(152);
      break;
    case DCMPL: 
      asm.visitInsn(149);
      break;
    case EQ: 
      asm.visitInsn(151);
    }
  }
  
  private static void cast2(Type t1, Type t2, MethodVisitor asm)
  {
    if (t1.equals(t2)) {
      return;
    }
    switch (t1.getSort())
    {
    case 1: 
    case 2: 
    case 3: 
    case 4: 
      t1 = Type.INT_TYPE;
    }
    int opcode;
    int opcode;
    int opcode;
    int opcode;
    int opcode;
    int opcode;
    int opcode;
    int opcode;
    int opcode;
    int opcode;
    int opcode;
    int opcode;
    int opcode;
    int opcode;
    int opcode;
    int opcode;
    switch (t1.getSort() * 10 + t2.getSort())
    {
    case 56: 
      opcode = 134;
      break;
    case 57: 
      opcode = 133;
      break;
    case 58: 
      opcode = 135;
      break;
    case 52: 
      opcode = 146;
      break;
    case 53: 
      opcode = 145;
      break;
    case 54: 
      opcode = 147;
      break;
    case 75: 
      opcode = 136;
      break;
    case 76: 
      opcode = 137;
      break;
    case 78: 
      opcode = 138;
      break;
    case 65: 
      opcode = 139;
      break;
    case 67: 
      opcode = 140;
      break;
    case 68: 
      opcode = 141;
      break;
    case 85: 
      opcode = 142;
      break;
    case 86: 
      opcode = 144;
      break;
    case 87: 
      opcode = 143;
      break;
    case 55: 
    case 59: 
    case 60: 
    case 61: 
    case 62: 
    case 63: 
    case 64: 
    case 66: 
    case 69: 
    case 70: 
    case 71: 
    case 72: 
    case 73: 
    case 74: 
    case 77: 
    case 79: 
    case 80: 
    case 81: 
    case 82: 
    case 83: 
    case 84: 
    default: 
      opcode = -1;
    }
    if (opcode == -1) {
      throw new DexException("can't cast %s to %s", new Object[] { t1, t2 });
    }
    asm.visitInsn(opcode);
  }
}

/* Location:
 * Qualified Name:     com.googlecode.dex2jar.v3.IrMethod2AsmMethod
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.googlecode.dex2jar.v3;

import com.googlecode.dex2jar.visitors.DexAnnotationAble;
import com.googlecode.dex2jar.visitors.DexAnnotationVisitor;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.tree.MethodNode;

class V3MethodAdapter$1
  implements DexAnnotationAble
{
  V3MethodAdapter$1(V3MethodAdapter paramV3MethodAdapter, int paramInt) {}
  
  public DexAnnotationVisitor visitAnnotation(String name, boolean visible)
  {
    AnnotationVisitor av = this$0.methodNode.visitParameterAnnotation(val$index, name, visible);
    if (av != null) {
      return new Dex2AsmAnnotationAdapter(av);
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     com.googlecode.dex2jar.v3.V3MethodAdapter.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.googlecode.dex2jar.v3;

import com.googlecode.dex2jar.util.Out;
import java.io.PrintWriter;

class DexExceptionHandlerImpl$1
  implements Out
{
  DexExceptionHandlerImpl$1(DexExceptionHandlerImpl paramDexExceptionHandlerImpl, PrintWriter paramPrintWriter) {}
  
  public void pop() {}
  
  public void push() {}
  
  public void s(String s)
  {
    val$fw.println(s);
  }
  
  public void s(String format, Object... arg)
  {
    val$fw.println(String.format(format, arg));
  }
}

/* Location:
 * Qualified Name:     com.googlecode.dex2jar.v3.DexExceptionHandlerImpl.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.googlecode.dex2jar.v3;

import com.googlecode.dex2jar.Method;
import com.googlecode.dex2jar.ir.IrMethod;
import org.objectweb.asm.tree.MethodNode;

public abstract interface DexExceptionHandler
{
  public abstract void handleFileException(Exception paramException);
  
  public abstract void handleMethodTranslateException(Method paramMethod, IrMethod paramIrMethod, MethodNode paramMethodNode, Exception paramException);
}

/* Location:
 * Qualified Name:     com.googlecode.dex2jar.v3.DexExceptionHandler
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.googlecode.dex2jar.v3;

import com.googlecode.dex2jar.visitors.DexAnnotationVisitor;
import com.googlecode.dex2jar.visitors.EmptyVisitor;

class V3ClassAdapter$1
  extends EmptyVisitor
{
  V3ClassAdapter$1(V3ClassAdapter paramV3ClassAdapter) {}
  
  public DexAnnotationVisitor visitAnnotation(String name, String desc)
  {
  
1 2 3 4

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd