Mercurial > hg > truffle
annotate graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualStackSlot.java @ 18437:7ce389a85277
Change VirtualStackSlot.toString().
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Tue, 11 Nov 2014 16:51:41 +0100 |
parents | a84639853ea6 |
children | d68ab3959fec |
rev | line source |
---|---|
18425
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
1 /* |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
4 * |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
8 * |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
14 * |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
18 * |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
21 * questions. |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
22 */ |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
23 package com.oracle.graal.api.code; |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
24 |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
25 import com.oracle.graal.api.meta.*; |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
26 |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
27 public abstract class VirtualStackSlot extends StackSlotValue { |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
28 |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
29 private static final long serialVersionUID = 2823688688873398219L; |
18435
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
30 private static int idCounter = 0; |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
31 private final int id; |
18425
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
32 |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
33 public VirtualStackSlot(LIRKind lirKind) { |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
34 super(lirKind); |
18435
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
35 id = idCounter++; |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
36 } |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
37 |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
38 public int getId() { |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
39 return id; |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
40 } |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
41 |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
42 @Override |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
43 public String toString() { |
18437
7ce389a85277
Change VirtualStackSlot.toString().
Josef Eisl <josef.eisl@jku.at>
parents:
18435
diff
changeset
|
44 return "vstack(" + id + ")" + getKindSuffix(); |
18435
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
45 } |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
46 |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
47 @Override |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
48 public int hashCode() { |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
49 final int prime = 31; |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
50 int result = super.hashCode(); |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
51 result = prime * result + id; |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
52 return result; |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
53 } |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
54 |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
55 @Override |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
56 public boolean equals(Object obj) { |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
57 if (this == obj) { |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
58 return true; |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
59 } |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
60 if (!super.equals(obj)) { |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
61 return false; |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
62 } |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
63 if (getClass() != obj.getClass()) { |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
64 return false; |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
65 } |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
66 VirtualStackSlot other = (VirtualStackSlot) obj; |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
67 if (id != other.id) { |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
68 return false; |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
69 } |
a84639853ea6
Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
70 return true; |
18425
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
71 } |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
72 |
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
73 } |