if (!type.asArray().getElementType().isPrimitiveType()) type = OPT_ClassLoaderProxy.JavaLangObjectArrayType; if (seenLoad.contains(type)) resultSet.add(type); if (seenStore.contains(type)) resultSet.add(type); seenLoad.add(type);
if (type.isArrayType()) { if (!type.asArray().getElementType().isPrimitiveType()) type = OPT_ClassLoaderProxy.JavaLangObjectArrayType; if (seenLoad.contains(type)) resultSet.add(type); if (seenStore.contains(type)) resultSet.add(type); seenLoad.add(type); }
  final public static Set getCandidates (OPT_IR ir) {    HashSet seenLoad = new HashSet(10);    HashSet seenStore = new HashSet(10);    HashSet resultSet = new HashSet(10);    // walk the instructions.  Store whether we've seen a load and/or a    // store for each type. Then, when we see a second appearance,    // if we've previously seen a load, then add this type to the    // result set.    for (OPT_InstructionEnumeration e = ir.forwardInstrEnumerator();          e.hasMoreElements();) {      OPT_Instruction s = e.next();      switch (s.operator().opcode) {        case GETFIELD_opcode:case GETFIELD_UNRESOLVED_opcode:          OPT_LocationOperand loc = GetField.getLocation(s);          VM_Field f = loc.field;          if (seenLoad.contains(f))            resultSet.add(f);          if (seenStore.contains(f))            resultSet.add(f);          seenLoad.add(f);          break;        case PUTFIELD_opcode:case PUTFIELD_UNRESOLVED_opcode:          loc = PutField.getLocation(s);          f = loc.field;          if (seenLoad.contains(f))            resultSet.add(f);          seenStore.add(f);          break;        case GETSTATIC_opcode:case GETSTATIC_UNRESOLVED_opcode:          loc = GetStatic.getLocation(s);          f = loc.field;          if (seenLoad.contains(f))            resultSet.add(f);          if (seenStore.contains(f))            resultSet.add(f);          seenLoad.add(f);          break;        case PUTSTATIC_opcode:case PUTSTATIC_UNRESOLVED_opcode:          loc = PutStatic.getLocation(s);          f = loc.field;          if (seenLoad.contains(f))            resultSet.add(f);          seenStore.add(f);          break;        case INT_ALOAD_opcode:case LONG_ALOAD_opcode:case FLOAT_ALOAD_opcode:        case DOUBLE_ALOAD_opcode:case REF_ALOAD_opcode:case BYTE_ALOAD_opcode:        case UBYTE_ALOAD_opcode:case USHORT_ALOAD_opcode:case SHORT_ALOAD_opcode:          VM_Type type = ALoad.getArray(s).getType();          if (!type.asArray().getElementType().isPrimitiveType())            type = OPT_ClassLoaderProxy.JavaLangObjectArrayType;          if (seenLoad.contains(type))            resultSet.add(type);          if (seenStore.contains(type))            resultSet.add(type);          seenLoad.add(type);          break;        case INT_ASTORE_opcode:case LONG_ASTORE_opcode:        case FLOAT_ASTORE_opcode:case DOUBLE_ASTORE_opcode:        case REF_ASTORE_opcode:case BYTE_ASTORE_opcode:        case SHORT_ASTORE_opcode:          type = AStore.getArray(s).getType();          if (!type.asArray().getElementType().isPrimitiveType())            type = OPT_ClassLoaderProxy.JavaLangObjectArrayType;          if (seenLoad.contains(type))            resultSet.add(type);          seenStore.add(type);        default:          break;      }    }    return  resultSet;  }