Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/SystemIdentityHashCodeNode.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 |
---|---|
13487
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
1 /* |
19396
7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
2 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. |
13487
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
4 * |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
8 * |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
14 * |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
18 * |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
21 * questions. |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
22 */ |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.hotspot.replacements; |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
24 |
15259
d90e5c22ba55
Move GraalOptions to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15018
diff
changeset
|
25 import static com.oracle.graal.compiler.common.GraalOptions.*; |
13487
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
26 |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
27 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:
18845
diff
changeset
|
28 import com.oracle.graal.graph.*; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13487
diff
changeset
|
29 import com.oracle.graal.hotspot.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:
16822
diff
changeset
|
30 import com.oracle.graal.nodeinfo.*; |
13487
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
31 import com.oracle.graal.nodes.*; |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
32 import com.oracle.graal.replacements.nodes.*; |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
33 |
16822
5d468add216f
added @NodeInfo annotations to all Node classes
Doug Simon <doug.simon@oracle.com>
parents:
15259
diff
changeset
|
34 @NodeInfo |
19396
7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
35 public final class SystemIdentityHashCodeNode extends PureFunctionMacroNode { |
7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
36 |
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
|
37 public static final NodeClass<SystemIdentityHashCodeNode> TYPE = NodeClass.get(SystemIdentityHashCodeNode.class); |
13487
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
38 |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18282
diff
changeset
|
39 public SystemIdentityHashCodeNode(Invoke invoke) { |
19396
7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
40 super(TYPE, invoke); |
13487
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
41 } |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
42 |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
43 @Override |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
44 protected JavaConstant evaluate(JavaConstant param, MetaAccessProvider metaAccess) { |
18282
ecf3de366ecc
added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
45 if (ImmutableCode.getValue() || param.isNull()) { |
ecf3de366ecc
added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
46 return null; |
ecf3de366ecc
added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
47 } |
ecf3de366ecc
added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
48 HotSpotObjectConstant c = (HotSpotObjectConstant) param; |
ecf3de366ecc
added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
49 return JavaConstant.forInt(c.getIdentityHashCode()); |
13487
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
50 } |
c5449c0d5909
Move class SystemIdentityHashCodeNode to its own Java file to work around javac bug when compiling the inner class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
51 } |