# HG changeset patch # User Josef Eisl # Date 1415711575 -3600 # Node ID a84639853ea671ecf0c1edceab1970544a601b60 # Parent 06624c98ed8b4911871e55b0c75c414d03159cdd Add getId(), hashCode() toString() equals() to VirtualStackSlot. diff -r 06624c98ed8b -r a84639853ea6 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualStackSlot.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualStackSlot.java Mon Nov 10 19:43:16 2014 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualStackSlot.java Tue Nov 11 14:12:55 2014 +0100 @@ -27,9 +27,47 @@ public abstract class VirtualStackSlot extends StackSlotValue { private static final long serialVersionUID = 2823688688873398219L; + private static int idCounter = 0; + private final int id; public VirtualStackSlot(LIRKind lirKind) { super(lirKind); + id = idCounter++; + } + + public int getId() { + return id; + } + + @Override + public String toString() { + return "VirtualSlot" + id + getKindSuffix(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + id; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!super.equals(obj)) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + VirtualStackSlot other = (VirtualStackSlot) obj; + if (id != other.id) { + return false; + } + return true; } }