private StdTypeList toTypeList(List<TypeId<?>> types) { StdTypeList result = new StdTypeList(types.size()); for (int i = 0; i < types.size(); i++) { result.set(i, types.get(i).ropType); } return result; }
/** * Check if an int or reference equals to zero. If the comparison is true, * execution jumps to {@code trueLabel}. If it is false, execution continues to * the next instruction. */ public <T> void compareZ(Comparison comparison, Label trueLabel, Local<?> a) { adopt(trueLabel); Rop rop = comparison.rop(StdTypeList.make(a.type.ropType)); addInstruction(new PlainInsn(rop, sourcePosition, null, RegisterSpecList.make(a.spec())), trueLabel); }
/** {@inheritDoc} */ public TypeList withAddedType(Type type) { int sz = size(); StdTypeList result = new StdTypeList(sz + 1); for (int i = 0; i < sz; i++) { result.set0(i, get0(i)); } result.set(sz, type); result.setImmutable(); return result; }
/** * Returns a new instance, which is the same as this instance, * except that it has an additional type prepended to the * original. * * @param type {@code non-null;} the new first element * @return {@code non-null;} an appropriately-constructed instance */ public StdTypeList withFirst(Type type) { int sz = size(); StdTypeList result = new StdTypeList(sz + 1); result.set0(0, type); for (int i = 0; i < sz; i++) { result.set0(i + 1, getOrNull0(i)); } return result; } }
/** * Creates the short-form of the given prototype. * * @param prototype {@code non-null;} the prototype * @return {@code non-null;} the short form */ private static CstString makeShortForm(Prototype prototype) { StdTypeList parameters = prototype.getParameterTypes(); int size = parameters.size(); StringBuilder sb = new StringBuilder(size + 1); sb.append(shortFormCharFor(prototype.getReturnType())); for (int i = 0; i < size; i++) { sb.append(shortFormCharFor(parameters.getType(i))); } return new CstString(sb.toString()); }
/** * Compares Insn contents, since {@code Insn.equals()} is defined * to be an identity compare. Insn's are {@code contentEquals()} * if they have the same opcode, registers, source position, and other * metadata. * * @return true in the case described above */ public boolean contentEquals(Insn b) { return opcode == b.getOpcode() && position.equals(b.getPosition()) && (getClass() == b.getClass()) && equalsHandleNulls(result, b.getResult()) && equalsHandleNulls(sources, b.getSources()) && StdTypeList.equalContents(getCatches(), b.getCatches()); }
/** {@inheritDoc} */ @Override protected int compareTo0(OffsettedItem other) { TypeList thisList = this.list; TypeList otherList = ((TypeListItem) other).list; return StdTypeList.compareContents(thisList, otherList); } }
/** * Gets the indicated element. It is an error to call this with the * index for an element which was never set; if you do that, this * will throw {@code NullPointerException}. * * @param n {@code >= 0, < size();} which element * @return {@code non-null;} the indicated element */ public Type get(int n) { return (Type) get0(n); }
/** {@inheritDoc} */ @Override public Type getType(int n) { return get(n); }
/** {@inheritDoc} */ @Override public TypeList withAddedType(Type type) { int sz = size(); StdTypeList result = new StdTypeList(sz + 1); for (int i = 0; i < sz; i++) { result.set0(i, get0(i)); } result.set(sz, type); result.setImmutable(); return result; }
/** * Returns a new instance, which is the same as this instance, * except that it has an additional type prepended to the * original. * * @param type {@code non-null;} the new first element * @return {@code non-null;} an appropriately-constructed instance */ public StdTypeList withFirst(Type type) { int sz = size(); StdTypeList result = new StdTypeList(sz + 1); result.set0(0, type); for (int i = 0; i < sz; i++) { result.set0(i + 1, getOrNull0(i)); } return result; } }
/** * Creates the short-form of the given prototype. * * @param prototype {@code non-null;} the prototype * @return {@code non-null;} the short form */ private static CstString makeShortForm(Prototype prototype) { StdTypeList parameters = prototype.getParameterTypes(); int size = parameters.size(); StringBuilder sb = new StringBuilder(size + 1); sb.append(shortFormCharFor(prototype.getReturnType())); for (int i = 0; i < size; i++) { sb.append(shortFormCharFor(parameters.getType(i))); } return new CstString(sb.toString()); }
/** * Compares Insn contents, since {@code Insn.equals()} is defined * to be an identity compare. Insn's are {@code contentEquals()} * if they have the same opcode, registers, source position, and other * metadata. * * @return true in the case described above */ public boolean contentEquals(Insn b) { return opcode == b.getOpcode() && position.equals(b.getPosition()) && (getClass() == b.getClass()) && equalsHandleNulls(result, b.getResult()) && equalsHandleNulls(sources, b.getSources()) && StdTypeList.equalContents(getCatches(), b.getCatches()); }
/** {@inheritDoc} */ @Override protected int compareTo0(OffsettedItem other) { TypeList thisList = this.list; TypeList otherList = ((TypeListItem) other).list; return StdTypeList.compareContents(thisList, otherList); } }
/** * Gets the indicated element. It is an error to call this with the * index for an element which was never set; if you do that, this * will throw {@code NullPointerException}. * * @param n {@code >= 0, < size();} which element * @return {@code non-null;} the indicated element */ public Type get(int n) { return (Type) get0(n); }
/** {@inheritDoc} */ @Override public Type getType(int n) { return get(n); }
/** {@inheritDoc} */ public TypeList withAddedType(Type type) { int sz = size(); StdTypeList result = new StdTypeList(sz + 1); for (int i = 0; i < sz; i++) { result.set0(i, get0(i)); } result.set(sz, type); result.setImmutable(); return result; }
/** * Returns a new instance, which is the same as this instance, * except that it has an additional type prepended to the * original. * * @param type {@code non-null;} the new first element * @return {@code non-null;} an appropriately-constructed instance */ public StdTypeList withFirst(Type type) { int sz = size(); StdTypeList result = new StdTypeList(sz + 1); result.set0(0, type); for (int i = 0; i < sz; i++) { result.set0(i + 1, getOrNull0(i)); } return result; } }
/** * Creates the short-form of the given prototype. * * @param prototype {@code non-null;} the prototype * @return {@code non-null;} the short form */ private static CstString makeShortForm(Prototype prototype) { StdTypeList parameters = prototype.getParameterTypes(); int size = parameters.size(); StringBuilder sb = new StringBuilder(size + 1); sb.append(shortFormCharFor(prototype.getReturnType())); for (int i = 0; i < size; i++) { sb.append(shortFormCharFor(parameters.getType(i))); } return new CstString(sb.toString()); }