mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-26 08:48:08 +08:00
Merge remote-tracking branch
'origin/GP-776_dragonmacher_PR-2845_tavianator_fix-dominance-equality' (Closes #2845, Closes #2836)
This commit is contained in:
@@ -122,7 +122,7 @@ public class ChkDominanceAlgorithm<V, E extends GEdge<V>> extends AbstractDomina
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
V p = iterator.next();
|
||||
if (p == newIdom) {
|
||||
if (newIdom.equals(p)) {
|
||||
continue;
|
||||
}
|
||||
if (dominatorMap.containsKey(p)) {
|
||||
@@ -131,7 +131,7 @@ public class ChkDominanceAlgorithm<V, E extends GEdge<V>> extends AbstractDomina
|
||||
}
|
||||
|
||||
V idom = dominatorMap.get(b);
|
||||
if (idom != newIdom) {
|
||||
if (!newIdom.equals(idom)) {
|
||||
V last = dominatorMap.put(b, newIdom);
|
||||
dominatedMap.get(newIdom).add(b);
|
||||
if (last != null) {
|
||||
@@ -148,7 +148,7 @@ public class ChkDominanceAlgorithm<V, E extends GEdge<V>> extends AbstractDomina
|
||||
V finger2 = v2;
|
||||
int finger1Index = map.get(finger1);
|
||||
int finger2Index = map.get(finger2);
|
||||
while (finger1 != finger2) {
|
||||
while (!finger1.equals(finger2)) {
|
||||
while (finger1Index < finger2Index) {
|
||||
finger1 = dominatorMap.get(finger1);
|
||||
finger1Index = map.get(finger1);
|
||||
@@ -197,7 +197,7 @@ public class ChkDominanceAlgorithm<V, E extends GEdge<V>> extends AbstractDomina
|
||||
Set<V> dominators = new HashSet<>();
|
||||
dominators.add(a);
|
||||
|
||||
while (a != root) {
|
||||
while (!root.equals(a)) {
|
||||
a = dominatorMap.get(a); // immediate dominator
|
||||
add(a, dominators);
|
||||
}
|
||||
|
||||
+26
-28
@@ -273,34 +273,32 @@ public abstract class AbstractGraphAlgorithmsTest extends AbstractGenericTest {
|
||||
return id;
|
||||
}
|
||||
|
||||
// TODO put this in
|
||||
//
|
||||
// @Override
|
||||
// public int hashCode() {
|
||||
// final int prime = 31;
|
||||
// int result = 1;
|
||||
// result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean equals(Object obj) {
|
||||
// if (this == obj) {
|
||||
// return true;
|
||||
// }
|
||||
// if (obj == null) {
|
||||
// return false;
|
||||
// }
|
||||
// if (getClass() != obj.getClass()) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// TestV other = (TestV) obj;
|
||||
// if (!Objects.equals(id, other.id)) {
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TestV other = (TestV) obj;
|
||||
if (!Objects.equals(id, other.id)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected static class TestE extends DefaultGEdge<TestV> {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user