TypeId(com.android.dx.rop.type.Type ropType) { this(ropType.getDescriptor(), ropType); }
private Rop getCastRop(com.android.dx.rop.type.Type sourceType, com.android.dx.rop.type.Type targetType) { if (sourceType.getBasicType() == BT_INT) { switch (targetType.getBasicType()) { case BT_SHORT: return Rops.TO_SHORT; case BT_CHAR: return Rops.TO_CHAR; case BT_BYTE: return Rops.TO_BYTE; } } return Rops.opConv(targetType, sourceType); }
/** * Returns the number of registered required to hold this local. */ int size() { return type.ropType.getCategory(); }
if (!isReference()) { throw new IllegalArgumentException("not a reference type: " + descriptor); if (isUninitialized()) { Type result = new Type(newDesc, BT_OBJECT, newAt); result.initializedType = this; return putIntern(result);
Type.intern(descriptor.substring(startAt, at)); paramCount++; Type returnType = Type.internReturnType(descriptor.substring(at)); StdTypeList parameterTypes = new StdTypeList(paramCount);
if (thisType.isUninitialized()) { frame.makeInitialized(thisType); setResult(type.asUninitialized(offset)); break; setResult(type.getArrayType()); break;
if (source.getType().ropType.isReference()) { addInstruction(new ThrowingCstInsn(Rops.CHECK_CAST, sourcePosition, RegisterSpecList.make(source.spec()), catches, target.type.constant));
public void addSupperClass(String name){ if (name.endsWith(CLASS_EXTENSION)) { classNames.add(name.substring(0, name.length() - CLASS_EXTENSION.length())); } if (name.endsWith(CLASS_EXTENSION)) { DirectClassFile classFile; try { classFile = path.getClass(name); CstType superClass = classFile.getSuperclass(); if (superClass != null) { String superClassName=superClass.getClassType().getClassName(); classNames.add(superClassName); } } catch (FileNotFoundException e) { // throw new IOException("Class " + name + // " is missing form original class path " + path, e); } } } public void addRootsV2(String name){
/** * Compares by (in priority order) register number, unwrapped type * (that is types not {@link TypeBearer}s, and local info. * * @param other {@code non-null;} spec to compare to * @return {@code -1..1;} standard result of comparison */ public int compareTo(RegisterSpec other) { if (this.reg < other.reg) { return -1; } else if (this.reg > other.reg) { return 1; } int compare = type.getType().compareTo(other.type.getType()); if (compare != 0) { return compare; } if (this.local == null) { return (other.local == null) ? 0 : -1; } else if (other.local == null) { return 1; } return this.local.compareTo(other.local); }
/** * Interns an instance, adding to the descriptor as necessary based * on the given definer, name, and flags. For example, an init * method has an uninitialized object of type {@code definer} * as its first argument. * * @param descriptor {@code non-null;} the descriptor string * @param definer {@code non-null;} class the method is defined on * @param isStatic whether this is a static method * @param isInit whether this is an init method * @return {@code non-null;} the interned instance */ public static Prototype intern(String descriptor, Type definer, boolean isStatic, boolean isInit) { Prototype base = intern(descriptor); if (isStatic) { return base; } if (isInit) { definer = definer.asUninitialized(Integer.MAX_VALUE); } return base.withFirstParameter(definer); }
/** * @param name a descriptor like "Ljava/lang/Class;". */ public static <T> TypeId<T> get(String name) { return new TypeId<>(name, com.android.dx.rop.type.Type.internReturnType(name)); }
/** * Like {@link #equalsUsingSimpleType} but ignoring the register number. * This is useful to determine if two instances refer to the "same" * local variable. * * @param other {@code null-ok;} spec to compare to * @return {@code true} iff {@code this} and {@code other} are equal * in the stated way */ public boolean matchesVariable(RegisterSpec other) { if (other == null) { return false; } return type.getType().equals(other.type.getType()) && ((local == other.local) || ((local != null) && local.equals(other.local))); }
if (!isReference()) { throw new IllegalArgumentException("not a reference type: " + descriptor); if (isUninitialized()) { Type result = new Type(newDesc, BT_OBJECT, newAt); result.initializedType = this; return putIntern(result);
Type.intern(descriptor.substring(startAt, at)); paramCount++; Type returnType = Type.internReturnType(descriptor.substring(at)); StdTypeList parameterTypes = new StdTypeList(paramCount);
if (thisType.isUninitialized()) { frame.makeInitialized(thisType); setResult(type.asUninitialized(offset)); break; setResult(type.getArrayType()); break;
/** * Gets the name of the class this type corresponds to, in internal * form. This method is only valid if this instance is for a * normal reference type (that is, a reference type and * additionally not a return address). * * @return {@code non-null;} the internal-form class name */ public String getClassName() { if (className == null) { if (!isReference()) { throw new IllegalArgumentException("not an object type: " + descriptor); } if (descriptor.charAt(0) == '[') { className = descriptor; } else { className = descriptor.substring(1, descriptor.length() - 1); } } return className; }