# HG changeset patch # User Thomas Wuerthinger # Date 1422440855 -3600 # Node ID 3be6793b4549519bc683e952ecbb8cbd136ab037 # Parent 5a79fa76b48962bde923d2b42e53d790959a6167 Fix LocationSet - use equals for comparing LocationIdentity objects. diff -r 5a79fa76b489 -r 3be6793b4549 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Wed Jan 28 04:05:07 2015 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Wed Jan 28 11:27:35 2015 +0100 @@ -101,14 +101,24 @@ } public void add(LocationIdentity location) { - if (location == LocationIdentity.ANY_LOCATION) { + if (LocationIdentity.ANY_LOCATION.equals(location)) { firstLocation = location; list = null; } else { if (firstLocation == null) { firstLocation = location; + } else if (LocationIdentity.ANY_LOCATION.equals(firstLocation)) { + return; + } else if (location.equals(firstLocation)) { + return; } else { initList(); + for (int i = 0; i < list.size(); ++i) { + LocationIdentity value = list.get(i); + if (location.equals(value)) { + return; + } + } list.add(location); } } @@ -128,18 +138,18 @@ public boolean contains(LocationIdentity locationIdentity) { assert locationIdentity != null; - assert locationIdentity != LocationIdentity.ANY_LOCATION; - assert locationIdentity != LocationIdentity.FINAL_LOCATION; - if (firstLocation == LocationIdentity.ANY_LOCATION) { + assert !locationIdentity.equals(LocationIdentity.ANY_LOCATION); + assert !locationIdentity.equals(LocationIdentity.FINAL_LOCATION); + if (LocationIdentity.ANY_LOCATION.equals(firstLocation)) { return true; } - if (firstLocation == locationIdentity) { + if (locationIdentity.equals(firstLocation)) { return true; } if (list != null) { for (int i = 0; i < list.size(); ++i) { LocationIdentity value = list.get(i); - if (value == locationIdentity) { + if (locationIdentity.equals(value)) { return true; } }