Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/SnippetLocationNode.java @ 15018:db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Mon, 07 Apr 2014 16:09:17 -0700 |
parents | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SnippetLocationNode.java@27c04ee36dcb |
children | 844cfee4041a |
rev | line source |
---|---|
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
1 /* |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2013, 2013, Oracle and/or its affiliates. All rights reserved. |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
4 * |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
8 * |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
14 * |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
18 * |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
21 * questions. |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
22 */ |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15001
diff
changeset
|
23 package com.oracle.graal.word.nodes; |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
24 |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
25 import static com.oracle.graal.api.meta.LocationIdentity.*; |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
26 |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
27 import com.oracle.graal.api.meta.*; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15001
diff
changeset
|
28 import com.oracle.graal.api.replacements.*; |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
29 import com.oracle.graal.graph.*; |
11881
da9db8331658
moved Canonicalizable and Simplifiable to the com.oracle.graal.graph project (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11880
diff
changeset
|
30 import com.oracle.graal.graph.spi.*; |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
31 import com.oracle.graal.nodes.*; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15001
diff
changeset
|
32 import com.oracle.graal.nodes.extended.*; |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
33 import com.oracle.graal.nodes.spi.*; |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
34 import com.oracle.graal.nodes.type.*; |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
35 |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
36 /** |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
37 * Location node that can be used inside a snippet without having the elements (including the |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
38 * location identity and kind) as a snippet constant. Can represent locations in the form of [base + |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
39 * index * scale + disp]. When the location is created, all elements (base, index, scale, disp) are |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
40 * nodes. Both scale and disp must eventually canonicalize to {@link ConstantNode constants} so that |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
41 * this node can be canonicalized to a {@link IndexedLocationNode} or {@link ConstantLocationNode}. |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
42 */ |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
43 public final class SnippetLocationNode extends LocationNode implements Canonicalizable { |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
44 |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15001
diff
changeset
|
45 private final SnippetReflectionProvider snippetReflection; |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15001
diff
changeset
|
46 |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
47 @Input private ValueNode valueKind; |
15001 | 48 @Input(InputType.Association) private ValueNode locationIdentity; |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
49 @Input private ValueNode displacement; |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
50 @Input private ValueNode index; |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
51 @Input private ValueNode indexScaling; |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
52 |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15001
diff
changeset
|
53 public static SnippetLocationNode create(SnippetReflectionProvider snippetReflection, ValueNode identity, ValueNode kind, ValueNode displacement, ValueNode index, ValueNode indexScaling, |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15001
diff
changeset
|
54 Graph graph) { |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15001
diff
changeset
|
55 return graph.unique(new SnippetLocationNode(snippetReflection, identity, kind, displacement, index, indexScaling)); |
9601
278a50fb49c7
Create a LoadFieldNode for a getstatic of a static final field in the graph builder, and rely on the canonicalizer for replacing it with the constant value.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9545
diff
changeset
|
56 } |
278a50fb49c7
Create a LoadFieldNode for a getstatic of a static final field in the graph builder, and rely on the canonicalizer for replacing it with the constant value.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9545
diff
changeset
|
57 |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15001
diff
changeset
|
58 private SnippetLocationNode(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement) { |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15001
diff
changeset
|
59 this(snippetReflection, locationIdentity, kind, displacement, null, null); |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
60 } |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
61 |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15001
diff
changeset
|
62 private SnippetLocationNode(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement, ValueNode index, |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15001
diff
changeset
|
63 ValueNode indexScaling) { |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
64 super(StampFactory.object()); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15001
diff
changeset
|
65 this.snippetReflection = snippetReflection; |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
66 this.valueKind = kind; |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
67 this.locationIdentity = locationIdentity; |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
68 this.displacement = displacement; |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
69 this.index = index; |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
70 this.indexScaling = indexScaling; |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
71 } |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
72 |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
73 @Override |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
74 public Kind getValueKind() { |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
75 if (valueKind.isConstant()) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15001
diff
changeset
|
76 return (Kind) snippetReflection.asObject(valueKind.asConstant()); |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
77 } |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
78 throw new GraalInternalError("Cannot access kind yet because it is not constant: " + valueKind); |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
79 } |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
80 |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
81 @Override |
9526
ae5cd887e67c
Use a LocationIdentity interface instead of just Object for the location identity of a LocationNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9525
diff
changeset
|
82 public LocationIdentity getLocationIdentity() { |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
83 if (locationIdentity.isConstant()) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15001
diff
changeset
|
84 return (LocationIdentity) snippetReflection.asObject(locationIdentity.asConstant()); |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
85 } |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
86 // We do not know our actual location identity yet, so be conservative. |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
87 return ANY_LOCATION; |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
88 } |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
89 |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
90 @Override |
11880
9a747d8e0d0f
broadened types in Canonicalizable interface so that it can be moved to the com.oracle.graal.graph project (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
9793
diff
changeset
|
91 public Node canonical(CanonicalizerTool tool) { |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
92 if (valueKind.isConstant() && locationIdentity.isConstant() && displacement.isConstant() && (indexScaling == null || indexScaling.isConstant())) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15001
diff
changeset
|
93 Kind constKind = (Kind) snippetReflection.asObject(valueKind.asConstant()); |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15001
diff
changeset
|
94 LocationIdentity constLocation = (LocationIdentity) snippetReflection.asObject(locationIdentity.asConstant()); |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
95 long constDisplacement = displacement.asConstant().asLong(); |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
96 int constIndexScaling = indexScaling == null ? 0 : indexScaling.asConstant().asInt(); |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
97 |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
98 if (index == null || constIndexScaling == 0) { |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
99 return ConstantLocationNode.create(constLocation, constKind, constDisplacement, graph()); |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
100 } else if (index.isConstant()) { |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
101 return ConstantLocationNode.create(constLocation, constKind, index.asConstant().asLong() * constIndexScaling + constDisplacement, graph()); |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
102 } else { |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
103 return IndexedLocationNode.create(constLocation, constKind, constDisplacement, index, graph(), constIndexScaling); |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
104 } |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
105 } |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
106 return this; |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
107 } |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
108 |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
109 @Override |
14950
d5a1206e1923
NodeLIRBuilderTool: fix typo in interface name.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
110 public Value generateAddress(NodeLIRBuilderTool gen, Value base) { |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
111 throw new GraalInternalError("locationIdentity must be a constant so that this node can be canonicalized: " + locationIdentity); |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
112 } |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
113 |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
114 @NodeIntrinsic |
9545
7931508747f5
Fix parameters of node intrinsics to use more specific Location and LocationIdentity types.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9526
diff
changeset
|
115 public static native Location constantLocation(LocationIdentity identity, Kind kind, long displacement); |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
116 |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
117 @NodeIntrinsic |
9545
7931508747f5
Fix parameters of node intrinsics to use more specific Location and LocationIdentity types.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9526
diff
changeset
|
118 public static native Location indexedLocation(LocationIdentity identity, Kind kind, long displacement, int index, int indexScaling); |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
119 } |