public void performVerboseAction() { System.err.println(("size: " + store.length)); System.err.println(("occupancy: " + computeOccupancy())); }
/** * make sure we can store to a particular index */ private void ensureCapacity(int capacity) { if (capacity >= store.length) { int[] old = store; store = Arrays.copyOf(old, 1 + (int) (getGrowthFactor() * capacity)); Arrays.fill(store, old.length, store.length, defaultValue); } }
public SimpleIntVector(int defaultValue) { this.defaultValue = defaultValue; store = new int[getInitialSize()]; store[0] = defaultValue; }
/** * @throws IllegalArgumentException if dst is null */ public void addExceptionalEdge(T src, T dst) { if (dst == null) { throw new IllegalArgumentException("dst is null"); } if (dst.equals(exit())) { exceptionalToExit.set(getNumber(src)); } else { exceptionalEdgeManager.addEdge(src, dst); SimpleIntVector v = exceptionalSuccessors.get(getNumber(src)); if (v == null) { v = new SimpleIntVector(-1); exceptionalSuccessors.set(getNumber(src), v); v.set(0, getNumber(dst)); return; } if (v.get(v.getMaxIndex()) != getNumber(dst)) { v.set(v.getMaxIndex() + 1, getNumber(dst)); } } }
switch (implementation[i]) { case SIMPLE: smallStore[i] = new SimpleIntVector(EMPTY_CODE); break; case TWO_LEVEL:
/** * @param number of a basic block * @return the exceptional successors of the basic block, in order of increasing catch scope. */ private Iterator<T> iterateExceptionalSuccessors(int number) { if (exceptionalEdgeManager.hasAnySuccessor(number)) { List<T> result = new ArrayList<>(); SimpleIntVector v = exceptionalSuccessors.get(number); for (int i = 0; i <= v.getMaxIndex(); i++) { result.add(getNode(v.get(i))); } if (exceptionalToExit.get(number)) { result.add(exit); } return result.iterator(); } else { if (exceptionalToExit.get(number)) { return new NonNullSingletonIterator<>(exit()); } else { return EmptyIterator.instance(); } } }
@Override public void set(int x, int value) { if (x < 0) { throw new IllegalArgumentException("illegal x: " + x); } if (x > MAX_SIZE) { throw new IllegalArgumentException("x is too big: " + x); } maxIndex = Math.max(maxIndex,x); if (value == defaultValue) { if (x >= store.length) { return; } else { store[x] = value; } } else { ensureCapacity(x); store[x] = value; } }
/** * @throws IllegalArgumentException if dst is null */ public void addExceptionalEdge(T src, T dst) { if (dst == null) { throw new IllegalArgumentException("dst is null"); } if (dst.equals(exit())) { exceptionalToExit.set(getNumber(src)); } else { exceptionalEdgeManager.addEdge(src, dst); SimpleIntVector v = exceptionalSuccessors.get(getNumber(src)); if (v == null) { v = new SimpleIntVector(-1); exceptionalSuccessors.set(getNumber(src), v); v.set(0, getNumber(dst)); return; } if (v.get(v.getMaxIndex()) != getNumber(dst)) { v.set(v.getMaxIndex() + 1, getNumber(dst)); } } }
switch (implementation[i]) { case SIMPLE: smallStore[i] = new SimpleIntVector(EMPTY_CODE); break; case TWO_LEVEL:
/** * @param number of a basic block * @return the exceptional successors of the basic block, in order of increasing catch scope. */ private Iterator<T> iterateExceptionalSuccessors(int number) { if (exceptionalEdgeManager.hasAnySuccessor(number)) { List<T> result = new ArrayList<>(); SimpleIntVector v = exceptionalSuccessors.get(number); for (int i = 0; i <= v.getMaxIndex(); i++) { result.add(getNode(v.get(i))); } if (exceptionalToExit.get(number)) { result.add(exit); } return result.iterator(); } else { if (exceptionalToExit.get(number)) { return new NonNullSingletonIterator<>(exit()); } else { return EmptyIterator.instance(); } } }
@Override public void set(int x, int value) { if (x < 0) { throw new IllegalArgumentException("illegal x: " + x); } if (x > MAX_SIZE) { throw new IllegalArgumentException("x is too big: " + x); } maxIndex = Math.max(maxIndex,x); if (value == defaultValue) { if (x >= store.length) { return; } else { store[x] = value; } } else { ensureCapacity(x); store[x] = value; } }
switch (implementation[i]) { case SIMPLE: smallStore[i] = new SimpleIntVector(EMPTY_CODE); break; case TWO_LEVEL:
/** * make sure we can store to a particular index */ private void ensureCapacity(int capacity) { if (capacity >= store.length) { int[] old = store; store = Arrays.copyOf(old, 1 + (int) (getGrowthFactor() * capacity)); Arrays.fill(store, old.length, store.length, defaultValue); } }
public SimpleIntVector(int defaultValue) { this.defaultValue = defaultValue; store = new int[getInitialSize()]; store[0] = defaultValue; }
public void performVerboseAction() { System.err.println(("size: " + store.length)); System.err.println(("occupancy: " + computeOccupancy())); }
@Override public void set(int x, int value) { if (x < 0) { throw new IllegalArgumentException("illegal x: " + x); } if (x > MAX_SIZE) { throw new IllegalArgumentException("x is too big: " + x); } maxIndex = Math.max(maxIndex,x); if (value == defaultValue) { if (x >= store.length) { return; } else { store[x] = value; } } else { ensureCapacity(x); store[x] = value; } }
/** * make sure we can store to a particular index */ private void ensureCapacity(int capacity) { if (capacity >= store.length) { int[] old = store; store = Arrays.copyOf(old, 1 + (int) (getGrowthFactor() * capacity)); Arrays.fill(store, old.length, store.length, defaultValue); } }
public SimpleIntVector(int defaultValue) { this.defaultValue = defaultValue; store = new int[getInitialSize()]; store[0] = defaultValue; }
public void performVerboseAction() { System.err.println(("size: " + store.length)); System.err.println(("occupancy: " + computeOccupancy())); }