annotate jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/VirtualStackSlot.java @ 21798:395ac43a8578

moved JVMCI sources from graal/ to jvmci/ directory
author Doug Simon <doug.simon@oracle.com>
date Tue, 09 Jun 2015 00:22:49 +0200
parents graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/VirtualStackSlot.java@48c1ebd24120
children
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 */
21556
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
23 package com.oracle.jvmci.code;
18425
b856446ff7e0 Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff changeset
24
21556
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21411
diff changeset
25 import com.oracle.jvmci.meta.LIRKind;
18425
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
18435
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
33 private final int id;
18425
b856446ff7e0 Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff changeset
34
18469
d68ab3959fec Remove static id from VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18437
diff changeset
35 public VirtualStackSlot(int id, LIRKind lirKind) {
18425
b856446ff7e0 Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff changeset
36 super(lirKind);
18469
d68ab3959fec Remove static id from VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18437
diff changeset
37 this.id = id;
18435
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
38 }
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 public int getId() {
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
41 return id;
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
42 }
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 @Override
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
45 public String toString() {
19026
78532f14a3c9 VirtualStackSlot: make toString() c1visualizer compatible.
Josef Eisl <josef.eisl@jku.at>
parents: 18513
diff changeset
46 return "vstack:" + id + getKindSuffix();
18435
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
47 }
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 @Override
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
50 public int hashCode() {
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
51 final int prime = 31;
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
52 int result = super.hashCode();
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
53 result = prime * result + id;
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
54 return result;
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
55 }
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 @Override
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
58 public boolean equals(Object obj) {
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
59 if (this == obj) {
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
60 return true;
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
61 }
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
62 if (!super.equals(obj)) {
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
63 return false;
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
64 }
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
65 if (getClass() != obj.getClass()) {
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
66 return false;
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
67 }
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
68 VirtualStackSlot other = (VirtualStackSlot) obj;
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
69 if (id != other.id) {
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
70 return false;
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
71 }
a84639853ea6 Add getId(), hashCode() toString() equals() to VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
72 return true;
18425
b856446ff7e0 Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
diff changeset
73 }
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 }