annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java @ 10090:ae6f0c381087

split MemoryCheckpoint interface into Single and Multi
author Lukas Stadler <lukas.stadler@jku.at>
date Wed, 19 Jun 2013 16:42:56 +0200
parents b4f12c603be5
children ae619d70bf4b
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 /*
4233
fa53d5e4aa35 Remove lock information from frame states, and compute it instead when LIR is generated.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 3733
diff changeset
2 * Copyright (c) 2009, 2012, 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 */
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
23 package com.oracle.graal.nodes.java;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
9792
06dc2d2324d6 pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents: 9526
diff changeset
25 import com.oracle.graal.api.meta.*;
9504
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9251
diff changeset
26 import com.oracle.graal.graph.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
27 import com.oracle.graal.nodes.*;
6386
abeeb57b655d added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents: 5061
diff changeset
28 import com.oracle.graal.nodes.extended.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
29 import com.oracle.graal.nodes.spi.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
30
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
31 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
32 * The {@code MonitorEnterNode} represents a monitor release.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33 */
10090
ae6f0c381087 split MemoryCheckpoint interface into Single and Multi
Lukas Stadler <lukas.stadler@jku.at>
parents: 9793
diff changeset
34 public final class MonitorExitNode extends AccessMonitorNode implements Virtualizable, Lowerable, Node.IterableNodeType, MonitorExit, MemoryCheckpoint.Single, MonitorReference {
8586
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8394
diff changeset
35
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8394
diff changeset
36 private int lockDepth;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
37
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
38 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
39 * Creates a new MonitorExitNode.
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6462
diff changeset
40 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
41 * @param object the instruction produces the object value
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
42 */
8586
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8394
diff changeset
43 public MonitorExitNode(ValueNode object, int lockDepth) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
44 super(object);
8586
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8394
diff changeset
45 this.lockDepth = lockDepth;
3733
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
7864
b66a826acf4b add location identity to MemoryCheckpoint and let WriteNode implement MemoryCheckpoint
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
48 @Override
10090
ae6f0c381087 split MemoryCheckpoint interface into Single and Multi
Lukas Stadler <lukas.stadler@jku.at>
parents: 9793
diff changeset
49 public LocationIdentity getLocationIdentity() {
ae6f0c381087 split MemoryCheckpoint interface into Single and Multi
Lukas Stadler <lukas.stadler@jku.at>
parents: 9793
diff changeset
50 return LocationIdentity.ANY_LOCATION;
7864
b66a826acf4b add location identity to MemoryCheckpoint and let WriteNode implement MemoryCheckpoint
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
51 }
b66a826acf4b add location identity to MemoryCheckpoint and let WriteNode implement MemoryCheckpoint
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
52
9504
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9251
diff changeset
53 @Override
9251
435bb9425124 added enum to Lowerable interface (before/after guard lowering)
Lukas Stadler <lukas.stadler@jku.at>
parents: 8586
diff changeset
54 public void lower(LoweringTool tool, LoweringType loweringType) {
6386
abeeb57b655d added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents: 5061
diff changeset
55 tool.getRuntime().lower(this, tool);
abeeb57b655d added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents: 5061
diff changeset
56 }
8586
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8394
diff changeset
57
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8394
diff changeset
58 public int getLockDepth() {
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8394
diff changeset
59 return lockDepth;
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8394
diff changeset
60 }
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8394
diff changeset
61
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8394
diff changeset
62 public void setLockDepth(int lockDepth) {
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8394
diff changeset
63 this.lockDepth = lockDepth;
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8394
diff changeset
64 }
9504
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9251
diff changeset
65
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9251
diff changeset
66 @Override
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9251
diff changeset
67 public void virtualize(VirtualizerTool tool) {
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9251
diff changeset
68 State state = tool.getObjectState(object());
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9251
diff changeset
69 if (state != null && state.getState() == EscapeState.Virtual && state.getVirtualObject().hasIdentity()) {
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9251
diff changeset
70 int removedLock = state.removeLock();
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9251
diff changeset
71 assert removedLock == getLockDepth();
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9251
diff changeset
72 tool.delete();
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9251
diff changeset
73 }
106f0a0acafa refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents: 9251
diff changeset
74 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
75 }