Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java @ 18425:b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Thu, 23 Oct 2014 14:55:04 +0200 |
parents | c6086a18c9ce |
children | f57d86eb036f |
rev | line source |
---|---|
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.hotspot.nodes; |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
13594
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
11698
diff
changeset
|
25 import java.util.*; |
fcabc0da42b0
enhanced support for reserving a block of memory on the stack such that the block can be a mix of primitive data and object pointers
Doug Simon <doug.simon@oracle.com>
parents:
11698
diff
changeset
|
26 |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 import com.oracle.graal.api.code.*; |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 import com.oracle.graal.api.meta.*; |
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.*; |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 import com.oracle.graal.nodes.calc.*; |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14810
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.*; |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7300
diff
changeset
|
35 * Node that is used to maintain a stack based counter of how many locks are currently held. |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
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:
15336
diff
changeset
|
37 @NodeInfo |
5d468add216f
added @NodeInfo annotations to all Node classes
Doug Simon <doug.simon@oracle.com>
parents:
15336
diff
changeset
|
38 public class MonitorCounterNode extends FloatingNode implements LIRLowerable { |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
40 public static MonitorCounterNode create() { |
17450
45b45f902bed
removed Node generation (GRAAL-857)
Doug Simon <doug.simon@oracle.com>
parents:
17309
diff
changeset
|
41 return new MonitorCounterNode(); |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
42 } |
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
43 |
17309
845e881ce054
constructors in a Node class must be protected
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
44 protected MonitorCounterNode() { |
11698
4eec2ac671c2
Refactor the WordTypeVerificationPhase to use fewer graph iterations, and invoke it a fewer places
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9298
diff
changeset
|
45 super(null); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 @Override |
15336
c260582ba074
Remove obsolete LIRGenResLowerable interface.
Josef Eisl <josef.eisl@jku.at>
parents:
15292
diff
changeset
|
49 public void generate(NodeLIRBuilderTool gen) { |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 assert graph().getNodes().filter(MonitorCounterNode.class).count() == 1 : "monitor counters not canonicalized to single instance"; |
18425
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18149
diff
changeset
|
51 VirtualStackSlot counter = gen.getLIRGeneratorTool().getResult().getFrameMapBuilder().allocateStackSlots(1, new BitSet(0), null); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14810
diff
changeset
|
52 Value result = gen.getLIRGeneratorTool().emitAddress(counter); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 gen.setResult(this, result); |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 } |
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 |
11698
4eec2ac671c2
Refactor the WordTypeVerificationPhase to use fewer graph iterations, and invoke it a fewer places
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9298
diff
changeset
|
56 @NodeIntrinsic(setStampFromReturnType = true) |
6954
0e20ad1ea98b
removed WordStamp (and a nasty bug associated with its misusage)
Doug Simon <doug.simon@oracle.com>
parents:
6458
diff
changeset
|
57 public static native Word counter(); |
6451
c9f45d2d96cf
fixed bug in monitor snippets; they are now used for general lowering of monitor operations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 } |