private static RegisterSpecList concatenate(Local<?> first, Local<?>[] rest) { int offset = (first != null) ? 1 : 0; RegisterSpecList result = new RegisterSpecList(offset + rest.length); if (first != null) { result.set(0, first.spec()); } for (int i = 0; i < rest.length; i++) { result.set(i + offset, rest[i].spec()); } return result; } }
/** * Awaits the lock on {@code monitor}, and acquires it. */ public void monitorEnter(Local<?> monitor) { addInstruction(new ThrowingInsn(Rops.MONITOR_ENTER, sourcePosition, RegisterSpecList.make(monitor.spec()), catches)); }
/** * Returns a new instance, which is the same as this instance, * except that it has an additional element prepended to the original. * Mutability of the result is inherited from the original. * * @param spec {@code non-null;} the new first spec (to prepend) * @return {@code non-null;} an appropriately-constructed instance */ public RegisterSpecList withFirst(RegisterSpec spec) { int sz = size(); RegisterSpecList result = new RegisterSpecList(sz + 1); for (int i = 0; i < sz; i++) { result.set0(i + 1, get0(i)); } result.set0(0, spec); if (isImmutable()) { result.setImmutable(); } return result; }
/** * * @param sources old register list * @return new mapped register list, or old if nothing has changed. */ public final RegisterSpecList map(RegisterSpecList sources) { int sz = sources.size(); RegisterSpecList newSources = new RegisterSpecList(sz); for (int i = 0; i < sz; i++) { newSources.set(i, map(sources.get(i))); } newSources.setImmutable(); // Return the old sources if nothing has changed. return newSources.equals(sources) ? sources : newSources; }
int szSources = sources.size(); int nextRopReg = newRegStart; RegisterSpec source = sources.get(i); int sourceReg = source.getReg(); int category = source.getCategory(); if (-1 != sources.indexOfRegister(similarReg)) { continue;
RegisterSpecList sources = insn.getSources(); int index = sources.indexOfRegister(reg); RegisterSpec spec = sources.get(index); RegisterSpec newSpec = spec.withType((TypedConstant)latticeConstants[reg]);
private RegisterSpecList getResult() { if (regSpecList.isImmutable()) { result.setImmutable(); } return result; } }
private Expander(RegisterSpecList regSpecList, BitSet compatRegs, int base, boolean duplicateFirst) { this.regSpecList = regSpecList; this.compatRegs = compatRegs; this.base = base; this.result = new RegisterSpecList(regSpecList.size()); this.duplicateFirst = duplicateFirst; }
/** * 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 RegisterSpec get(int n) { return (RegisterSpec) get0(n); }
/** * Sets the element at the given index. * * @param n {@code >= 0, < size();} which element * @param spec {@code non-null;} the value to store */ public void set(int n, RegisterSpec spec) { set0(n, spec); }
/** * Returns a new instance, which is the same as this instance, * except that it has an additional element prepended to the original. * Mutability of the result is inherited from the original. * * @param spec {@code non-null;} the new first spec (to prepend) * @return {@code non-null;} an appropriately-constructed instance */ public RegisterSpecList withFirst(RegisterSpec spec) { int sz = size(); RegisterSpecList result = new RegisterSpecList(sz + 1); for (int i = 0; i < sz; i++) { result.set0(i + 1, get0(i)); } result.set0(0, spec); if (isImmutable()) { result.setImmutable(); } return result; }
/** * * @param sources old register list * @return new mapped register list, or old if nothing has changed. */ public final RegisterSpecList map(RegisterSpecList sources) { int sz = sources.size(); RegisterSpecList newSources = new RegisterSpecList(sz); for (int i = 0; i < sz; i++) { newSources.set(i, map(sources.get(i))); } newSources.setImmutable(); // Return the old sources if nothing has changed. return newSources.equals(sources) ? sources : newSources; }
int szSources = sources.size(); int nextRopReg = newRegStart; RegisterSpec source = sources.get(i); int sourceReg = source.getReg(); int category = source.getCategory(); if (-1 != sources.indexOfRegister(similarReg)) { continue;
RegisterSpecList sources = insn.getSources(); int index = sources.indexOfRegister(reg); RegisterSpec spec = sources.get(index); RegisterSpec newSpec = spec.withType((TypedConstant)latticeConstants[reg]);
private RegisterSpecList getResult() { if (regSpecList.isImmutable()) { result.setImmutable(); } return result; } }