Mercurial > hg > graal-compiler
comparison graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassQueryNode.java @ 20101:178814b064a7
moved use of GraphUtil.originalValue API into InvocationPlugins to avoid its overhead during canonicalization
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 31 Mar 2015 14:12:23 +0200 |
parents | 8470e81631f8 |
children |
comparison
equal
deleted
inserted
replaced
20100:1505cfecbeed | 20101:178814b064a7 |
---|---|
28 import com.oracle.graal.graph.spi.*; | 28 import com.oracle.graal.graph.spi.*; |
29 import com.oracle.graal.hotspot.meta.*; | 29 import com.oracle.graal.hotspot.meta.*; |
30 import com.oracle.graal.nodeinfo.*; | 30 import com.oracle.graal.nodeinfo.*; |
31 import com.oracle.graal.nodes.CallTargetNode.InvokeKind; | 31 import com.oracle.graal.nodes.CallTargetNode.InvokeKind; |
32 import com.oracle.graal.nodes.*; | 32 import com.oracle.graal.nodes.*; |
33 import com.oracle.graal.nodes.util.*; | |
34 import com.oracle.graal.replacements.nodes.*; | 33 import com.oracle.graal.replacements.nodes.*; |
35 | 34 |
36 /** | 35 /** |
37 * {@link MacroNode Macro node} for some basic query methods in {@link Class}. | 36 * {@link MacroNode Macro node} for some basic query methods in {@link Class}. |
38 */ | 37 */ |
77 ValueNode value = tryFold(getJavaClass(), query, tool.getMetaAccess(), tool.getConstantReflection()); | 76 ValueNode value = tryFold(getJavaClass(), query, tool.getMetaAccess(), tool.getConstantReflection()); |
78 return value == null ? this : value; | 77 return value == null ? this : value; |
79 } | 78 } |
80 | 79 |
81 public static ValueNode tryFold(ValueNode javaClass, Query query, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) { | 80 public static ValueNode tryFold(ValueNode javaClass, Query query, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) { |
82 ValueNode value = GraphUtil.originalValue(javaClass); | 81 if (javaClass != null && javaClass.isConstant()) { |
83 if (value != null && value.isConstant()) { | |
84 if (query.returnKind == Kind.Object) { | 82 if (query.returnKind == Kind.Object) { |
85 if (GraalOptions.ImmutableCode.getValue()) { | 83 if (GraalOptions.ImmutableCode.getValue()) { |
86 return null; | 84 return null; |
87 } | 85 } |
88 HotSpotObjectConstant c = (HotSpotObjectConstant) value.asConstant(); | 86 HotSpotObjectConstant c = (HotSpotObjectConstant) javaClass.asConstant(); |
89 JavaConstant answer; | 87 JavaConstant answer; |
90 switch (query) { | 88 switch (query) { |
91 case getClassLoader0: | 89 case getClassLoader0: |
92 answer = c.getClassLoader(); | 90 answer = c.getClassLoader(); |
93 break; | 91 break; |
103 } | 101 } |
104 if (answer != null) { | 102 if (answer != null) { |
105 return ConstantNode.forConstant(answer, metaAccess); | 103 return ConstantNode.forConstant(answer, metaAccess); |
106 } | 104 } |
107 } else { | 105 } else { |
108 ResolvedJavaType type = constantReflection.asJavaType(value.asConstant()); | 106 ResolvedJavaType type = constantReflection.asJavaType(javaClass.asConstant()); |
109 if (type != null) { | 107 if (type != null) { |
110 switch (query) { | 108 switch (query) { |
111 case isArray: | 109 case isArray: |
112 return ConstantNode.forBoolean(type.isArray()); | 110 return ConstantNode.forBoolean(type.isArray()); |
113 case isPrimitive: | 111 case isPrimitive: |