Mercurial > hg > graal-jvmci-8
changeset 18435:a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Tue, 11 Nov 2014 14:12:55 +0100 |
parents | 06624c98ed8b |
children | 59e65d3aa2fc |
files | graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualStackSlot.java |
diffstat | 1 files changed, 38 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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; } }