annotate graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualStackSlot.java @ 18513:a21a4039ce7b

Add javadoc for StackSlotValue and VirtualStackSlot.
author Josef Eisl <josef.eisl@jku.at>
date Tue, 25 Nov 2014 19:20:48 +0100
parents d68ab3959fec
children 78532f14a3c9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
18513
a21a4039ce7b Add javadoc for StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18469
diff changeset
27 /**
a21a4039ce7b Add javadoc for StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18469
diff changeset
28 * {@link VirtualStackSlot}s are stack slots that are not yet fixed to specific frame offset. They
a21a4039ce7b Add javadoc for StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18469
diff changeset
29 * are replaced by real {@link StackSlot}s with a fixed position in the frame before code emission.
a21a4039ce7b Add javadoc for StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18469
diff changeset
30 */
18425
b856446ff7e0 Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff changeset
31 public abstract class VirtualStackSlot extends StackSlotValue {
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 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
34 private final int id;
18425
b856446ff7e0 Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff changeset
35
18469
d68ab3959fec Remove static id from VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18437
diff changeset
36 public VirtualStackSlot(int id, LIRKind lirKind) {
18425
b856446ff7e0 Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff changeset
37 super(lirKind);
18469
d68ab3959fec Remove static id from VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18437
diff changeset
38 this.id = id;
18435
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
39 }
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 public int getId() {
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
42 return id;
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
43 }
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
44
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
45 @Override
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
46 public String toString() {
18437
7ce389a85277 Change VirtualStackSlot.toString().
Josef Eisl <josef.eisl@jku.at>
parents: 18435
diff changeset
47 return "vstack(" + id + ")" + getKindSuffix();
18435
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
48 }
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
49
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
50 @Override
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
51 public int hashCode() {
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
52 final int prime = 31;
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
53 int result = super.hashCode();
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
54 result = prime * result + id;
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
55 return result;
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
56 }
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
57
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
58 @Override
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
59 public boolean equals(Object obj) {
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
60 if (this == obj) {
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
61 return true;
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 (!super.equals(obj)) {
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 if (getClass() != obj.getClass()) {
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
67 return false;
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
68 }
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
69 VirtualStackSlot other = (VirtualStackSlot) obj;
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
70 if (id != other.id) {
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
71 return false;
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
72 }
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
73 return true;
18425
b856446ff7e0 Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff changeset
74 }
b856446ff7e0 Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff changeset
75
b856446ff7e0 Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff changeset
76 }