Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentLockNode.java @ 19403:61d3cb8e1280
Add generic parameter to NodeClass. Change Graph#getNodes(Class) to Graph#getNodes(NodeClass).
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Mon, 16 Feb 2015 17:47:43 +0100 |
parents | 7e2c87dae93e |
children | 8fc336a04d77 |
rev | line source |
---|---|
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.hotspot.nodes; |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
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:
7300
diff
changeset
|
25 import com.oracle.graal.api.code.*; |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 import com.oracle.graal.api.meta.*; |
19396
7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19129
diff
changeset
|
27 import com.oracle.graal.graph.*; |
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:
7300
diff
changeset
|
28 import com.oracle.graal.hotspot.*; |
16841
cbd42807a31f
moved NodeInfo and friends into separate com.oracle.graal.nodeinfo project so that annotation processor can be applied to the base Node class
Doug Simon <doug.simon@oracle.com>
parents:
16837
diff
changeset
|
29 import com.oracle.graal.nodeinfo.*; |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 import com.oracle.graal.nodes.*; |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
11698
diff
changeset
|
31 import com.oracle.graal.nodes.spi.*; |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7034
diff
changeset
|
32 import com.oracle.graal.word.*; |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 /** |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 * Intrinsic for getting the lock in the current {@linkplain BeginLockScopeNode lock scope}. |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 */ |
16822
5d468add216f
added @NodeInfo annotations to all Node classes
Doug Simon <doug.simon@oracle.com>
parents:
14950
diff
changeset
|
37 @NodeInfo |
18998
ec0733b5a90a
Allow final modifier on node subclasses and start adding the modifier to leaf classes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
38 public final class CurrentLockNode extends FixedWithNextNode implements LIRLowerable { |
19403
61d3cb8e1280
Add generic parameter to NodeClass. Change Graph#getNodes(Class) to Graph#getNodes(NodeClass).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19396
diff
changeset
|
39 public static final NodeClass<CurrentLockNode> TYPE = NodeClass.get(CurrentLockNode.class); |
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:
7300
diff
changeset
|
40 |
17276
ffb974bef674
moved Node valueNumber and valueEquals logic (optionally) to generated nodes
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
41 protected int lockDepth; |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18425
diff
changeset
|
43 public CurrentLockNode(int lockDepth) { |
19396
7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19129
diff
changeset
|
44 super(TYPE, null); |
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:
7300
diff
changeset
|
45 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:
7300
diff
changeset
|
46 } |
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:
7300
diff
changeset
|
47 |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 @Override |
14950
d5a1206e1923
NodeLIRBuilderTool: fix typo in interface name.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
49 public void generate(NodeLIRBuilderTool gen) { |
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:
7300
diff
changeset
|
50 assert lockDepth != -1; |
14845
ba13350ee179
Fix LIRGenerator casting problem.
Josef Eisl <josef.eisl@jku.at>
parents:
14841
diff
changeset
|
51 HotSpotLIRGenerator hsGen = (HotSpotLIRGenerator) gen.getLIRGeneratorTool(); |
18425
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
17450
diff
changeset
|
52 StackSlotValue slot = hsGen.getLockSlot(lockDepth); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 // The register allocator cannot handle stack -> register moves so we use an LEA here |
19129
afb826080949
CurrentLockNode: do not create superfluous move.
Josef Eisl <josef.eisl@jku.at>
parents:
18998
diff
changeset
|
54 Value result = gen.getLIRGeneratorTool().emitAddress(slot); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 gen.setResult(this, result); |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 } |
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 |
11698
4eec2ac671c2
Refactor the WordTypeVerificationPhase to use fewer graph iterations, and invoke it a fewer places
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9504
diff
changeset
|
58 @NodeIntrinsic(setStampFromReturnType = true) |
9504
106f0a0acafa
refactored monitor handling in EA: MonitorEnter/Exit is removed, not eliminated
Lukas Stadler <lukas.stadler@jku.at>
parents:
9298
diff
changeset
|
59 public static native Word currentLock(@ConstantNodeParameter int lockDepth); |
6386
abeeb57b655d
added MonitorSnippets which passes MonitorTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 } |