dex-ir-1.12

16:35:18.818 INFO  jd.cli.Main - Decompiling dex-ir-1.12.jar
package com.googlecode.dex2jar.ir;

public enum Value$VT
{
  ADD("+"),  AND("&"),  ARRAY,  CAST,  CHECK_CAST,  LCMP,  FCMPG,  FCMPL,  DCMPG,  DCMPL,  CONSTANT,  DIV("/"),  EQ("=="),  EXCEPTION_REF,  FIELD,  GE(
    ">="),  GT(">"),  INSTANCE_OF,  INVOKE_INTERFACE,  INVOKE_NEW,  INVOKE_SPECIAL,  INVOKE_STATIC,  INVOKE_VIRTUAL,  LE("<="),  LENGTH,  LOCAL,  LT("<"),  MUL("*"),  NE("!="),  NEG,  NEW,  NEW_ARRAY,  NEW_MUTI_ARRAY,  NOT,  OR("|"),  PARAMETER_REF,  REM("%"),  SHL("<<"),  SHR(">>"),  SUB("-"),  THIS_REF,  USHR(
    ">>>"),  XOR("^"),  FILLED_ARRAY;
  
  private String name;
  
  private Value$VT()
  {
    this(null);
  }
  
  private Value$VT(String name)
  {
    this.name = name;
  }
  
  public String toString()
  {
    return name == null ? super.toString() : name;
  }
}

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

public abstract class Value$E2Expr
  extends Value
{
  public ValueBox op1;
  public ValueBox op2;
  
  public Value$E2Expr(Value.VT vt, ValueBox op1, ValueBox op2)
  {
    super(vt, ET.E2);
    this.op1 = op1;
    this.op2 = op2;
  }
}

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

public enum ET
{
  E0,  E1,  E2,  En;
}

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

import com.googlecode.dex2jar.ir.stmt.StmtList;
import java.util.ArrayList;
import java.util.List;
import org.objectweb.asm.Type;

public class IrMethod
{
  public int access;
  public Type[] args;
  public List<Local> locals = new ArrayList();
  public String name;
  public Type owner;
  public Type ret;
  public StmtList stmts = new StmtList();
  public List<Trap> traps = new ArrayList();
  public List<LocalVar> vars = new ArrayList();
  
  public String toString()
  {
    StringBuilder sb = new StringBuilder();
    sb.append("// ").append(owner == null ? null : owner.getClassName()).append("\n");
    sb.append(ToStringUtil.getAccDes(access)).append(ret == null ? null : ToStringUtil.toShortClassName(ret))
      .append(' ').append(name).append('(');
    Type arg;
    if (args != null)
    {
      boolean first = true;
      Type[] arrayOfType;
      int j = (arrayOfType = args).length;
      for (int i = 0; i < j; i++)
      {
        arg = arrayOfType[i];
        if (first) {
          first = false;
        } else {
          sb.append(',');
        }
        sb.append(ToStringUtil.toShortClassName(arg));
      }
    }
    sb.append(") {\n\n").append(stmts).append("\n");
    if ((traps.size() > 0) || (vars.size() > 0))
    {
      sb.append("=============\n");
      for (Trap trap : traps) {
        sb.append(trap).append('\n');
      }
      for (LocalVar var : vars) {
        sb.append(var).append('\n');
      }
    }
    sb.append("}");
    return sb.toString();
  }
}

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

public class Local
  extends Value.E0Expr
{
  public int _ls_index;
  public int _ls_read_count;
  public ValueBox _ls_vb;
  public int _ls_write_count;
  public String name;
  
  public Local(String name)
  {
    super(Value.VT.LOCAL);
    this.name = name;
  }
  
  public Value clone()
  {
    return this;
  }
  
  public String toString()
  {
    return name;
  }
}

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

import com.googlecode.dex2jar.ir.stmt.LabelStmt;
import java.util.Map;

public class LocalVar
{
  public LabelStmt start;
  public LabelStmt end;
  public String name;
  public String type;
  public String signature;
  public ValueBox reg;
  
  public LocalVar(String name, String type, String signature, LabelStmt start, LabelStmt end, ValueBox reg)
  {
    this.name = name;
    this.start = start;
    this.end = end;
    this.type = type;
    this.signature = signature;
    this.reg = reg;
  }
  
  public LocalVar clone(Map<LabelStmt, LabelStmt> map)
  {
    return new LocalVar(name, type, signature, start.clone(map), end.clone(map), new ValueBox(reg.value.clone()));
  }
  
  public String toString()
  {
    return String.format(".var %s ~ %s %s -> %s //%s", new Object[] { start.getDisplayName(), end.getDisplayName(), reg, name, 
      type });
  }
}

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

public abstract class Value$EnExpr
  extends Value
{
  public ValueBox[] ops;
  
  public Value$EnExpr(Value.VT vt, ValueBox[] ops)
  {
    super(vt, ET.En);
    this.ops = ops;
  }
}

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

import org.objectweb.asm.Type;
import org.objectweb.asm.util.AbstractVisitor;

public class Constant
  extends Value.E0Expr
{
  public static final Object Null = new Object();
  public static Type STRING = Type.getType(String.class);
  public Type type;
  public Object value;
  
  public static Constant n(Type type, Object value)
  {
    return new Constant(type, value);
  }
  
  public static Constant nByte(byte i)
  {
    return new Constant(Type.BYTE_TYPE, Byte.valueOf(i));
  }
  
  public static Constant nChar(char i)
  {
    return new Constant(Type.CHAR_TYPE, Character.valueOf(i));
  }
  
  public static Constant nClass(Type clz)
  {
    return new Constant(Type.getType("Ljava/lang/Class;"), clz);
  }
  
  public static Constant nDouble(double i)
  {
    return new Constant(Type.DOUBLE_TYPE, Double.valueOf(i));
  }
  
  public static Constant nFloat(float i)
  {
    return new Constant(Type.FLOAT_TYPE, Float.valueOf(i));
  }
  
  public static Constant nInt(int i)
  {
    return new Constant(Type.INT_TYPE, Integer.valueOf(i));
  }
  
  public static Constant nLong(long i)
  {
    return new Constant(Type.LONG_TYPE, Long.valueOf(i));
  }
  
  public static Constant nNull()
  {
    return new Constant(Null);
  }
  
  public static Constant nShort(short i)
  {
    return new Constant(Type.SHORT_TYPE, Short.valueOf(i));
  }
  
  public static Constant nString(String i)
  {
    return new Constant(STRING, i);
  }
  
  public Constant(Object value)
  {
    super(Value.VT.CONSTANT);
    this.value = value;
  }
  
  public Constant(Type type, Object value)
  {
    super(Value.VT.CONSTANT);
    this.value = value;
    this.type = type;
  }
  
  public Value clone()
  {
    return new Constant(type, value);
  }
  
  public String toString()
  {
    if (Null == value) {
      return "null";
    }
    if (value == null) {
      return "NULL";
    }
    if ((value instanceof Number))
    {
      if ((value instanceof Float)) {
        return value.toString() + "F";
      }
      if ((value instanceof Long)) {
        return value.toString() + "L";
      }
      return value.toString();
    }
    if ((value instanceof String))
    {
      StringBuffer buf = new StringBuffer();
      AbstractVisitor.appendString(buf, (String)value);
      return buf.toString();
    }
    if (type.equals(Type.getType(Class.class))) {
      return ToStringUtil.toShortClassName((Type)value) + ".class";
    }
    return (String)value;
  }
}

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

import org.objectweb.asm.Type;

public class ToStringUtil
{
  public static String getAccDes(int acc)
  {
    StringBuilder sb = new StringBuilder();
    if ((acc & 0x1) != 0) {
      sb.append("public ");
    }
    if ((acc & 0x4) != 0) {
      sb.append("protected ");
    }
    if ((acc & 0x2) != 0) {
      sb.append("private ");
    }
    if ((acc & 0x8) != 0) {
      sb.append("static ");
    }
    if (((acc & 0x400) != 0) && ((acc & 0x200) == 0)) {
      sb.append("abstract ");
    }
    if ((acc & 0x2000) != 0) {
      sb.append("annotation ");
    }
    if ((acc & 0x40) != 0) {
      sb.append("bridge ");
    }
    if ((acc & 0x20000) != 0) {
      sb.append("deprecated ");
    }
    if ((acc & 0x4000) != 0) {
      sb.append("enum ");
    }
    if ((acc & 0x10) != 0) {
      sb.append("final ");
    }
    if ((acc & 0x200) != 0) {
      sb.append("interace ");
    }
    if ((acc & 0x100) != 0) {
      sb.append("native ");
    }
    if ((acc & 0x800) != 0) {
      sb.append("strict ");
    }
    if ((acc & 0x20) != 0) {
      sb.append("synchronized ");
    }
    if ((acc & 0x80) != 0) {
      sb.append("transient ");
    }
    if ((acc & 0x80) != 0) {
      sb.append("varargs ");
    }
    if ((acc & 0x40) != 0) {
      sb.append("volatile ");
    }
    return sb.toString();
  }
  
  public static String toShortClassName(Type t)
  {
    String cn = t.getClassName();
    int i = cn.lastIndexOf('.');
    return i > 0 ? cn.substring(i + 1) : cn;
  }
}

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

import org.objectweb.asm.Type;

public abstract class Value
  implements Cloneable
{
  public TypeRef typeRef;
  public final ET et;
  public final VT vt;
  
  public static abstract class E0Expr
    extends Value
  {
    public E0Expr(Value.VT vt)
    {
      super(ET.E0);
    }
  }
  
  public static abstract class E1Expr
    extends Value
  {
    public ValueBox op;
    
    public E1Expr(Value.VT vt, ValueBox op)
    {
      super(ET.E1);
      this.op = op;
    }
  }
  
  public static abstract class E2Expr
    extends Value
  {
    public ValueBox op1;
    public ValueBox op2;
    
    public E2Expr(Value.VT vt, ValueBox op1, ValueBox op2)
    {
      super(ET.E2);
      this.op1 = op1;
      this.op2 = op2;
    }
  }
  
  public static abstract class EnExpr
    extends Value
  {
    public ValueBox[] ops;
    
    public EnExpr(Value.VT vt, ValueBox[] ops)
    {
      super(ET.En);
      this.ops = ops;
    }
  }
  
  public static abstract interface TypeRef
  {
    public abstract Type get();
  }
  
  public static enum VT
  {
    ADD("+"),  AND("&"),  ARRAY,  CAST,  CHECK_CAST,  LCMP,  FCMPG,  FCMPL,  DCMPG,  DCMPL,  CONSTANT,  DIV("/"),  EQ("=="),  EXCEPTION_REF,  FIELD,  GE(
      ">="),  GT(">"),  INSTANCE_OF,  INVOKE_INTERFACE,  INVOKE_NEW,  INVOKE_SPECIAL,  INVOKE_STATIC,  INVOKE_VIRTUAL,  LE("<="),  LENGTH,  LOCAL,  LT("<"),  MUL("*"),  NE("!="),  NEG,  NEW,  NEW_ARRAY,  NEW_MUTI_ARRAY,  NOT,  OR("|"),  PARAMETER_REF,  REM("%"),  SHL("<<"),  SHR(">>"),  SUB("-"),  THIS_REF,  USHR(
      ">>>"),  XOR("^"),  FILLED_ARRAY;
    
    private String name;
    
    private VT()
    {
      this(null);
    }
    
    private VT(String name)
    {
      this.name = name;
    }
    
    public String toString()
    {
      return name == null ? super.toString() : name;
    }
  }
  
  protected Value(VT vt, ET et)
  {
    this.vt = vt;
    this.et = et;
  }
  
  public abstract Value clone();
}

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

import java.util.HashSet;
import java.util.Set;

public class BaseLiveAnalyze$Phi
{
  public Set<Phi> parents = new HashSet(3);
  public Set<Phi> children = new HashSet(3);
  public boolean used;
  
  public String toString()
  {
    return ".";
  }
}

/* Location:
 * Qualified Name:     com.googlecode.dex2jar.ir.ts.BaseLiveAnalyze.Phi
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.googlecode.dex2jar.ir.ts;

import com.googlecode.dex2jar.ir.IrMethod;
import com.googlecode.dex2jar.ir.Local;
import com.googlecode.dex2jar.ir.stmt.Stmt;
import com.googlecode.dex2jar.ir.stmt.StmtList;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

public class LiveAnalyze
  extends BaseLiveAnalyze
{
  public static class LivePhi
    extends BaseLiveAnalyze.Phi
  {
    public Local local;
    public BaseLiveAnalyze.Phi tag;
    
    public String toString()
    {
      if (tag != null) {
        return tag.toString();
      }
      if (local != null) {
        return local.toString();
      }
      return "?";
    }
  }
  
  private static LivePhi trim(LivePhi phi)
  {
    while (tag != null) {
      phi = (LivePhi)tag;
    }
    return phi;
  }
  
  public LiveAnalyze(IrMethod method)
  {
    super(method);
  }
  
  protected void onUseLocal(BaseLiveAnalyze.Phi phi, Local local)
  {
    LivePhi phi2 = (LivePhi)phi;
    local = local;
  }
  
  protected BaseLiveAnalyze.Phi newPhi()
  {
    return new LivePhi();
  }
  
  protected void analyzePhi()
  {
    Set<BaseLiveAnalyze.Phi> used = super.markUsed();
    for (BaseLiveAnalyze.Phi x : used)
    {
      LivePhi reg = (LivePhi)x;
      LivePhi a = trim(reg);
      if ((a != reg) && (local != null)) {
        local = local;
      }
      if (parents.size() > 0) {
        for (BaseLiveAnalyze.Phi r : parents)
        {
          LivePhi b = trim((LivePhi)r);
          if (a != b)
          {
            tag = a;
            if (local != null) {
              local = local;
            }
          }
        }
      }
    }
    for (Stmt p = method.stmts.getFirst(); p != null; p = p.getNext())
    {
      frame = (BaseLiveAnalyze.Phi[])_ls_forward_frame;
      if (frame != null) {
        for (int i = 0; i < frame.length; i++)
        {
          BaseLiveAnalyze.Phi r = frame[i];
          if (r != null) {
            if (used) {
              frame[i] = trim((LivePhi)r);
            } else {
              frame[i] = null;
            }
          }
        }
      }
    }
    phis.clear();
    for (Object frame = used.iterator(); ((Iterator)frame).hasNext();)
    {
      BaseLiveAnalyze.Phi x = (BaseLiveAnalyze.Phi)((Iterator)frame).next();
      LivePhi r = (LivePhi)x;
      if ((used) && (tag == null))
      {
        parents.clear();
        phis.add(r);
      }
    }
    used.clear();
    
    List<BaseLiveAnalyze.Phi> nPhis = new ArrayList(phis);
    phis.clear();
    Collections.sort(nPhis, new Comparator()
    {
      public int compare(BaseLiveAnalyze.Phi o1, BaseLiveAnalyze.Phi o2)
      {
        LiveAnalyze.LivePhi a1 = (LiveAnalyze.LivePhi)o1;
        LiveAnalyze.LivePhi a2 = (LiveAnalyze.LivePhi)o2;
        return local._ls_index - local._ls_index;
      }
    });
    phis.addAll(nPhis);
  }
  
  public String toString()
  {
    StringBuilder sb = new StringBuilder();
    for (Stmt stmt = method.stmts.getFirst(); stmt != null; stmt = stmt.getNext())
    {
      BaseLiveAnalyze.Phi[] frame = (BaseLiveAnalyze.Phi[])_ls_forward_frame;
      if (frame != null)
      {
        BaseLiveAnalyze.Phi[] arrayOfPhi1;
        int j = (arrayOfPhi1 = frame).length;
        for (int i = 0; i < j; i++)
        {
          BaseLiveAnalyze.Phi p = arrayOfPhi1[i];
          if (p == null) {
            sb.append('.');
          } else if (used) {
            sb.append('x');
          } else {
            sb.append('?');
          }
        }
        sb.append(" | ");
      }
      sb.append(stmt.toString()).append('\n');
    }
    return sb.toString();
  }
}

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

import com.googlecode.dex2jar.ir.Local;
import java.util.Comparator;

class LiveAnalyze$1
  implements Comparator<BaseLiveAnalyze.Phi>
{
  LiveAnalyze$1(LiveAnalyze paramLiveAnalyze) {}
  
  public int compare(BaseLiveAnalyze.Phi o1, BaseLiveAnalyze.Phi o2)
  {
    LiveAnalyze.LivePhi a1 = (LiveAnalyze.LivePhi)o1;
    LiveAnalyze.LivePhi a2 = (LiveAnalyze.LivePhi)o2;
    return local._ls_index - local._ls_index;
  }
}

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

import com.googlecode.dex2jar.ir.Constant;
import com.googlecode.dex2jar.ir.IrMethod;
import com.googlecode.dex2jar.ir.Local;
import com.googlecode.dex2jar.ir.Value;
import com.googlecode.dex2jar.ir.Value.E0Expr;
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.stmt.LabelStmt;
import com.googlecode.dex2jar.ir.stmt.Stmt;
import com.googlecode.dex2jar.ir.stmt.Stmt.E1Stmt;
import com.googlecode.dex2jar.ir.stmt.Stmt.E2Stmt;
import com.googlecode.dex2jar.ir.stmt.Stmt.EnStmt;
import com.googlecode.dex2jar.ir.stmt.Stmt.ST;
import com.googlecode.dex2jar.ir.stmt.StmtList;
import com.googlecode.dex2jar.ir.stmt.Stmts;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Set;

public class ZeroTransformer
  implements Transformer
{
  static class ZeroAnalyzePhi
    extends BaseLiveAnalyze.Phi
  {
    public Boolean isZero = null;
    public Set<BaseLiveAnalyze.Phi> assignFrom = new HashSet(3);
    public Set<BaseLiveAnalyze.Phi> assignTo = new HashSet(3);
    
    public String toString()
    {
      if (isZero == null) {
        return "?";
      }
      return isZero.booleanValue() ? "Z" : ".";
    }
  }
  
  private static class ZeroAnalyze
    extends BaseLiveAnalyze
  {
    protected BaseLiveAnalyze.Phi newPhi()
    {
      return new ZeroTransformer.ZeroAnalyzePhi();
    }
    
    public String toString()
    {
      StringBuilder sb = new StringBuilder();
      for (Stmt stmt = method.stmts.getFirst(); stmt != null; stmt = stmt.getNext())
      {
        BaseLiveAnalyze.Phi[] frame = (BaseLiveAnalyze.Phi[])_ls_forward_frame;
        if (frame != null)
        {
          BaseLiveAnalyze.Phi[] arrayOfPhi1;
          int j = (arrayOfPhi1 = frame).length;
          for (int i = 0; i < j; i++)
          {
            BaseLiveAnalyze.Phi p = arrayOfPhi1[i];
            if (p == null) {
              sb.append("_");
            } else {
              sb.append(p.toString());
            }
          }
          sb.append(" | ");
        }
        sb.append(stmt.toString()).append('\n');
      }
      return sb.toString();
    }
    
    public ZeroAnalyze(IrMethod irMethod)
    {
      super();
    }
    
    protected void initCFG()
    {
      Cfg.createCFG(method);
    }
    
    protected void onAssignLocal(BaseLiveAnalyze.Phi[] frame, BaseLiveAnalyze.Phi phi, Value value)
    {
      if (vt == Value.VT.CONSTANT)
      {
        ZeroTransformer.ZeroAnalyzePhi zaf = (ZeroTransformer.ZeroAnalyzePhi)phi;
        Constant c = (Constant)value;
        if (((value instanceof Integer)) && (ZeroTransformer.ZERO.equals(value))) {
          isZero = Boolean.TRUE;
        } else {
          isZero = Boolean.FALSE;
        }
      }
      else if (vt == Value.VT.LOCAL)
      {
        Local local = (Local)value;
        ZeroTransformer.ZeroAnalyzePhi zaf1 = (ZeroTransformer.ZeroAnalyzePhi)phi;
        ZeroTransformer.ZeroAnalyzePhi zaf2 = (ZeroTransformer.ZeroAnalyzePhi)frame[_ls_index];
        assignFrom.add(zaf2);
        assignTo.add(zaf1);
      }
      else
      {
        ZeroTransformer.ZeroAnalyzePhi zaf = (ZeroTransformer.ZeroAnalyzePhi)phi;
        isZero = Boolean.FALSE;
      }
    }
    
    protected void analyzePhi()
    {
      super.analyzePhi();
      Queue<BaseLiveAnalyze.Phi> queue = new LinkedList();
      queue.addAll(phis);
      BaseLiveAnalyze.Phi p;
      while (!queue.isEmpty())
      {
        ZeroTransformer.ZeroAnalyzePhi phi = (ZeroTransformer.ZeroAnalyzePhi)queue.poll();
        if (Boolean.FALSE.equals(isZero))
        {
          for (BaseLiveAnalyze.Phi p : children)
          {
            ZeroTransformer.ZeroAnalyzePhi cp = (ZeroTransformer.ZeroAnalyzePhi)p;
            if (isZero == null)
            {
              isZero = Boolean.FALSE;
              queue.add(cp);
            }
          }
          for (??? = assignTo.iterator(); ???.hasNext();)
          {
            p = (BaseLiveAnalyze.Phi)???.next();
            ZeroTransformer.ZeroAnalyzePhi cp = (ZeroTransformer.ZeroAnalyzePhi)p;
            if (isZero == null)
            {
              isZero = Boolean.FALSE;
              queue.add(cp);
            }
          }
        }
      }
      for (BaseLiveAnalyze.Phi p : phis)
      {
        ZeroTransformer.ZeroAnalyzePhi cp = (ZeroTransformer.ZeroAnalyzePhi)p;
        if (isZero == null) {
          isZero = Boolean.TRUE;
        }
      }
    }
  }
  
  private static final Integer ZERO = Integer.valueOf(0);
  
  public void transform(IrMethod irMethod)
  {
    ZeroAnalyze za = new ZeroAnalyze(irMethod);
    za.analyze();
    
    List<Local> locals = locals;
    int localSize = locals.size();
    StmtList stmts = stmts;
    for (Stmt p = stmts.getFirst(); p != null; p = p.getNext())
    {
      BaseLiveAnalyze.Phi[] frame = (BaseLiveAnalyze.Phi[])_ls_forward_frame;
      if ((frame != null) && (_cfg_visited)) {
        switch (et)
        {
        case E0: 
          if ((st == Stmt.ST.LABEL) && 
            (_cfg_froms.size() > 0)) {
            for (int i = 0; i < localSize; i++)
            {
              ZeroAnalyzePhi phi = (ZeroAnalyzePhi)frame[i];
              Local local = (Local)locals.get(i);
              if ((phi != null) && (Boolean.FALSE.equals(isZero))) {
                for (Stmt from : _cfg_froms) {
                  if (needInsertX(from, i)) {
                    insertX(stmts, (LabelStmt)p, from, i, local);
                  }
                }
              }
            }
          }
          break;
        case E1: 
          Stmt.E1Stmt e1 = (Stmt.E1Stmt)p;
          replace(op, frame);
          break;
        case E2: 
          Stmt.E2Stmt e2 = (Stmt.E2Stmt)p;
          if (op1.value.vt != Value.VT.LOCAL) {
            replace(op1, frame);
          }
          replace(op2, frame);
          break;
        case En: 
          Stmt.EnStmt en = (Stmt.EnStmt)p;
          ValueBox[] arrayOfValueBox;
          int j = (arrayOfValueBox = ops).length;
          for (int i = 0; i < j; i++)
          {
            ValueBox vb = arrayOfValueBox[i];
            replace(vb, frame);
          }
        }
      }
    }
  }
  
  private void insertX(StmtList stmts, LabelStmt ls, Stmt p, int index, Local local)
  {
    switch (st)
    {
    case GOTO: 
    case IF: 
    case LOOKUP_SWITCH: 
    case TABLE_SWITCH: 
      stmts.insertBefore(p, Stmts.nAssign(local, Constant.nInt(0)));
    }
  }
  
  private boolean needInsertX(Stmt p, int index)
  {
    BaseLiveAnalyze.Phi[] frame = (BaseLiveAnalyze.Phi[])_ls_forward_frame;
    if (frame == null) {
      return false;
    }
    ZeroAnalyzePhi phi = (ZeroAnalyzePhi)frame[index];
    if ((phi == null) || (isZero == null)) {
      return false;
    }
    return isZero.booleanValue();
  }
  
  private void replace(ValueBox op, BaseLiveAnalyze.Phi[] frame)
  {
    if (op == null) {
      return;
    }
    Value value = value;
    switch (et)
    {
    case E0: 
      Value.E0Expr e0 = (Value.E0Expr)value;
      if (vt == Value.VT.LOCAL)
      {
        Local local = (Local)e0;
        ZeroAnalyzePhi phi = (ZeroAnalyzePhi)frame[_ls_index];
        if (Boolean.TRUE.equals(isZero)) {
          value = Constant.nInt(0);
        }
      }
      break;
    case E1: 
      Value.E1Expr e1 = (Value.E1Expr)value;
      replace(op, frame);
      break;
    case E2: 
      Value.E2Expr e2 = (Value.E2Expr)value;
      replace(op1, frame);
      replace(op2, frame);
      break;
    case En: 
      Value.EnExpr en = (Value.EnExpr)value;
      ValueBox[] arrayOfValueBox;
      int j = (arrayOfValueBox = ops).length;
      for (int i = 0; i < j; i++)
      {
        ValueBox vb = arrayOfValueBox[i];
        replace(vb, frame);
      }
    }
  }
}

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

import com.googlecode.dex2jar.ir.Constant;
import com.googlecode.dex2jar.ir.IrMethod;
import com.googlecode.dex2jar.ir.Value;
import com.googlecode.dex2jar.ir.Value.TypeRef;
import com.googlecode.dex2jar.ir.Value.VT;
import java.io.PrintStream;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.objectweb.asm.Type;

public class LocalType
  implements Transformer
{
  public static Type typeOf(Value local)
  {
    return typeRef == null ? null : typeRef.get();
  }
  
  public void transform(IrMethod irMethod)
  {
    TypeAnalyze ta = new TypeAnalyze(irMethod);
    List<TypeAnalyze.DefTypeRef> refs = ta.analyze();
    for (TypeAnalyze.DefTypeRef ref : refs)
    {
      Type type = null;
      if (providerAs.size() > 0) {
        type = (Type)providerAs.iterator().next();
      }
      if (useAs.size() > 0)
      {
        Type useType = (Type)useAs.iterator().next();
        if (type == null) {
          type = useType;
        } else {
          switch (useType.getSort())
          {
          case 9: 
          case 10: 
            if (type.getSort() != 9) {
              type = useType;
            }
            break;
          case 6: 
          case 8: 
            type = useType;
          }
        }
      }
      if (type == null)
      {
        System.err.println(ref);
      }
      else
      {
        type = type;
        if (value.vt == Value.VT.CONSTANT)
        {
          Constant cst = (Constant)value;
          switch (type.getSort())
          {
          case 9: 
          case 10: 
            if (Integer.valueOf(0).equals(value)) {
              value = Constant.Null;
            }
            break;
          case 6: 
            if (!(value instanceof Float)) {
              value = Float.valueOf(Float.intBitsToFloat(((Number)value).intValue()));
            }
            break;
          case 8: 
            if (!(value instanceof Double)) {
              value = Double.valueOf(Double.longBitsToDouble(((Number)value).longValue()));
            }
            break;
          }
        }
        arrayValues = null;
        arryRoots = null;
        froms = null;
        tos = null;
        providerAs = null;
        tos = null;
        useAs = null;
        value = null;
        sameValues = null;
      }
    }
  }
}

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

import com.googlecode.dex2jar.ir.IrMethod;
import com.googlecode.dex2jar.ir.LocalVar;
import com.googlecode.dex2jar.ir.Trap;
import com.googlecode.dex2jar.ir.stmt.BaseSwitchStmt;
import com.googlecode.dex2jar.ir.stmt.JumpStmt;
import com.googlecode.dex2jar.ir.stmt.LabelStmt;
import com.googlecode.dex2jar.ir.stmt.Stmt;
import com.googlecode.dex2jar.ir.stmt.Stmt.ST;
import com.googlecode.dex2jar.ir.stmt.StmtList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

public class CleanLabel
  implements Transformer
{
  public void transform(IrMethod irMethod)
  {
    Set<LabelStmt> uselabels = new HashSet();
    addTrap(traps, uselabels);
    addVars(vars, uselabels);
    addStmt(stmts, uselabels);
    rmUnused(stmts, uselabels);
  }
  
  private void addVars(List<LocalVar> vars, Set<LabelStmt> uselabels)
  {
    if (vars != null) {
      for (LocalVar var : vars)
      {
        uselabels.add(start);
        uselabels.add(end);
      }
    }
  }
  
  private void rmUnused(StmtList stmts, Set<LabelStmt> uselabels)
  {
    for (Stmt p = stmts.getFirst(); p != null;) {
      if ((st == Stmt.ST.LABEL) && 
        (!uselabels.contains(p)))
      {
        Stmt q = p.getNext();
        stmts.remove(p);
        p = q;
      }
      else
      {
        p = p.getNext();
      }
    }
  }
  
  private void addStmt(StmtList stmts, Set<LabelStmt> labels)
  {
    for (Stmt p = stmts.getFirst(); p != null; p = p.getNext()) {
      if ((p instanceof JumpStmt))
      {
        labels.add(target);
      }
      else if ((p instanceof BaseSwitchStmt))
      {
        BaseSwitchStmt stmt = (BaseSwitchStmt)p;
        labels.add(defaultTarget);
        LabelStmt[] arrayOfLabelStmt;
        int j = (arrayOfLabelStmt = targets).length;
        for (int i = 0; i < j; i++)
        {
          LabelStmt t = arrayOfLabelStmt[i];
          labels.add(t);
        }
      }
    }
  }
  
  private void addTrap(List<Trap> traps, Set<LabelStmt> labels)
  {
    if (traps != null)
    {
      int j;
      int i;
      for (Iterator localIterator = traps.iterator(); localIterator.hasNext(); i < j)
      {
        Trap trap = (Trap)localIterator.next();
        labels.add(start);
        labels.add(end);
        LabelStmt[] arrayOfLabelStmt;
        j = (arrayOfLabelStmt = handlers).length;i = 0; continue;LabelStmt h = arrayOfLabelStmt[i];
        labels.add(h);i++;
      }
    }
  }
}

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

import com.googlecode.dex2jar.ir.IrMethod;
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.ValueBox;
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.E1Stmt;
import com.googlecode.dex2jar.ir.stmt.Stmt.E2Stmt;
import com.googlecode.dex2jar.ir.stmt.StmtList;
import com.googlecode.dex2jar.ir.stmt.TableSwitchStmt;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.Stack;
import java.util.TreeSet;

public class Cfg
{
  private static boolean notThrow(Value s)
  {
    switch (et)
    {
    case E0: 
      switch (vt)
      {
      case EXCEPTION_REF: 
      case LENGTH: 
        return true;
      }
      break;
    case E1: 
      Value.E1Expr e1 = (Value.E1Expr)s;
      switch (vt)
      {
      case CAST: 
      case NE: 
        return notThrow(op.value);
      }
      break;
    case E2: 
      Value.E2Expr e2 = (Value.E2Expr)s;
      switch (vt)
      {
      case ADD: 
      case AND: 
      case CONSTANT: 
      case DCMPG: 
      case DCMPL: 
      case DIV: 
      case EQ: 
      case FCMPL: 
      case GE: 
      case GT: 
      case LCMP: 
      case LOCAL: 
      case LT: 
      case MUL: 
      case NOT: 
      case PARAMETER_REF: 
      case REM: 
      case SHL: 
      case SHR: 
      case THIS_REF: 
      case USHR: 
        return (notThrow(op1.value)) && (notThrow(op2.value));
      }
      break;
    }
    return false;
  }
  
  public static boolean notThrow(Stmt s)
  {
    switch (st)
    {
    case GOTO: 
    case IDENTITY: 
    case LABEL: 
    case NOP: 
    case RETURN_VOID: 
      return true;
    case ASSIGN: 
      Stmt.E2Stmt e2 = (Stmt.E2Stmt)s;
      return (notThrow(op1.value)) && (notThrow(op2.value));
    case IF: 
    case LOOKUP_SWITCH: 
    case RETURN: 
    case TABLE_SWITCH: 
      return notThrow(op.value);
    }
    return false;
  }
  
  public static void createCfgForLiveAnalyze(IrMethod jm)
  {
    for (Stmt st : stmts)
    {
      _ls_forward_frame = null;
      if (_cfg_froms == null) {
        _cfg_froms = new TreeSet(stmts);
      } else {
        _cfg_froms.clear();
      }
      if (_cfg_tos == null) {
        _cfg_tos = new TreeSet(stmts);
      } else {
        _cfg_tos.clear();
      }
    }
    Trap t;
    Stmt s;
    LabelStmt[] arrayOfLabelStmt1;
    int j;
    int i;
    for (??? = traps.iterator(); ???.hasNext(); s != end)
    {
      t = (Trap)???.next();
      s = start; continue;
      j = (arrayOfLabelStmt1 = handlers).length;
      for (i = 0; i < j; i++)
      {
        LabelStmt handler = arrayOfLabelStmt1[i];
        link(s, handler);
      }
      s = s.getNext();
    }
    for (Stmt st : stmts) {
      switch (st)
      {
      case GOTO: 
        link(st, target);
        break;
      case IF: 
        link(st, target);
        link(st, st.getNext());
        break;
      case LOOKUP_SWITCH: 
        LookupSwitchStmt lss = (LookupSwitchStmt)st;
        link(st, defaultTarget);
        j = (arrayOfLabelStmt1 = targets).length;
        for (i = 0; i < j; i++)
        {
          LabelStmt ls = arrayOfLabelStmt1[i];
          link(st, ls);
        }
        break;
      case TABLE_SWITCH: 
        TableSwitchStmt tss = (TableSwitchStmt)st;
        link(st, defaultTarget);
        LabelStmt[] arrayOfLabelStmt2;
        int k = (arrayOfLabelStmt2 = targets).length;
        for (j = 0; j < k; j++)
        {
          LabelStmt ls = arrayOfLabelStmt2[j];
          link(st, ls);
        }
        break;
      case RETURN: 
      case RETURN_VOID: 
      case THROW: 
        break;
      case IDENTITY: 
      case LABEL: 
      case LOCK: 
      case NOP: 
      default: 
        link(st, st.getNext());
      }
    }
  }
  
  public static void createCFG(IrMethod jm)
  {
    for (Stmt st : stmts)
    {
      _ls_forward_frame = null;
      if (_cfg_froms == null) {
        _cfg_froms = new TreeSet(stmts);
      } else {
        _cfg_froms.clear();
      }
      if (_cfg_tos == null) {
        _cfg_tos = new TreeSet(stmts);
      } else {
        _cfg_tos.clear();
      }
    }
    Trap t;
    Stmt s;
    LabelStmt[] arrayOfLabelStmt1;
    int j;
    int i;
    for (??? = traps.iterator(); ???.hasNext(); s != end)
    {
      t = (Trap)???.next();
      s = start.getNext(); continue;
      if (!notThrow(s))
      {
        j = (arrayOfLabelStmt1 = handlers).length;
        for (i = 0; i < j; i++)
        {
          LabelStmt handler = arrayOfLabelStmt1[i];
          link(s.getPre(), handler);
        }
      }
      s = s.getNext();
    }
    for (Stmt st : stmts) {
      switch (st)
      {
      case GOTO: 
        link(st, target);
        break;
      case IF: 
        link(st, target);
        link(st, st.getNext());
        break;
      case LOOKUP_SWITCH: 
        LookupSwitchStmt lss = (LookupSwitchStmt)st;
        link(st, defaultTarget);
        j = (arrayOfLabelStmt1 = targets).length;
        for (i = 0; i < j; i++)
        {
          LabelStmt ls = arrayOfLabelStmt1[i];
          link(st, ls);
        }
        break;
      case TABLE_SWITCH: 
        TableSwitchStmt tss = (TableSwitchStmt)st;
        link(st, defaultTarget);
        LabelStmt[] arrayOfLabelStmt2;
        int k = (arrayOfLabelStmt2 = targets).length;
        for (j = 0; j < k; j++)
        {
          LabelStmt ls = arrayOfLabelStmt2[j];
          link(st, ls);
        }
        break;
      case RETURN: 
      case RETURN_VOID: 
      case THROW: 
        break;
      case IDENTITY: 
      case LABEL: 
      case LOCK: 
      case NOP: 
      default: 
        link(st, st.getNext());
      }
    }
  }
  
  public static <T> void Forward(IrMethod jm, StmtVisitor<T> sv)
  {
    if (stmts.getSize() == 0) {
      return;
    }
    for (Stmt st : stmts) {
      _cfg_visited = false;
    }
    Stack<Stmt> toVisitQueue = new Stack();
    boolean isFv = sv instanceof FrameVisitor;
    FrameVisitor<T> fv = isFv ? (FrameVisitor)sv : null;
    
    toVisitQueue.add(stmts.getFirst());
    while (!toVisitQueue.isEmpty())
    {
      Stmt currentStmt = (Stmt)toVisitQueue.pop();
      if ((currentStmt != null) && (!_cfg_visited))
      {
        _cfg_visited = true;
        
        toVisitQueue.addAll(_cfg_tos);
        
        T afterExecFrame = sv.exec(currentStmt);
        if (isFv) {
          for (Stmt dist : _cfg_tos) {
            fv.merge(afterExecFrame, dist);
          }
        }
      }
    }
  }
  
  private static void link(Stmt from, Stmt to)
  {
    if (to == null) {
      return;
    }
    _cfg_tos.add(to);
    _cfg_froms.add(from);
  }
  
  public static abstract interface FrameVisitor<T>
    extends Cfg.StmtVisitor<T>
  {
    public abstract void merge(T paramT, Stmt paramStmt);
  }
  
  public static abstract interface StmtVisitor<T>
  {
    public abstract T exec(Stmt paramStmt);
  }
}

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

import com.googlecode.dex2jar.ir.stmt.Stmt;
import java.util.Iterator;

class TopologicalSort$Item
{
  public Stmt stmt;
  public Iterator<Stmt> it;
  public boolean visitedAdded = false;
}

/* Location:
 * Qualified Name:     com.googlecode.dex2jar.ir.ts.TopologicalSort.Item
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.googlecode.dex2jar.ir.ts;

import com.googlecode.dex2jar.ir.stmt.Stmt;

public abstract interface Cfg$FrameVisitor<T>
  extends Cfg.StmtVisitor<T>
{
  public abstract void merge(T paramT, Stmt paramStmt);
}

/* Location:
 * Qualified Name:     com.googlecode.dex2jar.ir.ts.Cfg.FrameVisitor
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.googlecode.dex2jar.ir.ts;

import com.googlecode.dex2jar.ir.Constant;
import com.googlecode.dex2jar.ir.IrMethod;
import com.googlecode.dex2jar.ir.Value;
import com.googlecode.dex2jar.ir.Value.E0Expr;
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.TypeRef;
import com.googlecode.dex2jar.ir.Value.VT;
import com.googlecode.dex2jar.ir.ValueBox;
import com.googlecode.dex2jar.ir.expr.BinopExpr;
import com.googlecode.dex2jar.ir.expr.CastExpr;
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.expr.UnopExpr;
import com.googlecode.dex2jar.ir.stmt.Stmt;
import com.googlecode.dex2jar.ir.stmt.Stmt.E1Stmt;
import com.googlecode.dex2jar.ir.stmt.Stmt.E2Stmt;
import com.googlecode.dex2jar.ir.stmt.Stmt.ST;
import com.googlecode.dex2jar.ir.stmt.StmtList;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import org.objectweb.asm.Type;

public class TypeAnalyze
{
  protected IrMethod method;
  
  public static class DefTypeRef
    implements Value.TypeRef
  {
    static Comparator<Type> c = new Comparator()
    {
      int[] x = { 999, 1, 4, 2, 3, 5, 6, 7, 8, 10, 9 };
      
      public int compare(Type o1, Type o2)
      {
        if (o1.equals(o2)) {
          return 0;
        }
        int s1 = o1.getSort();
        int s2 = o2.getSort();
        if (s1 == s2) {
          switch (s1)
          {
          case 10: 
            if (o1.equals(Type.getType(Object.class))) {
              return 1;
            }
            if (o2.equals(Type.getType(Object.class))) {
              return -1;
            }
      
1 2 3 4 5

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