Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/WordOperationPlugin.java @ 21567:f41409c6ff26
Do not rely on single/double slot information from the Kind of the value in a local variable or expression stack entry. With word type rewriting during parsing, long values can be single slot values when they are rewritten from Object values.
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Thu, 28 May 2015 17:00:59 -0700 |
parents | 48c1ebd24120 |
children | 625b2b12b418 |
rev | line source |
---|---|
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
21418
cba35d171cd1
Move memory related nodes to their own package.
Roland Schatz <roland.schatz@oracle.com>
parents:
21128
diff
changeset
|
2 * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.replacements; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 import static com.oracle.graal.nodes.ConstantNode.*; |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
26 import static com.oracle.jvmci.meta.LocationIdentity.*; |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 import java.lang.reflect.*; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 import com.oracle.graal.api.replacements.*; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 import com.oracle.graal.compiler.common.calc.*; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 import com.oracle.graal.compiler.common.type.*; |
19820
4d33cd6e0c8f
refactored GraphBuilderConfiguration (and its component classes) into a separate project
Doug Simon <doug.simon@oracle.com>
parents:
19798
diff
changeset
|
33 import com.oracle.graal.graphbuilderconf.*; |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 import com.oracle.graal.nodes.*; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 import com.oracle.graal.nodes.calc.*; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 import com.oracle.graal.nodes.extended.*; |
21418
cba35d171cd1
Move memory related nodes to their own package.
Roland Schatz <roland.schatz@oracle.com>
parents:
21128
diff
changeset
|
37 import com.oracle.graal.nodes.memory.HeapAccess.BarrierType; |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 import com.oracle.graal.word.*; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 import com.oracle.graal.word.Word.Opcode; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 import com.oracle.graal.word.Word.Operation; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 import com.oracle.graal.word.nodes.*; |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21418
diff
changeset
|
42 import com.oracle.jvmci.common.*; |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
43 import com.oracle.jvmci.meta.*; |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 /** |
21128
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
46 * A {@link GenericInvocationPlugin} for calls to {@linkplain Operation word operations}, and a |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
47 * {@link TypeCheckPlugin} to handle casts between word types. |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 */ |
21128
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
49 public class WordOperationPlugin implements GenericInvocationPlugin, TypeCheckPlugin { |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 protected final WordTypes wordTypes; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 protected final Kind wordKind; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 protected final SnippetReflectionProvider snippetReflection; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 public WordOperationPlugin(SnippetReflectionProvider snippetReflection, WordTypes wordTypes) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 this.snippetReflection = snippetReflection; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 this.wordTypes = wordTypes; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 this.wordKind = wordTypes.getWordKind(); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 /** |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 * Processes a call to a method if it is annotated with {@link Operation} by adding nodes to the |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
62 * graph being built that implement the denoted operation. |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 * |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 * @return {@code true} iff {@code method} is annotated with {@link Operation} (and was thus |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 * processed by this method) |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 */ |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
67 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod method, ValueNode[] args) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 if (!wordTypes.isWordOperation(method)) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
69 return false; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
70 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
71 processWordOperation(b, args, wordTypes.getWordOperation(method, b.getMethod().getDeclaringClass())); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
72 return true; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
73 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
74 |
21128
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
75 @Override |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
76 public boolean checkCast(GraphBuilderContext b, ValueNode object, ResolvedJavaType type, JavaTypeProfile profile) { |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
77 if (!wordTypes.isWord(type)) { |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
78 if (object.getKind() != Kind.Object) { |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
79 throw b.bailout("Cannot cast a word value to a non-word type: " + type.toJavaName(true)); |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
80 } |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
81 return false; |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
82 } |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
83 |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
84 if (object.getKind() != wordTypes.getWordKind()) { |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
85 throw b.bailout("Cannot cast a non-word value to a word type: " + type.toJavaName(true)); |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
86 } |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
87 b.push(Kind.Object, object); |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
88 return true; |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
89 } |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
90 |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
91 @Override |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
92 public boolean instanceOf(GraphBuilderContext b, ValueNode object, ResolvedJavaType type, JavaTypeProfile profile) { |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
93 if (wordTypes.isWord(type)) { |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
94 throw b.bailout("Cannot use instanceof for word a type: " + type.toJavaName(true)); |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
95 } else if (object.getKind() != Kind.Object) { |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
96 throw b.bailout("Cannot use instanceof on a word value: " + type.toJavaName(true)); |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
97 } |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
98 return false; |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
99 } |
0f289b082d3d
Handle checkCast and instanceOf involving word types using a GraphBuilderPlugin
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20148
diff
changeset
|
100 |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21418
diff
changeset
|
101 protected void processWordOperation(GraphBuilderContext b, ValueNode[] args, ResolvedJavaMethod wordMethod) throws JVMCIError { |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
102 Operation operation = wordMethod.getAnnotation(Word.Operation.class); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
103 Kind returnKind = wordMethod.getSignature().getReturnKind(); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
104 switch (operation.opcode()) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
105 case NODE_CLASS: |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
106 assert args.length == 2; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
107 ValueNode left = args[0]; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
108 ValueNode right = operation.rightOperandIsInt() ? toUnsigned(b, args[1], Kind.Int) : fromSigned(b, args[1]); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
109 |
21567
f41409c6ff26
Do not rely on single/double slot information from the Kind of the value in a local variable or expression stack entry. With word type rewriting during parsing, long values can be single slot values when they are rewritten from Object values.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21556
diff
changeset
|
110 b.addPush(returnKind, createBinaryNodeInstance(operation.node(), left, right)); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
111 break; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
112 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
113 case COMPARISON: |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
114 assert args.length == 2; |
21567
f41409c6ff26
Do not rely on single/double slot information from the Kind of the value in a local variable or expression stack entry. With word type rewriting during parsing, long values can be single slot values when they are rewritten from Object values.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21556
diff
changeset
|
115 b.push(returnKind, comparisonOp(b, operation.condition(), args[0], fromSigned(b, args[1]))); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
116 break; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
117 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
118 case NOT: |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
119 assert args.length == 1; |
21567
f41409c6ff26
Do not rely on single/double slot information from the Kind of the value in a local variable or expression stack entry. With word type rewriting during parsing, long values can be single slot values when they are rewritten from Object values.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21556
diff
changeset
|
120 b.addPush(returnKind, new XorNode(args[0], b.add(forIntegerKind(wordKind, -1)))); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
121 break; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
122 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
123 case READ_POINTER: |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
124 case READ_OBJECT: |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
125 case READ_BARRIERED: { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
126 assert args.length == 2 || args.length == 3; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
127 Kind readKind = wordTypes.asKind(wordMethod.getSignature().getReturnType(wordMethod.getDeclaringClass())); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
128 LocationNode location; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
129 if (args.length == 2) { |
19852
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19798
diff
changeset
|
130 location = makeLocation(b, args[1], any()); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
131 } else { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
132 location = makeLocation(b, args[1], args[2]); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
133 } |
21567
f41409c6ff26
Do not rely on single/double slot information from the Kind of the value in a local variable or expression stack entry. With word type rewriting during parsing, long values can be single slot values when they are rewritten from Object values.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21556
diff
changeset
|
134 b.push(returnKind, readOp(b, readKind, args[0], location, operation.opcode())); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
135 break; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
136 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
137 case READ_HEAP: { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
138 assert args.length == 3; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
139 Kind readKind = wordTypes.asKind(wordMethod.getSignature().getReturnType(wordMethod.getDeclaringClass())); |
19852
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19798
diff
changeset
|
140 LocationNode location = makeLocation(b, args[1], any()); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
141 BarrierType barrierType = snippetReflection.asObject(BarrierType.class, args[2].asJavaConstant()); |
21567
f41409c6ff26
Do not rely on single/double slot information from the Kind of the value in a local variable or expression stack entry. With word type rewriting during parsing, long values can be single slot values when they are rewritten from Object values.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21556
diff
changeset
|
142 b.push(returnKind, readOp(b, readKind, args[0], location, barrierType, true)); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
143 break; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
144 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
145 case WRITE_POINTER: |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
146 case WRITE_OBJECT: |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
147 case WRITE_BARRIERED: |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
148 case INITIALIZE: { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
149 assert args.length == 3 || args.length == 4; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
150 Kind writeKind = wordTypes.asKind(wordMethod.getSignature().getParameterType(wordMethod.isStatic() ? 2 : 1, wordMethod.getDeclaringClass())); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
151 LocationNode location; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
152 if (args.length == 3) { |
19852
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19798
diff
changeset
|
153 location = makeLocation(b, args[1], LocationIdentity.any()); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
154 } else { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
155 location = makeLocation(b, args[1], args[3]); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
156 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
157 writeOp(b, writeKind, args[0], args[2], location, operation.opcode()); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
158 break; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
159 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
160 case ZERO: |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
161 assert args.length == 0; |
21567
f41409c6ff26
Do not rely on single/double slot information from the Kind of the value in a local variable or expression stack entry. With word type rewriting during parsing, long values can be single slot values when they are rewritten from Object values.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21556
diff
changeset
|
162 b.addPush(returnKind, forIntegerKind(wordKind, 0L)); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
163 break; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
164 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
165 case FROM_UNSIGNED: |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
166 assert args.length == 1; |
21567
f41409c6ff26
Do not rely on single/double slot information from the Kind of the value in a local variable or expression stack entry. With word type rewriting during parsing, long values can be single slot values when they are rewritten from Object values.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21556
diff
changeset
|
167 b.push(returnKind, fromUnsigned(b, args[0])); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
168 break; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
169 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
170 case FROM_SIGNED: |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
171 assert args.length == 1; |
21567
f41409c6ff26
Do not rely on single/double slot information from the Kind of the value in a local variable or expression stack entry. With word type rewriting during parsing, long values can be single slot values when they are rewritten from Object values.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21556
diff
changeset
|
172 b.push(returnKind, fromSigned(b, args[0])); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
173 break; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
174 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
175 case TO_RAW_VALUE: |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
176 assert args.length == 1; |
21567
f41409c6ff26
Do not rely on single/double slot information from the Kind of the value in a local variable or expression stack entry. With word type rewriting during parsing, long values can be single slot values when they are rewritten from Object values.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21556
diff
changeset
|
177 b.push(returnKind, toUnsigned(b, args[0], Kind.Long)); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
178 break; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
179 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
180 case FROM_WORDBASE: |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
181 assert args.length == 1; |
21567
f41409c6ff26
Do not rely on single/double slot information from the Kind of the value in a local variable or expression stack entry. With word type rewriting during parsing, long values can be single slot values when they are rewritten from Object values.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21556
diff
changeset
|
182 b.push(returnKind, args[0]); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
183 break; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
184 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
185 case FROM_OBJECT: |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
186 assert args.length == 1; |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
187 WordCastNode objectToWord = b.add(WordCastNode.objectToWord(args[0], wordKind)); |
21567
f41409c6ff26
Do not rely on single/double slot information from the Kind of the value in a local variable or expression stack entry. With word type rewriting during parsing, long values can be single slot values when they are rewritten from Object values.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21556
diff
changeset
|
188 b.push(returnKind, objectToWord); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
189 break; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
190 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
191 case FROM_ARRAY: |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
192 assert args.length == 2; |
21567
f41409c6ff26
Do not rely on single/double slot information from the Kind of the value in a local variable or expression stack entry. With word type rewriting during parsing, long values can be single slot values when they are rewritten from Object values.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21556
diff
changeset
|
193 b.addPush(returnKind, new ComputeAddressNode(args[0], args[1], StampFactory.forKind(wordKind))); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
194 break; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
195 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
196 case TO_OBJECT: |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
197 assert args.length == 1; |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
198 WordCastNode wordToObject = b.add(WordCastNode.wordToObject(args[0], wordKind)); |
21567
f41409c6ff26
Do not rely on single/double slot information from the Kind of the value in a local variable or expression stack entry. With word type rewriting during parsing, long values can be single slot values when they are rewritten from Object values.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21556
diff
changeset
|
199 b.push(returnKind, wordToObject); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
200 break; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
201 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
202 default: |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21418
diff
changeset
|
203 throw new JVMCIError("Unknown opcode: %s", operation.opcode()); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
204 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
205 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
206 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
207 /** |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
208 * Create an instance of a binary node which is used to lower {@link Word} operations. This |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
209 * method is called for all {@link Word} operations which are annotated with @Operation(node = |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
210 * ...) and encapsulates the reflective allocation of the node. |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
211 */ |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
212 private static ValueNode createBinaryNodeInstance(Class<? extends ValueNode> nodeClass, ValueNode left, ValueNode right) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
213 try { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
214 Constructor<?> cons = nodeClass.getDeclaredConstructor(ValueNode.class, ValueNode.class); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
215 return (ValueNode) cons.newInstance(left, right); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
216 } catch (Throwable ex) { |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21418
diff
changeset
|
217 throw new JVMCIError(ex).addContext(nodeClass.getName()); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
218 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
219 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
220 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
221 private ValueNode comparisonOp(GraphBuilderContext graph, Condition condition, ValueNode left, ValueNode right) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
222 assert left.getKind() == wordKind && right.getKind() == wordKind; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
223 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
224 // mirroring gets the condition into canonical form |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
225 boolean mirror = condition.canonicalMirror(); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
226 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
227 ValueNode a = mirror ? right : left; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
228 ValueNode b = mirror ? left : right; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
229 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
230 CompareNode comparison; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
231 if (condition == Condition.EQ || condition == Condition.NE) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
232 comparison = new IntegerEqualsNode(a, b); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
233 } else if (condition.isUnsigned()) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
234 comparison = new IntegerBelowNode(a, b); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
235 } else { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
236 comparison = new IntegerLessThanNode(a, b); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
237 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
238 |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
239 ConstantNode trueValue = graph.add(forInt(1)); |
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
240 ConstantNode falseValue = graph.add(forInt(0)); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
241 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
242 if (condition.canonicalNegate()) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
243 ConstantNode temp = trueValue; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
244 trueValue = falseValue; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
245 falseValue = temp; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
246 } |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
247 ConditionalNode materialize = graph.add(new ConditionalNode(graph.add(comparison), trueValue, falseValue)); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
248 return materialize; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
249 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
250 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
251 protected ValueNode readOp(GraphBuilderContext b, Kind readKind, ValueNode base, LocationNode location, Opcode op) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
252 assert op == Opcode.READ_POINTER || op == Opcode.READ_OBJECT || op == Opcode.READ_BARRIERED; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
253 final BarrierType barrier = (op == Opcode.READ_BARRIERED ? BarrierType.PRECISE : BarrierType.NONE); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
254 final boolean compressible = (op == Opcode.READ_OBJECT || op == Opcode.READ_BARRIERED); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
255 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
256 return readOp(b, readKind, base, location, barrier, compressible); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
257 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
258 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
259 public static ValueNode readOp(GraphBuilderContext b, Kind readKind, ValueNode base, LocationNode location, BarrierType barrierType, boolean compressible) { |
20148
6f669b9be43c
lower JavaReadNode to a ReadNode that will never float
Doug Simon <doug.simon@oracle.com>
parents:
20045
diff
changeset
|
260 /* |
6f669b9be43c
lower JavaReadNode to a ReadNode that will never float
Doug Simon <doug.simon@oracle.com>
parents:
20045
diff
changeset
|
261 * A JavaReadNode lowered to a ReadNode that will not float. This means it cannot float |
6f669b9be43c
lower JavaReadNode to a ReadNode that will never float
Doug Simon <doug.simon@oracle.com>
parents:
20045
diff
changeset
|
262 * above an explicit zero check on its base address or any other test that ensures the read |
6f669b9be43c
lower JavaReadNode to a ReadNode that will never float
Doug Simon <doug.simon@oracle.com>
parents:
20045
diff
changeset
|
263 * is safe. |
6f669b9be43c
lower JavaReadNode to a ReadNode that will never float
Doug Simon <doug.simon@oracle.com>
parents:
20045
diff
changeset
|
264 */ |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
265 JavaReadNode read = b.add(new JavaReadNode(readKind, base, location, barrierType, compressible)); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
266 return read; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
267 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
268 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
269 protected void writeOp(GraphBuilderContext b, Kind writeKind, ValueNode base, ValueNode value, LocationNode location, Opcode op) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
270 assert op == Opcode.WRITE_POINTER || op == Opcode.WRITE_OBJECT || op == Opcode.WRITE_BARRIERED || op == Opcode.INITIALIZE; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
271 final BarrierType barrier = (op == Opcode.WRITE_BARRIERED ? BarrierType.PRECISE : BarrierType.NONE); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
272 final boolean compressible = (op == Opcode.WRITE_OBJECT || op == Opcode.WRITE_BARRIERED); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
273 final boolean initialize = (op == Opcode.INITIALIZE); |
20006
2d51a92a301a
added helper methods to GraphBuilderContext for common operation combinations
Doug Simon <doug.simon@oracle.com>
parents:
19878
diff
changeset
|
274 b.add(new JavaWriteNode(writeKind, base, value, location, barrier, compressible, initialize)); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
275 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
276 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
277 public LocationNode makeLocation(GraphBuilderContext b, ValueNode offset, LocationIdentity locationIdentity) { |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
278 return b.add(new IndexedLocationNode(locationIdentity, 0, fromSigned(b, offset), 1)); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
279 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
280 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
281 public LocationNode makeLocation(GraphBuilderContext b, ValueNode offset, ValueNode locationIdentity) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
282 if (locationIdentity.isConstant()) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
283 return makeLocation(b, offset, snippetReflection.asObject(LocationIdentity.class, locationIdentity.asJavaConstant())); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
284 } |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
285 return b.add(new SnippetLocationNode(snippetReflection, locationIdentity, b.add(ConstantNode.forLong(0)), fromSigned(b, offset), b.add(ConstantNode.forInt(1)))); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
286 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
287 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
288 public ValueNode fromUnsigned(GraphBuilderContext b, ValueNode value) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
289 return convert(b, value, wordKind, true); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
290 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
291 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
292 public ValueNode fromSigned(GraphBuilderContext b, ValueNode value) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
293 return convert(b, value, wordKind, false); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
294 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
295 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
296 public ValueNode toUnsigned(GraphBuilderContext b, ValueNode value, Kind toKind) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
297 return convert(b, value, toKind, true); |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
298 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
299 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
300 public ValueNode convert(GraphBuilderContext b, ValueNode value, Kind toKind, boolean unsigned) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
301 if (value.getKind() == toKind) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
302 return value; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
303 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
304 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
305 if (toKind == Kind.Int) { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
306 assert value.getKind() == Kind.Long; |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
307 return b.add(new NarrowNode(value, 32)); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
308 } else { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
309 assert toKind == Kind.Long; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
310 assert value.getKind().getStackKind() == Kind.Int; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
311 if (unsigned) { |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
312 return b.add(new ZeroExtendNode(value, 64)); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
313 } else { |
20045
8470e81631f8
converted all @MacroSubstitution uses to InvocationPlugins
Doug Simon <doug.simon@oracle.com>
parents:
20006
diff
changeset
|
314 return b.add(new SignExtendNode(value, 64)); |
19775
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
315 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
316 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
317 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
318 |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
319 public WordTypes getWordTypes() { |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
320 return wordTypes; |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
321 } |
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
322 } |