FileDocCategorySizeDatePackage
DataflowInterpreter.javaAPI DocGlassfish v2 API5014Thu Mar 02 11:51:18 GMT 2006oracle.toplink.libraries.asm.tree.analysis

DataflowInterpreter

public class DataflowInterpreter extends Object implements Interpreter, Constants
An {@link Interpreter} for {@link DataflowValue} values.
author
Eric Bruneton

Fields Summary
Constructors Summary
Methods Summary
public ValuebinaryOperation(oracle.toplink.libraries.asm.tree.AbstractInsnNode insn, Value value1, Value value2)

    int size;
    switch (insn.getOpcode()) {
      case LALOAD:
      case DALOAD:
      case LADD:
      case DADD:
      case LSUB:
      case DSUB:
      case LMUL:
      case DMUL:
      case LDIV:
      case DDIV:
      case LREM:
      case DREM:
      case LSHL:
      case LSHR:
      case LUSHR:
      case LAND:
      case LOR:
      case LXOR:
        size = 2;
        break;
      default:
        size = 1;
    }
    return new DataflowValue(size, insn);
  
public ValuecopyOperation(oracle.toplink.libraries.asm.tree.AbstractInsnNode insn, Value value)

    return new DataflowValue(value.getSize(), insn);
  
public Valuemerge(Value v, Value w)

    DataflowValue dv = (DataflowValue)v;
    DataflowValue dw = (DataflowValue)w;
    if (dv.size != dw.size || !dv.insns.equals(dw.insns)) {
      Set s = new HashSet();
      s.addAll(dv.insns);
      s.addAll(dw.insns);
      return new DataflowValue(Math.min(dv.size, dw.size), s);
    }
    return v;
  
public ValuenaryOperation(oracle.toplink.libraries.asm.tree.AbstractInsnNode insn, java.util.List values)

    int size;
    if (insn.getOpcode() == MULTIANEWARRAY) {
      size = 1;
    } else {
      size = Type.getReturnType(((MethodInsnNode)insn).desc).getSize();
    }
    return new DataflowValue(size, insn);
  
public ValuenewOperation(oracle.toplink.libraries.asm.tree.AbstractInsnNode insn)

    int size;
    switch (insn.getOpcode()) {
      case LCONST_0:
      case LCONST_1:
      case DCONST_0:
      case DCONST_1:
        size = 2;
        break;
      case LDC:
        Object cst = ((LdcInsnNode)insn).cst;
        size = cst instanceof Long || cst instanceof Double ? 2 : 1;
        break;
      case GETSTATIC:
        size = Type.getType(((FieldInsnNode)insn).desc).getSize();
        break;
      default:
        size = 1;
    }
    return new DataflowValue(size, insn);
  
public ValuenewValue(oracle.toplink.libraries.asm.Type type)

    return new DataflowValue(type == null ? 1 : type.getSize());
  
public ValueternaryOperation(oracle.toplink.libraries.asm.tree.AbstractInsnNode insn, Value value1, Value value2, Value value3)

    return new DataflowValue(1, insn);
  
public ValueunaryOperation(oracle.toplink.libraries.asm.tree.AbstractInsnNode insn, Value value)

    int size;
    switch (insn.getOpcode()) {
      case LNEG:
      case DNEG:
      case I2L:
      case I2D:
      case L2D:
      case F2L:
      case F2D:
      case D2L:
        size = 2;
        break;
      case GETFIELD:
        size = Type.getType(((FieldInsnNode)insn).desc).getSize();
        break;
      default:
        size = 1;
    }
    return new DataflowValue(size, insn);