annotate graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/StackLockValue.java @ 21556:48c1ebd24120

renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Wed, 27 May 2015 00:36:16 +0200
parents graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackLockValue.java@082417ac43e4
children f5b549811bac
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
19602
b6beb2161e7a Move stack monitor value into api.code
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18441
diff changeset
2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
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;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
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.JavaValue;
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
26 import com.oracle.jvmci.meta.AbstractValue;
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
27 import com.oracle.jvmci.meta.Value;
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
28 import com.oracle.jvmci.meta.LIRKind;
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
29 import static com.oracle.jvmci.code.ValueUtil.*;
18441
d11ce424f09d Allow updating HotSpotMonitorValue.slot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
30
5504
452f91ebdb54 Moved RiKind to cri.ri package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5503
diff changeset
31
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5552
diff changeset
32 /**
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5552
diff changeset
33 * Represents lock information in the debug information.
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5552
diff changeset
34 */
19602
b6beb2161e7a Move stack monitor value into api.code
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18441
diff changeset
35 public final class StackLockValue extends AbstractValue implements JavaValue {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6329
diff changeset
36
19669
f595e97626fd Use Value instead of JavaValue in BytecodeFrame and VirtualObject
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19602
diff changeset
37 private Value owner;
18441
d11ce424f09d Allow updating HotSpotMonitorValue.slot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
38 private StackSlotValue slot;
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
39 private final boolean eliminated;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
40
19669
f595e97626fd Use Value instead of JavaValue in BytecodeFrame and VirtualObject
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19602
diff changeset
41 public StackLockValue(Value object, StackSlotValue slot, boolean eliminated) {
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 9640
diff changeset
42 super(LIRKind.Illegal);
19669
f595e97626fd Use Value instead of JavaValue in BytecodeFrame and VirtualObject
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19602
diff changeset
43 this.owner = object;
8589
ec06c7e67698 renamed MonitorValue to HotSpotMonitorValue and moved it to com.oracle.graal.hotspot project
Doug Simon <doug.simon@oracle.com>
parents: 7530
diff changeset
44 this.slot = slot;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
45 this.eliminated = eliminated;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47
19669
f595e97626fd Use Value instead of JavaValue in BytecodeFrame and VirtualObject
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19602
diff changeset
48 public Value getOwner() {
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
49 return owner;
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
50 }
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
51
19669
f595e97626fd Use Value instead of JavaValue in BytecodeFrame and VirtualObject
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19602
diff changeset
52 public void setOwner(Value newOwner) {
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
53 this.owner = newOwner;
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
54 }
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
55
8589
ec06c7e67698 renamed MonitorValue to HotSpotMonitorValue and moved it to com.oracle.graal.hotspot project
Doug Simon <doug.simon@oracle.com>
parents: 7530
diff changeset
56 public Value getSlot() {
ec06c7e67698 renamed MonitorValue to HotSpotMonitorValue and moved it to com.oracle.graal.hotspot project
Doug Simon <doug.simon@oracle.com>
parents: 7530
diff changeset
57 return slot;
5552
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
58 }
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
59
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
60 public boolean isEliminated() {
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
61 return eliminated;
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
62 }
69a8969dbf40 Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
63
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
64 @Override
4169
f5328dda9714 Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
65 public String toString() {
8589
ec06c7e67698 renamed MonitorValue to HotSpotMonitorValue and moved it to com.oracle.graal.hotspot project
Doug Simon <doug.simon@oracle.com>
parents: 7530
diff changeset
66 return "monitor[" + owner + (slot != null ? ", " + slot : "") + (eliminated ? ", eliminated" : "") + "]";
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
67 }
9631
3c9aeef2702c Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents: 8589
diff changeset
68
3c9aeef2702c Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents: 8589
diff changeset
69 @Override
3c9aeef2702c Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents: 8589
diff changeset
70 public int hashCode() {
9640
65d7696fb58a Value: tidy up generated `hashCode()' and `equals()' methods a bit
Bernhard Urban <bernhard.urban@jku.at>
parents: 9631
diff changeset
71 final int prime = 43;
9631
3c9aeef2702c Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents: 8589
diff changeset
72 int result = super.hashCode();
3c9aeef2702c Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents: 8589
diff changeset
73 result = prime * result + (eliminated ? 1231 : 1237);
9640
65d7696fb58a Value: tidy up generated `hashCode()' and `equals()' methods a bit
Bernhard Urban <bernhard.urban@jku.at>
parents: 9631
diff changeset
74 result = prime * result + owner.hashCode();
65d7696fb58a Value: tidy up generated `hashCode()' and `equals()' methods a bit
Bernhard Urban <bernhard.urban@jku.at>
parents: 9631
diff changeset
75 result = prime * result + slot.hashCode();
9631
3c9aeef2702c Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents: 8589
diff changeset
76 return result;
3c9aeef2702c Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents: 8589
diff changeset
77 }
3c9aeef2702c Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents: 8589
diff changeset
78
3c9aeef2702c Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents: 8589
diff changeset
79 @Override
3c9aeef2702c Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents: 8589
diff changeset
80 public boolean equals(Object obj) {
19602
b6beb2161e7a Move stack monitor value into api.code
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18441
diff changeset
81 if (obj instanceof StackLockValue) {
b6beb2161e7a Move stack monitor value into api.code
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18441
diff changeset
82 StackLockValue other = (StackLockValue) obj;
9640
65d7696fb58a Value: tidy up generated `hashCode()' and `equals()' methods a bit
Bernhard Urban <bernhard.urban@jku.at>
parents: 9631
diff changeset
83 return super.equals(obj) && eliminated == other.eliminated && owner.equals(other.owner) && slot.equals(other.slot);
9631
3c9aeef2702c Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents: 8589
diff changeset
84 }
9640
65d7696fb58a Value: tidy up generated `hashCode()' and `equals()' methods a bit
Bernhard Urban <bernhard.urban@jku.at>
parents: 9631
diff changeset
85 return false;
9631
3c9aeef2702c Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents: 8589
diff changeset
86 }
18441
d11ce424f09d Allow updating HotSpotMonitorValue.slot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
87
d11ce424f09d Allow updating HotSpotMonitorValue.slot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
88 public void setSlot(StackSlotValue stackSlot) {
d11ce424f09d Allow updating HotSpotMonitorValue.slot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
89 assert slot == null || (isVirtualStackSlot(slot) && (slot.equals(stackSlot) || isStackSlot(stackSlot))) : String.format("Can not set slot for %s to %s", this, stackSlot);
d11ce424f09d Allow updating HotSpotMonitorValue.slot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
90 slot = stackSlot;
d11ce424f09d Allow updating HotSpotMonitorValue.slot.
Josef Eisl <josef.eisl@jku.at>
parents: 18425
diff changeset
91 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
92 }