Skip to content

Commit

Permalink
Code simplifications (#6621)
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst committed May 23, 2024
1 parent 879cc3e commit ecd5a03
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.util.Comparator;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.Objects;
import java.util.PriorityQueue;
import java.util.Set;
Expand Down Expand Up @@ -449,19 +448,6 @@ protected boolean updateNodeValues(Node node, TransferResult<V, S> transferResul
return nodeValueChanged || transferResult.storeChanged();
}

/**
* Read the store for a particular basic block from a map of stores (or {@code null} if none
* exists yet).
*
* @param stores a map of stores
* @param b the target block
* @param <S> method return type should be a subtype of {@link Store}
* @return the store for the target block
*/
protected static <S> @Nullable S readFromStore(Map<Block, S> stores, Block b) {
return stores.get(b);
}

/**
* Add a basic block to {@link #worklist}. If {@code b} is already present, the method does
* nothing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ protected void addStoreAfter(Block pred, @Nullable Node node, S s, boolean addBl
* @return the store right after the given block
*/
protected @Nullable S getStoreAfter(Block b) {
return readFromStore(outStores, b);
return outStores.get(b);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,9 @@ private S mergeStores(S newStore, @Nullable S previousStore, boolean shouldWiden
protected @Nullable S getStoreBefore(Block b, Store.Kind kind) {
switch (kind) {
case THEN:
return readFromStore(thenStores, b);
return thenStores.get(b);
case ELSE:
return readFromStore(elseStores, b);
return elseStores.get(b);
default:
throw new BugInCF("Unexpected Store.Kind: " + kind);
}
Expand Down
3 changes: 3 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Version 3.44.0 (June 3, 2024)

**Implementation details:**

Removed methods:
* `AbstractAnalysis.readFromStore()`: use `Map.get()`

Renamed methods:
* `CFAbstractStore.methodValues()` => `methodCallExpressions()`

Expand Down

0 comments on commit ecd5a03

Please sign in to comment.